Mercurial > repos > blastem
comparison backend_x86.c @ 620:9d6fed6501ba
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.
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 29 Dec 2014 23:08:39 -0800 |
parents | 39d7d463ed5b |
children | 6aa29ac33f1a |
comparison
equal
deleted
inserted
replaced
619:3072fb746601 | 620:9d6fed6501ba |
---|---|
198 or_ir(code, 0xFF00, opts->scratch1, SZ_W); | 198 or_ir(code, 0xFF00, opts->scratch1, SZ_W); |
199 } | 199 } |
200 } | 200 } |
201 } | 201 } |
202 if (is_write && (memmap[chunk].flags & MMAP_CODE)) { | 202 if (is_write && (memmap[chunk].flags & MMAP_CODE)) { |
203 //TODO: Fixme for Z80 | |
204 mov_rr(code, opts->scratch2, opts->scratch1, opts->address_size); | 203 mov_rr(code, opts->scratch2, opts->scratch1, opts->address_size); |
205 shr_ir(code, 11, opts->scratch1, opts->address_size); | 204 shr_ir(code, opts->ram_flags_shift, opts->scratch1, opts->address_size); |
206 bt_rrdisp(code, opts->scratch1, opts->context_reg, opts->ram_flags_off, opts->address_size); | 205 bt_rrdisp(code, opts->scratch1, opts->context_reg, opts->ram_flags_off, opts->address_size); |
207 code_ptr not_code = code->cur + 1; | 206 code_ptr not_code = code->cur + 1; |
208 jcc(code, CC_NC, code->cur + 2); | 207 jcc(code, CC_NC, code->cur + 2); |
209 call(code, opts->save_context); | 208 call(code, opts->save_context); |
210 #ifdef X86_32 | 209 #ifdef X86_32 |
211 push_r(code, opts->context_reg); | 210 push_r(code, opts->context_reg); |
212 push_r(code, opts->scratch2); | 211 push_r(code, opts->scratch2); |
212 #else | |
213 if (opts->scratch2 != RDI) { | |
214 mov_rr(code, opts->scratch2, RDI, opts->address_size); | |
215 } | |
213 #endif | 216 #endif |
214 call(code, opts->handle_code_write); | 217 call(code, opts->handle_code_write); |
215 #ifdef X86_32 | 218 #ifdef X86_32 |
216 add_ir(code, 8, RSP, SZ_D); | 219 add_ir(code, 8, RSP, SZ_D); |
217 #endif | 220 #endif |