1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-06-01 05:41:27 +00:00

Add struct with info about reason for stopping emulation.

This commit is contained in:
Radosław Kujawa 2017-01-26 12:52:40 +01:00
parent 13ef3e2d08
commit 941e89173a
3 changed files with 12 additions and 1 deletions

View File

@ -280,6 +280,7 @@ void
emul_stp(rk65c02emu_t *e, void *id, instruction_t *i)
{
e->state = STOPPED;
e->stopreason = STP;
}
/* STA - store accumulator */

View File

@ -45,6 +45,7 @@ rk65c02_start(rk65c02emu_t *e) {
printf("unimplemented opcode %X @ %X\n", i.opcode,
e->regs.PC);
e->state = STOPPED;
e->stopreason = EMUERROR;
}
}
}

View File

@ -6,9 +6,17 @@
typedef enum {
STOPPED,
RUNNING,
STEPPING
STEPPING /* XXX: how to implement? */
} emu_state_t;
typedef enum
STP, /* due to 65C02 STP instruction */
BREAKPOINT, /* due to breakpoint set */
WATCHPOINT, /* due to watchpoint set */
HOST, /* due to host stop function called */
EMUERROR /* due to emulator error */
} emu_stop_reason_t;
struct reg_state {
uint8_t A; /* accumulator */
uint8_t X; /* index X */
@ -41,6 +49,7 @@ struct rk65c02emu {
emu_state_t state;
bus_t *bus;
reg_state_t regs;
emu_stop_reason_t stopreason;
};
typedef struct rk65c02emu rk65c02emu_t;