Consolidate SNES::Init

This commit is contained in:
scawful
2024-04-19 17:54:26 -04:00
parent a1558fd9a2
commit c906da46a0
2 changed files with 8 additions and 10 deletions

View File

@@ -107,6 +107,14 @@ RomInfo SNES::ReadRomHeader(uint32_t offset) {
}
void SNES::Init(Rom& rom) {
// Setup observers for the memory space
memory_.AddObserver(&apu_);
memory_.AddObserver(&ppu_);
// Load the ROM into memory and set up the memory mapping
rom_data = rom.vector();
memory_.Initialize(rom_data);
// Perform a long jump into a FastROM bank (if the ROM speed is FastROM)
// Disable the emulation flag (switch to 65816 native mode)
cpu_.E = 0;

View File

@@ -68,16 +68,6 @@ class SNES : public DirectMemoryAccess {
return static_cast<Cpu::UpdateMode>(cpu_mode_);
}
void SetupMemory(Rom& rom) {
// Setup observers for the memory space
memory_.AddObserver(&apu_);
memory_.AddObserver(&ppu_);
// Load the ROM into memory and set up the memory mapping
rom_data = rom.vector();
memory_.Initialize(rom_data);
}
private:
void WriteToRegister(uint16_t address, uint8_t value) {
memory_.WriteByte(address, value);