diff options
author | Michael Pavone <pavone@retrodev.com> | 2015-06-27 13:18:55 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2015-06-27 13:18:55 -0700 |
commit | 85a13fa44481d4dafd548ed0e92654a9d6aea62f (patch) | |
tree | 02a350b76cab896a9fdee671478eb575e2d2ff14 /backend_x86.c | |
parent | 41427a5cbad6eae33ec644d38227fc7301d7a8c6 (diff) |
Preserve scratch2 when using it as a temporary in memory read functions. This fixes a bunch of issues with the Z80 core and possibly some issues with the 68K core as well
Diffstat (limited to 'backend_x86.c')
-rw-r--r-- | backend_x86.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/backend_x86.c b/backend_x86.c index 3e804b2..f9128ef 100644 --- a/backend_x86.c +++ b/backend_x86.c @@ -171,8 +171,10 @@ code_ptr gen_mem_fun(cpu_options * opts, memmap_chunk const * memmap, uint32_t n pop_r(code, opts->scratch1); mov_rrind(code, opts->scratch1, opts->scratch2, tmp_size); } else { + push_r(code, opts->scratch2); mov_ir(code, (intptr_t)memmap[chunk].buffer, opts->scratch2, SZ_PTR); mov_rindexr(code, opts->scratch2, opts->scratch1, 1, opts->scratch1, tmp_size); + pop_r(code, opts->scratch2); } } if (size != tmp_size && !is_write) { |