src/memory/mappers/std_banked.cc
/*
 * Writes the given value to vram, accounting for mirroring.
 * Update the palette data array if a value is written to the palette.
 * Does nothing if the program attempts to write to CHR-ROM.
 */
Writes the given value to vram, accounting for mirroring.
Update the palette data array if a value is written to the palette.
Does nothing if the program attempts to write to CHR-ROM.
Writes the given value to vram accounting for mirroring . Update the palette data array if a value is written to the palette . Does nothing if the program attempts to write to CHR - ROM .
void StdBanked::VramWrite(DoubleWord addr, DataWord val) {
  addr &= VRAM_BUS_MASK;
  if ((addr < NAMETABLE_OFFSET) && is_chr_ram_) {
    pattern_table_[addr & PATTERN_TABLE_MASK] = val;
  } else if ((NAMETABLE_OFFSET <= addr) && (addr < PALETTE_OFFSET)) {
    DataWord table = (addr & NAMETABLE_SELECT_MASK) >> 10;
    nametable_[table][addr & NAMETABLE_ADDR_MASK] = val;
  } else if (addr >= PALETTE_OFFSET) {
    PaletteWrite(addr, val);
  }
  return;
}
void StdBanked :: VramWrite ( DoubleWord addr , DataWord val ) { addr &= VRAM_BUS_MASK ; if ( ( addr < NAMETABLE_OFFSET ) && is_chr_ram_ ) { pattern_table_ [ addr & PATTERN_TABLE_MASK ] = val ; } else if ( ( NAMETABLE_OFFSET <= addr ) && ( addr < PALETTE_OFFSET ) ) { DataWord table = ( addr & NAMETABLE_SELECT_MASK ) >> 10 ; nametable_ [ table ] [ addr & NAMETABLE_ADDR_MASK ] = val ; } else if ( addr >= PALETTE_OFFSET ) { PaletteWrite ( addr , val ) ; } return ; }
Writes the given value to vram, accounting for mirroring.
Writes the given value to vram accounting for mirroring .
// Masks out any extra bits. // Determine which part of VRAM is being accessed. // Name table is being accessed. // Palette data is being accessed.