1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-12-11 18:49:16 +00:00

Add function to dump registers state onto stdout.

This commit is contained in:
Radosław Kujawa 2017-01-27 11:27:14 +01:00
parent 646c7d1905
commit 1f581d3fd3
2 changed files with 49 additions and 0 deletions

View File

@ -82,6 +82,54 @@ rk65c02_step(rk65c02emu_t *e, uint16_t steps) {
i++;
}
}
void
rk65c02_dump_regs(rk65c02emu_t *e)
{
printf("A: %X X: %X Y: %X SP: %X P: ", e->regs.A, e->regs.X, e->regs.Y, e->regs.SP);
if (e->regs.P & P_NEGATIVE)
printf("N");
else
printf("-");
if (e->regs.P & P_SIGN_OVERFLOW)
printf("O");
else
printf("-");
if (e->regs.P & P_UNDEFINED)
printf("1");
else
printf("-");
if (e->regs.P & P_BREAK)
printf("B");
else
printf("-");
if (e->regs.P & P_DECIMAL)
printf("D");
else
printf("-");
if (e->regs.P & P_IRQ_DISABLE)
printf("I");
else
printf("-");
if (e->regs.P & P_ZERO)
printf("Z");
else
printf("-");
if (e->regs.P & P_CARRY)
printf("C");
else
printf("-");
printf("\n");
}
/*
int
main(void)

View File

@ -58,6 +58,7 @@ typedef struct rk65c02emu rk65c02emu_t;
rk65c02emu_t rk65c02_init(bus_t *);
void rk65c02_start(rk65c02emu_t *);
void rk65c02_step(rk65c02emu_t *, uint16_t);
void rk65c02_dump_regs(rk65c02emu_t *);
#endif