summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2013-05-12 01:34:29 -0700
committerMike Pavone <pavone@retrodev.com>2013-05-12 01:34:29 -0700
commitd63b3046aee99574180b6e553e4c0d9c359ad1d3 (patch)
tree2a476376a87bc9e367a4bf2e75573df3881002ee
parent301f9c12bf5ca2a600bc917a62488d088b5e1946 (diff)
Fixed decoding of CHK destination
-rw-r--r--68kinst.c2
-rwxr-xr-xgentests.py8
-rw-r--r--testcases.txt9
3 files changed, 16 insertions, 3 deletions
diff --git a/68kinst.c b/68kinst.c
index 699f112..8417c13 100644
--- a/68kinst.c
+++ b/68kinst.c
@@ -480,7 +480,7 @@ uint16_t * m68k_decode(uint16_t * istream, m68kinst * decoded, uint32_t address)
#endif
}
decoded->dst.addr_mode = MODE_REG;
- decoded->dst.addr_mode = m68k_reg_quick_field(*istream);
+ decoded->dst.params.regs.pri = m68k_reg_quick_field(*istream);
istream = m68k_decode_op(istream, decoded->extra.size, &(decoded->src));
if (!istream) {
decoded->op = M68K_INVALID;
diff --git a/gentests.py b/gentests.py
index 9aa6a92..edfb55b 100755
--- a/gentests.py
+++ b/gentests.py
@@ -24,9 +24,12 @@ class Program(object):
def write_rom_test(self, outfile):
outfile.write('\tdc.l $0, start\n')
needdivzero = self.inst.name.startswith('div')
+ needchk = self.inst.name.startswith('chk')
for i in xrange(0x8, 0x100, 0x4):
if needdivzero and i == 0x14:
outfile.write('\tdc.l div_zero_handler\n')
+ elif needchk and i == 0x18:
+ outfile.write('\tdc.l chk_handler\n')
else:
outfile.write('\tdc.l empty_handler\n')
outfile.write('\tdc.b "SEGA"\nempty_handler:\n\trte\n')
@@ -35,6 +38,11 @@ class Program(object):
div_zero_count = self.get_dreg()
outfile.write('\taddq #1, ' + str(div_zero_count) + '\n')
outfile.write('\trte\n')
+ if needchk:
+ outfile.write('chk_handler:\n')
+ chk_count = self.get_dreg()
+ outfile.write('\taddq #1, ' + str(chk_count) + '\n')
+ outfile.write('\trte\n')
outfile.write('start:\n\tmove #0, CCR\n')
if needdivzero:
outfile.write('\tmoveq #0, ' + str(div_zero_count) + '\n')
diff --git a/testcases.txt b/testcases.txt
index b4f1958..301afd1 100644
--- a/testcases.txt
+++ b/testcases.txt
@@ -41,6 +41,11 @@ Name Sizes Src Modes Dst Modes
#moveq l #(-128-127) d
#roxl bwl d;#(1-8) d
#roxr bwl d;#(1-8) d
-divs w d;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l;#n;(n,pc);(n,pc,x) d
-divu w d;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l;#n;(n,pc);(n,pc,x) d
+#divs w d;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l;#n;(n,pc);(n,pc,x) d
+#divu w d;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l;#n;(n,pc);(n,pc,x) d
+chk w d;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l;#n;(n,pc);(n,pc,x) d
+cmp bwl d;a;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l;#n;(n,pc);(n,pc,x) d
+cmpa wl d;a;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l;#n;(n,pc);(n,pc,x) a
+cmpi bwl #n d;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l
+cmpm bwl (a)+ (a)+