c64_assembler_6502/opcodes.rs
1pub use gen::*;
2
3/// An OpCode is the first byte that encodes the instruction and type of addressing mode.
4pub type OpCode = u8;
5
6const UNUSED: OpCode = 0xFF;
7/// Special OpCode for instructions that don't have an op-code for implied addressing mode.
8pub const NO_IMPLIED: OpCode = UNUSED;
9/// Special OpCode for instructions that don't have an op-code for immediate addressing mode.
10pub const NO_IMMEDIATE: OpCode = UNUSED;
11/// Special OpCode for instructions that don't have an op-code for accumulator addressing mode.
12pub const NO_ACCUMULATOR: OpCode = UNUSED;
13/// Special OpCode for instructions that don't have an op-code for absolute addressing mode.
14pub const NO_ABSOLUTE: OpCode = UNUSED;
15/// Special OpCode for instructions that don't have an op-code for absolute-x addressing mode.
16pub const NO_ABSOLUTE_X: OpCode = UNUSED;
17/// Special OpCode for instructions that don't have an op-code for absolute-y addressing mode.
18pub const NO_ABSOLUTE_Y: OpCode = UNUSED;
19/// Special OpCode for instructions that don't have an op-code for zeropage addressing mode.
20pub const NO_ZEROPAGE: OpCode = UNUSED;
21/// Special OpCode for instructions that don't have an op-code for zeropage-x addressing mode.
22pub const NO_ZEROPAGE_X: OpCode = UNUSED;
23/// Special OpCode for instructions that don't have an op-code for zeropage-y addressing mode.
24pub const NO_ZEROPAGE_Y: OpCode = UNUSED;
25/// Special OpCode for instructions that don't have an op-code for indirect addressing mode.
26pub const NO_INDIRECT: OpCode = UNUSED;
27/// Special OpCode for instructions that don't have an op-code for indexed indirect addressing mode.
28pub const NO_INDEXED_INDIRECT: OpCode = UNUSED;
29/// Special OpCode for instructions that don't have an op-code for indirect indexed addressing mode.
30pub const NO_INDIRECT_INDEXED: OpCode = UNUSED;
31/// Special OpCode for instructions that don't have an op-code for relative addressing mode.
32pub const NO_RELATIVE: OpCode = UNUSED;
33
34mod gen {
35 use super::OpCode;
36
37 /// OpCode for the adc instruction in addressing mode immediate
38 pub const ADC_IMMEDIATE: OpCode = 0x69;
39 /// OpCode for the adc instruction in addressing mode absolute
40 pub const ADC_ABSOLUTE: OpCode = 0x6d;
41 /// OpCode for the adc instruction in addressing mode absolute_x
42 pub const ADC_ABSOLUTE_X: OpCode = 0x7d;
43 /// OpCode for the adc instruction in addressing mode absolute_y
44 pub const ADC_ABSOLUTE_Y: OpCode = 0x79;
45 /// OpCode for the adc instruction in addressing mode zeropage
46 pub const ADC_ZEROPAGE: OpCode = 0x65;
47 /// OpCode for the adc instruction in addressing mode zeropage_x
48 pub const ADC_ZEROPAGE_X: OpCode = 0x75;
49 /// OpCode for the adc instruction in addressing mode indexed_indirect
50 pub const ADC_INDEXED_INDIRECT: OpCode = 0x61;
51 /// OpCode for the adc instruction in addressing mode indirect_indexed
52 pub const ADC_INDIRECT_INDEXED: OpCode = 0x71;
53 /// OpCode for the and instruction in addressing mode immediate
54 pub const AND_IMMEDIATE: OpCode = 0x29;
55 /// OpCode for the and instruction in addressing mode absolute
56 pub const AND_ABSOLUTE: OpCode = 0x2d;
57 /// OpCode for the and instruction in addressing mode absolute_x
58 pub const AND_ABSOLUTE_X: OpCode = 0x3d;
59 /// OpCode for the and instruction in addressing mode absolute_y
60 pub const AND_ABSOLUTE_Y: OpCode = 0x39;
61 /// OpCode for the and instruction in addressing mode zeropage
62 pub const AND_ZEROPAGE: OpCode = 0x25;
63 /// OpCode for the and instruction in addressing mode zeropage_x
64 pub const AND_ZEROPAGE_X: OpCode = 0x35;
65 /// OpCode for the and instruction in addressing mode indexed_indirect
66 pub const AND_INDEXED_INDIRECT: OpCode = 0x21;
67 /// OpCode for the and instruction in addressing mode indirect_indexed
68 pub const AND_INDIRECT_INDEXED: OpCode = 0x01;
69 /// OpCode for the asl instruction in addressing mode accumulator
70 pub const ASL_ACCUMULATOR: OpCode = 0x0a;
71 /// OpCode for the asl instruction in addressing mode absolute
72 pub const ASL_ABSOLUTE: OpCode = 0x0e;
73 /// OpCode for the asl instruction in addressing mode absolute_x
74 pub const ASL_ABSOLUTE_X: OpCode = 0x1e;
75 /// OpCode for the asl instruction in addressing mode zeropage
76 pub const ASL_ZEROPAGE: OpCode = 0x06;
77 /// OpCode for the asl instruction in addressing mode zeropage_x
78 pub const ASL_ZEROPAGE_X: OpCode = 0x16;
79 /// OpCode for the bcc instruction in addressing mode relative
80 pub const BCC_RELATIVE: OpCode = 0x90;
81 /// OpCode for the bcs instruction in addressing mode relative
82 pub const BCS_RELATIVE: OpCode = 0xb0;
83 /// OpCode for the beq instruction in addressing mode relative
84 pub const BEQ_RELATIVE: OpCode = 0xf0;
85 /// OpCode for the bit instruction in addressing mode absolute
86 pub const BIT_ABSOLUTE: OpCode = 0x2c;
87 /// OpCode for the bit instruction in addressing mode zeropage
88 pub const BIT_ZEROPAGE: OpCode = 0x24;
89 /// OpCode for the bmi instruction in addressing mode relative
90 pub const BMI_RELATIVE: OpCode = 0x30;
91 /// OpCode for the bne instruction in addressing mode relative
92 pub const BNE_RELATIVE: OpCode = 0xd0;
93 /// OpCode for the bpl instruction in addressing mode relative
94 pub const BPL_RELATIVE: OpCode = 0x10;
95 /// OpCode for the brk instruction in addressing mode implied
96 pub const BRK_IMPLIED: OpCode = 0x00;
97 /// OpCode for the bvc instruction in addressing mode relative
98 pub const BVC_RELATIVE: OpCode = 0x50;
99 /// OpCode for the bvs instruction in addressing mode relative
100 pub const BVS_RELATIVE: OpCode = 0x70;
101 /// OpCode for the cld instruction in addressing mode implied
102 pub const CLD_IMPLIED: OpCode = 0xd8;
103 /// OpCode for the cli instruction in addressing mode implied
104 pub const CLI_IMPLIED: OpCode = 0x58;
105 /// OpCode for the clv instruction in addressing mode implied
106 pub const CLV_IMPLIED: OpCode = 0xb8;
107 /// OpCode for the cmp instruction in addressing mode immediate
108 pub const CMP_IMMEDIATE: OpCode = 0xc9;
109 /// OpCode for the cmp instruction in addressing mode absolute
110 pub const CMP_ABSOLUTE: OpCode = 0xcd;
111 /// OpCode for the cmp instruction in addressing mode absolute_x
112 pub const CMP_ABSOLUTE_X: OpCode = 0xdd;
113 /// OpCode for the cmp instruction in addressing mode absolute_y
114 pub const CMP_ABSOLUTE_Y: OpCode = 0xd9;
115 /// OpCode for the cmp instruction in addressing mode zeropage
116 pub const CMP_ZEROPAGE: OpCode = 0xc5;
117 /// OpCode for the cmp instruction in addressing mode zeropage_x
118 pub const CMP_ZEROPAGE_X: OpCode = 0xd5;
119 /// OpCode for the cmp instruction in addressing mode indexed_indirect
120 pub const CMP_INDEXED_INDIRECT: OpCode = 0xc1;
121 /// OpCode for the cmp instruction in addressing mode indirect_indexed
122 pub const CMP_INDIRECT_INDEXED: OpCode = 0xd1;
123 /// OpCode for the cpx instruction in addressing mode immediate
124 pub const CPX_IMMEDIATE: OpCode = 0xe0;
125 /// OpCode for the cpx instruction in addressing mode absolute
126 pub const CPX_ABSOLUTE: OpCode = 0xec;
127 /// OpCode for the cpx instruction in addressing mode zeropage
128 pub const CPX_ZEROPAGE: OpCode = 0xe4;
129 /// OpCode for the cpy instruction in addressing mode immediate
130 pub const CPY_IMMEDIATE: OpCode = 0xc0;
131 /// OpCode for the cpy instruction in addressing mode absolute
132 pub const CPY_ABSOLUTE: OpCode = 0xcc;
133 /// OpCode for the cpy instruction in addressing mode zeropage
134 pub const CPY_ZEROPAGE: OpCode = 0xc4;
135 /// OpCode for the dec instruction in addressing mode absolute
136 pub const DEC_ABSOLUTE: OpCode = 0xce;
137 /// OpCode for the dec instruction in addressing mode absolute_x
138 pub const DEC_ABSOLUTE_X: OpCode = 0xde;
139 /// OpCode for the dec instruction in addressing mode zeropage
140 pub const DEC_ZEROPAGE: OpCode = 0xc6;
141 /// OpCode for the dec instruction in addressing mode zeropage_x
142 pub const DEC_ZEROPAGE_X: OpCode = 0xd6;
143 /// OpCode for the dex instruction in addressing mode implied
144 pub const DEX_IMPLIED: OpCode = 0xca;
145 /// OpCode for the dey instruction in addressing mode implied
146 pub const DEY_IMPLIED: OpCode = 0x88;
147 /// OpCode for the eor instruction in addressing mode immediate
148 pub const EOR_IMMEDIATE: OpCode = 0x49;
149 /// OpCode for the eor instruction in addressing mode absolute
150 pub const EOR_ABSOLUTE: OpCode = 0x4d;
151 /// OpCode for the eor instruction in addressing mode absolute_x
152 pub const EOR_ABSOLUTE_X: OpCode = 0x5d;
153 /// OpCode for the eor instruction in addressing mode absolute_y
154 pub const EOR_ABSOLUTE_Y: OpCode = 0x59;
155 /// OpCode for the eor instruction in addressing mode zeropage
156 pub const EOR_ZEROPAGE: OpCode = 0x45;
157 /// OpCode for the eor instruction in addressing mode zeropage_x
158 pub const EOR_ZEROPAGE_X: OpCode = 0x55;
159 /// OpCode for the eor instruction in addressing mode indexed_indirect
160 pub const EOR_INDEXED_INDIRECT: OpCode = 0x41;
161 /// OpCode for the eor instruction in addressing mode indirect_indexed
162 pub const EOR_INDIRECT_INDEXED: OpCode = 0x51;
163 /// OpCode for the inc instruction in addressing mode absolute
164 pub const INC_ABSOLUTE: OpCode = 0xee;
165 /// OpCode for the inc instruction in addressing mode absolute_x
166 pub const INC_ABSOLUTE_X: OpCode = 0xfe;
167 /// OpCode for the inc instruction in addressing mode zeropage
168 pub const INC_ZEROPAGE: OpCode = 0xe6;
169 /// OpCode for the inc instruction in addressing mode zeropage_x
170 pub const INC_ZEROPAGE_X: OpCode = 0xf6;
171 /// OpCode for the inx instruction in addressing mode implied
172 pub const INX_IMPLIED: OpCode = 0xe8;
173 /// OpCode for the iny instruction in addressing mode implied
174 pub const INY_IMPLIED: OpCode = 0xc8;
175 /// OpCode for the ldx instruction in addressing mode immediate
176 pub const LDX_IMMEDIATE: OpCode = 0xa2;
177 /// OpCode for the ldx instruction in addressing mode absolute
178 pub const LDX_ABSOLUTE: OpCode = 0xae;
179 /// OpCode for the ldx instruction in addressing mode absolute_y
180 pub const LDX_ABSOLUTE_Y: OpCode = 0xbe;
181 /// OpCode for the ldx instruction in addressing mode zeropage
182 pub const LDX_ZEROPAGE: OpCode = 0xa6;
183 /// OpCode for the ldx instruction in addressing mode zeropage_y
184 pub const LDX_ZEROPAGE_Y: OpCode = 0xb6;
185 /// OpCode for the lsr instruction in addressing mode accumulator
186 pub const LSR_ACCUMULATOR: OpCode = 0x4a;
187 /// OpCode for the lsr instruction in addressing mode absolute
188 pub const LSR_ABSOLUTE: OpCode = 0x4e;
189 /// OpCode for the lsr instruction in addressing mode absolute_x
190 pub const LSR_ABSOLUTE_X: OpCode = 0x5e;
191 /// OpCode for the lsr instruction in addressing mode zeropage
192 pub const LSR_ZEROPAGE: OpCode = 0x46;
193 /// OpCode for the lsr instruction in addressing mode zeropage_x
194 pub const LSR_ZEROPAGE_X: OpCode = 0x56;
195 /// OpCode for the nop instruction in addressing mode implied
196 pub const NOP_IMPLIED: OpCode = 0xea;
197 /// OpCode for the ora instruction in addressing mode immediate
198 pub const ORA_IMMEDIATE: OpCode = 0x09;
199 /// OpCode for the ora instruction in addressing mode absolute
200 pub const ORA_ABSOLUTE: OpCode = 0x0d;
201 /// OpCode for the ora instruction in addressing mode absolute_x
202 pub const ORA_ABSOLUTE_X: OpCode = 0x1d;
203 /// OpCode for the ora instruction in addressing mode absolute_y
204 pub const ORA_ABSOLUTE_Y: OpCode = 0x19;
205 /// OpCode for the ora instruction in addressing mode zeropage
206 pub const ORA_ZEROPAGE: OpCode = 0x05;
207 /// OpCode for the ora instruction in addressing mode zeropage_x
208 pub const ORA_ZEROPAGE_X: OpCode = 0x15;
209 /// OpCode for the ora instruction in addressing mode indexed_indirect
210 pub const ORA_INDEXED_INDIRECT: OpCode = 0x01;
211 /// OpCode for the ora instruction in addressing mode indirect_indexed
212 pub const ORA_INDIRECT_INDEXED: OpCode = 0x11;
213 /// OpCode for the pha instruction in addressing mode implied
214 pub const PHA_IMPLIED: OpCode = 0x48;
215 /// OpCode for the php instruction in addressing mode implied
216 pub const PHP_IMPLIED: OpCode = 0x08;
217 /// OpCode for the pla instruction in addressing mode implied
218 pub const PLA_IMPLIED: OpCode = 0x68;
219 /// OpCode for the plp instruction in addressing mode implied
220 pub const PLP_IMPLIED: OpCode = 0x28;
221 /// OpCode for the rol instruction in addressing mode accumulator
222 pub const ROL_ACCUMULATOR: OpCode = 0x2a;
223 /// OpCode for the rol instruction in addressing mode absolute
224 pub const ROL_ABSOLUTE: OpCode = 0x2e;
225 /// OpCode for the rol instruction in addressing mode absolute_x
226 pub const ROL_ABSOLUTE_X: OpCode = 0x3e;
227 /// OpCode for the rol instruction in addressing mode zeropage
228 pub const ROL_ZEROPAGE: OpCode = 0x26;
229 /// OpCode for the rol instruction in addressing mode zeropage_x
230 pub const ROL_ZEROPAGE_X: OpCode = 0x36;
231 /// OpCode for the ror instruction in addressing mode accumulator
232 pub const ROR_ACCUMULATOR: OpCode = 0x6a;
233 /// OpCode for the ror instruction in addressing mode absolute
234 pub const ROR_ABSOLUTE: OpCode = 0x6e;
235 /// OpCode for the ror instruction in addressing mode absolute_x
236 pub const ROR_ABSOLUTE_X: OpCode = 0x7e;
237 /// OpCode for the ror instruction in addressing mode zeropage
238 pub const ROR_ZEROPAGE: OpCode = 0x66;
239 /// OpCode for the ror instruction in addressing mode zeropage_x
240 pub const ROR_ZEROPAGE_X: OpCode = 0x76;
241 /// OpCode for the rti instruction in addressing mode implied
242 pub const RTI_IMPLIED: OpCode = 0x40;
243 /// OpCode for the sbc instruction in addressing mode immediate
244 pub const SBC_IMMEDIATE: OpCode = 0xe9;
245 /// OpCode for the sbc instruction in addressing mode absolute
246 pub const SBC_ABSOLUTE: OpCode = 0xed;
247 /// OpCode for the sbc instruction in addressing mode absolute_x
248 pub const SBC_ABSOLUTE_X: OpCode = 0xfd;
249 /// OpCode for the sbc instruction in addressing mode absolute_y
250 pub const SBC_ABSOLUTE_Y: OpCode = 0xf9;
251 /// OpCode for the sbc instruction in addressing mode zeropage
252 pub const SBC_ZEROPAGE: OpCode = 0xe5;
253 /// OpCode for the sbc instruction in addressing mode zeropage_x
254 pub const SBC_ZEROPAGE_X: OpCode = 0xf5;
255 /// OpCode for the sbc instruction in addressing mode indexed_indirect
256 pub const SBC_INDEXED_INDIRECT: OpCode = 0xe1;
257 /// OpCode for the sbc instruction in addressing mode indirect_indexed
258 pub const SBC_INDIRECT_INDEXED: OpCode = 0xf1;
259 /// OpCode for the sed instruction in addressing mode implied
260 pub const SED_IMPLIED: OpCode = 0xf8;
261 /// OpCode for the sei instruction in addressing mode implied
262 pub const SEI_IMPLIED: OpCode = 0x78;
263 /// OpCode for the stx instruction in addressing mode absolute
264 pub const STX_ABSOLUTE: OpCode = 0x8e;
265 /// OpCode for the stx instruction in addressing mode zeropage
266 pub const STX_ZEROPAGE: OpCode = 0x86;
267 /// OpCode for the stx instruction in addressing mode zeropage_y
268 pub const STX_ZEROPAGE_Y: OpCode = 0x96;
269 /// OpCode for the sty instruction in addressing mode absolute
270 pub const STY_ABSOLUTE: OpCode = 0x8c;
271 /// OpCode for the sty instruction in addressing mode zeropage
272 pub const STY_ZEROPAGE: OpCode = 0x84;
273 /// OpCode for the sty instruction in addressing mode zeropage_x
274 pub const STY_ZEROPAGE_X: OpCode = 0x94;
275 /// OpCode for the tax instruction in addressing mode implied
276 pub const TAX_IMPLIED: OpCode = 0xaa;
277 /// OpCode for the tay instruction in addressing mode implied
278 pub const TAY_IMPLIED: OpCode = 0xa8;
279 /// OpCode for the tsx instruction in addressing mode implied
280 pub const TSX_IMPLIED: OpCode = 0xba;
281 /// OpCode for the txa instruction in addressing mode implied
282 pub const TXA_IMPLIED: OpCode = 0x8a;
283 /// OpCode for the txs instruction in addressing mode implied
284 pub const TXS_IMPLIED: OpCode = 0x9a;
285 /// OpCode for the tya instruction in addressing mode implied
286 pub const TYA_IMPLIED: OpCode = 0x98;
287 /// OpCode for the lda instruction in addressing mode immediate
288 pub const LDA_IMMEDIATE: OpCode = 0xa9;
289 /// OpCode for the lda instruction in addressing mode absolute
290 pub const LDA_ABSOLUTE: OpCode = 0xad;
291 /// OpCode for the lda instruction in addressing mode absolute_x
292 pub const LDA_ABSOLUTE_X: OpCode = 0xbd;
293 /// OpCode for the lda instruction in addressing mode absolute_y
294 pub const LDA_ABSOLUTE_Y: OpCode = 0xb9;
295 /// OpCode for the lda instruction in addressing mode zeropage
296 pub const LDA_ZEROPAGE: OpCode = 0xa5;
297 /// OpCode for the lda instruction in addressing mode zeropage_x
298 pub const LDA_ZEROPAGE_X: OpCode = 0xb5;
299 /// OpCode for the lda instruction in addressing mode indexed_indirect
300 pub const LDA_INDEXED_INDIRECT: OpCode = 0xa1;
301 /// OpCode for the lda instruction in addressing mode indirect_indexed
302 pub const LDA_INDIRECT_INDEXED: OpCode = 0xb1;
303 /// OpCode for the ldy instruction in addressing mode immediate
304 pub const LDY_IMMEDIATE: OpCode = 0xa0;
305 /// OpCode for the ldy instruction in addressing mode absolute
306 pub const LDY_ABSOLUTE: OpCode = 0xac;
307 /// OpCode for the ldy instruction in addressing mode absolute_x
308 pub const LDY_ABSOLUTE_X: OpCode = 0xbc;
309 /// OpCode for the ldy instruction in addressing mode zeropage
310 pub const LDY_ZEROPAGE: OpCode = 0xa4;
311 /// OpCode for the ldy instruction in addressing mode zeropage_x
312 pub const LDY_ZEROPAGE_X: OpCode = 0xb4;
313 /// OpCode for the sta instruction in addressing mode absolute
314 pub const STA_ABSOLUTE: OpCode = 0x8d;
315 /// OpCode for the sta instruction in addressing mode absolute_x
316 pub const STA_ABSOLUTE_X: OpCode = 0x9d;
317 /// OpCode for the sta instruction in addressing mode absolute_y
318 pub const STA_ABSOLUTE_Y: OpCode = 0x99;
319 /// OpCode for the sta instruction in addressing mode zeropage
320 pub const STA_ZEROPAGE: OpCode = 0x85;
321 /// OpCode for the sta instruction in addressing mode zeropage_x
322 pub const STA_ZEROPAGE_X: OpCode = 0x95;
323 /// OpCode for the sta instruction in addressing mode indexed_indirect
324 pub const STA_INDEXED_INDIRECT: OpCode = 0x81;
325 /// OpCode for the sta instruction in addressing mode indirect_indexed
326 pub const STA_INDIRECT_INDEXED: OpCode = 0x91;
327 /// OpCode for the jmp instruction in addressing mode absolute
328 pub const JMP_ABSOLUTE: OpCode = 0x4c;
329 /// OpCode for the jmp instruction in addressing mode indirect
330 pub const JMP_INDIRECT: OpCode = 0x6c;
331 /// OpCode for the jsr instruction in addressing mode absolute
332 pub const JSR_ABSOLUTE: OpCode = 0x20;
333 /// OpCode for the sec instruction in addressing mode implied
334 pub const SEC_IMPLIED: OpCode = 0x38;
335 /// OpCode for the clc instruction in addressing mode implied
336 pub const CLC_IMPLIED: OpCode = 0x18;
337 /// OpCode for the rts instruction in addressing mode implied
338 pub const RTS_IMPLIED: OpCode = 0x60;
339}