Emulator: Fix address pushed onto stack in CALL opcode

This commit is contained in:
Riyyi
2022-08-31 20:30:23 +02:00
parent 5d054c90f8
commit c7903c0a50
+4 -4
View File
@@ -1411,13 +1411,13 @@ void CPU::call()
}
m_wait_cycles += 24;
// Push address of next 2 bytes in memory onto stack
// Push address of the instruction after the CALL on the stack, such that RET can pop it later
m_sp = (m_sp - 1) & 0xffff;
write(m_sp, data >> 8);
write(m_sp, m_pc >> 8);
m_sp = (m_sp - 1) & 0xffff;
write(m_sp, data & 0xff);
write(m_sp, m_pc & 0xff);
// Jump to this address
// Jump to operand address
m_pc = data;
};