set int delay in dma fns

This commit is contained in:
scawful
2024-04-24 15:41:31 -04:00
parent f6e610814d
commit 2a5886e5e0
2 changed files with 4 additions and 0 deletions

View File

@@ -160,6 +160,7 @@ void Write(MemoryImpl* memory, uint16_t adr, uint8_t val) {
void DoDma(SNES* snes, MemoryImpl* memory, int cpuCycles) {
auto channel = memory->dma_channels();
snes->cpu().set_int_delay(true);
// align to multiple of 8
snes->SyncCycles(true, 8);
@@ -228,6 +229,7 @@ void InitHdma(SNES* snes, MemoryImpl* memory, bool do_sync, int cpu_cycles) {
channel[i].terminated = false;
}
if (!hdmaEnabled) return;
snes->cpu().set_int_delay(true);
if (do_sync) snes->SyncCycles(true, 8);
// full transfer overhead
@@ -269,6 +271,7 @@ void DoHdma(SNES* snes, MemoryImpl* memory, bool do_sync, int cycles) {
}
if (!hdmaActive) return;
snes->cpu().set_int_delay(true);
if (do_sync) snes->SyncCycles(true, 8);

View File

@@ -289,6 +289,7 @@ class MemoryImpl : public Memory, public Loggable {
// Stack Pointer access.
uint16_t SP() const override { return SP_; }
auto mutable_sp() -> uint16_t& { return SP_; }
void SetSP(uint16_t value) override { SP_ = value; }
void ClearMemory() override { std::fill(memory_.begin(), memory_.end(), 0); }