Consolidate SNES::Init
This commit is contained in:
@@ -107,6 +107,14 @@ RomInfo SNES::ReadRomHeader(uint32_t offset) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SNES::Init(Rom& rom) {
|
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)
|
// Perform a long jump into a FastROM bank (if the ROM speed is FastROM)
|
||||||
// Disable the emulation flag (switch to 65816 native mode)
|
// Disable the emulation flag (switch to 65816 native mode)
|
||||||
cpu_.E = 0;
|
cpu_.E = 0;
|
||||||
|
|||||||
@@ -68,16 +68,6 @@ class SNES : public DirectMemoryAccess {
|
|||||||
return static_cast<Cpu::UpdateMode>(cpu_mode_);
|
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:
|
private:
|
||||||
void WriteToRegister(uint16_t address, uint8_t value) {
|
void WriteToRegister(uint16_t address, uint8_t value) {
|
||||||
memory_.WriteByte(address, value);
|
memory_.WriteByte(address, value);
|
||||||
|
|||||||
Reference in New Issue
Block a user