1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-12-23 22:30:01 +00:00

Add functions to dump stack.

Always useful.
This commit is contained in:
Radosław Kujawa 2017-02-06 23:16:00 +01:00
parent 442c8dc3df
commit 299b7ee7d8
2 changed files with 22 additions and 0 deletions

View File

@ -124,6 +124,27 @@ rk65c02_step(rk65c02emu_t *e, uint16_t steps) {
e->stopreason = STEPPED; e->stopreason = STEPPED;
} }
void
rk65c02_dump_stack(rk65c02emu_t *e, uint8_t n)
{
uint16_t stackaddr;
stackaddr = STACK_END-n;
while (stackaddr <= STACK_END) {
if ((stackaddr == STACK_END-n) || !((stackaddr % 0x10)))
printf("stack %#02x: ", stackaddr);
printf("%#02x ", bus_read_1(e->bus, stackaddr));
stackaddr++;
if (!(stackaddr % 0x10))
printf("\n");
}
}
void void
rk65c02_dump_regs(rk65c02emu_t *e) rk65c02_dump_regs(rk65c02emu_t *e)
{ {

View File

@ -62,6 +62,7 @@ rk65c02emu_t rk65c02_init(bus_t *);
void rk65c02_start(rk65c02emu_t *); void rk65c02_start(rk65c02emu_t *);
void rk65c02_step(rk65c02emu_t *, uint16_t); void rk65c02_step(rk65c02emu_t *, uint16_t);
void rk65c02_dump_regs(rk65c02emu_t *); void rk65c02_dump_regs(rk65c02emu_t *);
void rk65c02_dump_stack(rk65c02emu_t *, uint8_t);
void rk65c02_irq(rk65c02emu_t *e); void rk65c02_irq(rk65c02emu_t *e);
#endif #endif