mirror of
https://github.com/rkujawa/rk65c02.git
synced 2025-01-10 18:29:53 +00:00
Simplify handling ciritcal emulation errors.
This commit is contained in:
parent
68fa918d97
commit
7cf3f263e3
@ -325,8 +325,8 @@ instruction_data_write_1(rk65c02emu_t *e, instrdef_t *id, instruction_t *i, uint
|
||||
* PC which is handled within emulation of a given opcode.
|
||||
*/
|
||||
default:
|
||||
rk65c02_log(LOG_ERROR,
|
||||
"unhandled addressing mode for opcode %x\n", i->opcode);
|
||||
rk65c02_panic(e, "unhandled addressing mode for opcode %x\n",
|
||||
i->opcode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -389,8 +389,8 @@ instruction_data_read_1(rk65c02emu_t *e, instrdef_t *id, instruction_t *i)
|
||||
* PC which is handled within emulation of a given opcode.
|
||||
*/
|
||||
default:
|
||||
rk65c02_log(LOG_ERROR,
|
||||
"unhandled addressing mode for opcode %x\n", i->opcode);
|
||||
rk65c02_panic(e, "unhandled addressing mode for opcode %x\n",
|
||||
i->opcode);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
@ -129,11 +130,8 @@ rk65c02_exec(rk65c02emu_t *e)
|
||||
* maturity, let's catch them here to help iron out the
|
||||
* bugs.
|
||||
*/
|
||||
rk65c02_log(LOG_WARN, "invalid opcode %X @ %X\n",
|
||||
rk65c02_panic(e, "invalid opcode %X @ %X\n",
|
||||
i.opcode, e->regs.PC);
|
||||
|
||||
e->state = STOPPED;
|
||||
e->stopreason = EMUERROR;
|
||||
}
|
||||
|
||||
if (e->trace)
|
||||
@ -235,6 +233,22 @@ rk65c02_regs_string_get(reg_state_t regs)
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
void
|
||||
rk65c02_panic(rk65c02emu_t *e, const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
rk65c02_log(LOG_CRIT, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
e->state = STOPPED;
|
||||
e->stopreason = EMUERROR;
|
||||
|
||||
/* TODO: run some UI callback. */
|
||||
}
|
||||
|
||||
/*
|
||||
int
|
||||
main(void)
|
||||
|
@ -82,7 +82,8 @@ void rk65c02_step(rk65c02emu_t *, uint16_t);
|
||||
char *rk65c02_regs_string_get(reg_state_t);
|
||||
void rk65c02_dump_regs(reg_state_t);
|
||||
void rk65c02_dump_stack(rk65c02emu_t *, uint8_t);
|
||||
void rk65c02_irq(rk65c02emu_t *e);
|
||||
void rk65c02_irq(rk65c02emu_t *);
|
||||
void rk65c02_panic(rk65c02emu_t *, const char*, ...);
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user