src/memory/mappers/sxrom.cc
/*
 * Loads the given rom file into the sxrom memory object.
 * Note that while this implementation assumes the banks will boot in mode 3,
 * with the upper half of rom fixed to the last bank and the lower half on bank
 * 0, this is not specified in original hardware.
 *
 * Assumes the provided rom_file is valid.
 * Assumes the object was initialized with a valid header structure.
 */
Loads the given rom file into the sxrom memory object.
Note that while this implementation assumes the banks will boot in mode 3,
with the upper half of rom fixed to the last bank and the lower half on bank
0, this is not specified in original hardware.

Assumes the provided rom_file is valid.
Assumes the object was initialized with a valid header structure.
Loads the given rom file into the sxrom memory object . Note that while this implementation assumes the banks will boot in mode 3 with the upper half of rom fixed to the last bank and the lower half on bank 0 this is not specified in original hardware . Assumes the provided rom_file is valid . Assumes the object was initialized with a valid header structure .
void Sxrom::LoadPrgRom(FILE *rom_file) {
  num_prg_rom_banks_ = header_->prg_rom_size / ROM_BANK_SIZE;
  fseek(rom_file, HEADER_SIZE, SEEK_SET);
  for (size_t i = 0; i < num_prg_rom_banks_; i++) {
    prg_rom_[i] = new DataWord[ROM_BANK_SIZE];
    for (size_t j = 0; j < ROM_BANK_SIZE; j++) {
      prg_rom_[i][j] = fgetc(rom_file);
    }
  }
  if (num_prg_rom_banks_ > 16) {
    prg_rom_high_mask_ = 0x10;
  } else {
    prg_rom_high_mask_ = 0;
  }
  prg_rom_bank_b_ = num_prg_rom_banks_ - 1;
  return;
}
void Sxrom :: LoadPrgRom ( FILE * rom_file ) { num_prg_rom_banks_ = header_ -> prg_rom_size / ROM_BANK_SIZE ; fseek ( rom_file , HEADER_SIZE , SEEK_SET ) ; for ( size_t i = 0 ; i < num_prg_rom_banks_ ; i ++ ) { prg_rom_ [ i ] = new DataWord [ ROM_BANK_SIZE ] ; for ( size_t j = 0 ; j < ROM_BANK_SIZE ; j ++ ) { prg_rom_ [ i ] [ j ] = fgetc ( rom_file ) ; } } if ( num_prg_rom_banks_ > 16 ) { prg_rom_high_mask_ = 0x10 ; } else { prg_rom_high_mask_ = 0 ; } prg_rom_bank_b_ = num_prg_rom_banks_ - 1 ; return ; }
Loads the given rom file into the sxrom memory object.
Loads the given rom file into the sxrom memory object .
// Get the number of PRG-ROM banks, then load the rom into memory. // Determine if the requested PRG-ROM size needs a fifth selection bit. // Setup the default bank mode.