ac6502 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +261 -0
  3. package/dist/components/CPU.js +1170 -0
  4. package/dist/components/CPU.js.map +1 -0
  5. package/dist/components/Cart.js +23 -0
  6. package/dist/components/Cart.js.map +1 -0
  7. package/dist/components/IO/Empty.js +19 -0
  8. package/dist/components/IO/Empty.js.map +1 -0
  9. package/dist/components/IO/GPIOAttachments/GPIOAttachment.js +71 -0
  10. package/dist/components/IO/GPIOAttachments/GPIOAttachment.js.map +1 -0
  11. package/dist/components/IO/GPIOAttachments/GPIOJoystickAttachment.js +90 -0
  12. package/dist/components/IO/GPIOAttachments/GPIOJoystickAttachment.js.map +1 -0
  13. package/dist/components/IO/GPIOAttachments/GPIOKeyboardEncoderAttachment.js +489 -0
  14. package/dist/components/IO/GPIOAttachments/GPIOKeyboardEncoderAttachment.js.map +1 -0
  15. package/dist/components/IO/GPIOAttachments/GPIOKeyboardMatrixAttachment.js +274 -0
  16. package/dist/components/IO/GPIOAttachments/GPIOKeyboardMatrixAttachment.js.map +1 -0
  17. package/dist/components/IO/GPIOCard.js +597 -0
  18. package/dist/components/IO/GPIOCard.js.map +1 -0
  19. package/dist/components/IO/InputBoard.js +19 -0
  20. package/dist/components/IO/InputBoard.js.map +1 -0
  21. package/dist/components/IO/LCDCard.js +19 -0
  22. package/dist/components/IO/LCDCard.js.map +1 -0
  23. package/dist/components/IO/RAMCard.js +63 -0
  24. package/dist/components/IO/RAMCard.js.map +1 -0
  25. package/dist/components/IO/RTCCard.js +483 -0
  26. package/dist/components/IO/RTCCard.js.map +1 -0
  27. package/dist/components/IO/SerialCard.js +282 -0
  28. package/dist/components/IO/SerialCard.js.map +1 -0
  29. package/dist/components/IO/SoundCard.js +620 -0
  30. package/dist/components/IO/SoundCard.js.map +1 -0
  31. package/dist/components/IO/StorageCard.js +428 -0
  32. package/dist/components/IO/StorageCard.js.map +1 -0
  33. package/dist/components/IO/VGACard.js +9 -0
  34. package/dist/components/IO/VGACard.js.map +1 -0
  35. package/dist/components/IO/VideoCard.js +623 -0
  36. package/dist/components/IO/VideoCard.js.map +1 -0
  37. package/dist/components/IO.js +3 -0
  38. package/dist/components/IO.js.map +1 -0
  39. package/dist/components/Machine.js +310 -0
  40. package/dist/components/Machine.js.map +1 -0
  41. package/dist/components/RAM.js +24 -0
  42. package/dist/components/RAM.js.map +1 -0
  43. package/dist/components/ROM.js +23 -0
  44. package/dist/components/ROM.js.map +1 -0
  45. package/dist/index.js +441 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/tests/CPU.test.js +1626 -0
  48. package/dist/tests/CPU.test.js.map +1 -0
  49. package/dist/tests/Cart.test.js +119 -0
  50. package/dist/tests/Cart.test.js.map +1 -0
  51. package/dist/tests/IO/GPIOAttachments/GPIOAttachment.test.js +339 -0
  52. package/dist/tests/IO/GPIOAttachments/GPIOAttachment.test.js.map +1 -0
  53. package/dist/tests/IO/GPIOAttachments/GPIOJoystickAttachment.test.js +126 -0
  54. package/dist/tests/IO/GPIOAttachments/GPIOJoystickAttachment.test.js.map +1 -0
  55. package/dist/tests/IO/GPIOAttachments/GPIOKeyboardEncoderAttachment.test.js +779 -0
  56. package/dist/tests/IO/GPIOAttachments/GPIOKeyboardEncoderAttachment.test.js.map +1 -0
  57. package/dist/tests/IO/GPIOAttachments/GPIOKeyboardMatrixAttachment.test.js +355 -0
  58. package/dist/tests/IO/GPIOAttachments/GPIOKeyboardMatrixAttachment.test.js.map +1 -0
  59. package/dist/tests/IO/GPIOCard.test.js +503 -0
  60. package/dist/tests/IO/GPIOCard.test.js.map +1 -0
  61. package/dist/tests/IO/RAMCard.test.js +229 -0
  62. package/dist/tests/IO/RAMCard.test.js.map +1 -0
  63. package/dist/tests/IO/RTCCard.test.js +177 -0
  64. package/dist/tests/IO/RTCCard.test.js.map +1 -0
  65. package/dist/tests/IO/SerialCard.test.js +423 -0
  66. package/dist/tests/IO/SerialCard.test.js.map +1 -0
  67. package/dist/tests/IO/SoundCard.test.js +528 -0
  68. package/dist/tests/IO/SoundCard.test.js.map +1 -0
  69. package/dist/tests/IO/StorageCard.test.js +647 -0
  70. package/dist/tests/IO/StorageCard.test.js.map +1 -0
  71. package/dist/tests/IO/VideoCard.test.js +549 -0
  72. package/dist/tests/IO/VideoCard.test.js.map +1 -0
  73. package/dist/tests/Machine.test.js +383 -0
  74. package/dist/tests/Machine.test.js.map +1 -0
  75. package/dist/tests/RAM.test.js +160 -0
  76. package/dist/tests/RAM.test.js.map +1 -0
  77. package/dist/tests/ROM.test.js +123 -0
  78. package/dist/tests/ROM.test.js.map +1 -0
  79. package/jest.config.cjs +9 -0
  80. package/package.json +43 -0
  81. package/src/components/CPU.ts +1371 -0
  82. package/src/components/Cart.ts +20 -0
  83. package/src/components/IO/GPIOAttachments/GPIOAttachment.ts +189 -0
  84. package/src/components/IO/GPIOAttachments/GPIOJoystickAttachment.ts +99 -0
  85. package/src/components/IO/GPIOAttachments/GPIOKeyboardEncoderAttachment.ts +465 -0
  86. package/src/components/IO/GPIOAttachments/GPIOKeyboardMatrixAttachment.ts +287 -0
  87. package/src/components/IO/GPIOCard.ts +677 -0
  88. package/src/components/IO/RAMCard.ts +68 -0
  89. package/src/components/IO/RTCCard.ts +518 -0
  90. package/src/components/IO/SerialCard.ts +335 -0
  91. package/src/components/IO/SoundCard.ts +711 -0
  92. package/src/components/IO/StorageCard.ts +473 -0
  93. package/src/components/IO/VideoCard.ts +730 -0
  94. package/src/components/IO.ts +11 -0
  95. package/src/components/Machine.ts +364 -0
  96. package/src/components/RAM.ts +23 -0
  97. package/src/components/ROM.ts +19 -0
  98. package/src/index.ts +474 -0
  99. package/src/tests/CPU.test.ts +2045 -0
  100. package/src/tests/Cart.test.ts +149 -0
  101. package/src/tests/IO/GPIOAttachments/GPIOAttachment.test.ts +413 -0
  102. package/src/tests/IO/GPIOAttachments/GPIOJoystickAttachment.test.ts +147 -0
  103. package/src/tests/IO/GPIOAttachments/GPIOKeyboardEncoderAttachment.test.ts +961 -0
  104. package/src/tests/IO/GPIOAttachments/GPIOKeyboardMatrixAttachment.test.ts +449 -0
  105. package/src/tests/IO/GPIOCard.test.ts +644 -0
  106. package/src/tests/IO/RAMCard.test.ts +284 -0
  107. package/src/tests/IO/RTCCard.test.ts +222 -0
  108. package/src/tests/IO/SerialCard.test.ts +530 -0
  109. package/src/tests/IO/SoundCard.test.ts +659 -0
  110. package/src/tests/IO/StorageCard.test.ts +787 -0
  111. package/src/tests/IO/VideoCard.test.ts +668 -0
  112. package/src/tests/Machine.test.ts +437 -0
  113. package/src/tests/RAM.test.ts +196 -0
  114. package/src/tests/ROM.test.ts +154 -0
  115. package/tsconfig.json +12 -0
