From c08fd5d68d86faaaf3216794746135dbaf236def Mon Sep 17 00:00:00 2001 From: MadMaurice Date: Tue, 29 Aug 2023 16:53:53 +0200 Subject: [PATCH] cpu/decoder - Actually use pushStack16 and popStack16 for POP and PUSH --- cpu/decoder.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cpu/decoder.cpp b/cpu/decoder.cpp index 5013cd8..fac61c1 100644 --- a/cpu/decoder.cpp +++ b/cpu/decoder.cpp @@ -67,17 +67,13 @@ void Cpu::executeInstruction() default: data = state.reg16((op >> 4) & 0x3); } - state.SP-=2; - - bus->write16(state.SP, data); + pushStack16(data); mcycles = 4; } else if((op & 0xCF) == 0xC1) // POP rr { - u16 data = bus->read16(state.SP); - - state.SP+=2; + u16 data = popStack16(); switch((op >> 4) & 0x3) {