1 /*****************************************************************************
2 *
3 * tbl6502.c
4 * 6502 opcode functions and function pointer table
5 *
6 * Copyright (c) 1998,1999,2000 Juergen Buchmueller, all rights reserved.
7 *
8 * - This source code is released as freeware for non-commercial purposes.
9 * - You are free to use and redistribute this code in modified or
10 * unmodified form, provided you list me in the credits.
11 * - If you modify this source code, you must add a notice to each modified
12 * source file that it has been changed. If you're a nice person, you
13 * will clearly mark each change too. :)
14 * - If you wish to use this for commercial purposes, please contact me at
15 * pullmoll@t-online.de
16 * - The author of this copywritten work reserves the right to change the
17 * terms of its usage and license at any time, including retroactively
18 * - This entire notice must remain in the source code.
19 *
20 * 2003-05-26 Fixed PHP, PLP, PHA, PLA cycle counts. [SJ]
21 *
22 *****************************************************************************/
23
24 #undef OP
25 #define OP(nn) static INLINE void m6502_##nn(void)
26
27 /*****************************************************************************
28 *****************************************************************************
29 *
30 * plain vanilla 6502 opcodes
31 *
32 *****************************************************************************
33 * op temp cycles rdmem opc wrmem ********************/
34
35 OP(00) { m6502_ICount -= 7; BRK; } /* 7 BRK */
36 OP(20) { m6502_ICount -= 6; JSR; } /* 6 JSR */
37 OP(40) { m6502_ICount -= 6; RTI; } /* 6 RTI */
38 OP(60) { m6502_ICount -= 6; RTS; } /* 6 RTS */
39 OP(80) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(a0)40 OP(a0) { int tmp; m6502_ICount -= 2; RD_IMM; LDY; } /* 2 LDY IMM */
OP(c0)41 OP(c0) { int tmp; m6502_ICount -= 2; RD_IMM; CPY; } /* 2 CPY IMM */
OP(e0)42 OP(e0) { int tmp; m6502_ICount -= 2; RD_IMM; CPX; } /* 2 CPX IMM */
43
44 OP(10) { int tmp; BPL; } /* 2 BPL REL */
45 OP(30) { int tmp; BMI; } /* 2 BMI REL */
46 OP(50) { int tmp; BVC; } /* 2 BVC REL */
47 OP(70) { int tmp; BVS; } /* 2 BVS REL */
48 OP(90) { int tmp; BCC; } /* 2 BCC REL */
OP(b0)49 OP(b0) { int tmp; BCS; } /* 2 BCS REL */
OP(d0)50 OP(d0) { int tmp; BNE; } /* 2 BNE REL */
OP(f0)51 OP(f0) { int tmp; BEQ; } /* 2 BEQ REL */
52
53 OP(01) { int tmp; m6502_ICount -= 6; RD_IDX; ORA; } /* 6 ORA IDX */
54 OP(21) { int tmp; m6502_ICount -= 6; RD_IDX; AND; } /* 6 AND IDX */
55 OP(41) { int tmp; m6502_ICount -= 6; RD_IDX; EOR; } /* 6 EOR IDX */
56 OP(61) { int tmp; m6502_ICount -= 6; RD_IDX; ADC; } /* 6 ADC IDX */
57 OP(81) { int tmp; m6502_ICount -= 6; STA; WR_IDX; } /* 6 STA IDX */
OP(a1)58 OP(a1) { int tmp; m6502_ICount -= 6; RD_IDX; LDA; } /* 6 LDA IDX */
OP(c1)59 OP(c1) { int tmp; m6502_ICount -= 6; RD_IDX; CMP; } /* 6 CMP IDX */
OP(e1)60 OP(e1) { int tmp; m6502_ICount -= 6; RD_IDX; SBC; } /* 6 SBC IDX */
61
62 OP(11) { int tmp; m6502_ICount -= 5; RD_IDY; ORA; } /* 5 ORA IDY */
63 OP(31) { int tmp; m6502_ICount -= 5; RD_IDY; AND; } /* 5 AND IDY */
64 OP(51) { int tmp; m6502_ICount -= 5; RD_IDY; EOR; } /* 5 EOR IDY */
65 OP(71) { int tmp; m6502_ICount -= 5; RD_IDY; ADC; } /* 5 ADC IDY */
66 OP(91) { int tmp; m6502_ICount -= 6; STA; WR_IDY; } /* 6 STA IDY */
OP(b1)67 OP(b1) { int tmp; m6502_ICount -= 5; RD_IDY; LDA; } /* 5 LDA IDY */
OP(d1)68 OP(d1) { int tmp; m6502_ICount -= 5; RD_IDY; CMP; } /* 5 CMP IDY */
OP(f1)69 OP(f1) { int tmp; m6502_ICount -= 5; RD_IDY; SBC; } /* 5 SBC IDY */
70
71 OP(02) { m6502_ICount -= 2; ILL; } /* 2 ILL */
72 OP(22) { m6502_ICount -= 2; ILL; } /* 2 ILL */
73 OP(42) { m6502_ICount -= 2; ILL; } /* 2 ILL */
74 OP(62) { m6502_ICount -= 2; ILL; } /* 2 ILL */
75 OP(82) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(a2)76 OP(a2) { int tmp; m6502_ICount -= 2; RD_IMM; LDX; } /* 2 LDX IMM */
OP(c2)77 OP(c2) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(e2)78 OP(e2) { m6502_ICount -= 2; ILL; } /* 2 ILL */
79
80 OP(12) { m6502_ICount -= 2; ILL; } /* 2 ILL */
81 OP(32) { m6502_ICount -= 2; ILL; } /* 2 ILL */
82 OP(52) { m6502_ICount -= 2; ILL; } /* 2 ILL */
83 OP(72) { m6502_ICount -= 2; ILL; } /* 2 ILL */
84 OP(92) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(b2)85 OP(b2) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(d2)86 OP(d2) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(f2)87 OP(f2) { m6502_ICount -= 2; ILL; } /* 2 ILL */
88
89 OP(03) { m6502_ICount -= 2; ILL; } /* 2 ILL */
90 OP(23) { m6502_ICount -= 2; ILL; } /* 2 ILL */
91 OP(43) { m6502_ICount -= 2; ILL; } /* 2 ILL */
92 OP(63) { m6502_ICount -= 2; ILL; } /* 2 ILL */
93 OP(83) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(a3)94 OP(a3) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(c3)95 OP(c3) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(e3)96 OP(e3) { m6502_ICount -= 2; ILL; } /* 2 ILL */
97
98 OP(13) { m6502_ICount -= 2; ILL; } /* 2 ILL */
99 OP(33) { m6502_ICount -= 2; ILL; } /* 2 ILL */
100 OP(53) { m6502_ICount -= 2; ILL; } /* 2 ILL */
101 OP(73) { m6502_ICount -= 2; ILL; } /* 2 ILL */
102 OP(93) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(b3)103 OP(b3) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(d3)104 OP(d3) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(f3)105 OP(f3) { m6502_ICount -= 2; ILL; } /* 2 ILL */
106
107 OP(04) { m6502_ICount -= 2; ILL; } /* 2 ILL */
108 OP(24) { int tmp; m6502_ICount -= 3; RD_ZPG; BIT; } /* 3 BIT ZPG */
109 OP(44) { m6502_ICount -= 2; ILL; } /* 2 ILL */
110 OP(64) { m6502_ICount -= 2; ILL; } /* 2 ILL */
111 OP(84) { int tmp; m6502_ICount -= 3; STY; WR_ZPG; } /* 3 STY ZPG */
OP(a4)112 OP(a4) { int tmp; m6502_ICount -= 3; RD_ZPG; LDY; } /* 3 LDY ZPG */
OP(c4)113 OP(c4) { int tmp; m6502_ICount -= 3; RD_ZPG; CPY; } /* 3 CPY ZPG */
OP(e4)114 OP(e4) { int tmp; m6502_ICount -= 3; RD_ZPG; CPX; } /* 3 CPX ZPG */
115
116 OP(14) { m6502_ICount -= 2; ILL; } /* 2 ILL */
117 OP(34) { m6502_ICount -= 2; ILL; } /* 2 ILL */
118 OP(54) { m6502_ICount -= 2; ILL; } /* 2 ILL */
119 OP(74) { m6502_ICount -= 2; ILL; } /* 2 ILL */
120 OP(94) { int tmp; m6502_ICount -= 4; STY; WR_ZPX; } /* 4 STY ZPX */
OP(b4)121 OP(b4) { int tmp; m6502_ICount -= 4; RD_ZPX; LDY; } /* 4 LDY ZPX */
OP(d4)122 OP(d4) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(f4)123 OP(f4) { m6502_ICount -= 2; ILL; } /* 2 ILL */
124
125 OP(05) { int tmp; m6502_ICount -= 3; RD_ZPG; ORA; } /* 3 ORA ZPG */
126 OP(25) { int tmp; m6502_ICount -= 3; RD_ZPG; AND; } /* 3 AND ZPG */
127 OP(45) { int tmp; m6502_ICount -= 3; RD_ZPG; EOR; } /* 3 EOR ZPG */
128 OP(65) { int tmp; m6502_ICount -= 3; RD_ZPG; ADC; } /* 3 ADC ZPG */
129 OP(85) { int tmp; m6502_ICount -= 3; STA; WR_ZPG; } /* 3 STA ZPG */
OP(a5)130 OP(a5) { int tmp; m6502_ICount -= 3; RD_ZPG; LDA; } /* 3 LDA ZPG */
OP(c5)131 OP(c5) { int tmp; m6502_ICount -= 3; RD_ZPG; CMP; } /* 3 CMP ZPG */
OP(e5)132 OP(e5) { int tmp; m6502_ICount -= 3; RD_ZPG; SBC; } /* 3 SBC ZPG */
133
134 OP(15) { int tmp; m6502_ICount -= 4; RD_ZPX; ORA; } /* 4 ORA ZPX */
135 OP(35) { int tmp; m6502_ICount -= 4; RD_ZPX; AND; } /* 4 AND ZPX */
136 OP(55) { int tmp; m6502_ICount -= 4; RD_ZPX; EOR; } /* 4 EOR ZPX */
137 OP(75) { int tmp; m6502_ICount -= 4; RD_ZPX; ADC; } /* 4 ADC ZPX */
138 OP(95) { int tmp; m6502_ICount -= 4; STA; WR_ZPX; } /* 4 STA ZPX */
OP(b5)139 OP(b5) { int tmp; m6502_ICount -= 4; RD_ZPX; LDA; } /* 4 LDA ZPX */
OP(d5)140 OP(d5) { int tmp; m6502_ICount -= 4; RD_ZPX; CMP; } /* 4 CMP ZPX */
OP(f5)141 OP(f5) { int tmp; m6502_ICount -= 4; RD_ZPX; SBC; } /* 4 SBC ZPX */
142
143 OP(06) { int tmp; m6502_ICount -= 5; RD_ZPG; ASL; WB_EA; } /* 5 ASL ZPG */
144 OP(26) { int tmp; m6502_ICount -= 5; RD_ZPG; ROL; WB_EA; } /* 5 ROL ZPG */
145 OP(46) { int tmp; m6502_ICount -= 5; RD_ZPG; LSR; WB_EA; } /* 5 LSR ZPG */
146 OP(66) { int tmp; m6502_ICount -= 5; RD_ZPG; ROR; WB_EA; } /* 5 ROR ZPG */
147 OP(86) { int tmp; m6502_ICount -= 3; STX; WR_ZPG; } /* 3 STX ZPG */
OP(a6)148 OP(a6) { int tmp; m6502_ICount -= 3; RD_ZPG; LDX; } /* 3 LDX ZPG */
OP(c6)149 OP(c6) { int tmp; m6502_ICount -= 5; RD_ZPG; DEC; WB_EA; } /* 5 DEC ZPG */
OP(e6)150 OP(e6) { int tmp; m6502_ICount -= 5; RD_ZPG; INC; WB_EA; } /* 5 INC ZPG */
151
152 OP(16) { int tmp; m6502_ICount -= 6; RD_ZPX; ASL; WB_EA; } /* 6 ASL ZPX */
153 OP(36) { int tmp; m6502_ICount -= 6; RD_ZPX; ROL; WB_EA; } /* 6 ROL ZPX */
154 OP(56) { int tmp; m6502_ICount -= 6; RD_ZPX; LSR; WB_EA; } /* 6 LSR ZPX */
155 OP(76) { int tmp; m6502_ICount -= 6; RD_ZPX; ROR; WB_EA; } /* 6 ROR ZPX */
156 OP(96) { int tmp; m6502_ICount -= 4; STX; WR_ZPY; } /* 4 STX ZPY */
OP(b6)157 OP(b6) { int tmp; m6502_ICount -= 4; RD_ZPY; LDX; } /* 4 LDX ZPY */
OP(d6)158 OP(d6) { int tmp; m6502_ICount -= 6; RD_ZPX; DEC; WB_EA; } /* 6 DEC ZPX */
OP(f6)159 OP(f6) { int tmp; m6502_ICount -= 6; RD_ZPX; INC; WB_EA; } /* 6 INC ZPX */
160
161 OP(07) { m6502_ICount -= 2; ILL; } /* 2 ILL */
162 OP(27) { m6502_ICount -= 2; ILL; } /* 2 ILL */
163 OP(47) { m6502_ICount -= 2; ILL; } /* 2 ILL */
164 OP(67) { m6502_ICount -= 2; ILL; } /* 2 ILL */
165 OP(87) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(a7)166 OP(a7) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(c7)167 OP(c7) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(e7)168 OP(e7) { m6502_ICount -= 2; ILL; } /* 2 ILL */
169
170 OP(17) { m6502_ICount -= 2; ILL; } /* 2 ILL */
171 OP(37) { m6502_ICount -= 2; ILL; } /* 2 ILL */
172 OP(57) { m6502_ICount -= 2; ILL; } /* 2 ILL */
173 OP(77) { m6502_ICount -= 2; ILL; } /* 2 ILL */
174 OP(97) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(b7)175 OP(b7) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(d7)176 OP(d7) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(f7)177 OP(f7) { m6502_ICount -= 2; ILL; } /* 2 ILL */
178
179 OP(08) { m6502_ICount -= 3; PHP; } /* 2 PHP */
180 OP(28) { m6502_ICount -= 4; PLP; } /* 2 PLP */
181 OP(48) { m6502_ICount -= 3; PHA; } /* 2 PHA */
182 OP(68) { m6502_ICount -= 4; PLA; } /* 2 PLA */
183 OP(88) { m6502_ICount -= 2; DEY; } /* 2 DEY */
OP(a8)184 OP(a8) { m6502_ICount -= 2; TAY; } /* 2 TAY */
OP(c8)185 OP(c8) { m6502_ICount -= 2; INY; } /* 2 INY */
OP(e8)186 OP(e8) { m6502_ICount -= 2; INX; } /* 2 INX */
187
188 OP(18) { m6502_ICount -= 2; CLC; } /* 2 CLC */
189 OP(38) { m6502_ICount -= 2; SEC; } /* 2 SEC */
190 OP(58) { m6502_ICount -= 2; CLI; } /* 2 CLI */
191 OP(78) { m6502_ICount -= 2; SEI; } /* 2 SEI */
192 OP(98) { m6502_ICount -= 2; TYA; } /* 2 TYA */
OP(b8)193 OP(b8) { m6502_ICount -= 2; CLV; } /* 2 CLV */
OP(d8)194 OP(d8) { m6502_ICount -= 2; CLD; } /* 2 CLD */
OP(f8)195 OP(f8) { m6502_ICount -= 2; SED; } /* 2 SED */
196
197 OP(09) { int tmp; m6502_ICount -= 2; RD_IMM; ORA; } /* 2 ORA IMM */
198 OP(29) { int tmp; m6502_ICount -= 2; RD_IMM; AND; } /* 2 AND IMM */
199 OP(49) { int tmp; m6502_ICount -= 2; RD_IMM; EOR; } /* 2 EOR IMM */
200 OP(69) { int tmp; m6502_ICount -= 2; RD_IMM; ADC; } /* 2 ADC IMM */
201 OP(89) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(a9)202 OP(a9) { int tmp; m6502_ICount -= 2; RD_IMM; LDA; } /* 2 LDA IMM */
OP(c9)203 OP(c9) { int tmp; m6502_ICount -= 2; RD_IMM; CMP; } /* 2 CMP IMM */
OP(e9)204 OP(e9) { int tmp; m6502_ICount -= 2; RD_IMM; SBC; } /* 2 SBC IMM */
205
206 OP(19) { int tmp; m6502_ICount -= 4; RD_ABY; ORA; } /* 4 ORA ABY */
207 OP(39) { int tmp; m6502_ICount -= 4; RD_ABY; AND; } /* 4 AND ABY */
208 OP(59) { int tmp; m6502_ICount -= 4; RD_ABY; EOR; } /* 4 EOR ABY */
209 OP(79) { int tmp; m6502_ICount -= 4; RD_ABY; ADC; } /* 4 ADC ABY */
210 OP(99) { int tmp; m6502_ICount -= 5; STA; WR_ABY; } /* 5 STA ABY */
OP(b9)211 OP(b9) { int tmp; m6502_ICount -= 4; RD_ABY; LDA; } /* 4 LDA ABY */
OP(d9)212 OP(d9) { int tmp; m6502_ICount -= 4; RD_ABY; CMP; } /* 4 CMP ABY */
OP(f9)213 OP(f9) { int tmp; m6502_ICount -= 4; RD_ABY; SBC; } /* 4 SBC ABY */
214
215 OP(0a) { int tmp; m6502_ICount -= 2; RD_ACC; ASL; WB_ACC; } /* 2 ASL A */
216 OP(2a) { int tmp; m6502_ICount -= 2; RD_ACC; ROL; WB_ACC; } /* 2 ROL A */
217 OP(4a) { int tmp; m6502_ICount -= 2; RD_ACC; LSR; WB_ACC; } /* 2 LSR A */
218 OP(6a) { int tmp; m6502_ICount -= 2; RD_ACC; ROR; WB_ACC; } /* 2 ROR A */
219 OP(8a) { m6502_ICount -= 2; TXA; } /* 2 TXA */
OP(aa)220 OP(aa) { m6502_ICount -= 2; TAX; } /* 2 TAX */
OP(ca)221 OP(ca) { m6502_ICount -= 2; DEX; } /* 2 DEX */
OP(ea)222 OP(ea) { m6502_ICount -= 2; NOP; } /* 2 NOP */
223
224 OP(1a) { m6502_ICount -= 2; ILL; } /* 2 ILL */
225 OP(3a) { m6502_ICount -= 2; ILL; } /* 2 ILL */
226 OP(5a) { m6502_ICount -= 2; ILL; } /* 2 ILL */
227 OP(7a) { m6502_ICount -= 2; ILL; } /* 2 ILL */
228 OP(9a) { m6502_ICount -= 2; TXS; } /* 2 TXS */
OP(ba)229 OP(ba) { m6502_ICount -= 2; TSX; } /* 2 TSX */
OP(da)230 OP(da) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(fa)231 OP(fa) { m6502_ICount -= 2; ILL; } /* 2 ILL */
232
233 OP(0b) { m6502_ICount -= 2; ILL; } /* 2 ILL */
234 OP(2b) { m6502_ICount -= 2; ILL; } /* 2 ILL */
235 OP(4b) { m6502_ICount -= 2; ILL; } /* 2 ILL */
236 OP(6b) { m6502_ICount -= 2; ILL; } /* 2 ILL */
237 OP(8b) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(ab)238 OP(ab) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(cb)239 OP(cb) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(eb)240 OP(eb) { m6502_ICount -= 2; ILL; } /* 2 ILL */
241
242 OP(1b) { m6502_ICount -= 2; ILL; } /* 2 ILL */
243 OP(3b) { m6502_ICount -= 2; ILL; } /* 2 ILL */
244 OP(5b) { m6502_ICount -= 2; ILL; } /* 2 ILL */
245 OP(7b) { m6502_ICount -= 2; ILL; } /* 2 ILL */
246 OP(9b) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(bb)247 OP(bb) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(db)248 OP(db) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(fb)249 OP(fb) { m6502_ICount -= 2; ILL; } /* 2 ILL */
250
251 OP(0c) { m6502_ICount -= 2; ILL; } /* 2 ILL */
252 OP(2c) { int tmp; m6502_ICount -= 4; RD_ABS; BIT; } /* 4 BIT ABS */
253 OP(4c) { m6502_ICount -= 3; EA_ABS; JMP; } /* 3 JMP ABS */
254 OP(6c) { int tmp; m6502_ICount -= 5; EA_IND; JMP; } /* 5 JMP IND */
255 OP(8c) { int tmp; m6502_ICount -= 4; STY; WR_ABS; } /* 4 STY ABS */
OP(ac)256 OP(ac) { int tmp; m6502_ICount -= 4; RD_ABS; LDY; } /* 4 LDY ABS */
OP(cc)257 OP(cc) { int tmp; m6502_ICount -= 4; RD_ABS; CPY; } /* 4 CPY ABS */
OP(ec)258 OP(ec) { int tmp; m6502_ICount -= 4; RD_ABS; CPX; } /* 4 CPX ABS */
259
260 OP(1c) { m6502_ICount -= 2; ILL; } /* 2 ILL */
261 OP(3c) { m6502_ICount -= 2; ILL; } /* 2 ILL */
262 OP(5c) { m6502_ICount -= 2; ILL; } /* 2 ILL */
263 OP(7c) { m6502_ICount -= 2; ILL; } /* 2 ILL */
264 OP(9c) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(bc)265 OP(bc) { int tmp; m6502_ICount -= 4; RD_ABX; LDY; } /* 4 LDY ABX */
OP(dc)266 OP(dc) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(fc)267 OP(fc) { m6502_ICount -= 2; ILL; } /* 2 ILL */
268
269 OP(0d) { int tmp; m6502_ICount -= 4; RD_ABS; ORA; } /* 4 ORA ABS */
270 OP(2d) { int tmp; m6502_ICount -= 4; RD_ABS; AND; } /* 4 AND ABS */
271 OP(4d) { int tmp; m6502_ICount -= 4; RD_ABS; EOR; } /* 4 EOR ABS */
272 OP(6d) { int tmp; m6502_ICount -= 4; RD_ABS; ADC; } /* 4 ADC ABS */
273 OP(8d) { int tmp; m6502_ICount -= 4; STA; WR_ABS; } /* 4 STA ABS */
OP(ad)274 OP(ad) { int tmp; m6502_ICount -= 4; RD_ABS; LDA; } /* 4 LDA ABS */
OP(cd)275 OP(cd) { int tmp; m6502_ICount -= 4; RD_ABS; CMP; } /* 4 CMP ABS */
OP(ed)276 OP(ed) { int tmp; m6502_ICount -= 4; RD_ABS; SBC; } /* 4 SBC ABS */
277
278 OP(1d) { int tmp; m6502_ICount -= 4; RD_ABX; ORA; } /* 4 ORA ABX */
279 OP(3d) { int tmp; m6502_ICount -= 4; RD_ABX; AND; } /* 4 AND ABX */
280 OP(5d) { int tmp; m6502_ICount -= 4; RD_ABX; EOR; } /* 4 EOR ABX */
281 OP(7d) { int tmp; m6502_ICount -= 4; RD_ABX; ADC; } /* 4 ADC ABX */
282 OP(9d) { int tmp; m6502_ICount -= 5; STA; WR_ABX; } /* 5 STA ABX */
OP(bd)283 OP(bd) { int tmp; m6502_ICount -= 4; RD_ABX; LDA; } /* 4 LDA ABX */
OP(dd)284 OP(dd) { int tmp; m6502_ICount -= 4; RD_ABX; CMP; } /* 4 CMP ABX */
OP(fd)285 OP(fd) { int tmp; m6502_ICount -= 4; RD_ABX; SBC; } /* 4 SBC ABX */
286
287 OP(0e) { int tmp; m6502_ICount -= 6; RD_ABS; ASL; WB_EA; } /* 6 ASL ABS */
288 OP(2e) { int tmp; m6502_ICount -= 6; RD_ABS; ROL; WB_EA; } /* 6 ROL ABS */
289 OP(4e) { int tmp; m6502_ICount -= 6; RD_ABS; LSR; WB_EA; } /* 6 LSR ABS */
290 OP(6e) { int tmp; m6502_ICount -= 6; RD_ABS; ROR; WB_EA; } /* 6 ROR ABS */
291 OP(8e) { int tmp; m6502_ICount -= 5; STX; WR_ABS; } /* 5 STX ABS */
OP(ae)292 OP(ae) { int tmp; m6502_ICount -= 4; RD_ABS; LDX; } /* 4 LDX ABS */
OP(ce)293 OP(ce) { int tmp; m6502_ICount -= 6; RD_ABS; DEC; WB_EA; } /* 6 DEC ABS */
OP(ee)294 OP(ee) { int tmp; m6502_ICount -= 6; RD_ABS; INC; WB_EA; } /* 6 INC ABS */
295
296 OP(1e) { int tmp; m6502_ICount -= 7; RD_ABX; ASL; WB_EA; } /* 7 ASL ABX */
297 OP(3e) { int tmp; m6502_ICount -= 7; RD_ABX; ROL; WB_EA; } /* 7 ROL ABX */
298 OP(5e) { int tmp; m6502_ICount -= 7; RD_ABX; LSR; WB_EA; } /* 7 LSR ABX */
299 OP(7e) { int tmp; m6502_ICount -= 7; RD_ABX; ROR; WB_EA; } /* 7 ROR ABX */
300 OP(9e) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(be)301 OP(be) { int tmp; m6502_ICount -= 4; RD_ABY; LDX; } /* 4 LDX ABY */
OP(de)302 OP(de) { int tmp; m6502_ICount -= 7; RD_ABX; DEC; WB_EA; } /* 7 DEC ABX */
OP(fe)303 OP(fe) { int tmp; m6502_ICount -= 7; RD_ABX; INC; WB_EA; } /* 7 INC ABX */
304
305 OP(0f) { m6502_ICount -= 2; ILL; } /* 2 ILL */
306 OP(2f) { m6502_ICount -= 2; ILL; } /* 2 ILL */
307 OP(4f) { m6502_ICount -= 2; ILL; } /* 2 ILL */
308 OP(6f) { m6502_ICount -= 2; ILL; } /* 2 ILL */
309 OP(8f) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(af)310 OP(af) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(cf)311 OP(cf) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(ef)312 OP(ef) { m6502_ICount -= 2; ILL; } /* 2 ILL */
313
314 OP(1f) { m6502_ICount -= 2; ILL; } /* 2 ILL */
315 OP(3f) { m6502_ICount -= 2; ILL; } /* 2 ILL */
316 OP(5f) { m6502_ICount -= 2; ILL; } /* 2 ILL */
317 OP(7f) { m6502_ICount -= 2; ILL; } /* 2 ILL */
318 OP(9f) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(bf)319 OP(bf) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(df)320 OP(df) { m6502_ICount -= 2; ILL; } /* 2 ILL */
OP(ff)321 OP(ff) { m6502_ICount -= 2; ILL; } /* 2 ILL */
322
323 /* and here's the array of function pointers */
324
325 static void (*insn6502[0x100])(void) = {
326 m6502_00,m6502_01,m6502_02,m6502_03,m6502_04,m6502_05,m6502_06,m6502_07,
327 m6502_08,m6502_09,m6502_0a,m6502_0b,m6502_0c,m6502_0d,m6502_0e,m6502_0f,
328 m6502_10,m6502_11,m6502_12,m6502_13,m6502_14,m6502_15,m6502_16,m6502_17,
329 m6502_18,m6502_19,m6502_1a,m6502_1b,m6502_1c,m6502_1d,m6502_1e,m6502_1f,
330 m6502_20,m6502_21,m6502_22,m6502_23,m6502_24,m6502_25,m6502_26,m6502_27,
331 m6502_28,m6502_29,m6502_2a,m6502_2b,m6502_2c,m6502_2d,m6502_2e,m6502_2f,
332 m6502_30,m6502_31,m6502_32,m6502_33,m6502_34,m6502_35,m6502_36,m6502_37,
333 m6502_38,m6502_39,m6502_3a,m6502_3b,m6502_3c,m6502_3d,m6502_3e,m6502_3f,
334 m6502_40,m6502_41,m6502_42,m6502_43,m6502_44,m6502_45,m6502_46,m6502_47,
335 m6502_48,m6502_49,m6502_4a,m6502_4b,m6502_4c,m6502_4d,m6502_4e,m6502_4f,
336 m6502_50,m6502_51,m6502_52,m6502_53,m6502_54,m6502_55,m6502_56,m6502_57,
337 m6502_58,m6502_59,m6502_5a,m6502_5b,m6502_5c,m6502_5d,m6502_5e,m6502_5f,
338 m6502_60,m6502_61,m6502_62,m6502_63,m6502_64,m6502_65,m6502_66,m6502_67,
339 m6502_68,m6502_69,m6502_6a,m6502_6b,m6502_6c,m6502_6d,m6502_6e,m6502_6f,
340 m6502_70,m6502_71,m6502_72,m6502_73,m6502_74,m6502_75,m6502_76,m6502_77,
341 m6502_78,m6502_79,m6502_7a,m6502_7b,m6502_7c,m6502_7d,m6502_7e,m6502_7f,
342 m6502_80,m6502_81,m6502_82,m6502_83,m6502_84,m6502_85,m6502_86,m6502_87,
343 m6502_88,m6502_89,m6502_8a,m6502_8b,m6502_8c,m6502_8d,m6502_8e,m6502_8f,
344 m6502_90,m6502_91,m6502_92,m6502_93,m6502_94,m6502_95,m6502_96,m6502_97,
345 m6502_98,m6502_99,m6502_9a,m6502_9b,m6502_9c,m6502_9d,m6502_9e,m6502_9f,
346 m6502_a0,m6502_a1,m6502_a2,m6502_a3,m6502_a4,m6502_a5,m6502_a6,m6502_a7,
347 m6502_a8,m6502_a9,m6502_aa,m6502_ab,m6502_ac,m6502_ad,m6502_ae,m6502_af,
348 m6502_b0,m6502_b1,m6502_b2,m6502_b3,m6502_b4,m6502_b5,m6502_b6,m6502_b7,
349 m6502_b8,m6502_b9,m6502_ba,m6502_bb,m6502_bc,m6502_bd,m6502_be,m6502_bf,
350 m6502_c0,m6502_c1,m6502_c2,m6502_c3,m6502_c4,m6502_c5,m6502_c6,m6502_c7,
351 m6502_c8,m6502_c9,m6502_ca,m6502_cb,m6502_cc,m6502_cd,m6502_ce,m6502_cf,
352 m6502_d0,m6502_d1,m6502_d2,m6502_d3,m6502_d4,m6502_d5,m6502_d6,m6502_d7,
353 m6502_d8,m6502_d9,m6502_da,m6502_db,m6502_dc,m6502_dd,m6502_de,m6502_df,
354 m6502_e0,m6502_e1,m6502_e2,m6502_e3,m6502_e4,m6502_e5,m6502_e6,m6502_e7,
355 m6502_e8,m6502_e9,m6502_ea,m6502_eb,m6502_ec,m6502_ed,m6502_ee,m6502_ef,
356 m6502_f0,m6502_f1,m6502_f2,m6502_f3,m6502_f4,m6502_f5,m6502_f6,m6502_f7,
357 m6502_f8,m6502_f9,m6502_fa,m6502_fb,m6502_fc,m6502_fd,m6502_fe,m6502_ff
358 };
359