1
0
mirror of https://github.com/jscrane/r65emu.git synced 2024-06-01 07:41:57 +00:00

add step for debugging

This commit is contained in:
Stephen Crane 2014-11-19 19:35:16 +00:00
parent 43c7aece2f
commit 93403d5a8e
3 changed files with 202 additions and 193 deletions

3
cpu.h
View File

@ -7,8 +7,9 @@
class CPU: public Checkpointable { class CPU: public Checkpointable {
public: public:
virtual Memory::address run(unsigned instructions) =0;
virtual void reset () =0; virtual void reset () =0;
virtual Memory::address run (unsigned instructions) =0; virtual Memory::address step() =0;
virtual void raise (int level) =0; virtual void raise (int level) =0;
virtual char *status () =0; virtual char *status () =0;

391
r6502.cpp
View File

@ -5,262 +5,269 @@
#include "cpu.h" #include "cpu.h"
#include "r6502.h" #include "r6502.h"
Memory::address r6502::run (unsigned clocks) { Memory::address r6502::step() {
while (clocks--) byte op = (*_memory)[PC];
{
byte op = (*_memory)[PC];
#ifdef CPU_DEBUG #ifdef CPU_DEBUG
if (_debug) if (_debug)
_status ("%04x: %02x [%02x %02x %02x, %02x]\r", PC, op, A, X, Y, flags()); _status ("%04x: %02x [%02x %02x %02x, %02x]\r", PC, op, A, X, Y, flags());
#endif #endif
PC++; PC++;
(this->*_ops[op])(); (this->*_ops[op])();
} return PC;
return PC; }
Memory::address r6502::run(unsigned clocks) {
#ifdef CPU_DEBUG
if (_debug)
return step();
#endif
while (clocks--)
step();
return PC;
} }
byte r6502::flags() { byte r6502::flags() {
P.bits.N = ((N & 0x80) != 0); P.bits.N = ((N & 0x80) != 0);
P.bits.V = V; P.bits.V = V;
P.bits.Z = !Z; P.bits.Z = !Z;
P.bits.C = C; P.bits.C = C;
P.bits._ = 1; P.bits._ = 1;
return P.value; return P.value;
} }
char *r6502::status () { char *r6502::status () {
static char buf[128]; static char buf[128];
flags(); flags();
sprintf (buf, "aa xx yy sp nv_bdizc _pc_\r\n" sprintf (buf, "aa xx yy sp nv_bdizc _pc_\r\n"
"%02x %02x %02x %02x %d%d%d%d%d%d%d%d %04x\r\n", "%02x %02x %02x %02x %d%d%d%d%d%d%d%d %04x\r\n",
A, X, Y, S, P.bits.N, P.bits.V, P.bits._, P.bits.B, A, X, Y, S, P.bits.N, P.bits.V, P.bits._, P.bits.B,
P.bits.D, P.bits.I, P.bits.Z, P.bits.C, PC); P.bits.D, P.bits.I, P.bits.Z, P.bits.C, PC);
return buf; return buf;
} }
void r6502::checkpoint(Stream &s) void r6502::checkpoint(Stream &s)
{ {
s.write(PC / 0xff); s.write(PC / 0xff);
s.write(PC % 0xff); s.write(PC % 0xff);
s.write(S); s.write(S);
s.write(A); s.write(A);
s.write(X); s.write(X);
s.write(Y); s.write(Y);
s.write(N); s.write(N);
s.write(V); s.write(V);
s.write(B); s.write(B);
s.write(D); s.write(D);
s.write(I); s.write(I);
s.write(Z); s.write(Z);
s.write(C); s.write(C);
s.write(P.value); s.write(P.value);
} }
void r6502::restore(Stream &s) void r6502::restore(Stream &s)
{ {
byte hi = s.read(), lo = s.read(); byte hi = s.read(), lo = s.read();
PC = hi * 0xff + lo; PC = hi * 0xff + lo;
S = s.read(); S = s.read();
A = s.read(); A = s.read();
X = s.read(); X = s.read();
Y = s.read(); Y = s.read();
N = s.read(); N = s.read();
V = s.read(); V = s.read();
B = s.read(); B = s.read();
D = s.read(); D = s.read();
I = s.read(); I = s.read();
Z = s.read(); Z = s.read();
C = s.read(); C = s.read();
P.value = s.read(); P.value = s.read();
} }
void r6502::raise (int level) { void r6502::raise (int level) {
if (level < 0) if (level < 0)
nmi (); nmi ();
else if (!P.bits.I) else if (!P.bits.I)
irq (); irq ();
else else
_irq = true; _irq = true;
} }
void r6502::irq () { void r6502::irq () {
pusha (PC); pusha (PC);
P.bits.B = 0; P.bits.B = 0;
pushb (flags ()); pushb (flags ());
P.bits.B = 1; P.bits.B = 1;
P.bits.I = 1; P.bits.I = 1;
PC = vector (ibvec); PC = vector (ibvec);
_irq = false; _irq = false;
} }
void r6502::brk () { void r6502::brk () {
if (!P.bits.I) { if (!P.bits.I) {
pusha (PC); pusha (PC);
P.bits.B = 1; P.bits.B = 1;
php (); php ();
P.bits.I = 1; P.bits.I = 1;
PC = vector (ibvec); PC = vector (ibvec);
} }
P.bits.B = 1; P.bits.B = 1;
P.bits._ = 1; P.bits._ = 1;
} }
void r6502::rti () { void r6502::rti () {
plp (); plp ();
PC = popa (); PC = popa ();
} }
void r6502::cli () { void r6502::cli () {
P.bits.I = 0; P.bits.I = 0;
if (_irq) if (_irq)
irq(); irq();
} }
void r6502::nmi () { void r6502::nmi () {
pusha (PC); pusha (PC);
php (); php ();
P.bits.I = 1; P.bits.I = 1;
PC = vector (nmivec); PC = vector (nmivec);
} }
// php and plp are complicated by the representation // php and plp are complicated by the representation
// of the processor state for efficient normal operation // of the processor state for efficient normal operation
void r6502::php () { void r6502::php () {
P.bits.B = 1; P.bits.B = 1;
pushb (flags ()); pushb (flags ());
} }
void r6502::plp () { void r6502::plp () {
P.value = popb (); P.value = popb ();
N = P.bits.N? 0x80: 0; N = P.bits.N? 0x80: 0;
V = P.bits.V; V = P.bits.V;
Z = !P.bits.Z; Z = !P.bits.Z;
C = P.bits.C; C = P.bits.C;
} }
void r6502::rts () { void r6502::rts () {
PC = popa ()+1; PC = popa ()+1;
} }
void r6502::jsr () { void r6502::jsr () {
pusha (PC+1); pusha (PC+1);
PC = vector (PC); PC = vector (PC);
} }
void r6502::_adc (byte d) { void r6502::_adc (byte d) {
if (P.bits.D) { if (P.bits.D) {
int r = _fromBCD[A] + _fromBCD[d] + C; int r = _fromBCD[A] + _fromBCD[d] + C;
C = (r > 99); C = (r > 99);
if (C) r -= 100; if (C) r -= 100;
A = _toBCD[r]; A = _toBCD[r];
} else { } else {
unsigned short u = (unsigned short)A + (unsigned short)d + (unsigned short)C; unsigned short u = (unsigned short)A + (unsigned short)d + (unsigned short)C;
short s = (char)A + (char)d + (char)C; short s = (char)A + (char)d + (char)C;
C = (u < 0 || u > 255); C = (u < 0 || u > 255);
V = (s > 127 || s < -128); V = (s > 127 || s < -128);
A = (u & 0xff); A = (u & 0xff);
} }
N = (A & 0x80); N = (A & 0x80);
Z = A; Z = A;
} }
void r6502::sbcd (byte d) { void r6502::sbcd (byte d) {
int r = _fromBCD[A] - _fromBCD[d] - !C; int r = _fromBCD[A] - _fromBCD[d] - !C;
C = (r >= 0); C = (r >= 0);
if (r < 0) r += 100; if (r < 0) r += 100;
A = _toBCD[r & 0xff]; A = _toBCD[r & 0xff];
N = (A & 0x80); N = (A & 0x80);
Z = A; Z = A;
// V not tested for: http://www.6502.org/tutorials/decimal_mode.html // V not tested for: http://www.6502.org/tutorials/decimal_mode.html
} }
void r6502::ill () { void r6502::ill () {
_status ("Illegal instruction at %04x!\r\n%s", (PC-1), status()); _status ("Illegal instruction at %04x!\r\n%s", (PC-1), status());
longjmp (*_err, 1); longjmp (*_err, 1);
} }
void r6502::reset () void r6502::reset ()
{ {
_debug = false; _debug = false;
P.value = 0; P.value = 0;
P.bits._ = 1; P.bits._ = 1;
P.bits.B = 1; P.bits.B = 1;
_irq = false; _irq = false;
S = 0xff; S = 0xff;
PC = vector(resvec); PC = vector(resvec);
} }
r6502::r6502 (Memory *m, jmp_buf *e, CPU::statfn s): CPU (m,e,s) { r6502::r6502 (Memory *m, jmp_buf *e, CPU::statfn s): CPU (m,e,s) {
for (int i=0; i < 256; i++) { for (int i=0; i < 256; i++) {
_fromBCD[i] = ((i >> 4) & 0x0f)*10 + (i & 0x0f); _fromBCD[i] = ((i >> 4) & 0x0f)*10 + (i & 0x0f);
_toBCD[i] = (((i % 100) / 10) << 4) | (i % 10); _toBCD[i] = (((i % 100) / 10) << 4) | (i % 10);
} }
OP *p = _ops; OP *p = _ops;
*p++=&r6502::brk; *p++=&r6502::ora_ix; *p++=&r6502::ill; *p++=&r6502::ill; *p++=&r6502::brk; *p++=&r6502::ora_ix; *p++=&r6502::ill; *p++=&r6502::ill;
*p++=&r6502::nop2; *p++=&r6502::ora_z; *p++=&r6502::asl_z; *p++=&r6502::ill; *p++=&r6502::nop2; *p++=&r6502::ora_z; *p++=&r6502::asl_z; *p++=&r6502::ill;
*p++=&r6502::php; *p++=&r6502::ora_; *p++=&r6502::asl; *p++=&r6502::ill; *p++=&r6502::php; *p++=&r6502::ora_; *p++=&r6502::asl; *p++=&r6502::ill;
*p++=&r6502::nop3; *p++=&r6502::ora_a; *p++=&r6502::asl_a; *p++=&r6502::ill; *p++=&r6502::nop3; *p++=&r6502::ora_a; *p++=&r6502::asl_a; *p++=&r6502::ill;
*p++=&r6502::bpl; *p++=&r6502::ora_iy; *p++=&r6502::ill; *p++=&r6502::ill; *p++=&r6502::bpl; *p++=&r6502::ora_iy; *p++=&r6502::ill; *p++=&r6502::ill;
*p++=&r6502::nop2; *p++=&r6502::ora_zx; *p++=&r6502::asl_zx; *p++=&r6502::ill; *p++=&r6502::nop2; *p++=&r6502::ora_zx; *p++=&r6502::asl_zx; *p++=&r6502::ill;
*p++=&r6502::clc; *p++=&r6502::ora_ay; *p++=&r6502::nop; *p++=&r6502::ill; *p++=&r6502::clc; *p++=&r6502::ora_ay; *p++=&r6502::nop; *p++=&r6502::ill;
*p++=&r6502::nop2; *p++=&r6502::ora_ax; *p++=&r6502::asl_ax; *p++=&r6502::ill; *p++=&r6502::nop2; *p++=&r6502::ora_ax; *p++=&r6502::asl_ax; *p++=&r6502::ill;
*p++=&r6502::jsr; *p++=&r6502::and_ix; *p++=&r6502::ill; *p++=&r6502::ill; *p++=&r6502::jsr; *p++=&r6502::and_ix; *p++=&r6502::ill; *p++=&r6502::ill;
*p++=&r6502::bit_z; *p++=&r6502::and_z; *p++=&r6502::rol_z; *p++=&r6502::ill; *p++=&r6502::bit_z; *p++=&r6502::and_z; *p++=&r6502::rol_z; *p++=&r6502::ill;
*p++=&r6502::plp; *p++=&r6502::and_; *p++=&r6502::rol; *p++=&r6502::ill; *p++=&r6502::plp; *p++=&r6502::and_; *p++=&r6502::rol; *p++=&r6502::ill;
*p++=&r6502::bit_a; *p++=&r6502::and_a; *p++=&r6502::rol_a; *p++=&r6502::ill; *p++=&r6502::bit_a; *p++=&r6502::and_a; *p++=&r6502::rol_a; *p++=&r6502::ill;
*p++=&r6502::bmi; *p++=&r6502::and_iy; *p++=&r6502::ill; *p++=&r6502::ill; *p++=&r6502::bmi; *p++=&r6502::and_iy; *p++=&r6502::ill; *p++=&r6502::ill;
*p++=&r6502::nop2; *p++=&r6502::and_zx; *p++=&r6502::rol_zx; *p++=&r6502::ill; *p++=&r6502::nop2; *p++=&r6502::and_zx; *p++=&r6502::rol_zx; *p++=&r6502::ill;
*p++=&r6502::sec; *p++=&r6502::and_ay; *p++=&r6502::nop; *p++=&r6502::ill; *p++=&r6502::sec; *p++=&r6502::and_ay; *p++=&r6502::nop; *p++=&r6502::ill;
*p++=&r6502::nop3; *p++=&r6502::and_ax; *p++=&r6502::rol_ax; *p++=&r6502::ill; *p++=&r6502::nop3; *p++=&r6502::and_ax; *p++=&r6502::rol_ax; *p++=&r6502::ill;
*p++=&r6502::rti; *p++=&r6502::eor_ix; *p++=&r6502::ill; *p++=&r6502::ill; *p++=&r6502::rti; *p++=&r6502::eor_ix; *p++=&r6502::ill; *p++=&r6502::ill;
*p++=&r6502::nop2; *p++=&r6502::eor_z; *p++=&r6502::lsr_z; *p++=&r6502::ill; *p++=&r6502::nop2; *p++=&r6502::eor_z; *p++=&r6502::lsr_z; *p++=&r6502::ill;
*p++=&r6502::pha; *p++=&r6502::eor_; *p++=&r6502::lsr_; *p++=&r6502::ill; *p++=&r6502::pha; *p++=&r6502::eor_; *p++=&r6502::lsr_; *p++=&r6502::ill;
*p++=&r6502::jmp; *p++=&r6502::eor_a; *p++=&r6502::lsr_a; *p++=&r6502::ill; *p++=&r6502::jmp; *p++=&r6502::eor_a; *p++=&r6502::lsr_a; *p++=&r6502::ill;
*p++=&r6502::bvc; *p++=&r6502::eor_iy; *p++=&r6502::ill; *p++=&r6502::ill; *p++=&r6502::bvc; *p++=&r6502::eor_iy; *p++=&r6502::ill; *p++=&r6502::ill;
*p++=&r6502::nop2; *p++=&r6502::eor_zx; *p++=&r6502::lsr_zx; *p++=&r6502::ill; *p++=&r6502::nop2; *p++=&r6502::eor_zx; *p++=&r6502::lsr_zx; *p++=&r6502::ill;
*p++=&r6502::cli; *p++=&r6502::eor_ay; *p++=&r6502::nop; *p++=&r6502::ill; *p++=&r6502::cli; *p++=&r6502::eor_ay; *p++=&r6502::nop; *p++=&r6502::ill;
*p++=&r6502::nop3; *p++=&r6502::eor_ax; *p++=&r6502::lsr_ax; *p++=&r6502::ill; *p++=&r6502::nop3; *p++=&r6502::eor_ax; *p++=&r6502::lsr_ax; *p++=&r6502::ill;
*p++=&r6502::rts; *p++=&r6502::adc_ix; *p++=&r6502::ill; *p++=&r6502::ill; *p++=&r6502::rts; *p++=&r6502::adc_ix; *p++=&r6502::ill; *p++=&r6502::ill;
*p++=&r6502::nop2; *p++=&r6502::adc_z; *p++=&r6502::ror_z; *p++=&r6502::ill; *p++=&r6502::nop2; *p++=&r6502::adc_z; *p++=&r6502::ror_z; *p++=&r6502::ill;
*p++=&r6502::pla; *p++=&r6502::adc_; *p++=&r6502::ror_; *p++=&r6502::ill; *p++=&r6502::pla; *p++=&r6502::adc_; *p++=&r6502::ror_; *p++=&r6502::ill;
*p++=&r6502::jmp_i; *p++=&r6502::adc_a; *p++=&r6502::ror_a; *p++=&r6502::ill; *p++=&r6502::jmp_i; *p++=&r6502::adc_a; *p++=&r6502::ror_a; *p++=&r6502::ill;
*p++=&r6502::bvs; *p++=&r6502::adc_iy; *p++=&r6502::ill; *p++=&r6502::ill; *p++=&r6502::bvs; *p++=&r6502::adc_iy; *p++=&r6502::ill; *p++=&r6502::ill;
*p++=&r6502::nop2; *p++=&r6502::adc_zx; *p++=&r6502::ror_zx; *p++=&r6502::ill; *p++=&r6502::nop2; *p++=&r6502::adc_zx; *p++=&r6502::ror_zx; *p++=&r6502::ill;
*p++=&r6502::sei; *p++=&r6502::adc_ay; *p++=&r6502::nop; *p++=&r6502::ill; *p++=&r6502::sei; *p++=&r6502::adc_ay; *p++=&r6502::nop; *p++=&r6502::ill;
*p++=&r6502::nop3; *p++=&r6502::adc_ax; *p++=&r6502::ror_ax; *p++=&r6502::ill; *p++=&r6502::nop3; *p++=&r6502::adc_ax; *p++=&r6502::ror_ax; *p++=&r6502::ill;
*p++=&r6502::nop2; *p++=&r6502::sta_ix; *p++=&r6502::nop2; *p++=&r6502::ill; *p++=&r6502::nop2; *p++=&r6502::sta_ix; *p++=&r6502::nop2; *p++=&r6502::ill;
*p++=&r6502::sty_z; *p++=&r6502::sta_z; *p++=&r6502::stx_z; *p++=&r6502::ill; *p++=&r6502::sty_z; *p++=&r6502::sta_z; *p++=&r6502::stx_z; *p++=&r6502::ill;
*p++=&r6502::dey; *p++=&r6502::nop2; *p++=&r6502::txa; *p++=&r6502::ill; *p++=&r6502::dey; *p++=&r6502::nop2; *p++=&r6502::txa; *p++=&r6502::ill;
*p++=&r6502::sty_a; *p++=&r6502::sta_a; *p++=&r6502::stx_a; *p++=&r6502::ill; *p++=&r6502::sty_a; *p++=&r6502::sta_a; *p++=&r6502::stx_a; *p++=&r6502::ill;
*p++=&r6502::bcc; *p++=&r6502::sta_iy; *p++=&r6502::ill; *p++=&r6502::ill; *p++=&r6502::bcc; *p++=&r6502::sta_iy; *p++=&r6502::ill; *p++=&r6502::ill;
*p++=&r6502::sty_zx; *p++=&r6502::sta_zx; *p++=&r6502::stx_zy; *p++=&r6502::ill; *p++=&r6502::sty_zx; *p++=&r6502::sta_zx; *p++=&r6502::stx_zy; *p++=&r6502::ill;
*p++=&r6502::tya; *p++=&r6502::sta_ay; *p++=&r6502::txs; *p++=&r6502::ill; *p++=&r6502::tya; *p++=&r6502::sta_ay; *p++=&r6502::txs; *p++=&r6502::ill;
*p++=&r6502::ill; *p++=&r6502::sta_ax; *p++=&r6502::ill; *p++=&r6502::ill; *p++=&r6502::ill; *p++=&r6502::sta_ax; *p++=&r6502::ill; *p++=&r6502::ill;
*p++=&r6502::ldy_; *p++=&r6502::lda_ix; *p++=&r6502::ldx_; *p++=&r6502::lax_ix; *p++=&r6502::ldy_; *p++=&r6502::lda_ix; *p++=&r6502::ldx_; *p++=&r6502::lax_ix;
*p++=&r6502::ldy_z; *p++=&r6502::lda_z; *p++=&r6502::ldx_z; *p++=&r6502::lax_z; *p++=&r6502::ldy_z; *p++=&r6502::lda_z; *p++=&r6502::ldx_z; *p++=&r6502::lax_z;
*p++=&r6502::tay; *p++=&r6502::lda_; *p++=&r6502::tax; *p++=&r6502::ill; *p++=&r6502::tay; *p++=&r6502::lda_; *p++=&r6502::tax; *p++=&r6502::ill;
*p++=&r6502::ldy_a; *p++=&r6502::lda_a; *p++=&r6502::ldx_a; *p++=&r6502::lax_a; *p++=&r6502::ldy_a; *p++=&r6502::lda_a; *p++=&r6502::ldx_a; *p++=&r6502::lax_a;
*p++=&r6502::bcs; *p++=&r6502::lda_iy; *p++=&r6502::ill; *p++=&r6502::lax_iy; *p++=&r6502::bcs; *p++=&r6502::lda_iy; *p++=&r6502::ill; *p++=&r6502::lax_iy;
*p++=&r6502::ldy_zx; *p++=&r6502::lda_zx; *p++=&r6502::ldx_zy; *p++=&r6502::lax_zy; *p++=&r6502::ldy_zx; *p++=&r6502::lda_zx; *p++=&r6502::ldx_zy; *p++=&r6502::lax_zy;
*p++=&r6502::clv; *p++=&r6502::lda_ay; *p++=&r6502::tsx; *p++=&r6502::ill; *p++=&r6502::clv; *p++=&r6502::lda_ay; *p++=&r6502::tsx; *p++=&r6502::ill;
*p++=&r6502::ldy_ax; *p++=&r6502::lda_ax; *p++=&r6502::ldx_ay; *p++=&r6502::lax_ay; *p++=&r6502::ldy_ax; *p++=&r6502::lda_ax; *p++=&r6502::ldx_ay; *p++=&r6502::lax_ay;
*p++=&r6502::cpy_; *p++=&r6502::cmp_ix; *p++=&r6502::nop2; *p++=&r6502::ill; *p++=&r6502::cpy_; *p++=&r6502::cmp_ix; *p++=&r6502::nop2; *p++=&r6502::ill;
*p++=&r6502::cpy_z; *p++=&r6502::cmp_z; *p++=&r6502::dec_z; *p++=&r6502::ill; *p++=&r6502::cpy_z; *p++=&r6502::cmp_z; *p++=&r6502::dec_z; *p++=&r6502::ill;
*p++=&r6502::iny; *p++=&r6502::cmp_; *p++=&r6502::dex; *p++=&r6502::ill; *p++=&r6502::iny; *p++=&r6502::cmp_; *p++=&r6502::dex; *p++=&r6502::ill;
*p++=&r6502::cpy_a; *p++=&r6502::cmp_a; *p++=&r6502::dec_a; *p++=&r6502::ill; *p++=&r6502::cpy_a; *p++=&r6502::cmp_a; *p++=&r6502::dec_a; *p++=&r6502::ill;
*p++=&r6502::bne; *p++=&r6502::cmp_iy; *p++=&r6502::ill; *p++=&r6502::ill; *p++=&r6502::bne; *p++=&r6502::cmp_iy; *p++=&r6502::ill; *p++=&r6502::ill;
*p++=&r6502::nop2; *p++=&r6502::cmp_zx; *p++=&r6502::dec_zx; *p++=&r6502::ill; *p++=&r6502::nop2; *p++=&r6502::cmp_zx; *p++=&r6502::dec_zx; *p++=&r6502::ill;
*p++=&r6502::cld; *p++=&r6502::cmp_ay; *p++=&r6502::nop; *p++=&r6502::ill; *p++=&r6502::cld; *p++=&r6502::cmp_ay; *p++=&r6502::nop; *p++=&r6502::ill;
*p++=&r6502::nop3; *p++=&r6502::cmp_ax; *p++=&r6502::dec_ax; *p++=&r6502::ill; *p++=&r6502::nop3; *p++=&r6502::cmp_ax; *p++=&r6502::dec_ax; *p++=&r6502::ill;
*p++=&r6502::cpx_; *p++=&r6502::sbc_ix; *p++=&r6502::nop2; *p++=&r6502::ill; *p++=&r6502::cpx_; *p++=&r6502::sbc_ix; *p++=&r6502::nop2; *p++=&r6502::ill;
*p++=&r6502::cpx_z; *p++=&r6502::sbc_z; *p++=&r6502::inc_z; *p++=&r6502::ill; *p++=&r6502::cpx_z; *p++=&r6502::sbc_z; *p++=&r6502::inc_z; *p++=&r6502::ill;
*p++=&r6502::inx; *p++=&r6502::sbc_; *p++=&r6502::nop; *p++=&r6502::ill; *p++=&r6502::inx; *p++=&r6502::sbc_; *p++=&r6502::nop; *p++=&r6502::ill;
*p++=&r6502::cpx_a; *p++=&r6502::sbc_a; *p++=&r6502::inc_a; *p++=&r6502::ill; *p++=&r6502::cpx_a; *p++=&r6502::sbc_a; *p++=&r6502::inc_a; *p++=&r6502::ill;
*p++=&r6502::beq; *p++=&r6502::sbc_iy; *p++=&r6502::ill; *p++=&r6502::ill; *p++=&r6502::beq; *p++=&r6502::sbc_iy; *p++=&r6502::ill; *p++=&r6502::ill;
*p++=&r6502::nop2; *p++=&r6502::sbc_zx; *p++=&r6502::inc_zx; *p++=&r6502::ill; *p++=&r6502::nop2; *p++=&r6502::sbc_zx; *p++=&r6502::inc_zx; *p++=&r6502::ill;
*p++=&r6502::sed; *p++=&r6502::sbc_ay; *p++=&r6502::nop; *p++=&r6502::ill; *p++=&r6502::sed; *p++=&r6502::sbc_ay; *p++=&r6502::nop; *p++=&r6502::ill;
*p++=&r6502::nop3; *p++=&r6502::sbc_ax; *p++=&r6502::inc_ax; *p++=&r6502::ill; *p++=&r6502::nop3; *p++=&r6502::sbc_ax; *p++=&r6502::inc_ax; *p++=&r6502::ill;
} }

View File

@ -8,6 +8,7 @@ class r6502: public CPU {
public: public:
void raise(int); void raise(int);
void reset(); void reset();
Memory::address step();
Memory::address run(unsigned); Memory::address run(unsigned);
char *status(); char *status();
void checkpoint(Stream &); void checkpoint(Stream &);