annotate test/tests/opcodes6809.pl @ 327:f3592d276aed lwtools-4.10

Bump version for 4.10 release.
author William Astle <lost@l-w.ca>
date Fri, 11 Apr 2014 21:53:51 -0600
parents 5e7f8e1ac99f
children 3cd8aa013b88
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
175
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
1 #!/usr/bin/perl
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
2 #
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
3 # these tests determine if the opcodes for each instruction, in each
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
4 # addressing mode, are correct.
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
5 #
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
6 # The following list is used to construct the tests. The key is the
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
7 # mneumonic and the value is a list of address mode characters as follows
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
8 #
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
9 # R: register/inherent
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
10 # I: immediate
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
11 # E: extended
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
12 # D: direct
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
13 # i: indexed
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
14 # r: register to register (TFR, etc.)
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
15 # p: psh/pul
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
16 # each letter is followed by an = and the 2 or 4 digit opcode in hex
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
17 # each entry is separated by a comma
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
18
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
19 $lwasm = './lwasm/lwasm';
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
20
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
21 %insnlist = (
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
22 'neg' => 'D=00,E=70,i=60',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
23 'com' => 'D=03,E=73,i=63',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
24 'lsr' => 'D=04,E=74,i=64',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
25 'ror' => 'D=06,E=76,i=66',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
26 'asr' => 'D=07,E=77,i=67',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
27 'lsl' => 'D=08,E=78,i=68',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
28 'rol' => 'D=09,E=79,i=69',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
29 'dec' => 'D=0A,E=7A,i=6A',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
30 'inc' => 'D=0C,E=7C,i=6C',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
31 'tst' => 'D=0D,E=7D,i=6D',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
32 'jmp' => 'D=0E,E=7E,i=6E',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
33 'clr' => 'D=0F,E=7F,i=6F',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
34 'nop' => 'R=12',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
35 'sync' => 'R=13',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
36 'lbra' => 'b=16',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
37 'lbsr' => 'b=17',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
38 'daa' => 'R=19',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
39 'orcc' => 'I=1A',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
40 'andcc' => 'I=1C',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
41 'sex' => 'R=1D',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
42 'exg' => 'r=1E',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
43 'tfr' => 'r=1F',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
44 'bra' => 'b=20',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
45 'brn' => 'b=21',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
46 'lbrn' => 'b=1021',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
47 'bhi' => 'b=22',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
48 'lbhi' => 'b=1022',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
49 'bls' => 'b=23',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
50 'lbls' => 'b=1023',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
51 'bcc' => 'b=24',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
52 'lbcc' => 'b=1024',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
53 'bhs' => 'b=24',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
54 'lbhs' => 'b=1024',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
55 'bcs' => 'b=25',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
56 'lbcs' => 'b=1025',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
57 'blo' => 'b=25',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
58 'lblo' => 'b=1025',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
59 'bne' => 'b=26',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
60 'lbne' => 'b=1026',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
61 'beq' => 'b=27',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
62 'lbeq' => 'b=1027',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
63 'bvc' => 'b=28',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
64 'lbvc' => 'b=1028',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
65 'bvs' => 'b=29',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
66 'lbvs' => 'b=1029',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
67 'bpl' => 'b=2A',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
68 'lbpl' => 'b=102A',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
69 'bmi' => 'b=2B',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
70 'lbmi' => 'b=102B',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
71 'bge' => 'b=2C',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
72 'lbge' => 'b=102C',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
73 'blt' => 'b=2D',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
74 'lblt' => 'b=102D',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
75 'bgt' => 'b=2E',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
76 'lbgt' => 'b=102E',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
77 'ble' => 'b=2F',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
78 'lble' => 'b=102F',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
79 'leax' => 'i=30',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
80 'leay' => 'i=31',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
81 'leas' => 'i=32',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
82 'leau' => 'i=33',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
83 'pshs' => 'p=34',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
84 'puls' => 'p=35',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
85 'pshu' => 'p=36',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
86 'pulu' => 'p=37',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
87 'rts' => 'R=39',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
88 'abx' => 'R=3A',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
89 'rti' => 'R=3B',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
90 'cwai' => 'I=3C',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
91 'mul' => 'R=3D',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
92 'swi' => 'R=3F',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
93 'swi2' => 'R=103F',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
94 'swi3' => 'R=113F',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
95 'nega' => 'R=40',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
96 'coma' => 'R=43',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
97 'lsra' => 'R=44',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
98 'rora' => 'R=46',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
99 'asra' => 'R=47',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
100 'lsla' => 'R=48',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
101 'rola' => 'R=49',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
102 'deca' => 'R=4A',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
103 'inca' => 'R=4C',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
104 'tsta' => 'R=4D',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
105 'clra' => 'R=4F',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
106 'negb' => 'R=50',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
107 'comb' => 'R=53',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
108 'lsrb' => 'R=54',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
109 'rorb' => 'R=56',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
110 'asrb' => 'R=57',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
111 'lslb' => 'R=58',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
112 'rolb' => 'R=59',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
113 'decb' => 'R=5A',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
114 'incb' => 'R=5C',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
115 'tstb' => 'R=5D',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
116 'clrb' => 'R=5F',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
117 'suba' => 'I=80,D=90,i=A0,E=B0',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
118 'cmpa' => 'I=81,D=91,i=A1,E=B1',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
119 'sbca' => 'I=82,D=92,i=A2,E=B2',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
120 'subd' => 'I=83,D=93,i=A3,E=B3',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
121 'cmpd' => 'I=1083,D=1093,i=10A3,E=10B3',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
122 'cmpu' => 'I=1183,D=1193,i=11A3,E=11B3',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
123 'anda' => 'I=84,D=94,i=A4,E=B4',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
124 'bita' => 'I=85,D=95,i=A5,E=B5',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
125 'lda' => 'I=86,D=96,i=A6,E=B6',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
126 'sta' => 'D=97,i=A7,E=B7',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
127 'eora' => 'I=88,D=98,i=A8,E=B8',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
128 'adca' => 'I=89,D=99,i=A9,E=B9',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
129 'ora' => 'I=8A,D=9A,i=AA,E=BA',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
130 'adda' => 'I=8B,D=9B,i=AB,E=BB',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
131 'cmpx' => 'I=8C,D=9C,i=AC,E=BC',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
132 'cmpy' => 'I=108C,D=109C,i=10AC,E=10BC',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
133 'cmps' => 'I=118C,D=119C,i=11AC,E=11BC',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
134 'bsr' => 'b=8D',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
135 'jsr' => 'D=9D,i=AD,E=BD',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
136 'ldx' => 'I=8E,D=9E,i=AE,E=BE',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
137 'ldy' => 'I=108E,D=109E,i=10AE,E=10BE',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
138 'stx' => 'D=9F,i=AF,E=BF',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
139 'sty' => 'D=109F,i=10AF,E=10BF',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
140 'subb' => 'I=C0,D=D0,i=E0,E=F0',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
141 'cmpb' => 'I=C1,D=D1,i=E1,E=F1',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
142 'sbcb' => 'I=C2,D=D2,i=E2,E=F2',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
143 'addd' => 'I=C3,D=D3,i=E3,E=F3',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
144 'andb' => 'I=C4,D=D4,i=E4,E=F4',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
145 'bitb' => 'I=C5,D=D5,i=E5,E=F5',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
146 'ldb' => 'I=C6,D=D6,i=E6,E=F6',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
147 'stb' => 'D=D7,i=E7,E=F7',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
148 'eorb' => 'I=C8,D=D8,i=E8,E=F8',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
149 'adcb' => 'I=C9,D=D9,i=E9,E=F9',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
150 'orb' => 'I=CA,D=DA,i=EA,E=FA',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
151 'addb' => 'I=CB,D=DB,i=EB,E=FB',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
152 'ldd' => 'I=CC,D=DC,i=EC,E=FC',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
153 'std' => 'D=DD,i=ED,E=FD',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
154 'ldu' => 'I=CE,D=DE,i=EE,E=FE',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
155 'lds' => 'I=10CE,D=10DE,i=10EE,E=10FE',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
156 'stu' => 'D=DF,i=EF,E=FF',
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
157 'sts' => 'D=10DF,i=10EF,E=10FF'
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
158
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
159 );
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
160
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
161 foreach $i (keys %insnlist)
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
162 {
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
163 # print "$i ... $insnlist{$i}\n";
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
164 @modes = split(/,/, $insnlist{$i});
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
165 foreach $j (@modes)
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
166 {
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
167 ($mc, $oc) = split(/=/, $j);
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
168 $operand = '';
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
169 if ($mc eq 'D')
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
170 {
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
171 $operand = '<0';
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
172 }
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
173 elsif ($mc eq 'E')
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
174 {
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
175 $operand = '>0';
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
176 }
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
177 elsif ($mc eq 'I')
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
178 {
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
179 $operand = '#0';
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
180 }
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
181 elsif ($mc eq 'i')
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
182 {
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
183 $operand = ',x';
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
184 }
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
185 elsif ($mc eq 'r')
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
186 {
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
187 $operand = 'a,a';
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
188 }
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
189 elsif ($mc eq 'p')
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
190 {
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
191 $operand = 'cc';
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
192 }
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
193 elsif ($mc eq 'b')
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
194 {
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
195 $operand = '*';
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
196 }
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
197 $asmcode = "\t$i $operand";
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
198
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
199 # now feed the asm code to the assembler and fetch the result
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
200 $tf = ".asmtmp.$$.$i.$mc";
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
201 open H, ">$tf.asm";
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
202 print H "$asmcode\n";
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
203 close H;
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
204 $r = `$lwasm --raw --list -o $tf $tf.asm`;
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
205 open H, "<$tf";
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
206 binmode H;
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
207 $buffer = '';
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
208 $r = read(H, $buffer, 10);
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
209 close H;
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
210 unlink $tf;
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
211 unlink "$tf.asm";
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
212 if ($r == 0)
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
213 {
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
214 $st = 'FAIL (no result)';
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
215 }
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
216 else
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
217 {
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
218 @bytes = split(//,$buffer);
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
219 $rc = sprintf('%02X', ord($bytes[0]));
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
220 if (length($oc) > 2)
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
221 {
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
222 $rc .= sprintf('%02X', ord($bytes[1]));
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
223 }
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
224 if ($rc ne $oc)
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
225 {
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
226 $st = "FAIL ($rc ≠ $oc, $asmcode)";
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
227 }
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
228 else
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
229 {
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
230 $st = 'PASS';
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
231 }
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
232 }
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
233 print "$i" . "_$mc $st\n";
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
234 }
5e7f8e1ac99f added tests to verify 6809 opcodes are correct
lost@l-w.ca
parents:
diff changeset
235 }