src/memory/mappers/sxrom.cc
/*
 * Writes a word to VRAM at the requested memory location, if possible.
 * Uses the bank selection registers to address VRAM.
 */
Writes a word to VRAM at the requested memory location, if possible.
Uses the bank selection registers to address VRAM.
Writes a word to VRAM at the requested memory location if possible . Uses the bank selection registers to address VRAM .
void Sxrom::VramWrite(DoubleWord addr, DataWord val) {
  if ((addr < NAMETABLE_OFFSET) && is_chr_ram_
     && (addr & PATTERN_TABLE_HIGH_ACCESS_BIT)) {
    pattern_table_[chr_bank_b_][addr & PATTERN_TABLE_MASK] = val;
  } else if ((addr < NAMETABLE_OFFSET) && is_chr_ram_) {
    pattern_table_[chr_bank_a_][addr & PATTERN_TABLE_MASK] = val;
  } else if ((NAMETABLE_OFFSET <= addr) && (addr < PALETTE_OFFSET)) {
    DataWord table = (addr & NAMETABLE_SELECT_MASK) >> NAMETABLE_SELECT_SHIFT;
    nametable_[table][addr & NAMETABLE_ADDR_MASK] = val;
  } else if (addr >= PALETTE_OFFSET) {
    PaletteWrite(addr, val);
  }
  return;
}
void Sxrom :: VramWrite ( DoubleWord addr , DataWord val ) { if ( ( addr < NAMETABLE_OFFSET ) && is_chr_ram_ && ( addr & PATTERN_TABLE_HIGH_ACCESS_BIT ) ) { pattern_table_ [ chr_bank_b_ ] [ addr & PATTERN_TABLE_MASK ] = val ; } else if ( ( addr < NAMETABLE_OFFSET ) && is_chr_ram_ ) { pattern_table_ [ chr_bank_a_ ] [ addr & PATTERN_TABLE_MASK ] = val ; } else if ( ( NAMETABLE_OFFSET <= addr ) && ( addr < PALETTE_OFFSET ) ) { DataWord table = ( addr & NAMETABLE_SELECT_MASK ) >> NAMETABLE_SELECT_SHIFT ; nametable_ [ table ] [ addr & NAMETABLE_ADDR_MASK ] = val ; } else if ( addr >= PALETTE_OFFSET ) { PaletteWrite ( addr , val ) ; } return ; }
Writes a word to VRAM at the requested memory location, if possible.
Writes a word to VRAM at the requested memory location if possible .
// Determine which part of VRAM is being accessed. // CHR1 is being accessed. // CHR0 is being accessed. // Nametable is being accessed. // Palette data is being accessed.