changeset 756:e1dc98f7ed9f

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
author Michael Pavone <pavone@retrodev.com>
date Sat, 27 Jun 2015 13:18:55 -0700
parents 7306b3967c51
children 483f7e7926a6
files backend_x86.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/backend_x86.c	Sat Jun 27 12:17:18 2015 -0700
+++ b/backend_x86.c	Sat Jun 27 13:18:55 2015 -0700
@@ -171,8 +171,10 @@
 						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) {