summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2015-05-12 19:14:09 -0700
committerMichael Pavone <pavone@retrodev.com>2015-05-12 19:14:09 -0700
commit42c1cb8c7c5369c88a8e94c083731b1e93b6119a (patch)
tree4461ddb4a73270f2b548787fbab0b676b04d3fe1
parent9eadca47ed6f00e7a00ac25b6b85ba4426104950 (diff)
Save PC to context struct when syncing Z80 at instruction start. This fixes saving savestates and probably the Z80 debugger as well
-rw-r--r--z80_to_x86.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/z80_to_x86.c b/z80_to_x86.c
index 17eb40a..313a8bb 100644
--- a/z80_to_x86.c
+++ b/z80_to_x86.c
@@ -2121,6 +2121,8 @@ void init_z80_opts(z80_options * options, memmap_chunk const * chunks, uint32_t
cmp_rdispr(code, options->gen.context_reg, offsetof(z80_context, sync_cycle), options->gen.cycles, SZ_D);
code_ptr skip_sync = code->cur + 1;
jcc(code, CC_B, skip_sync);
+ //save PC
+ mov_rrdisp(code, options->gen.scratch1, options->gen.context_reg, offsetof(z80_context, pc), SZ_D);
options->do_sync = code->cur;
call(code, options->gen.save_context);
pop_rind(code, options->gen.context_reg);