Add step mode to snes emulator

This commit is contained in:
scawful
2023-12-05 03:47:06 -05:00
parent 5755e2e867
commit dad4a38f59
4 changed files with 41 additions and 33 deletions

View File

@@ -112,7 +112,7 @@ void SNES::Init(ROM& rom) {
cpu_.E = 0;
// Initialize CPU
cpu_.Init();
cpu_.Init();
// Read the ROM header
auto header_offset = GetHeaderOffset(memory_);
@@ -211,6 +211,9 @@ void SNES::Init(ROM& rom) {
// Misc
memory_.WriteByte(0x2133, 0x00); // SETINI
// Psuedo-Init
memory_.WriteWord(0x2140, 0xBBAA);
running_ = true;
scanline = 0;
}
@@ -251,6 +254,22 @@ void SNES::Run() {
}
}
void SNES::StepRun() {
// Update the CPU
cpu_.UpdateClock(0.0);
cpu_.Update(CPU::UpdateMode::Step);
// Update the PPU
ppu_.UpdateClock(0.0);
ppu_.Update();
// Update the APU
apu_.UpdateClock(0.0);
apu_.Update();
HandleInput();
}
// Enable NMI Interrupts
void SNES::EnableVBlankInterrupts() {
v_blank_flag_ = false;
@@ -363,14 +382,6 @@ void SNES::LoadState(const std::string& path) {
// ...
}
void SNES::Debug() {
// ...
}
void SNES::Breakpoint(uint16_t address) {
// ...
}
} // namespace emu
} // namespace app
} // namespace yaze