c64_assembler/instruction/
operation.rs1use c64_assembler_6502::instruction::*;
2
3#[derive(Clone, Default, Debug, PartialEq)]
5pub enum Operation {
6 ADC,
8 AND,
10 ASL,
12 BCC,
14 BCS,
16 BEQ,
17 BIT,
18 BMI,
19 BNE,
20 BPL,
21 BRK,
22 BVC,
23 BVS,
24 CLD,
25 CLI,
26 CLV,
27 CMP,
28 CPX,
29 CPY,
30 DEC,
31 DEX,
32 DEY,
33 EOR,
34 INC,
35 INX,
36 INY,
37 LDX,
38 LSR,
39 #[default]
40 NOP,
41 ORA,
42 PHA,
43 PHP,
44 PLA,
45 PLP,
46 ROL,
47 ROR,
48 RTI,
49 SBC,
50 SED,
51 SEI,
52 STX,
53 STY,
54 TAX,
55 TAY,
56 TSX,
57 TXA,
58 TXS,
59 TYA,
60
61 LDA,
63 LDY,
64 STA,
66 JMP,
68 JSR,
70
71 SEC,
73 CLC,
75 RTS,
77
78 Raw(Vec<u8>),
80 Label(String),
82}
83
84impl Operation {
85 pub fn definition(&self) -> Option<&'static InstructionDef> {
87 match self {
88 Operation::ADC => Some(&OPCODES_ADC),
89 Operation::AND => Some(&OPCODES_AND),
90 Operation::ASL => Some(&OPCODES_ASL),
91 Operation::BCC => Some(&OPCODES_BCC),
92 Operation::BCS => Some(&OPCODES_BCS),
93 Operation::BEQ => Some(&OPCODES_BEQ),
94 Operation::BIT => Some(&OPCODES_BIT),
95 Operation::BMI => Some(&OPCODES_BMI),
96 Operation::BNE => Some(&OPCODES_BNE),
97 Operation::BPL => Some(&OPCODES_BPL),
98 Operation::BRK => Some(&OPCODES_BRK),
99 Operation::BVC => Some(&OPCODES_BVC),
100 Operation::BVS => Some(&OPCODES_BVS),
101 Operation::CLD => Some(&OPCODES_CLD),
102 Operation::CLI => Some(&OPCODES_CLI),
103 Operation::CLV => Some(&OPCODES_CLV),
104 Operation::CMP => Some(&OPCODES_CMP),
105 Operation::CPX => Some(&OPCODES_CPX),
106 Operation::CPY => Some(&OPCODES_CPY),
107 Operation::DEC => Some(&OPCODES_DEC),
108 Operation::DEX => Some(&OPCODES_DEX),
109 Operation::DEY => Some(&OPCODES_DEY),
110 Operation::EOR => Some(&OPCODES_EOR),
111 Operation::INC => Some(&OPCODES_INC),
112 Operation::INX => Some(&OPCODES_INX),
113 Operation::INY => Some(&OPCODES_INY),
114 Operation::LDX => Some(&OPCODES_LDX),
115 Operation::LSR => Some(&OPCODES_LSR),
116 Operation::NOP => Some(&OPCODES_NOP),
117 Operation::ORA => Some(&OPCODES_ORA),
118 Operation::PHA => Some(&OPCODES_PHA),
119 Operation::PHP => Some(&OPCODES_PHP),
120 Operation::PLA => Some(&OPCODES_PLA),
121 Operation::PLP => Some(&OPCODES_PLP),
122 Operation::ROL => Some(&OPCODES_ROL),
123 Operation::ROR => Some(&OPCODES_ROR),
124 Operation::RTI => Some(&OPCODES_RTI),
125 Operation::SBC => Some(&OPCODES_SBC),
126 Operation::SED => Some(&OPCODES_SED),
127 Operation::SEI => Some(&OPCODES_SEI),
128 Operation::STX => Some(&OPCODES_STX),
129 Operation::STY => Some(&OPCODES_STY),
130 Operation::TAX => Some(&OPCODES_TAX),
131 Operation::TAY => Some(&OPCODES_TAY),
132 Operation::TSX => Some(&OPCODES_TSX),
133 Operation::TXA => Some(&OPCODES_TXA),
134 Operation::TXS => Some(&OPCODES_TXS),
135 Operation::TYA => Some(&OPCODES_TYA),
136 Operation::LDA => Some(&OPCODES_LDA),
137 Operation::LDY => Some(&OPCODES_LDY),
138 Operation::STA => Some(&OPCODES_STA),
139 Operation::JMP => Some(&OPCODES_JMP),
140 Operation::JSR => Some(&OPCODES_JSR),
141 Operation::SEC => Some(&OPCODES_SEC),
142 Operation::CLC => Some(&OPCODES_CLC),
143 Operation::RTS => Some(&OPCODES_RTS),
144 Operation::Raw(_vec) => None,
145 Operation::Label(_) => None,
146 }
147 }
148}