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