This commit is contained in:
Stephen Crane 2014-12-10 12:02:47 +00:00
parent fab9afb6b9
commit 50110b3525
5 changed files with 11 additions and 11 deletions

4
cpu.h
View File

@ -20,9 +20,9 @@ public:
void debug() { _debug = !_debug; }
protected:
CPU (Memory &mem, jmp_buf *e, statfn s): _mem(mem), _err(e), _status(s){}
CPU (Memory &mem, jmp_buf &e, statfn s): _mem(mem), _err(e), _status(s), _debug(false) {}
Memory &_mem;
jmp_buf *_err;
jmp_buf &_err;
statfn _status;
bool _debug;
};

View File

@ -95,7 +95,7 @@ void i8080::daa() {
void i8080::hlt() {
_status("CPU halted at %04x\r%s", (PC-1), status());
longjmp(*_err, 1);
longjmp(_err, 1);
}
int i8080::parity_table[] = {
@ -117,7 +117,7 @@ int i8080::parity_table[] = {
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
};
i8080::i8080(Memory &m, jmp_buf *jb, CPU::statfn s, Ports &d): CPU(m, jb, s)
i8080::i8080(Memory &m, jmp_buf &jb, CPU::statfn s, Ports &d): CPU(m, jb, s)
{
_ports = &d;

View File

@ -13,7 +13,7 @@ public:
virtual byte in(byte p, i8080 *cpu) =0;
};
i8080(Memory &, jmp_buf *, CPU::statfn, Ports &);
i8080(Memory &, jmp_buf &, CPU::statfn, Ports &);
void run(unsigned);
void reset();

View File

@ -184,12 +184,12 @@ void r6502::sbcd (byte d) {
// V not tested for: http://www.6502.org/tutorials/decimal_mode.html
}
void r6502::ill () {
_status ("Illegal instruction at %04x!\r\n%s", (PC-1), status());
longjmp (*_err, 1);
void r6502::ill() {
_status("Illegal instruction at %04x!\r\n%s", (PC-1), status());
longjmp(_err, 1);
}
void r6502::reset ()
void r6502::reset()
{
_debug = false;
P.value = 0;
@ -200,7 +200,7 @@ void r6502::reset ()
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++) {
_fromBCD[i] = ((i >> 4) & 0x0f)*10 + (i & 0x0f);

View File

@ -13,7 +13,7 @@ public:
void checkpoint(Stream &);
void restore(Stream &);
r6502 (Memory &, jmp_buf *, CPU::statfn);
r6502 (Memory &, jmp_buf &, CPU::statfn);
private:
/* registers */
Memory::address PC;