src/memory/mappers/sxrom.cc
/*
 * Reads a word from VRAM using the bank selection registers.
 */
Reads a word from VRAM using the bank selection registers.
Reads a word from VRAM using the bank selection registers .
DataWord Sxrom::VramRead(DoubleWord addr) {
  addr &= VRAM_BUS_MASK;
  if ((addr < NAMETABLE_OFFSET) && (addr & PATTERN_TABLE_HIGH_ACCESS_BIT)) {
    return pattern_table_[chr_bank_b_][addr & PATTERN_TABLE_MASK];
  } else if (addr < NAMETABLE_OFFSET) {
    return pattern_table_[chr_bank_a_][addr & PATTERN_TABLE_MASK];
  } else if (addr < PALETTE_OFFSET) {
    DataWord table = (addr & NAMETABLE_SELECT_MASK) >> NAMETABLE_SELECT_SHIFT;
    return nametable_[table][addr & NAMETABLE_ADDR_MASK];
  } else {
    return PaletteRead(addr);
  }
}
DataWord Sxrom :: VramRead ( DoubleWord addr ) { addr &= VRAM_BUS_MASK ; if ( ( addr < NAMETABLE_OFFSET ) && ( addr & PATTERN_TABLE_HIGH_ACCESS_BIT ) ) { return pattern_table_ [ chr_bank_b_ ] [ addr & PATTERN_TABLE_MASK ] ; } else if ( addr < NAMETABLE_OFFSET ) { return pattern_table_ [ chr_bank_a_ ] [ addr & PATTERN_TABLE_MASK ] ; } else if ( addr < PALETTE_OFFSET ) { DataWord table = ( addr & NAMETABLE_SELECT_MASK ) >> NAMETABLE_SELECT_SHIFT ; return nametable_ [ table ] [ addr & NAMETABLE_ADDR_MASK ] ; } else { return PaletteRead ( addr ) ; } }
Reads a word from VRAM using the bank selection registers.
Reads a word from VRAM using the bank selection registers .
// Mask out any extra bits. // Determine which part of VRAM is being accessed. // CHR1 is being accessed. // CHR0 is being accessed. // Nametable is being accessed. // Access the palette.