1
0
mirror of https://github.com/cc65/cc65.git synced 2025-04-08 19:38:55 +00:00

CPU registers can be accessed from outside 6502.c.

The linkage of the 'Regs' variable in 6502.c was changed from static
to extern. This makes the Regs type visible (and even alterable) from
the outside.

This change helps tools to inspect the CPU state. In particular, it
was implemented to facilitate a tool that verifies opcode
functionality using the '65x02' testsuite. But the change is also
potentially useful for e.g. an online debugger that wants to inspect
the CPU state while the 6502 is neing simulated.
This commit is contained in:
Sidney Cadot 2024-12-16 17:12:07 +01:00
parent a53524b9de
commit 86ccf25e81
2 changed files with 4 additions and 1 deletions

View File

@ -391,7 +391,7 @@ CPUType CPU;
typedef void (*OPFunc) (void);
/* The CPU registers */
static CPURegs Regs;
CPURegs Regs;
/* Cycles for the current insn */
static unsigned Cycles;

View File

@ -65,6 +65,9 @@ struct CPURegs {
unsigned PC; /* Program counter */
};
/* Current CPU registers */
extern CPURegs Regs;
/* Status register bits */
#define CF 0x01 /* Carry flag */
#define ZF 0x02 /* Zero flag */