From c167cb34f229802b34f65ba958c7d28a6ba898ad Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Thu, 18 Apr 2024 12:05:03 +0900 Subject: [PATCH] expand "RET" stack operations --- op_callret.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/op_callret.go b/op_callret.go index 2b9585e..47e3de2 100644 --- a/op_callret.go +++ b/op_callret.go @@ -18,8 +18,13 @@ func oopRETN(cpu *CPU) { } func oopRET(cpu *CPU) { - cpu.PC = cpu.readU16(cpu.SP) - cpu.SP += 2 + //cpu.PC = cpu.readU16(cpu.SP) + //cpu.SP += 2 + l := cpu.Memory.Get(cpu.SP) + cpu.SP++ + h := cpu.Memory.Get(cpu.SP) + cpu.SP++ + cpu.PC= (uint16(h) << 8) | uint16(l) } //////////////////////////////////////////////////////////////////////////////