diff options
author | Michael Pavone <pavone@retrodev.com> | 2015-01-02 00:19:10 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2015-01-02 00:19:10 -0800 |
commit | 7d7892a23668855bb93b979e34a1d89440eb6e7e (patch) | |
tree | 62d6b32367d0ff3e9fac809f3a9d8922799485a8 /z80_to_x86.c | |
parent | 32c7399651b886128f9cbd7d185684f84d392a1a (diff) |
Sync Z80 when taking an interrupt so that int_cycle gets updated
Diffstat (limited to 'z80_to_x86.c')
-rw-r--r-- | z80_to_x86.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/z80_to_x86.c b/z80_to_x86.c index c1869b9..f13ef16 100644 --- a/z80_to_x86.c +++ b/z80_to_x86.c @@ -2103,7 +2103,16 @@ void init_z80_opts(z80_options * options, memmap_chunk const * chunks, uint32_t //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; |