Skip to content

Commit 3ac2bd4

Browse files
committed
Fix instruction RET
1 parent e3f331c commit 3ac2bd4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/emit.dasc

+11-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,17 @@ static bool inst_ret(dasm_State **Dst, gbz80_inst *inst, uint64_t *cycles)
249249

250250
| add qword state->inst_count, *cycles + inst->cycles;
251251
| and xSP, 0xffff
252-
| mov tmp1w, [aMem + xSP]
252+
253+
/* access two bytes seperately */
254+
| xor tmp1, tmp1
255+
| xor tmp2, tmp2
256+
| mov tmp3, xSP
257+
| add tmp3w, 1
258+
| mov tmp2b, [aMem + tmp3]
259+
| mov tmp1b, [aMem + xSP]
260+
| shl tmp2, 8
261+
| add tmp1, tmp2
262+
253263
| inc SP
254264
| inc SP
255265
| and tmp1, 0xffff

0 commit comments

Comments
 (0)