diff options
author | Michael Pavone <pavone@retrodev.com> | 2014-12-29 23:08:39 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2014-12-29 23:08:39 -0800 |
commit | c61ca95add7b82aadef09aea8b4c48774e079069 (patch) | |
tree | 7710ffc0c0f1a5d86949af8171558dbc434ddc91 /backend_x86.c | |
parent | c6beba019312aaaf7bd8718bb239b7c632477852 (diff) |
Fix handling of code writes for Z80 core. This seems to get things close to being back to where they were before the big refactor that broke the Z80 core. Some problems remain. Notably the sound driver in Sonic 2 is still quite broken.
Diffstat (limited to 'backend_x86.c')
-rw-r--r-- | backend_x86.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/backend_x86.c b/backend_x86.c index 631c6c7..71eaf28 100644 --- a/backend_x86.c +++ b/backend_x86.c @@ -200,9 +200,8 @@ code_ptr gen_mem_fun(cpu_options * opts, memmap_chunk const * memmap, uint32_t n } } if (is_write && (memmap[chunk].flags & MMAP_CODE)) { - //TODO: Fixme for Z80 mov_rr(code, opts->scratch2, opts->scratch1, opts->address_size); - shr_ir(code, 11, opts->scratch1, opts->address_size); + shr_ir(code, opts->ram_flags_shift, opts->scratch1, opts->address_size); bt_rrdisp(code, opts->scratch1, opts->context_reg, opts->ram_flags_off, opts->address_size); code_ptr not_code = code->cur + 1; jcc(code, CC_NC, code->cur + 2); @@ -210,6 +209,10 @@ code_ptr gen_mem_fun(cpu_options * opts, memmap_chunk const * memmap, uint32_t n #ifdef X86_32 push_r(code, opts->context_reg); push_r(code, opts->scratch2); +#else + if (opts->scratch2 != RDI) { + mov_rr(code, opts->scratch2, RDI, opts->address_size); + } #endif call(code, opts->handle_code_write); #ifdef X86_32 |