changeset 1225:197cb199a35b

Fix loading of the R register from the in memory context
author Michael Pavone <pavone@retrodev.com>
date Sun, 19 Feb 2017 17:37:25 -0800
parents 15c5be05e6a9
children 000953a7641b
files z80_to_x86.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/z80_to_x86.c	Sun Feb 19 12:41:57 2017 -0800
+++ b/z80_to_x86.c	Sun Feb 19 17:37:25 2017 -0800
@@ -3277,9 +3277,6 @@
 			or_rrdisp(code, options->regs[Z80_R], options->gen.context_reg, zr_off(Z80_R), SZ_B);
 		} else if (options->regs[reg] >= 0) {
 			mov_rrdisp(code, options->regs[reg], options->gen.context_reg, zr_off(reg), size);
-			if (reg == Z80_R) {
-				and_irdisp(code, 0x80, options->gen.context_reg, zr_off(reg), SZ_B);
-			}	
 		}
 		if (size == SZ_W) {
 			i++;
@@ -3310,6 +3307,9 @@
 		}
 		if (options->regs[reg] >= 0) {
 			mov_rdispr(code, options->gen.context_reg, offsetof(z80_context, regs) + i, options->regs[reg], size);
+			if (reg == Z80_R) {
+				and_irdisp(code, 0x80, options->gen.context_reg, zr_off(reg), SZ_B);
+			}
 		}
 		if (size == SZ_W) {
 			i++;