void scld_dec_write( libspectrum_word port GCC_UNUSED, libspectrum_byte b ) { scld old_dec = scld_last_dec; scld new_dec; libspectrum_byte ink,paper; /* We use new_dec as we don't want to have the new colours, modes etc. to take effect until we have updated the critical region */ new_dec.byte = b; /* If we changed the active screen, or change the colour in hires * mode, update the critical region and mark the entire display file as * dirty so we redraw it on the next pass */ if( new_dec.mask.scrnmode != old_dec.mask.scrnmode || new_dec.name.hires != old_dec.name.hires || ( new_dec.name.hires && ( new_dec.mask.hirescol != old_dec.mask.hirescol ) ) ) { display_update_critical( 0, 0 ); display_refresh_main_screen(); } /* Commit change to scld_last_dec */ scld_last_dec = new_dec; /* If we just reenabled interrupts, check for a retriggered interrupt */ if( old_dec.name.intdisable && !scld_last_dec.name.intdisable ) z80_interrupt(); if( scld_last_dec.name.altmembank != old_dec.name.altmembank ) machine_current->memory_map(); display_parse_attr( hires_get_attr(), &ink, &paper ); display_set_hires_border( paper ); }
/* Get the attribute byte or equivalent for the eight pixels starting at ( (8*x) , y ) */ static inline libspectrum_byte display_get_attr_byte( int x, int y ) { libspectrum_byte attr; if ( scld_last_dec.name.hires ) { attr = hires_get_attr(); } else { libspectrum_word offset; if( scld_last_dec.name.b1 ) { offset = display_line_start[y] + x + ALTDFILE_OFFSET; } else if( scld_last_dec.name.altdfile ) { offset = display_attr_start[y] + x + ALTDFILE_OFFSET; } else { offset = display_attr_start[y] + x; } attr = RAM[ memory_current_screen ][ offset ]; } return attr; }