PancakeNESEmu
A homebrewed NES Emulator written in C
Loading...
Searching...
No Matches
opcodes.h
Go to the documentation of this file.
1#ifndef opcodes_h
2#define opcodes_h
3
5 // ADC : Add with carry
6 ADC_I = 0x69,
7 ADC_Z = 0x65,
8 ADC_ZX = 0x75,
9 ADC_A = 0x6d,
10 ADC_AX = 0x7d,
11 ADC_AY = 0x79,
12 ADC_IdX = 0x61,
13 ADC_IdY = 0x71,
14
15 // AND: Logic AND
16
17 AND_I = 0x29,
18 AND_Z = 0x25,
19 AND_ZX = 0x35,
20 AND_A = 0x2d,
21 AND_AX = 0x3d,
22 AND_AY = 0x39,
23 AND_IdX = 0x21,
24 AND_IdY = 0x31,
25
26 // ASL: Arithmetic Shift Left
27
28 ASL_Ac = 0x0a,
29 ASL_Z = 0x06,
30 ASL_ZX = 0x16,
31 ASL_A = 0x0e,
32 ASL_AX = 0x1e,
33
34 // BCC: Branch if Carry Clear
35 BCC = 0x90,
36
37 // BCS: Branch if Carry Set
38 BCS = 0xb0,
39
40 // BEQ: Branch if Equal
41 BEQ = 0xf0,
42
43 // BIT: Bit Test
44
45 BIT_Z = 0x24,
46 BIT_A = 0x2c,
47
48 // BMI: Branch if Minus
49 BMI = 0x30,
50
51 // BNE: Branch if Not Equal
52 BNE = 0xd0,
53
54 // BPL: Branch if Positive
55 BPL = 0x10,
56
57 // BRK: Break
58 BRK = 0x00,
59
60 // BVC: Branch if Overflow Clear
61 BVC = 0x50,
62
63 // BVS: Branch if Overflow Set
64 BVS = 0x70,
65
66 // CLC: Clear Carry flag
67 CLC = 0x18,
68
69 // CLD: Clear Decimal flag
70 CLD = 0xd8,
71
72 // CLI: Clear Interrupt Disable flag
73 CLI = 0x58,
74
75 // CLV: Clear Overflow flag
76 CLV = 0xb8,
77
78 // CMP: Compare Accumulator
79 CMP_I = 0xc9,
80 CMP_Z = 0xc5,
81 CMP_ZX = 0xd5,
82 CMP_A = 0xcd,
83 CMP_AX = 0xdd,
84 CMP_AY = 0xd9,
85 CMP_IdX = 0xc1,
86 CMP_IdY = 0xd1,
87
88 // CPX: Compare X Register
89 CPX_I = 0xe0,
90 CPX_Z = 0xe4,
91 CPX_A = 0xec,
92
93 // CPY: Compare Y Register
94 CPY_I = 0xc0,
95 CPY_Z = 0xc4,
96 CPY_A = 0xcc,
97
98 // DEC: Decrement Memory
99 DEC_Z = 0xc6,
100 DEC_ZX = 0xd6,
101 DEC_A = 0xce,
102 DEC_AX = 0xde,
103
104 // DEX: Decrement X Register
105 DEX = 0xca,
106
107 // DEY: Decrement Y Register
108 DEY = 0x88,
109
110 // EOR: Exclusive OR
111 EOR_I = 0x49,
112 EOR_Z = 0x45,
113 EOR_ZX = 0x55,
114 EOR_A = 0x4d,
115 EOR_AX = 0x5d,
116 EOR_AY = 0x59,
117 EOR_IdX = 0x41,
118 EOR_IdY = 0x51,
119
120 // INC: Increment Memory
121 INC_Z = 0xe6,
122 INC_ZX = 0xf6,
123 INC_A = 0xee,
124 INC_AX = 0xfe,
125
126 // INX: Increment X Register
127 INX = 0xe8,
128
129 // INY: Increment Y Register
130 INY = 0xc8,
131
132 // JMP: Jump instruction
133 JMP_A = 0x4c,
134 JMP_Id = 0x6c,
135
136 // JSR: Jump Subroutine
137 JSR = 0x20,
138
139 // LDA: Load Accumulator
140 LDA_I = 0xa9,
141 LDA_Z = 0Xa5,
142 LDA_ZX = 0xb5,
143 LDA_A = 0xad,
144 LDA_AX = 0xbd,
145 LDA_AY = 0xb9,
146 LDA_IdX = 0xa1,
147 LDA_IdY = 0xb1,
148
149 // LDX: Load X Register
150 LDX_I = 0xa2,
151 LDX_Z = 0xa6,
152 LDX_ZY = 0xb6,
153 LDX_A = 0xae,
154 LDX_AY = 0xbe,
155
156 // LDY: Load Y Register
157 LDY_I = 0xa0,
158 LDY_Z = 0xa4,
159 LDY_ZX = 0xb4,
160 LDY_A = 0xac,
161 LDY_AX = 0xbc,
162
163 // LSR: Logical Shift Right
164 LSR_Ac = 0x4a,
165 LSR_Z = 0x46,
166 LSR_ZX = 0x56,
167 LSR_A = 0x4e,
168 LSR_AX = 0x5e,
169
170 // NOP: No Operation
171 NOP = 0xea,
172
173 // ORA: Logical OR
174 ORA_I = 0x09,
175 ORA_Z = 0x05,
176 ORA_ZX = 0x15,
177 ORA_A = 0x0d,
178 ORA_AX = 0x1d,
179 ORA_AY = 0x19,
180 ORA_IdX = 0x01,
181 ORA_IdY = 0x11,
182
183 // PHA: Push Accumulator
184 PHA = 0x48,
185
186 // PHP: Push Processor Status
187 PHP = 0x08,
188
189 // PLA: Pull Accumulator
190 PLA = 0x68,
191
192 // PLP: Pull Processor Status
193 PLP = 0x28,
194
195 // ROL: Rotate Left
196 ROL_Ac = 0x2a,
197 ROL_Z = 0x26,
198 ROL_ZX = 0x36,
199 ROL_A = 0x2e,
200 ROL_AX = 0x3e,
201
202 // ROR: Rotate Right
203 ROR_Ac = 0x6a,
204 ROR_Z = 0x66,
205 ROR_ZX = 0x76,
206 ROR_A = 0x6e,
207 ROR_AX = 0x7e,
208
209 // RTI: Return from Interrupt
210 RTI = 0x40,
211
212 // RTS: Return from subroutine
213 RTS = 0x60,
214
215 // SBC: Substract with Carry
216 SBC_I = 0xe9,
217 SBC_Z = 0xe5,
218 SBC_ZX = 0xf5,
219 SBC_A = 0xed,
220 SBC_AX = 0xfd,
221 SBC_AY = 0xf9,
222 SBC_IdX = 0xe1,
223 SBC_IdY = 0xf1,
224
225 // SEC: Set carry flag
226 SEC = 0x38,
227
228 // SED: Set Decimal flag
229 SED = 0xf8,
230
231 // SEI: Set Interrupt disable
232 SEI = 0x78,
233
234 // STA: Store Accumulator
235 STA_Z = 0x85,
236 STA_ZX = 0x95,
237 STA_A = 0x8d,
238 STA_AX = 0x9d,
239 STA_AY = 0x99,
240 STA_IdX = 0x81,
241 STA_IdY = 0x91,
242
243 // STX: Store X Register
244 STX_Z = 0x86,
245 STX_ZY = 0x96,
246 STX_A = 0x8e,
247
248 // STY: Store Y Register
249 STY_Z = 0x84,
250 STY_ZX = 0x94,
251 STY_A = 0x8c,
252
253 // TAX: Transfer Accumulator to X
254 TAX = 0xaa,
255
256 // TSX: Transfer stack pointer to X
257 TSX = 0xba,
258
259 // TXA: Transfer X to the Accumulator
260 TXA = 0x8a,
261
262 // TYA: Transfer Y to the Accumulator
263 TYA = 0x98,
264
265 // TXS: Transfer X to stack pointer
266 TXS = 0x9a,
267
268 // TAY: Transfer Accumulator to Y
269 TAY = 0xa8,
270};
271
272#endif // !opcodes_h
CPU_INSTRUCTION
Definition opcodes.h:4
@ DEC_Z
DEC Zero Page.
Definition opcodes.h:99
@ INC_AX
INC Absolute, X.
Definition opcodes.h:124
@ LSR_ZX
LSR Zero Page, X.
Definition opcodes.h:166
@ RTI
Return from the current interrupt.
Definition opcodes.h:210
@ TSX
X = sp.
Definition opcodes.h:257
@ CMP_IdX
CMP (Indirect, X)
Definition opcodes.h:85
@ BEQ
If Z = 1.
Definition opcodes.h:41
@ ROL_ZX
ROL Zero Page, X.
Definition opcodes.h:198
@ CMP_IdY
CMP (Indirect), Y.
Definition opcodes.h:86
@ ROL_Z
ROL Zero Page.
Definition opcodes.h:197
@ CMP_AX
CMP Absolute, X.
Definition opcodes.h:83
@ ASL_ZX
ASL Zero Page, X.
Definition opcodes.h:30
@ CMP_A
CMP Absolute.
Definition opcodes.h:82
@ CLI
I = 0.
Definition opcodes.h:73
@ ORA_ZX
ORA Zero Page, X.
Definition opcodes.h:176
@ LDA_AX
LDA Absolute, X.
Definition opcodes.h:144
@ CPY_Z
CPY Zero Page.
Definition opcodes.h:95
@ SBC_ZX
SBC Zero Page, X.
Definition opcodes.h:218
@ BPL
If N = 0.
Definition opcodes.h:55
@ ROL_A
ROL Absolute.
Definition opcodes.h:199
@ STY_Z
STY Zero Page.
Definition opcodes.h:249
@ TYA
ACC = Y.
Definition opcodes.h:263
@ LDX_ZY
LDX Zero Page, Y.
Definition opcodes.h:152
@ SEC
C = 1.
Definition opcodes.h:226
@ ADC_IdX
ADC (Indirect, X)
Definition opcodes.h:12
@ AND_AX
AND Absolute, X.
Definition opcodes.h:21
@ TAX
X = ACC.
Definition opcodes.h:254
@ LDY_ZX
LDY Zero Page, X.
Definition opcodes.h:159
@ ROR_Z
ROR Zero Page.
Definition opcodes.h:204
@ BCS
If C = 1.
Definition opcodes.h:38
@ AND_ZX
AND Zero Page, X.
Definition opcodes.h:19
@ INC_ZX
INC Zero Page, X.
Definition opcodes.h:122
@ LDA_A
LDA Absolute.
Definition opcodes.h:143
@ PLP
flags = pull(); sp = sp + 1;
Definition opcodes.h:193
@ CPX_A
CPX Absolute.
Definition opcodes.h:91
@ ADC_ZX
ADC Zero Page, X.
Definition opcodes.h:8
@ ADC_Z
ADC Zero Page.
Definition opcodes.h:7
@ LDA_I
LDA Immediate.
Definition opcodes.h:140
@ DEC_A
DEC Absolute.
Definition opcodes.h:101
@ CLV
V = 0.
Definition opcodes.h:76
@ BNE
If Z = 0.
Definition opcodes.h:52
@ STY_A
STY Absolute.
Definition opcodes.h:251
@ STX_Z
STX Zero Page.
Definition opcodes.h:244
@ ROL_AX
ROL Absolute, X.
Definition opcodes.h:200
@ ADC_I
ADC Immediate.
Definition opcodes.h:6
@ AND_IdX
AND (Indirect, X)
Definition opcodes.h:23
@ INC_Z
INC Zero Page.
Definition opcodes.h:121
@ BIT_Z
BIT Zero Page.
Definition opcodes.h:45
@ LDY_AX
LDY Absolute, X.
Definition opcodes.h:161
@ DEY
Y = Y - 1.
Definition opcodes.h:108
@ SEI
I = 1.
Definition opcodes.h:232
@ SBC_I
SBC Immediate.
Definition opcodes.h:216
@ AND_I
AND Immediate.
Definition opcodes.h:17
@ CPX_Z
CPX Zero Page.
Definition opcodes.h:90
@ TAY
Definition opcodes.h:269
@ ASL_AX
ASL Absolute, X.
Definition opcodes.h:32
@ INC_A
INC Absolute.
Definition opcodes.h:123
@ CMP_ZX
CMP Zero Page, X.
Definition opcodes.h:81
@ EOR_AY
EOR Absolute, Y.
Definition opcodes.h:116
@ PHP
push(flags); sp = sp - 1;
Definition opcodes.h:187
@ AND_AY
AND Absolute, Y.
Definition opcodes.h:22
@ EOR_ZX
EOR Zero Page, X.
Definition opcodes.h:113
@ BRK
Break instruction.
Definition opcodes.h:58
@ ADC_AX
ADC Absolute, X.
Definition opcodes.h:10
@ LDA_ZX
LDA Zero Page, X.
Definition opcodes.h:142
@ ROR_Ac
ROR Accumulator.
Definition opcodes.h:203
@ AND_IdY
AND (Indirect), Y.
Definition opcodes.h:24
@ BIT_A
BIT Absolute.
Definition opcodes.h:46
@ EOR_AX
EOR Absolute, X.
Definition opcodes.h:115
@ SBC_IdY
SBC (Indirect), Y.
Definition opcodes.h:223
@ ORA_AY
ORA Absolute, Y.
Definition opcodes.h:179
@ SBC_AX
SBC Absolute, X.
Definition opcodes.h:220
@ CLC
C = 0.
Definition opcodes.h:67
@ STA_Z
STA Zero Page.
Definition opcodes.h:235
@ LDA_Z
LDA Zero Page.
Definition opcodes.h:141
@ STA_A
STA Absolute.
Definition opcodes.h:237
@ TXA
ACC = X.
Definition opcodes.h:260
@ STA_AY
STA Absolute, Y.
Definition opcodes.h:239
@ ADC_IdY
ADC (Indirect), Y.
Definition opcodes.h:13
@ LDX_Z
LDX Zero Page.
Definition opcodes.h:151
@ CPX_I
CPX Immediate.
Definition opcodes.h:89
@ ROR_ZX
ROR Zero Page, X.
Definition opcodes.h:205
@ ORA_A
ORA Absolute.
Definition opcodes.h:177
@ AND_Z
AND Zero Page.
Definition opcodes.h:18
@ STA_IdY
STA (Indirect), Y.
Definition opcodes.h:241
@ CMP_Z
CMP Zero Page.
Definition opcodes.h:80
@ CPY_I
CPY Immediate.
Definition opcodes.h:94
@ ASL_Z
ASL Zero Page.
Definition opcodes.h:29
@ BCC
If C = 0.
Definition opcodes.h:35
@ CPY_A
CPY Absolute.
Definition opcodes.h:96
@ EOR_I
EOR Immediate.
Definition opcodes.h:111
@ TXS
Definition opcodes.h:266
@ SBC_IdX
SBC (Indirect, X)
Definition opcodes.h:222
@ LDX_AY
LDX Absolute, Y.
Definition opcodes.h:154
@ CMP_I
CMP Immediate.
Definition opcodes.h:79
@ STY_ZX
STY Zero Page, X.
Definition opcodes.h:250
@ STA_AX
STA Absolute, X.
Definition opcodes.h:238
@ LDX_I
LDX Immediate.
Definition opcodes.h:150
@ CLD
D = 0.
Definition opcodes.h:70
@ ROL_Ac
ROL Accumulator.
Definition opcodes.h:196
@ LDA_AY
LDA Absolute, Y.
Definition opcodes.h:145
@ ORA_IdY
ORA (Indirect), Y.
Definition opcodes.h:181
@ STA_IdX
STA (Indirect, X)
Definition opcodes.h:240
@ LSR_AX
LSR Absolute, X.
Definition opcodes.h:168
@ ROR_AX
ROR Absolute, X.
Definition opcodes.h:207
@ STX_ZY
STX Zero Page, Y.
Definition opcodes.h:245
@ PLA
ACC = pull(); sp = sp + 1;.
Definition opcodes.h:190
@ LDY_A
LDY Absolute.
Definition opcodes.h:160
@ BVC
If V = 0.
Definition opcodes.h:61
@ STA_ZX
STA Zero Page, X.
Definition opcodes.h:236
@ ASL_Ac
ASL Accumulator.
Definition opcodes.h:28
@ EOR_IdX
EOR (Indirect, X)
Definition opcodes.h:117
@ LDY_Z
LDY Zero Page.
Definition opcodes.h:158
@ LSR_A
LSR Absolute.
Definition opcodes.h:167
@ INY
Y = Y + 1.
Definition opcodes.h:130
@ DEC_ZX
DEC Zero Page, X.
Definition opcodes.h:100
@ LSR_Z
LSR Zero Page.
Definition opcodes.h:165
@ EOR_IdY
EOR (Indirect), Y.
Definition opcodes.h:118
@ AND_A
AND Absolute.
Definition opcodes.h:20
@ LDA_IdX
LDA (Indirect, X)
Definition opcodes.h:146
@ LDX_A
LDX Absolute.
Definition opcodes.h:153
@ ADC_AY
ADC Absolute, Y.
Definition opcodes.h:11
@ BMI
iF N = 1
Definition opcodes.h:49
@ LDA_IdY
LDA (Indirect), Y.
Definition opcodes.h:147
@ LSR_Ac
LSR Accumulator.
Definition opcodes.h:164
@ SBC_A
SBC Absolute.
Definition opcodes.h:219
@ DEC_AX
DEC Absolute, X.
Definition opcodes.h:102
@ PHA
push(ACC); sp = sp - 1;
Definition opcodes.h:184
@ ORA_Z
ORA Zero Page.
Definition opcodes.h:175
@ BVS
If V = 1.
Definition opcodes.h:64
@ ORA_IdX
ORA (Indirect, X)
Definition opcodes.h:180
@ INX
X = X + 1.
Definition opcodes.h:127
@ CMP_AY
CMP Absolute, Y.
Definition opcodes.h:84
@ ROR_A
ROR Absolute.
Definition opcodes.h:206
@ ADC_A
ADC Absolute.
Definition opcodes.h:9
@ SBC_Z
SBC Zero Page.
Definition opcodes.h:217
@ RTS
Return from the current subroutine.
Definition opcodes.h:213
@ JMP_A
JMP Absolute.
Definition opcodes.h:133
@ LDY_I
LDY Immediate.
Definition opcodes.h:157
@ ASL_A
ASL Absolute.
Definition opcodes.h:31
@ SED
D = 1.
Definition opcodes.h:229
@ ORA_I
ORA Immediate.
Definition opcodes.h:174
@ ORA_AX
ORA Absolute, X.
Definition opcodes.h:178
@ SBC_AY
SBC Absolute, Y.
Definition opcodes.h:221
@ STX_A
STX Absolute.
Definition opcodes.h:246
@ EOR_Z
EOR Zero Page.
Definition opcodes.h:112
@ JMP_Id
JMP Indirect.
Definition opcodes.h:134
@ NOP
No Operation.
Definition opcodes.h:171
@ DEX
X = X - 1.
Definition opcodes.h:105
@ EOR_A
EOR Abolute.
Definition opcodes.h:114
@ JSR
Jump to the subroutine.
Definition opcodes.h:137