Re-adding support for traceback
This commit is contained in:
parent
5170f5e983
commit
f70db77e69
|
@ -262,6 +262,22 @@ loop:
|
||||||
|
|
||||||
if ( clock_count >= clock_limit ) [[unlikely]] goto stop;
|
if ( clock_count >= clock_limit ) [[unlikely]] goto stop;
|
||||||
|
|
||||||
|
// If traceback support is enabled, trigger it here
|
||||||
|
#ifdef _QUICKERNES_ENABLE_TRACEBACK_SUPPORT
|
||||||
|
if (tracecb)
|
||||||
|
{
|
||||||
|
unsigned int scratch[7];
|
||||||
|
scratch[0] = a;
|
||||||
|
scratch[1] = x;
|
||||||
|
scratch[2] = y;
|
||||||
|
scratch[3] = sp;
|
||||||
|
scratch[4] = pc - 1;
|
||||||
|
scratch[5] = status;
|
||||||
|
scratch[6] = opcode;
|
||||||
|
tracecb(scratch);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
clock_count += clock_table [opcode];
|
clock_count += clock_table [opcode];
|
||||||
|
|
||||||
switch ( opcode )
|
switch ( opcode )
|
||||||
|
|
|
@ -14,6 +14,14 @@ typedef unsigned nes_addr_t; // 16-bit address
|
||||||
class Cpu
|
class Cpu
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
void set_tracecb(void (*cb)(unsigned int *data))
|
||||||
|
{
|
||||||
|
tracecb = cb;
|
||||||
|
}
|
||||||
|
|
||||||
|
void (*tracecb)(unsigned int *dest);
|
||||||
|
|
||||||
// NES 6502 registers. *Not* kept updated during a call to run().
|
// NES 6502 registers. *Not* kept updated during a call to run().
|
||||||
struct registers_t
|
struct registers_t
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,8 @@ class Emu
|
||||||
const uint8_t *getHostPixels() const { return emu.ppu.host_pixels; }
|
const uint8_t *getHostPixels() const { return emu.ppu.host_pixels; }
|
||||||
|
|
||||||
int get_joypad_read_count() const { return emu.joypad_read_count; }
|
int get_joypad_read_count() const { return emu.joypad_read_count; }
|
||||||
|
void set_tracecb(void (*cb)(unsigned int *dest)) { emu.set_tracecb(cb); }
|
||||||
|
|
||||||
// Save emulator state variants
|
// Save emulator state variants
|
||||||
void serializeState(jaffarCommon::serializer::Base& serializer) const { emu.serializeState(serializer); }
|
void serializeState(jaffarCommon::serializer::Base& serializer) const { emu.serializeState(serializer); }
|
||||||
void deserializeState(jaffarCommon::deserializer::Base& deserializer) { emu.deserializeState(deserializer); }
|
void deserializeState(jaffarCommon::deserializer::Base& deserializer) { emu.deserializeState(deserializer); }
|
||||||
|
|
Loading…
Reference in New Issue