changeset 976:8cdd4ddedd9a

Properly imlement btst with an immediate destination. Fixes a crash in NHL 95.
author Michael Pavone <pavone@retrodev.com>
date Sat, 23 Apr 2016 12:43:23 -0700
parents c6b19939da7b
children 4cbc349a82a9
files m68k_core_x86.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/m68k_core_x86.c	Sat Apr 23 01:08:43 2016 -0700
+++ b/m68k_core_x86.c	Sat Apr 23 12:43:23 2016 -0700
@@ -1588,6 +1588,11 @@
 			and_ir(code, 7, src_op->base, SZ_D);
 			size = SZ_D;
 		}
+		if (dst_op->mode == MODE_IMMED) {
+			dst_op->base = src_op->base == opts->gen.scratch1 ? opts->gen.scratch2 : opts->gen.scratch1;
+			mov_ir(code, dst_op->disp, dst_op->base, SZ_B);
+			dst_op->mode = MODE_REG_DIRECT;
+		}
 		if (dst_op->mode == MODE_REG_DIRECT) {
 			op_rr(code, inst, src_op->base, dst_op->base, size);
 		} else {