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