1
0
mirror of https://github.com/jscrane/r65emu.git synced 2024-12-21 12:29:51 +00:00

enable dynamic debugging

This commit is contained in:
Stephen Crane 2014-10-31 08:18:15 +00:00
parent 867760ffd0
commit 3337dd8646
2 changed files with 6 additions and 1 deletions

3
cpu.h
View File

@ -20,10 +20,13 @@ public:
virtual void checkpoint(Stream &s) = 0;
virtual void restore(Stream &s) = 0;
void debug() { _debug = !_debug; }
protected:
CPU (Memory *m, jmp_buf *e, statfn s): _memory(m), _err(e), _status(s){}
Memory *_memory;
jmp_buf *_err;
statfn _status;
bool _debug;
};
#endif

View File

@ -10,6 +10,7 @@ Memory::address r6502::run (unsigned clocks) {
{
byte op = (*_memory)[PC];
#ifdef CPU_DEBUG
if (_debug)
_status ("%04x: %02x [%02x %02x %02x, %02x]\r", PC, op, A, X, Y, flags());
#endif
PC++;
@ -180,6 +181,7 @@ void r6502::ill () {
void r6502::reset ()
{
_debug = false;
P.value = 0;
P.bits._ = 1;
P.bits.B = 1;