cpu - Fix push operations

This commit is contained in:
madmaurice 2023-08-29 12:10:10 +02:00
parent 002b745917
commit 1fc081b3c5

View file

@ -65,8 +65,8 @@ u16 Cpu::readPC16()
void Cpu::pushStack8(u8 data) void Cpu::pushStack8(u8 data)
{ {
bus->write8(state.SP, data);
state.SP--; state.SP--;
bus->write8(state.SP, data);
} }
u8 Cpu::popStack8() u8 Cpu::popStack8()
@ -78,8 +78,8 @@ u8 Cpu::popStack8()
void Cpu::pushStack16(u16 data) void Cpu::pushStack16(u16 data)
{ {
bus->write16(state.SP,data);
state.SP-=2; state.SP-=2;
bus->write16(state.SP,data);
} }
u16 Cpu::popStack16() u16 Cpu::popStack16()