@@ -0,0 +1,1371 @@
1
+ // 65c02 CPU
2
+ // Adapted from: https://github.com/OneLoneCoder/olcNES
3
+
4
+ export interface CPUInstruction {
5
+ name: string
6
+ cycles: number
7
+ opcode: () => number
8
+ addrMode: () => number
9
+ }
10
+
11
+ export class CPU {
12
+
13
+ static C: number = 0b00000001
14
+ static Z: number = 0b00000010
15
+ static I: number = 0b00000100
16
+ static D: number = 0b00001000
17
+ static B: number = 0b00010000
18
+ static U: number = 0b00100000
19
+ static V: number = 0b01000000
20
+ static N: number = 0b10000000
21
+
22
+ private fetched: number = 0x00 // Working input value to the ALU
23
+ private temp: number = 0x0000 // A convenience var used everywhere
24
+ private addrAbs: number = 0x0000 // All used memory addresses end up here
25
+ private addrRel: number = 0x0000 // Represents abs address following a branch
26
+ private opcode: number = 0x00 // The instruction byte
27
+
28
+ cyclesRem: number = 0 // Counts how many cycles the current instruction has remaining
29
+ cycles: number = 0 // Counts the total number of cycles executed
30
+
31
+ a: number = 0x00
32
+ x: number = 0x00
33
+ y: number = 0x00
34
+ pc: number = 0x0000
35
+ sp: number = 0xFD
36
+ st: number = 0x00 | CPU.U
37
+
38
+ read: (address: number) => number
39
+ write: (address: number, data: number) => void
40
+
41
+ constructor(
42
+ read: (address: number) => number,
43
+ write: (address: number, data: number) => void
44
+ ) {
45
+ this.read = read
46
+ this.write = write
47
+ }
48
+
49
+ //
50
+ // Interface
51
+ //
52
+
53
+ reset(): void {
54
+ // Read the PC location from the Reset vector
55
+ const resetVector = 0xFFFC
56
+ const lo: number = this.read(resetVector + 0)
57
+ const hi: number = this.read(resetVector + 1)
58
+ this.pc = (hi << 8) | lo
59
+
60
+ // Clear the registers
61
+ this.a = 0x00
62
+ this.x = 0x00
63
+ this.y = 0x00
64
+ this.sp = 0xFD
65
+ this.st = 0x00 | CPU.U
66
+
67
+ // Clear our helper variables
68
+ this.addrRel = 0x0000
69
+ this.addrAbs = 0x0000
70
+ this.fetched = 0x00
71
+
72
+ // Reset takes 7 clock cycles
73
+ this.cyclesRem = 7
74
+ this.cycles += 7
75
+ }
76
+
77
+ irq(): void {
78
+ // Are interrupts enabled?
79
+ if (this.getFlag(CPU.I) == 0) {
80
+ // Push the program counter onto the stack
81
+ this.write(0x0100 + this.sp, (this.pc >> 8) & 0x00FF)
82
+ this.decSP()
83
+ this.write(0x0100 + this.sp, this.pc & 0x00FF)
84
+ this.decSP()
85
+
86
+ // Push the status register onto the stack
87
+ this.setFlag(CPU.B, false)
88
+ this.setFlag(CPU.I, true)
89
+ this.write(0x0100 + this.sp, this.st)
90
+ this.decSP()
91
+
92
+ // Read new PC location from IRQ vector
93
+ const irqVector = 0xFFFE
94
+ const lo: number = this.read(irqVector + 0)
95
+ const hi: number = this.read(irqVector + 1)
96
+ this.pc = (hi << 8) | lo
97
+
98
+ // IRQ takes 7 clock cycles
99
+ this.cyclesRem = 7
100
+ this.cycles += 7
101
+ }
102
+ }
103
+
104
+ nmi(): void {
105
+ // Push the program counter onto the stack
106
+ this.write(0x0100 + this.sp, (this.pc >> 8) & 0x00FF)
107
+ this.decSP()
108
+ this.write(0x0100 + this.sp, this.pc & 0x00FF)
109
+ this.decSP()
110
+
111
+ // Push the status register onto the stack
112
+ this.setFlag(CPU.B, false)
113
+ this.setFlag(CPU.I, true)
114
+ this.write(0x0100 + this.sp, this.st)
115
+ this.decSP()
116
+
117
+ // Read new PC location from NMI vector
118
+ const nmiVector = 0xFFFA
119
+ const lo: number = this.read(nmiVector + 0)
120
+ const hi: number = this.read(nmiVector + 1)
121
+ this.pc = (hi << 8) | lo
122
+
123
+ // NMI takes 7 clock cycles
124
+ this.cyclesRem = 7
125
+ this.cycles += 7
126
+ }
127
+
128
+ tick(): void {
129
+ if (this.cyclesRem == 0) {
130
+ // Perform one clock cycle
131
+ this.opcode = this.read(this.pc)
132
+
133
+ this.setFlag(CPU.U, true)
134
+ this.incPC()
135
+
136
+ const instruction = this.instructionTable[this.opcode]
137
+
138
+ this.cyclesRem = instruction.cycles
139
+ this.cycles += instruction.cycles
140
+
141
+ const addCycleAddrMode = instruction.addrMode()
142
+ const addCycleOpcode = instruction.opcode()
143
+
144
+ // addrMode() and opcode() return 1 or 0 if additional clock cycles are required
145
+ this.cyclesRem += addCycleAddrMode & addCycleOpcode
146
+ this.cycles += addCycleAddrMode & addCycleOpcode
147
+ }
148
+
149
+ this.cyclesRem--
150
+ }
151
+
152
+ step(): number {
153
+ // Finish current instruction
154
+ if (this.cyclesRem > 0) {
155
+ do {
156
+ this.tick()
157
+ } while (this.cyclesRem > 0)
158
+ }
159
+
160
+ const startCycles = this.cycles
161
+
162
+ // Execute one instruction
163
+ do {
164
+ this.tick()
165
+ } while (this.cyclesRem > 0)
166
+
167
+ return this.cycles - startCycles
168
+ }
169
+
170
+
171
+ //
172
+ // Helpers
173
+ //
174
+
175
+ private fetch() {
176
+ // For IMP addressing mode (opcode 0x0A, 0x2A, 0x4A, 0x6A), fetched is already set to this.a
177
+ // Don't fetch from memory for those instructions
178
+ const accumulatorOpcodes = [0x0A, 0x2A, 0x4A, 0x6A]
179
+ if (!accumulatorOpcodes.includes(this.opcode)) {
180
+ this.fetched = this.read(this.addrAbs)
181
+ }
182
+ }
183
+
184
+ private getFlag(flag: number): number {
185
+ return (this.st & flag) > 0 ? 1 : 0
186
+ }
187
+
188
+ private setFlag(flag: number, value: boolean): void {
189
+ if (value) {
190
+ this.st |= flag
191
+ } else {
192
+ this.st &= ~flag
193
+ }
194
+ }
195
+
196
+ private incPC() {
197
+ if (this.pc == 0xFFFF) {
198
+ this.pc = 0x0000
199
+ } else {
200
+ this.pc++
201
+ }
202
+ }
203
+
204
+ private decPC() {
205
+ if (this.pc > 0x0000) {
206
+ this.pc--
207
+ } else {
208
+ this.pc = 0xFFFF
209
+ }
210
+ }
211
+
212
+ private incSP() {
213
+ if (this.sp == 0xFF) {
214
+ this.sp = 0x00
215
+ } else {
216
+ this.sp++
217
+ }
218
+ }
219
+
220
+ private decSP() {
221
+ if (this.sp > 0x00) {
222
+ this.sp--
223
+ } else {
224
+ this.sp = 0xFF
225
+ }
226
+ }
227
+
228
+ //
229
+ // Addressing Modes
230
+ //
231
+
232
+ private IMP(): number {
233
+ this.fetched = this.a
234
+ return 0
235
+ }
236
+
237
+ private IMM(): number {
238
+ this.addrAbs = this.pc;
239
+ this.incPC()
240
+ return 0
241
+ }
242
+
243
+ private ZP0(): number {
244
+ this.addrAbs = this.read(this.pc)
245
+ this.incPC()
246
+ this.addrAbs &= 0x00FF
247
+ return 0
248
+ }
249
+
250
+ private ZPX(): number {
251
+ this.addrAbs = this.read(this.pc) + this.x
252
+ this.incPC()
253
+ this.addrAbs &= 0x00FF
254
+ return 0
255
+ }
256
+
257
+ private ZPY(): number {
258
+ this.addrAbs = this.read(this.pc) + this.y
259
+ this.incPC()
260
+ this.addrAbs &= 0x00FF
261
+ return 0
262
+ }
263
+
264
+ private REL(): number {
265
+ this.addrRel = this.read(this.pc)
266
+ this.incPC()
267
+ if ((this.addrRel & 0x80) != 0) {
268
+ this.addrRel |= 0xFFFFFF00
269
+ }
270
+ return 0
271
+ }
272
+
273
+ private ABS(): number {
274
+ const lo: number = this.read(this.pc)
275
+ this.incPC()
276
+ const hi: number = this.read(this.pc)
277
+ this.incPC()
278
+
279
+ this.addrAbs = (hi << 8) | lo
280
+
281
+ return 0
282
+ }
283
+
284
+ private ABX(): number {
285
+ const lo: number = this.read(this.pc)
286
+ this.incPC()
287
+ const hi: number = this.read(this.pc)
288
+ this.incPC()
289
+
290
+ this.addrAbs = (hi << 8) | lo
291
+ this.addrAbs += this.x
292
+
293
+ if ((this.addrAbs & 0xFF00) != (hi << 8)) {
294
+ return 1
295
+ } else {
296
+ return 0
297
+ }
298
+ }
299
+
300
+ private ABY(): number {
301
+ const lo: number = this.read(this.pc)
302
+ this.incPC()
303
+ const hi: number = this.read(this.pc)
304
+ this.incPC()
305
+
306
+ this.addrAbs = (hi << 8) | lo
307
+ this.addrAbs += this.y
308
+
309
+ if ((this.addrAbs & 0xFF00) != (hi << 8)) {
310
+ return 1
311
+ } else {
312
+ return 0
313
+ }
314
+ }
315
+
316
+ private IND(): number {
317
+ const ptrLo: number = this.read(this.pc)
318
+ this.incPC()
319
+ const ptrHi: number = this.read(this.pc)
320
+ this.incPC()
321
+
322
+ const ptr = (ptrHi << 8) | ptrLo
323
+
324
+ // 65C02 fixed the page boundary bug from the original 6502
325
+ this.addrAbs = (this.read(ptr + 1) << 8) | this.read(ptr)
326
+
327
+ return 0
328
+ }
329
+
330
+ private IZX(): number {
331
+ const t = this.read(this.pc)
332
+ this.incPC()
333
+
334
+ const lo = this.read((t + this.x) & 0x00FF)
335
+ const hi = this.read((t + this.x + 1) & 0x00FF)
336
+
337
+ this.addrAbs = (hi << 8) | lo
338
+
339
+ return 0
340
+ }
341
+
342
+ private IZY(): number {
343
+ const t = this.read(this.pc)
344
+ this.incPC()
345
+
346
+ const lo = this.read((t ) & 0x00FF)
347
+ const hi = this.read((t + 1) & 0x00FF)
348
+
349
+ this.addrAbs = (hi << 8) | lo
350
+ this.addrAbs += this.y
351
+
352
+ if ((this.addrAbs & 0xFF00) != (hi << 8)) {
353
+ return 1
354
+ } else {
355
+ return 0
356
+ }
357
+ }
358
+
359
+ // IAX - Indexed Absolute Indirect - (a,x)
360
+ // Used by JMP (addr,X) on 65C02
361
+ private IAX(): number {
362
+ const lo = this.read(this.pc)
363
+ this.incPC()
364
+ const hi = this.read(this.pc)
365
+ this.incPC()
366
+
367
+ const ptr = ((hi << 8) | lo) + this.x
368
+
369
+ const addrLo = this.read(ptr)
370
+ const addrHi = this.read(ptr + 1)
371
+
372
+ this.addrAbs = (addrHi << 8) | addrLo
373
+
374
+ return 0
375
+ }
376
+
377
+ // ZPR - Zero Page + Relative
378
+ // Used by BBR/BBS instructions on WDC 65C02
379
+ private ZPR(): number {
380
+ // First byte is zero page address
381
+ this.addrAbs = this.read(this.pc) & 0x00FF
382
+ this.incPC()
383
+
384
+ // Second byte is relative offset for branch
385
+ const relAddr = this.read(this.pc)
386
+ this.incPC()
387
+
388
+ if (relAddr & 0x80) {
389
+ this.addrRel = relAddr | 0xFF00
390
+ } else {
391
+ this.addrRel = relAddr
392
+ }
393
+
394
+ return 0
395
+ }
396
+
397
+ //
398
+ // Opcodes
399
+ //
400
+
401
+ private ADC(): number {
402
+ this.fetch()
403
+
404
+ this.temp = this.a + this.fetched + this.getFlag(CPU.C)
405
+ this.setFlag(CPU.C, (this.temp & 0xFF00) != 0)
406
+ this.setFlag(CPU.Z, (this.temp & 0x00FF) == 0)
407
+ this.setFlag(CPU.V, ((this.temp ^ this.a) & (this.temp ^ this.fetched) & 0x0080) != 0)
408
+ this.setFlag(CPU.N, (this.temp & 0x0080) != 0)
409
+
410
+ this.a = this.temp & 0x00FF
411
+
412
+ return 1
413
+ }
414
+
415
+ private AND(): number {
416
+ this.fetch()
417
+ this.a &= this.fetched
418
+ this.setFlag(CPU.Z, this.a == 0x00)
419
+ this.setFlag(CPU.N, (this.a & 0x80) != 0)
420
+ return 1
421
+ }
422
+
423
+ private ASL(): number {
424
+ this.fetch()
425
+ this.temp = this.fetched << 1
426
+ this.setFlag(CPU.C, (this.temp & 0xFF00) > 0)
427
+ this.setFlag(CPU.Z, (this.temp & 0x00FF) == 0x00)
428
+ this.setFlag(CPU.N, (this.temp & 0x80) != 0)
429
+ // Opcode 0x0A is ASL A (accumulator mode)
430
+ if (this.opcode === 0x0A) {
431
+ this.a = this.temp & 0x00FF
432
+ } else {
433
+ this.write(this.addrAbs, this.temp & 0x00FF)
434
+ }
435
+ return 0
436
+ }
437
+
438
+ private BCC(): number {
439
+ if (this.getFlag(CPU.C) == 0) {
440
+ this.cycles++
441
+ this.addrAbs = this.pc + this.addrRel
442
+
443
+ if ((this.addrAbs & 0xFF00) != (this.pc & 0xFF00)) {
444
+ this.cycles++
445
+ }
446
+
447
+ this.pc = this.addrAbs
448
+ }
449
+ return 0
450
+ }
451
+
452
+ private BCS(): number {
453
+ if (this.getFlag(CPU.C) == 1) {
454
+ this.cycles++
455
+ this.addrAbs = this.pc + this.addrRel
456
+
457
+ if ((this.addrAbs & 0xFF00) != (this.pc & 0xFF00)) {
458
+ this.cycles++
459
+ }
460
+
461
+ this.pc = this.addrAbs
462
+ }
463
+ return 0
464
+ }
465
+
466
+ private BEQ(): number {
467
+ if (this.getFlag(CPU.Z) == 1) {
468
+ this.cycles++
469
+ this.addrAbs = this.pc + this.addrRel
470
+ if ((this.addrAbs & 0xFF00) != (this.pc & 0xFF00)) {
471
+ this.cycles++
472
+ }
473
+
474
+ this.pc = this.addrAbs
475
+ }
476
+ return 0
477
+ }
478
+
479
+ private BIT(): number {
480
+ this.fetch()
481
+ this.temp = this.a & this.fetched
482
+ this.setFlag(CPU.Z, (this.temp & 0x00FF) == 0x00)
483
+ this.setFlag(CPU.N, (this.fetched & (1 << 7)) != 0)
484
+ this.setFlag(CPU.V, (this.fetched & (1 << 6)) != 0)
485
+ return 0
486
+ }
487
+
488
+ private BMI(): number {
489
+ if (this.getFlag(CPU.N) == 1) {
490
+ this.cycles++
491
+ this.addrAbs = this.pc + this.addrRel
492
+
493
+ if ((this.addrAbs & 0xFF00) != (this.pc & 0xFF00)) {
494
+ this.cycles++
495
+ }
496
+
497
+ this.pc = this.addrAbs
498
+ }
499
+ return 0
500
+ }
501
+
502
+ private BNE(): number {
503
+ if (this.getFlag(CPU.Z) == 0) {
504
+ this.cycles++
505
+ this.addrAbs = this.pc + this.addrRel
506
+
507
+ if ((this.addrAbs & 0xFF00) != (this.pc & 0xFF00)) {
508
+ this.cycles++
509
+ }
510
+
511
+ this.pc = this.addrAbs
512
+ }
513
+ return 0
514
+ }
515
+
516
+ private BPL(): number {
517
+ if (this.getFlag(CPU.N) == 0) {
518
+ this.cycles++
519
+ this.addrAbs = this.pc + this.addrRel
520
+
521
+ if ((this.addrAbs & 0xFF00) != (this.pc & 0xFF00)) {
522
+ this.cycles++
523
+ }
524
+
525
+ this.pc = this.addrAbs
526
+ }
527
+ return 0
528
+ }
529
+
530
+ private BRK(): number {
531
+ this.incPC()
532
+
533
+ this.setFlag(CPU.I, true)
534
+ this.write(0x0100 + this.sp, (this.pc >> 8) & 0x00FF)
535
+ this.decSP()
536
+ this.write(0x0100 + this.sp, this.pc & 0x00FF)
537
+ this.decSP()
538
+
539
+ this.setFlag(CPU.B, true)
540
+ this.write(0x0100 + this.sp, this.st)
541
+ this.decSP()
542
+ this.setFlag(CPU.B, false)
543
+
544
+ this.pc = this.read(0xFFFE) | this.read(0xFFFF) << 8
545
+
546
+ return 0
547
+ }
548
+
549
+ private BVC(): number {
550
+ if (this.getFlag(CPU.V) == 0) {
551
+ this.cycles++
552
+ this.addrAbs = this.pc + this.addrRel
553
+
554
+ if ((this.addrAbs & 0xFF00) != (this.pc & 0xFF00)) {
555
+ this.cycles++
556
+ }
557
+
558
+ this.pc = this.addrAbs
559
+ }
560
+ return 0
561
+ }
562
+
563
+ private BVS(): number {
564
+ if (this.getFlag(CPU.V) == 1) {
565
+ this.cycles++
566
+ this.addrAbs = this.pc + this.addrRel
567
+
568
+ if ((this.addrAbs & 0xFF00) != (this.pc & 0xFF00)) {
569
+ this.cycles++
570
+ }
571
+
572
+ this.pc = this.addrAbs
573
+ }
574
+ return 0
575
+ }
576
+
577
+ private CLC(): number {
578
+ this.setFlag(CPU.C, false)
579
+ return 0
580
+ }
581
+
582
+ private CLD(): number {
583
+ this.setFlag(CPU.D, false)
584
+ return 0
585
+ }
586
+
587
+ private CLI(): number {
588
+ this.setFlag(CPU.I, false)
589
+ return 0
590
+ }
591
+
592
+ private CLV(): number {
593
+ this.setFlag(CPU.V, false)
594
+ return 0
595
+ }
596
+
597
+ private CMP(): number {
598
+ this.fetch()
599
+ this.temp = this.a - this.fetched
600
+ this.setFlag(CPU.C, this.a >= this.fetched)
601
+ this.setFlag(CPU.Z, (this.temp & 0x00FF) == 0x0000)
602
+ this.setFlag(CPU.N, (this.temp & 0x0080) != 0)
603
+ return 1
604
+ }
605
+
606
+ private CPX(): number {
607
+ this.fetch()
608
+ this.temp = this.x - this.fetched
609
+ this.setFlag(CPU.C, this.x >= this.fetched)
610
+ this.setFlag(CPU.Z, (this.temp & 0x00FF) == 0x0000)
611
+ this.setFlag(CPU.N, (this.temp & 0x0080) != 0)
612
+ return 0
613
+ }
614
+
615
+ private CPY(): number {
616
+ this.fetch()
617
+ this.temp = this.y - this.fetched
618
+ this.setFlag(CPU.C, this.y >= this.fetched)
619
+ this.setFlag(CPU.Z, (this.temp & 0x00FF) == 0x0000)
620
+ this.setFlag(CPU.N, (this.temp & 0x0080) != 0)
621
+ return 0
622
+ }
623
+
624
+ private DEC(): number {
625
+ this.fetch()
626
+ this.temp = this.fetched - 0x01
627
+ this.write(this.addrAbs, this.temp & 0x00FF)
628
+ this.setFlag(CPU.Z, (this.temp & 0x00FF) == 0x0000)
629
+ this.setFlag(CPU.N, (this.temp & 0x0080) != 0)
630
+ return 0
631
+ }
632
+
633
+ private DEX(): number {
634
+ this.x = (this.x - 1) & 0xFF
635
+ this.setFlag(CPU.Z, this.x == 0x00)
636
+ this.setFlag(CPU.N, (this.x & 0x80) != 0)
637
+ return 0
638
+ }
639
+
640
+ private DEY(): number {
641
+ this.y = (this.y - 1) & 0xFF
642
+ this.setFlag(CPU.Z, this.y == 0x00)
643
+ this.setFlag(CPU.N, (this.y & 0x80) != 0)
644
+ return 0
645
+ }
646
+
647
+ private EOR(): number {
648
+ this.fetch()
649
+ this.a ^= this.fetched
650
+ this.setFlag(CPU.Z, this.a == 0x00)
651
+ this.setFlag(CPU.N, (this.a & 0x80) != 0)
652
+ return 1
653
+ }
654
+
655
+ private INC(): number {
656
+ this.fetch()
657
+ this.temp = this.fetched + 1
658
+ this.write(this.addrAbs, this.temp & 0x00FF)
659
+ this.setFlag(CPU.Z, (this.temp & 0x00FF) == 0x0000)
660
+ this.setFlag(CPU.N, (this.temp & 0x0080) != 0)
661
+ return 0
662
+ }
663
+
664
+ private INX(): number {
665
+ this.x = (this.x + 1) & 0xFF
666
+ this.setFlag(CPU.Z, this.x == 0x00)
667
+ this.setFlag(CPU.N, (this.x & 0x80) != 0)
668
+ return 0
669
+ }
670
+
671
+ private INY(): number {
672
+ this.y = (this.y + 1) & 0xFF
673
+ this.setFlag(CPU.Z, this.y == 0x00)
674
+ this.setFlag(CPU.N, (this.y & 0x80) != 0)
675
+ return 0
676
+ }
677
+
678
+ private JMP(): number {
679
+ this.pc = this.addrAbs
680
+ return 0
681
+ }
682
+
683
+ private JSR(): number {
684
+ this.decPC()
685
+
686
+ this.write(0x0100 + this.sp, (this.pc >> 8) & 0x00FF)
687
+ this.decSP()
688
+ this.write(0x0100 + this.sp, this.pc & 0x00FF)
689
+ this.decSP()
690
+
691
+ this.pc = this.addrAbs
692
+
693
+ return 0
694
+ }
695
+
696
+ private LDA(): number {
697
+ this.fetch()
698
+ this.a = this.fetched
699
+ this.setFlag(CPU.Z, this.a == 0x00)
700
+ this.setFlag(CPU.N, (this.a & 0x80) != 0)
701
+ return 1
702
+ }
703
+
704
+ private LDX(): number {
705
+ this.fetch()
706
+ this.x = this.fetched
707
+ this.setFlag(CPU.Z, this.x == 0x00)
708
+ this.setFlag(CPU.N, (this.x & 0x80) != 0)
709
+ return 1
710
+ }
711
+
712
+ private LDY(): number {
713
+ this.fetch()
714
+ this.y = this.fetched
715
+ this.setFlag(CPU.Z, this.y == 0x00)
716
+ this.setFlag(CPU.N, (this.y & 0x80) != 0)
717
+ return 1
718
+ }
719
+
720
+ private LSR(): number {
721
+ this.fetch()
722
+ this.setFlag(CPU.C, (this.fetched & 0x0001) != 0)
723
+ this.temp = this.fetched >> 1
724
+ this.setFlag(CPU.Z, (this.temp & 0x00FF) == 0x0000)
725
+ this.setFlag(CPU.N, (this.temp & 0x0080) != 0)
726
+ // Opcode 0x4A is LSR A (accumulator mode)
727
+ if (this.opcode === 0x4A) {
728
+ this.a = this.temp & 0x00FF
729
+ } else {
730
+ this.write(this.addrAbs, this.temp & 0x00FF)
731
+ }
732
+ return 0
733
+ }
734
+
735
+ private NOP(): number {
736
+ switch (this.opcode) {
737
+ case 0x1C:
738
+ case 0x3C:
739
+ case 0x5C:
740
+ case 0x7C:
741
+ case 0xDC:
742
+ case 0xFC:
743
+ return 1
744
+ }
745
+ return 0
746
+ }
747
+
748
+ private ORA(): number {
749
+ this.fetch()
750
+ this.a |= this.fetched
751
+ this.setFlag(CPU.Z, this.a == 0x00)
752
+ this.setFlag(CPU.N, (this.a & 0x80) != 0)
753
+ return 1
754
+ }
755
+
756
+ private PHA(): number {
757
+ this.write(0x0100 + this.sp, this.a)
758
+ this.decSP()
759
+ return 0
760
+ }
761
+
762
+ private PHP(): number {
763
+ this.write(0x0100 + this.sp, this.st | CPU.B | CPU.U)
764
+ this.setFlag(CPU.B, false)
765
+ this.setFlag(CPU.U, false)
766
+ this.decSP()
767
+ return 0
768
+ }
769
+
770
+ private PLA(): number {
771
+ this.incSP()
772
+ this.a = this.read(0x0100 + this.sp)
773
+ this.setFlag(CPU.Z, this.a == 0x00)
774
+ this.setFlag(CPU.N, (this.a & 0x80) != 0)
775
+ return 0
776
+ }
777
+
778
+ private PLP(): number {
779
+ this.incSP()
780
+ this.st = this.read(0x0100 + this.sp)
781
+ this.setFlag(CPU.U, true)
782
+ return 0
783
+ }
784
+
785
+ private ROL(): number {
786
+ this.fetch()
787
+ this.temp = (this.fetched << 1) | this.getFlag(CPU.C)
788
+ this.setFlag(CPU.C, (this.temp & 0xFF00) != 0)
789
+ this.setFlag(CPU.Z, (this.temp & 0x00FF) == 0x00)
790
+ this.setFlag(CPU.N, (this.temp & 0x0080) != 0)
791
+ // Opcode 0x2A is ROL A (accumulator mode)
792
+ if (this.opcode === 0x2A) {
793
+ this.a = this.temp & 0x00FF
794
+ } else {
795
+ this.write(this.addrAbs, this.temp & 0x00FF)
796
+ }
797
+ return 0
798
+ }
799
+
800
+ private ROR(): number {
801
+ this.fetch()
802
+ this.temp = (this.getFlag(CPU.C) << 7) | (this.fetched >> 1)
803
+ this.setFlag(CPU.C, (this.fetched & 0x01) != 0)
804
+ this.setFlag(CPU.Z, (this.temp & 0x00FF) == 0x00)
805
+ this.setFlag(CPU.N, (this.temp & 0x0080) != 0)
806
+ // Opcode 0x6A is ROR A (accumulator mode)
807
+ if (this.opcode === 0x6A) {
808
+ this.a = this.temp & 0x00FF
809
+ } else {
810
+ this.write(this.addrAbs, this.temp & 0x00FF)
811
+ }
812
+ return 0
813
+ }
814
+
815
+ private RTI(): number {
816
+ this.incSP()
817
+ this.st = this.read(0x0100 + this.sp)
818
+ this.st &= ~CPU.B
819
+ this.st &= ~CPU.U
820
+ this.incSP()
821
+ this.pc = this.read(0x0100 + this.sp)
822
+ this.incSP()
823
+ this.pc |= this.read(0x0100 + this.sp) << 8
824
+ return 0
825
+ }
826
+
827
+ private RTS(): number {
828
+ this.incSP()
829
+ this.pc = this.read(0x0100 + this.sp)
830
+ this.incSP()
831
+ this.pc |= this.read(0x0100 + this.sp) << 8
832
+ this.incPC()
833
+
834
+ return 0
835
+ }
836
+
837
+ private SBC(): number {
838
+ this.fetch()
839
+
840
+ const value = this.fetched ^ 0x00FF
841
+
842
+ this.temp = this.a + value + this.getFlag(CPU.C)
843
+ this.setFlag(CPU.C, (this.temp & 0xFF00) != 0)
844
+ this.setFlag(CPU.Z, (this.temp & 0x00FF) == 0)
845
+ this.setFlag(CPU.V, ((this.temp ^ this.a) & (this.temp ^ value) & 0x0080) != 0)
846
+ this.setFlag(CPU.N, (this.temp & 0x0080) != 0)
847
+
848
+ this.a = this.temp & 0x00FF
849
+
850
+ return 1
851
+ }
852
+
853
+ private SEC(): number {
854
+ this.setFlag(CPU.C, true)
855
+ return 0
856
+ }
857
+
858
+ private SED(): number {
859
+ this.setFlag(CPU.D, true)
860
+ return 0
861
+ }
862
+
863
+ private SEI(): number {
864
+ this.setFlag(CPU.I, true)
865
+ return 0
866
+ }
867
+
868
+ private STA(): number {
869
+ this.write(this.addrAbs, this.a)
870
+ return 0
871
+ }
872
+
873
+ private STX(): number {
874
+ this.write(this.addrAbs, this.x)
875
+ return 0
876
+ }
877
+
878
+ private STY(): number {
879
+ this.write(this.addrAbs, this.y)
880
+ return 0
881
+ }
882
+
883
+ private TAX(): number {
884
+ this.x = this.a
885
+ this.setFlag(CPU.Z, this.x == 0x00)
886
+ this.setFlag(CPU.N, (this.x & 0x80) != 0)
887
+ return 0
888
+ }
889
+
890
+ private TAY(): number {
891
+ this.y = this.a
892
+ this.setFlag(CPU.Z, this.y == 0x00)
893
+ this.setFlag(CPU.N, (this.y & 0x80) != 0)
894
+ return 0
895
+ }
896
+
897
+ private TSX(): number {
898
+ this.x = this.sp
899
+ this.setFlag(CPU.Z, this.x == 0x00)
900
+ this.setFlag(CPU.N, (this.x & 0x80) != 0)
901
+ return 0
902
+ }
903
+
904
+ private TXA(): number {
905
+ this.a = this.x
906
+ this.setFlag(CPU.Z, this.a == 0x00)
907
+ this.setFlag(CPU.N, (this.a & 0x80) != 0)
908
+ return 0
909
+ }
910
+
911
+ private TXS(): number {
912
+ this.sp = this.x
913
+ return 0
914
+ }
915
+
916
+ private TYA(): number {
917
+ this.a = this.y
918
+ this.setFlag(CPU.Z, this.a == 0x00)
919
+ this.setFlag(CPU.N, (this.a & 0x80) != 0)
920
+ return 0
921
+ }
922
+
923
+ //
924
+ // 65C02 Instructions
925
+ //
926
+
927
+ private BRA(): number {
928
+ // Branch Always
929
+ this.cyclesRem++
930
+ this.pc = (this.pc + this.addrRel) & 0xFFFF
931
+
932
+ if ((this.pc & 0xFF00) != ((this.pc - this.addrRel) & 0xFF00)) {
933
+ this.cyclesRem++
934
+ }
935
+
936
+ return 0
937
+ }
938
+
939
+ private PHX(): number {
940
+ // Push X Register
941
+ this.write(0x0100 + this.sp, this.x)
942
+ this.decSP()
943
+ return 0
944
+ }
945
+
946
+ private PHY(): number {
947
+ // Push Y Register
948
+ this.write(0x0100 + this.sp, this.y)
949
+ this.decSP()
950
+ return 0
951
+ }
952
+
953
+ private PLX(): number {
954
+ // Pull X Register
955
+ this.incSP()
956
+ this.x = this.read(0x0100 + this.sp)
957
+ this.setFlag(CPU.Z, this.x == 0x00)
958
+ this.setFlag(CPU.N, (this.x & 0x80) != 0)
959
+ return 0
960
+ }
961
+
962
+ private PLY(): number {
963
+ // Pull Y Register
964
+ this.incSP()
965
+ this.y = this.read(0x0100 + this.sp)
966
+ this.setFlag(CPU.Z, this.y == 0x00)
967
+ this.setFlag(CPU.N, (this.y & 0x80) != 0)
968
+ return 0
969
+ }
970
+
971
+ private STZ(): number {
972
+ // Store Zero
973
+ this.write(this.addrAbs, 0x00)
974
+ return 0
975
+ }
976
+
977
+ private TRB(): number {
978
+ // Test and Reset Bits
979
+ this.fetch()
980
+ this.setFlag(CPU.Z, (this.a & this.fetched) == 0x00)
981
+ this.write(this.addrAbs, this.fetched & ~this.a)
982
+ return 0
983
+ }
984
+
985
+ private TSB(): number {
986
+ // Test and Set Bits
987
+ this.fetch()
988
+ this.setFlag(CPU.Z, (this.a & this.fetched) == 0x00)
989
+ this.write(this.addrAbs, this.fetched | this.a)
990
+ return 0
991
+ }
992
+
993
+ //
994
+ // WDC 65C02 Instructions
995
+ //
996
+
997
+ private STP(): number {
998
+ // Stop the processor
999
+ // Implementation: halt execution by preventing PC increment
1000
+ // The processor would need to be reset to continue
1001
+ this.cyclesRem = 0xFF // Set a large cycle count to effectively halt
1002
+ return 0
1003
+ }
1004
+
1005
+ private WAI(): number {
1006
+ // Wait for Interrupt
1007
+ // Implementation: stall until an interrupt occurs
1008
+ // For simplicity, we'll just add cycles
1009
+ this.cyclesRem = 0xFF // Wait state
1010
+ return 0
1011
+ }
1012
+
1013
+ private BBR(bit: number): number {
1014
+ // Branch on Bit Reset
1015
+ this.fetch()
1016
+ if ((this.fetched & (1 << bit)) == 0) {
1017
+ this.cyclesRem++
1018
+ this.pc = (this.pc + this.addrRel) & 0xFFFF
1019
+
1020
+ if ((this.pc & 0xFF00) != ((this.pc - this.addrRel) & 0xFF00)) {
1021
+ this.cyclesRem++
1022
+ }
1023
+ }
1024
+ return 0
1025
+ }
1026
+
1027
+ private BBR0(): number { return this.BBR(0) }
1028
+ private BBR1(): number { return this.BBR(1) }
1029
+ private BBR2(): number { return this.BBR(2) }
1030
+ private BBR3(): number { return this.BBR(3) }
1031
+ private BBR4(): number { return this.BBR(4) }
1032
+ private BBR5(): number { return this.BBR(5) }
1033
+ private BBR6(): number { return this.BBR(6) }
1034
+ private BBR7(): number { return this.BBR(7) }
1035
+
1036
+ private BBS(bit: number): number {
1037
+ // Branch on Bit Set
1038
+ this.fetch()
1039
+ if ((this.fetched & (1 << bit)) != 0) {
1040
+ this.cyclesRem++
1041
+ this.pc = (this.pc + this.addrRel) & 0xFFFF
1042
+
1043
+ if ((this.pc & 0xFF00) != ((this.pc - this.addrRel) & 0xFF00)) {
1044
+ this.cyclesRem++
1045
+ }
1046
+ }
1047
+ return 0
1048
+ }
1049
+
1050
+ private BBS0(): number { return this.BBS(0) }
1051
+ private BBS1(): number { return this.BBS(1) }
1052
+ private BBS2(): number { return this.BBS(2) }
1053
+ private BBS3(): number { return this.BBS(3) }
1054
+ private BBS4(): number { return this.BBS(4) }
1055
+ private BBS5(): number { return this.BBS(5) }
1056
+ private BBS6(): number { return this.BBS(6) }
1057
+ private BBS7(): number { return this.BBS(7) }
1058
+
1059
+ private RMB(bit: number): number {
1060
+ // Reset Memory Bit
1061
+ this.fetch()
1062
+ this.write(this.addrAbs, this.fetched & ~(1 << bit))
1063
+ return 0
1064
+ }
1065
+
1066
+ private RMB0(): number { return this.RMB(0) }
1067
+ private RMB1(): number { return this.RMB(1) }
1068
+ private RMB2(): number { return this.RMB(2) }
1069
+ private RMB3(): number { return this.RMB(3) }
1070
+ private RMB4(): number { return this.RMB(4) }
1071
+ private RMB5(): number { return this.RMB(5) }
1072
+ private RMB6(): number { return this.RMB(6) }
1073
+ private RMB7(): number { return this.RMB(7) }
1074
+
1075
+ private SMB(bit: number): number {
1076
+ // Set Memory Bit
1077
+ this.fetch()
1078
+ this.write(this.addrAbs, this.fetched | (1 << bit))
1079
+ return 0
1080
+ }
1081
+
1082
+ private SMB0(): number { return this.SMB(0) }
1083
+ private SMB1(): number { return this.SMB(1) }
1084
+ private SMB2(): number { return this.SMB(2) }
1085
+ private SMB3(): number { return this.SMB(3) }
1086
+ private SMB4(): number { return this.SMB(4) }
1087
+ private SMB5(): number { return this.SMB(5) }
1088
+ private SMB6(): number { return this.SMB(6) }
1089
+ private SMB7(): number { return this.SMB(7) }
1090
+
1091
+ private XXX(): number { return 0 }
1092
+
1093
+ //
1094
+ // Instruction Table
1095
+ //
1096
+
1097
+ instructionTable: CPUInstruction[] = [
1098
+ { name: 'BRK', cycles: 7, opcode: this.BRK.bind(this), addrMode: this.IMM.bind(this) },
1099
+ { name: 'ORA', cycles: 6, opcode: this.ORA.bind(this), addrMode: this.IZX.bind(this) },
1100
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1101
+ { name: '???', cycles: 8, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1102
+ { name: 'TSB', cycles: 5, opcode: this.TSB.bind(this), addrMode: this.ZP0.bind(this) },
1103
+ { name: 'ORA', cycles: 3, opcode: this.ORA.bind(this), addrMode: this.ZP0.bind(this) },
1104
+ { name: 'ASL', cycles: 5, opcode: this.ASL.bind(this), addrMode: this.ZP0.bind(this) },
1105
+ { name: 'RMB0', cycles: 5, opcode: this.RMB0.bind(this), addrMode: this.ZP0.bind(this) },
1106
+ { name: 'PHP', cycles: 3, opcode: this.PHP.bind(this), addrMode: this.IMP.bind(this) },
1107
+ { name: 'ORA', cycles: 2, opcode: this.ORA.bind(this), addrMode: this.IMM.bind(this) },
1108
+ { name: 'ASL', cycles: 2, opcode: this.ASL.bind(this), addrMode: this.IMP.bind(this) },
1109
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1110
+ { name: 'TSB', cycles: 6, opcode: this.TSB.bind(this), addrMode: this.ABS.bind(this) },
1111
+ { name: 'ORA', cycles: 4, opcode: this.ORA.bind(this), addrMode: this.ABS.bind(this) },
1112
+ { name: 'ASL', cycles: 6, opcode: this.ASL.bind(this), addrMode: this.ABS.bind(this) },
1113
+ { name: 'BBR0', cycles: 5, opcode: this.BBR0.bind(this), addrMode: this.ZPR.bind(this) },
1114
+
1115
+ { name: 'BPL', cycles: 2, opcode: this.BPL.bind(this), addrMode: this.REL.bind(this) },
1116
+ { name: 'ORA', cycles: 5, opcode: this.ORA.bind(this), addrMode: this.IZY.bind(this) },
1117
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1118
+ { name: '???', cycles: 8, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1119
+ { name: 'TRB', cycles: 5, opcode: this.TRB.bind(this), addrMode: this.ZP0.bind(this) },
1120
+ { name: 'ORA', cycles: 4, opcode: this.ORA.bind(this), addrMode: this.ZPX.bind(this) },
1121
+ { name: 'ASL', cycles: 6, opcode: this.ASL.bind(this), addrMode: this.ZPX.bind(this) },
1122
+ { name: 'RMB1', cycles: 5, opcode: this.RMB1.bind(this), addrMode: this.ZP0.bind(this) },
1123
+ { name: 'CLC', cycles: 2, opcode: this.CLC.bind(this), addrMode: this.IMP.bind(this) },
1124
+ { name: 'ORA', cycles: 4, opcode: this.ORA.bind(this), addrMode: this.ABY.bind(this) },
1125
+ { name: '???', cycles: 2, opcode: this.NOP.bind(this), addrMode: this.IMP.bind(this) },
1126
+ { name: '???', cycles: 7, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1127
+ { name: 'TRB', cycles: 6, opcode: this.TRB.bind(this), addrMode: this.ABS.bind(this) },
1128
+ { name: 'ORA', cycles: 4, opcode: this.ORA.bind(this), addrMode: this.ABX.bind(this) },
1129
+ { name: 'ASL', cycles: 7, opcode: this.ASL.bind(this), addrMode: this.ABX.bind(this) },
1130
+ { name: 'BBR1', cycles: 5, opcode: this.BBR1.bind(this), addrMode: this.ZPR.bind(this) },
1131
+
1132
+ { name: 'JSR', cycles: 6, opcode: this.JSR.bind(this), addrMode: this.ABS.bind(this) },
1133
+ { name: 'AND', cycles: 6, opcode: this.AND.bind(this), addrMode: this.IZX.bind(this) },
1134
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1135
+ { name: '???', cycles: 8, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1136
+ { name: 'BIT', cycles: 3, opcode: this.BIT.bind(this), addrMode: this.ZP0.bind(this) },
1137
+ { name: 'AND', cycles: 3, opcode: this.AND.bind(this), addrMode: this.ZP0.bind(this) },
1138
+ { name: 'ROL', cycles: 5, opcode: this.ROL.bind(this), addrMode: this.ZP0.bind(this) },
1139
+ { name: 'RMB2', cycles: 5, opcode: this.RMB2.bind(this), addrMode: this.ZP0.bind(this) },
1140
+ { name: 'PLP', cycles: 4, opcode: this.PLP.bind(this), addrMode: this.IMP.bind(this) },
1141
+ { name: 'AND', cycles: 2, opcode: this.AND.bind(this), addrMode: this.IMM.bind(this) },
1142
+ { name: 'ROL', cycles: 2, opcode: this.ROL.bind(this), addrMode: this.IMP.bind(this) },
1143
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1144
+ { name: 'BIT', cycles: 4, opcode: this.BIT.bind(this), addrMode: this.ABS.bind(this) },
1145
+ { name: 'AND', cycles: 4, opcode: this.AND.bind(this), addrMode: this.ABS.bind(this) },
1146
+ { name: 'ROL', cycles: 6, opcode: this.ROL.bind(this), addrMode: this.ABS.bind(this) },
1147
+ { name: 'BBR2', cycles: 5, opcode: this.BBR2.bind(this), addrMode: this.ZPR.bind(this) },
1148
+
1149
+ { name: 'BMI', cycles: 2, opcode: this.BMI.bind(this), addrMode: this.REL.bind(this) },
1150
+ { name: 'AND', cycles: 5, opcode: this.AND.bind(this), addrMode: this.IZY.bind(this) },
1151
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1152
+ { name: '???', cycles: 8, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1153
+ { name: '???', cycles: 4, opcode: this.NOP.bind(this), addrMode: this.IMP.bind(this) },
1154
+ { name: 'AND', cycles: 4, opcode: this.AND.bind(this), addrMode: this.ZPX.bind(this) },
1155
+ { name: 'ROL', cycles: 6, opcode: this.ROL.bind(this), addrMode: this.ZPX.bind(this) },
1156
+ { name: 'RMB3', cycles: 5, opcode: this.RMB3.bind(this), addrMode: this.ZP0.bind(this) },
1157
+ { name: 'SEC', cycles: 2, opcode: this.SEC.bind(this), addrMode: this.IMP.bind(this) },
1158
+ { name: 'AND', cycles: 4, opcode: this.AND.bind(this), addrMode: this.ABY.bind(this) },
1159
+ { name: '???', cycles: 2, opcode: this.NOP.bind(this), addrMode: this.IMP.bind(this) },
1160
+ { name: '???', cycles: 7, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1161
+ { name: '???', cycles: 4, opcode: this.NOP.bind(this), addrMode: this.IMP.bind(this) },
1162
+ { name: 'AND', cycles: 4, opcode: this.AND.bind(this), addrMode: this.ABX.bind(this) },
1163
+ { name: 'ROL', cycles: 7, opcode: this.ROL.bind(this), addrMode: this.ABX.bind(this) },
1164
+ { name: 'BBR3', cycles: 5, opcode: this.BBR3.bind(this), addrMode: this.ZPR.bind(this) },
1165
+
1166
+ { name: 'RTI', cycles: 6, opcode: this.RTI.bind(this), addrMode: this.IMP.bind(this) },
1167
+ { name: 'EOR', cycles: 6, opcode: this.EOR.bind(this), addrMode: this.IZX.bind(this) },
1168
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1169
+ { name: '???', cycles: 8, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1170
+ { name: '???', cycles: 3, opcode: this.NOP.bind(this), addrMode: this.IMP.bind(this) },
1171
+ { name: 'EOR', cycles: 3, opcode: this.EOR.bind(this), addrMode: this.ZP0.bind(this) },
1172
+ { name: 'LSR', cycles: 5, opcode: this.LSR.bind(this), addrMode: this.ZP0.bind(this) },
1173
+ { name: 'RMB4', cycles: 5, opcode: this.RMB4.bind(this), addrMode: this.ZP0.bind(this) },
1174
+ { name: 'PHA', cycles: 3, opcode: this.PHA.bind(this), addrMode: this.IMP.bind(this) },
1175
+ { name: 'EOR', cycles: 2, opcode: this.EOR.bind(this), addrMode: this.IMM.bind(this) },
1176
+ { name: 'LSR', cycles: 2, opcode: this.LSR.bind(this), addrMode: this.IMP.bind(this) },
1177
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1178
+ { name: 'JMP', cycles: 3, opcode: this.JMP.bind(this), addrMode: this.ABS.bind(this) },
1179
+ { name: 'EOR', cycles: 4, opcode: this.EOR.bind(this), addrMode: this.ABS.bind(this) },
1180
+ { name: 'LSR', cycles: 6, opcode: this.LSR.bind(this), addrMode: this.ABS.bind(this) },
1181
+ { name: 'BBR4', cycles: 5, opcode: this.BBR4.bind(this), addrMode: this.ZPR.bind(this) },
1182
+
1183
+ { name: 'BVC', cycles: 2, opcode: this.BVC.bind(this), addrMode: this.REL.bind(this) },
1184
+ { name: 'EOR', cycles: 5, opcode: this.EOR.bind(this), addrMode: this.IZY.bind(this) },
1185
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1186
+ { name: '???', cycles: 8, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1187
+ { name: '???', cycles: 4, opcode: this.NOP.bind(this), addrMode: this.IMP.bind(this) },
1188
+ { name: 'EOR', cycles: 4, opcode: this.EOR.bind(this), addrMode: this.ZPX.bind(this) },
1189
+ { name: 'LSR', cycles: 6, opcode: this.LSR.bind(this), addrMode: this.ZPX.bind(this) },
1190
+ { name: 'RMB5', cycles: 5, opcode: this.RMB5.bind(this), addrMode: this.ZP0.bind(this) },
1191
+ { name: 'CLI', cycles: 2, opcode: this.CLI.bind(this), addrMode: this.IMP.bind(this) },
1192
+ { name: 'EOR', cycles: 4, opcode: this.EOR.bind(this), addrMode: this.ABY.bind(this) },
1193
+ { name: 'PHY', cycles: 3, opcode: this.PHY.bind(this), addrMode: this.IMP.bind(this) },
1194
+ { name: '???', cycles: 7, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1195
+ { name: '???', cycles: 4, opcode: this.NOP.bind(this), addrMode: this.IMP.bind(this) },
1196
+ { name: 'EOR', cycles: 4, opcode: this.EOR.bind(this), addrMode: this.ABX.bind(this) },
1197
+ { name: 'LSR', cycles: 7, opcode: this.LSR.bind(this), addrMode: this.ABX.bind(this) },
1198
+ { name: 'BBR5', cycles: 5, opcode: this.BBR5.bind(this), addrMode: this.ZPR.bind(this) },
1199
+
1200
+ { name: 'RTS', cycles: 6, opcode: this.RTS.bind(this), addrMode: this.IMP.bind(this) },
1201
+ { name: 'ADC', cycles: 6, opcode: this.ADC.bind(this), addrMode: this.IZX.bind(this) },
1202
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1203
+ { name: '???', cycles: 8, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1204
+ { name: 'STZ', cycles: 3, opcode: this.STZ.bind(this), addrMode: this.ZP0.bind(this) },
1205
+ { name: 'ADC', cycles: 3, opcode: this.ADC.bind(this), addrMode: this.ZP0.bind(this) },
1206
+ { name: 'ROR', cycles: 5, opcode: this.ROR.bind(this), addrMode: this.ZP0.bind(this) },
1207
+ { name: 'RMB6', cycles: 5, opcode: this.RMB6.bind(this), addrMode: this.ZP0.bind(this) },
1208
+ { name: 'PLA', cycles: 4, opcode: this.PLA.bind(this), addrMode: this.IMP.bind(this) },
1209
+ { name: 'ADC', cycles: 2, opcode: this.ADC.bind(this), addrMode: this.IMM.bind(this) },
1210
+ { name: 'ROR', cycles: 2, opcode: this.ROR.bind(this), addrMode: this.IMP.bind(this) },
1211
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1212
+ { name: 'JMP', cycles: 5, opcode: this.JMP.bind(this), addrMode: this.IND.bind(this) },
1213
+ { name: 'ADC', cycles: 4, opcode: this.ADC.bind(this), addrMode: this.ABS.bind(this) },
1214
+ { name: 'ROR', cycles: 6, opcode: this.ROR.bind(this), addrMode: this.ABS.bind(this) },
1215
+ { name: 'BBR6', cycles: 5, opcode: this.BBR6.bind(this), addrMode: this.ZPR.bind(this) },
1216
+
1217
+ { name: 'BVS', cycles: 2, opcode: this.BVS.bind(this), addrMode: this.REL.bind(this) },
1218
+ { name: 'ADC', cycles: 5, opcode: this.ADC.bind(this), addrMode: this.IZY.bind(this) },
1219
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1220
+ { name: '???', cycles: 8, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1221
+ { name: 'STZ', cycles: 4, opcode: this.STZ.bind(this), addrMode: this.ZPX.bind(this) },
1222
+ { name: 'ADC', cycles: 4, opcode: this.ADC.bind(this), addrMode: this.ZPX.bind(this) },
1223
+ { name: 'ROR', cycles: 6, opcode: this.ROR.bind(this), addrMode: this.ZPX.bind(this) },
1224
+ { name: 'RMB7', cycles: 5, opcode: this.RMB7.bind(this), addrMode: this.ZP0.bind(this) },
1225
+ { name: 'SEI', cycles: 2, opcode: this.SEI.bind(this), addrMode: this.IMP.bind(this) },
1226
+ { name: 'ADC', cycles: 4, opcode: this.ADC.bind(this), addrMode: this.ABY.bind(this) },
1227
+ { name: 'PLY', cycles: 4, opcode: this.PLY.bind(this), addrMode: this.IMP.bind(this) },
1228
+ { name: '???', cycles: 7, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1229
+ { name: 'JMP', cycles: 6, opcode: this.JMP.bind(this), addrMode: this.IAX.bind(this) },
1230
+ { name: 'ADC', cycles: 4, opcode: this.ADC.bind(this), addrMode: this.ABX.bind(this) },
1231
+ { name: 'ROR', cycles: 7, opcode: this.ROR.bind(this), addrMode: this.ABX.bind(this) },
1232
+ { name: 'BBR7', cycles: 5, opcode: this.BBR7.bind(this), addrMode: this.ZPR.bind(this) },
1233
+
1234
+ { name: 'BRA', cycles: 3, opcode: this.BRA.bind(this), addrMode: this.REL.bind(this) },
1235
+ { name: 'STA', cycles: 6, opcode: this.STA.bind(this), addrMode: this.IZX.bind(this) },
1236
+ { name: '???', cycles: 2, opcode: this.NOP.bind(this), addrMode: this.IMP.bind(this) },
1237
+ { name: '???', cycles: 6, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1238
+ { name: 'STY', cycles: 3, opcode: this.STY.bind(this), addrMode: this.ZP0.bind(this) },
1239
+ { name: 'STA', cycles: 3, opcode: this.STA.bind(this), addrMode: this.ZP0.bind(this) },
1240
+ { name: 'STX', cycles: 3, opcode: this.STX.bind(this), addrMode: this.ZP0.bind(this) },
1241
+ { name: 'SMB0', cycles: 5, opcode: this.SMB0.bind(this), addrMode: this.ZP0.bind(this) },
1242
+ { name: 'DEY', cycles: 2, opcode: this.DEY.bind(this), addrMode: this.IMP.bind(this) },
1243
+ { name: 'BIT', cycles: 2, opcode: this.BIT.bind(this), addrMode: this.IMM.bind(this) },
1244
+ { name: 'TXA', cycles: 2, opcode: this.TXA.bind(this), addrMode: this.IMP.bind(this) },
1245
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1246
+ { name: 'STY', cycles: 4, opcode: this.STY.bind(this), addrMode: this.ABS.bind(this) },
1247
+ { name: 'STA', cycles: 4, opcode: this.STA.bind(this), addrMode: this.ABS.bind(this) },
1248
+ { name: 'STX', cycles: 4, opcode: this.STX.bind(this), addrMode: this.ABS.bind(this) },
1249
+ { name: 'BBS0', cycles: 5, opcode: this.BBS0.bind(this), addrMode: this.ZPR.bind(this) },
1250
+
1251
+ { name: 'BCC', cycles: 2, opcode: this.BCC.bind(this), addrMode: this.REL.bind(this) },
1252
+ { name: 'STA', cycles: 6, opcode: this.STA.bind(this), addrMode: this.IZY.bind(this) },
1253
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1254
+ { name: '???', cycles: 6, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1255
+ { name: 'STY', cycles: 4, opcode: this.STY.bind(this), addrMode: this.ZPX.bind(this) },
1256
+ { name: 'STA', cycles: 4, opcode: this.STA.bind(this), addrMode: this.ZPX.bind(this) },
1257
+ { name: 'STX', cycles: 4, opcode: this.STX.bind(this), addrMode: this.ZPY.bind(this) },
1258
+ { name: 'SMB1', cycles: 5, opcode: this.SMB1.bind(this), addrMode: this.ZP0.bind(this) },
1259
+ { name: 'TYA', cycles: 2, opcode: this.TYA.bind(this), addrMode: this.IMP.bind(this) },
1260
+ { name: 'STA', cycles: 5, opcode: this.STA.bind(this), addrMode: this.ABY.bind(this) },
1261
+ { name: 'TXS', cycles: 2, opcode: this.TXS.bind(this), addrMode: this.IMP.bind(this) },
1262
+ { name: '???', cycles: 5, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1263
+ { name: 'STZ', cycles: 4, opcode: this.STZ.bind(this), addrMode: this.ABS.bind(this) },
1264
+ { name: 'STA', cycles: 5, opcode: this.STA.bind(this), addrMode: this.ABX.bind(this) },
1265
+ { name: 'STZ', cycles: 5, opcode: this.STZ.bind(this), addrMode: this.ABX.bind(this) },
1266
+ { name: 'BBS1', cycles: 5, opcode: this.BBS1.bind(this), addrMode: this.ZPR.bind(this) },
1267
+
1268
+ { name: 'LDY', cycles: 2, opcode: this.LDY.bind(this), addrMode: this.IMM.bind(this) },
1269
+ { name: 'LDA', cycles: 6, opcode: this.LDA.bind(this), addrMode: this.IZX.bind(this) },
1270
+ { name: 'LDX', cycles: 2, opcode: this.LDX.bind(this), addrMode: this.IMM.bind(this) },
1271
+ { name: '???', cycles: 6, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1272
+ { name: 'LDY', cycles: 3, opcode: this.LDY.bind(this), addrMode: this.ZP0.bind(this) },
1273
+ { name: 'LDA', cycles: 3, opcode: this.LDA.bind(this), addrMode: this.ZP0.bind(this) },
1274
+ { name: 'LDX', cycles: 3, opcode: this.LDX.bind(this), addrMode: this.ZP0.bind(this) },
1275
+ { name: 'SMB2', cycles: 5, opcode: this.SMB2.bind(this), addrMode: this.ZP0.bind(this) },
1276
+ { name: 'TAY', cycles: 2, opcode: this.TAY.bind(this), addrMode: this.IMP.bind(this) },
1277
+ { name: 'LDA', cycles: 2, opcode: this.LDA.bind(this), addrMode: this.IMM.bind(this) },
1278
+ { name: 'TAX', cycles: 2, opcode: this.TAX.bind(this), addrMode: this.IMP.bind(this) },
1279
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1280
+ { name: 'LDY', cycles: 4, opcode: this.LDY.bind(this), addrMode: this.ABS.bind(this) },
1281
+ { name: 'LDA', cycles: 4, opcode: this.LDA.bind(this), addrMode: this.ABS.bind(this) },
1282
+ { name: 'LDX', cycles: 4, opcode: this.LDX.bind(this), addrMode: this.ABS.bind(this) },
1283
+ { name: 'BBS2', cycles: 5, opcode: this.BBS2.bind(this), addrMode: this.ZPR.bind(this) },
1284
+
1285
+ { name: 'BCS', cycles: 2, opcode: this.BCS.bind(this), addrMode: this.REL.bind(this) },
1286
+ { name: 'LDA', cycles: 5, opcode: this.LDA.bind(this), addrMode: this.IZY.bind(this) },
1287
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1288
+ { name: '???', cycles: 5, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1289
+ { name: 'LDY', cycles: 4, opcode: this.LDY.bind(this), addrMode: this.ZPX.bind(this) },
1290
+ { name: 'LDA', cycles: 4, opcode: this.LDA.bind(this), addrMode: this.ZPX.bind(this) },
1291
+ { name: 'LDX', cycles: 4, opcode: this.LDX.bind(this), addrMode: this.ZPY.bind(this) },
1292
+ { name: 'SMB3', cycles: 5, opcode: this.SMB3.bind(this), addrMode: this.ZP0.bind(this) },
1293
+ { name: 'CLV', cycles: 2, opcode: this.CLV.bind(this), addrMode: this.IMP.bind(this) },
1294
+ { name: 'LDA', cycles: 4, opcode: this.LDA.bind(this), addrMode: this.ABY.bind(this) },
1295
+ { name: 'TSX', cycles: 2, opcode: this.TSX.bind(this), addrMode: this.IMP.bind(this) },
1296
+ { name: '???', cycles: 4, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1297
+ { name: 'LDY', cycles: 4, opcode: this.LDY.bind(this), addrMode: this.ABX.bind(this) },
1298
+ { name: 'LDA', cycles: 4, opcode: this.LDA.bind(this), addrMode: this.ABX.bind(this) },
1299
+ { name: 'LDX', cycles: 4, opcode: this.LDX.bind(this), addrMode: this.ABY.bind(this) },
1300
+ { name: 'BBS3', cycles: 5, opcode: this.BBS3.bind(this), addrMode: this.ZPR.bind(this) },
1301
+
1302
+ { name: 'CPY', cycles: 2, opcode: this.CPY.bind(this), addrMode: this.IMM.bind(this) },
1303
+ { name: 'CMP', cycles: 6, opcode: this.CMP.bind(this), addrMode: this.IZX.bind(this) },
1304
+ { name: '???', cycles: 2, opcode: this.NOP.bind(this), addrMode: this.IMP.bind(this) },
1305
+ { name: '???', cycles: 8, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1306
+ { name: 'CPY', cycles: 3, opcode: this.CPY.bind(this), addrMode: this.ZP0.bind(this) },
1307
+ { name: 'CMP', cycles: 3, opcode: this.CMP.bind(this), addrMode: this.ZP0.bind(this) },
1308
+ { name: 'DEC', cycles: 5, opcode: this.DEC.bind(this), addrMode: this.ZP0.bind(this) },
1309
+ { name: 'SMB4', cycles: 5, opcode: this.SMB4.bind(this), addrMode: this.ZP0.bind(this) },
1310
+ { name: 'INY', cycles: 2, opcode: this.INY.bind(this), addrMode: this.IMP.bind(this) },
1311
+ { name: 'CMP', cycles: 2, opcode: this.CMP.bind(this), addrMode: this.IMM.bind(this) },
1312
+ { name: 'DEX', cycles: 2, opcode: this.DEX.bind(this), addrMode: this.IMP.bind(this) },
1313
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1314
+ { name: 'CPY', cycles: 4, opcode: this.CPY.bind(this), addrMode: this.ABS.bind(this) },
1315
+ { name: 'CMP', cycles: 4, opcode: this.CMP.bind(this), addrMode: this.ABS.bind(this) },
1316
+ { name: 'DEC', cycles: 6, opcode: this.DEC.bind(this), addrMode: this.ABS.bind(this) },
1317
+ { name: 'BBS4', cycles: 5, opcode: this.BBS4.bind(this), addrMode: this.ZPR.bind(this) },
1318
+
1319
+ { name: 'BNE', cycles: 2, opcode: this.BNE.bind(this), addrMode: this.REL.bind(this) },
1320
+ { name: 'CMP', cycles: 5, opcode: this.CMP.bind(this), addrMode: this.IZY.bind(this) },
1321
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1322
+ { name: '???', cycles: 8, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1323
+ { name: '???', cycles: 4, opcode: this.NOP.bind(this), addrMode: this.IMP.bind(this) },
1324
+ { name: 'CMP', cycles: 4, opcode: this.CMP.bind(this), addrMode: this.ZPX.bind(this) },
1325
+ { name: 'DEC', cycles: 6, opcode: this.DEC.bind(this), addrMode: this.ZPX.bind(this) },
1326
+ { name: 'SMB5', cycles: 5, opcode: this.SMB5.bind(this), addrMode: this.ZP0.bind(this) },
1327
+ { name: 'CLD', cycles: 2, opcode: this.CLD.bind(this), addrMode: this.IMP.bind(this) },
1328
+ { name: 'CMP', cycles: 4, opcode: this.CMP.bind(this), addrMode: this.ABY.bind(this) },
1329
+ { name: 'PHX', cycles: 3, opcode: this.PHX.bind(this), addrMode: this.IMP.bind(this) },
1330
+ { name: 'STP', cycles: 3, opcode: this.STP.bind(this), addrMode: this.IMP.bind(this) },
1331
+ { name: '???', cycles: 4, opcode: this.NOP.bind(this), addrMode: this.IMP.bind(this) },
1332
+ { name: 'CMP', cycles: 4, opcode: this.CMP.bind(this), addrMode: this.ABX.bind(this) },
1333
+ { name: 'DEC', cycles: 7, opcode: this.DEC.bind(this), addrMode: this.ABX.bind(this) },
1334
+ { name: '???', cycles: 7, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1335
+
1336
+ { name: 'CPX', cycles: 2, opcode: this.CPX.bind(this), addrMode: this.IMM.bind(this) },
1337
+ { name: 'SBC', cycles: 6, opcode: this.SBC.bind(this), addrMode: this.IZX.bind(this) },
1338
+ { name: '???', cycles: 2, opcode: this.NOP.bind(this), addrMode: this.IMP.bind(this) },
1339
+ { name: '???', cycles: 8, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1340
+ { name: 'CPX', cycles: 3, opcode: this.CPX.bind(this), addrMode: this.ZP0.bind(this) },
1341
+ { name: 'SBC', cycles: 3, opcode: this.SBC.bind(this), addrMode: this.ZP0.bind(this) },
1342
+ { name: 'INC', cycles: 5, opcode: this.INC.bind(this), addrMode: this.ZP0.bind(this) },
1343
+ { name: 'SMB6', cycles: 5, opcode: this.SMB6.bind(this), addrMode: this.ZP0.bind(this) },
1344
+ { name: 'INX', cycles: 2, opcode: this.INX.bind(this), addrMode: this.IMP.bind(this) },
1345
+ { name: 'SBC', cycles: 2, opcode: this.SBC.bind(this), addrMode: this.IMM.bind(this) },
1346
+ { name: 'NOP', cycles: 2, opcode: this.NOP.bind(this), addrMode: this.IMP.bind(this) },
1347
+ { name: 'WAI', cycles: 3, opcode: this.WAI.bind(this), addrMode: this.IMP.bind(this) },
1348
+ { name: 'CPX', cycles: 4, opcode: this.CPX.bind(this), addrMode: this.ABS.bind(this) },
1349
+ { name: 'SBC', cycles: 4, opcode: this.SBC.bind(this), addrMode: this.ABS.bind(this) },
1350
+ { name: 'INC', cycles: 6, opcode: this.INC.bind(this), addrMode: this.ABS.bind(this) },
1351
+ { name: 'BBS5', cycles: 5, opcode: this.BBS5.bind(this), addrMode: this.ZPR.bind(this) },
1352
+
1353
+ { name: 'BEQ', cycles: 2, opcode: this.BEQ.bind(this), addrMode: this.REL.bind(this) },
1354
+ { name: 'SBC', cycles: 5, opcode: this.SBC.bind(this), addrMode: this.IZY.bind(this) },
1355
+ { name: '???', cycles: 2, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1356
+ { name: '???', cycles: 8, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1357
+ { name: '???', cycles: 4, opcode: this.NOP.bind(this), addrMode: this.IMP.bind(this) },
1358
+ { name: 'SBC', cycles: 4, opcode: this.SBC.bind(this), addrMode: this.ZPX.bind(this) },
1359
+ { name: 'INC', cycles: 6, opcode: this.INC.bind(this), addrMode: this.ZPX.bind(this) },
1360
+ { name: 'SMB7', cycles: 5, opcode: this.SMB7.bind(this), addrMode: this.ZP0.bind(this) },
1361
+ { name: 'SED', cycles: 2, opcode: this.SED.bind(this), addrMode: this.IMP.bind(this) },
1362
+ { name: 'SBC', cycles: 4, opcode: this.SBC.bind(this), addrMode: this.ABY.bind(this) },
1363
+ { name: 'PLX', cycles: 4, opcode: this.PLX.bind(this), addrMode: this.IMP.bind(this) },
1364
+ { name: '???', cycles: 7, opcode: this.XXX.bind(this), addrMode: this.IMP.bind(this) },
1365
+ { name: '???', cycles: 4, opcode: this.NOP.bind(this), addrMode: this.IMP.bind(this) },
1366
+ { name: 'SBC', cycles: 4, opcode: this.SBC.bind(this), addrMode: this.ABX.bind(this) },
1367
+ { name: 'INC', cycles: 7, opcode: this.INC.bind(this), addrMode: this.ABX.bind(this) },
1368
+ { name: 'BBS7', cycles: 5, opcode: this.BBS7.bind(this), addrMode: this.ZPR.bind(this) }
1369
+ ]
1370
+
1371
+ }