changeset 158:a2ab895d9708

Fix predec address mode when used as source
author Mike Pavone <pavone@retrodev.com>
date Sat, 05 Jan 2013 00:53:50 -0800
parents 301470eb870b
children c1530501c215
files blastem.c m68k_to_x86.c
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/blastem.c	Fri Jan 04 23:52:20 2013 -0800
+++ b/blastem.c	Sat Jan 05 00:53:50 2013 -0800
@@ -34,6 +34,10 @@
 	}
 	fseek(f, 0, SEEK_END);
 	long filesize = ftell(f);
+	if (filesize/2 > CARTRIDGE_WORDS) {
+		//carts bigger than 4MB not currently supported
+		filesize = CARTRIDGE_WORDS*2;
+	}
 	fseek(f, 0, SEEK_SET);
 	fread(cart, 2, MIN(filesize/2, CARTRIDGE_WORDS), f);
 	fclose(f);
--- a/m68k_to_x86.c	Fri Jan 04 23:52:20 2013 -0800
+++ b/m68k_to_x86.c	Sat Jan 05 00:53:50 2013 -0800
@@ -130,9 +130,9 @@
 		dec_amount = inst->extra.size == OPSIZE_WORD ? 2 : (inst->extra.size == OPSIZE_LONG ? 4 : 1);
 		out = cycles(out, PREDEC_PENALTY);
 		if (opts->aregs[inst->src.params.regs.pri] >= 0) {
-			out = sub_ir(out, inc_amount, opts->aregs[inst->src.params.regs.pri], SZ_D);
+			out = sub_ir(out, dec_amount, opts->aregs[inst->src.params.regs.pri], SZ_D);
 		} else {
-			out = sub_irdisp8(out, inc_amount, CONTEXT, reg_offset(&(inst->src)), SZ_D);
+			out = sub_irdisp8(out, dec_amount, CONTEXT, reg_offset(&(inst->src)), SZ_D);
 		}
 	case MODE_AREG_INDIRECT:
 	case MODE_AREG_POSTINC: