-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoperation.rb
executable file
·178 lines (177 loc) · 2.89 KB
/
operation.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# Constant (enum-ish) definition of operations
module Operation
ADC = 1
AND = 2
ASL = 3
BCC = 4
BCS = 5
BEQ = 6
BIT = 7
BMI = 8
BNE = 9
BPL = 10
BRK = 11
BVC = 12
BVS = 13
CLC = 14
CLD = 15
CLI = 16
CLV = 17
CMP = 18
CPX = 19
CPY = 20
DEC = 21
DEX = 22
DEY = 23
EOR = 24
INC = 25
INX = 26
INY = 27
JMP = 28
JSR = 29
LDA = 30
LDX = 31
LDY = 32
LSR = 33
NOP = 34
ORA = 35
PHA = 36
PHP = 37
PLA = 38
PLP = 39
ROL = 40
ROR = 41
RTI = 42
RTS = 43
SBC = 44
SEC = 45
SED = 46
SEI = 47
STA = 48
STX = 49
STY = 50
TAX = 51
TAY = 52
TSX = 53
TXA = 54
TXS = 55
TYA = 56
def Operation.name(op)
result = ""
case op
when ADC
result = "ADC"
when AND
result = "AND"
when ASL
result = "ASL"
when BCC
result = "BCC"
when BCS
result = "BCS"
when BEQ
result = "BEQ"
when BIT
result = "BIT"
when BMI
result = "BMI"
when BNE
result = "BNE"
when BPL
result = "BPL"
when BRK
result = "BRK"
when BVC
result = "BVC"
when BVS
result = "BVS"
when CLC
result = "CLC"
when CLD
result = "CLD"
when CLI
result = "CLI"
when CLV
result = "CLV"
when CMP
result = "CMP"
when CPX
result = "CPX"
when CPY
result = "CPY"
when DEC
result = "DEC"
when DEX
result = "DEX"
when DEY
result = "DEY"
when EOR
result = "EOR"
when INC
result = "INC"
when INX
result = "INX"
when INY
result = "INY"
when JMP
result = "JMP"
when JSR
result = "JSR"
when LDA
result = "LDA"
when LDX
result = "LDX"
when LDY
result = "LDY"
when LSR
result = "LSR"
when NOP
result = "NOP"
when ORA
result = "ORA"
when PHA
result = "PHA"
when PHP
result = "PHP"
when PLA
result = "PLA"
when PLP
result = "PLP"
when ROL
result = "ROL"
when ROR
result = "ROR"
when RTI
result = "RTI"
when RTS
result = "RTS"
when SBC
result = "SBC"
when SEC
result = "SEC"
when SED
result = "SED"
when SEI
result = "SEI"
when STA
result = "STA"
when STX
result = "STX"
when STY
result = "STY"
when TAX
result = "TAX"
when TAY
result = "TAY"
when TSX
result = "TSX"
when TXA
result = "TXA"
when TXS
result = "TXS"
when TYA
result = "TYA"
end
return result
end
end