mirror of
https://github.com/jscrane/r65emu.git
synced 2025-01-03 04:30:38 +00:00
enable dynamic debugging
This commit is contained in:
parent
867760ffd0
commit
3337dd8646
3
cpu.h
3
cpu.h
@ -20,10 +20,13 @@ public:
|
|||||||
virtual void checkpoint(Stream &s) = 0;
|
virtual void checkpoint(Stream &s) = 0;
|
||||||
virtual void restore(Stream &s) = 0;
|
virtual void restore(Stream &s) = 0;
|
||||||
|
|
||||||
|
void debug() { _debug = !_debug; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CPU (Memory *m, jmp_buf *e, statfn s): _memory(m), _err(e), _status(s){}
|
CPU (Memory *m, jmp_buf *e, statfn s): _memory(m), _err(e), _status(s){}
|
||||||
Memory *_memory;
|
Memory *_memory;
|
||||||
jmp_buf *_err;
|
jmp_buf *_err;
|
||||||
statfn _status;
|
statfn _status;
|
||||||
|
bool _debug;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,7 +10,8 @@ Memory::address r6502::run (unsigned clocks) {
|
|||||||
{
|
{
|
||||||
byte op = (*_memory)[PC];
|
byte op = (*_memory)[PC];
|
||||||
#ifdef CPU_DEBUG
|
#ifdef CPU_DEBUG
|
||||||
_status ("%04x: %02x [%02x %02x %02x, %02x]\r", PC, op, A, X, Y, flags());
|
if (_debug)
|
||||||
|
_status ("%04x: %02x [%02x %02x %02x, %02x]\r", PC, op, A, X, Y, flags());
|
||||||
#endif
|
#endif
|
||||||
PC++;
|
PC++;
|
||||||
(this->*_ops[op])();
|
(this->*_ops[op])();
|
||||||
@ -180,6 +181,7 @@ void r6502::ill () {
|
|||||||
|
|
||||||
void r6502::reset ()
|
void r6502::reset ()
|
||||||
{
|
{
|
||||||
|
_debug = false;
|
||||||
P.value = 0;
|
P.value = 0;
|
||||||
P.bits._ = 1;
|
P.bits._ = 1;
|
||||||
P.bits.B = 1;
|
P.bits.B = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user