changeset 702:144df1a6d3b9

Save PC to context struct when syncing Z80 at instruction start. This fixes saving savestates and probably the Z80 debugger as well
author Michael Pavone <pavone@retrodev.com>
date Tue, 12 May 2015 19:14:09 -0700
parents 200ee73c7210
children 6e751a8f46aa
files z80_to_x86.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/z80_to_x86.c	Mon May 11 20:34:33 2015 -0700
+++ b/z80_to_x86.c	Tue May 12 19:14:09 2015 -0700
@@ -2121,6 +2121,8 @@
 	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);