# HG changeset patch # User Michael Pavone # Date 1420186750 28800 # Node ID 7a5461001242fcfcecaebf7980a63c064900ca01 # Parent 66388360f87352a97eb52027d38a201a86fb33d2 Sync Z80 when taking an interrupt so that int_cycle gets updated diff -r 66388360f873 -r 7a5461001242 z80_to_x86.c --- a/z80_to_x86.c Thu Jan 01 23:37:24 2015 -0800 +++ b/z80_to_x86.c Fri Jan 02 00:19:10 2015 -0800 @@ -2103,7 +2103,16 @@ //TODO: Support interrupt mode 0 and 2 mov_ir(code, 0x38, options->gen.scratch1, SZ_W); call(code, options->native_addr); - jmp_r(code, options->gen.scratch1); + mov_rrind(code, options->gen.scratch1, options->gen.context_reg, SZ_PTR); + //restore callee saved registers + pop_r(code, R15); + pop_r(code, R14); + pop_r(code, R13); + pop_r(code, R12); + pop_r(code, RBP); + pop_r(code, RBX); + //return to caller of z80_run to sync + retn(code); *skip_int = code->cur - (skip_int+1); cmp_rdispr(code, options->gen.context_reg, offsetof(z80_context, sync_cycle), options->gen.cycles, SZ_D); code_ptr skip_sync = code->cur + 1;