1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2025-01-26 19:30:12 +00:00

Unbreak BBR and BBS - they access zero page, don't act like immediate.

This commit is contained in:
Radosław Kujawa 2017-02-13 18:39:51 +01:00
parent 8de5574aab
commit c23136800a

View File

@ -124,8 +124,12 @@ emul_asl(rk65c02emu_t *e, void *id, instruction_t *i)
static void static void
emul_bbr(rk65c02emu_t *e, void *id, instruction_t *i, uint8_t bit) emul_bbr(rk65c02emu_t *e, void *id, instruction_t *i, uint8_t bit)
{ {
uint8_t val;
val = instruction_data_read_1(e, (instrdef_t *) id, i);
/* is bit is clear then branch */ /* is bit is clear then branch */
if (!(BIT(i->op1, bit))) if (!(BIT(val, bit)))
program_counter_branch(e, (int8_t) i->op2); program_counter_branch(e, (int8_t) i->op2);
else else
program_counter_increment(e, id); program_counter_increment(e, id);
@ -176,8 +180,12 @@ emul_bbr7(rk65c02emu_t *e, void *id, instruction_t *i)
static void static void
emul_bbs(rk65c02emu_t *e, void *id, instruction_t *i, uint8_t bit) emul_bbs(rk65c02emu_t *e, void *id, instruction_t *i, uint8_t bit)
{ {
uint8_t val;
val = instruction_data_read_1(e, (instrdef_t *) id, i);
/* is bit is set then branch */ /* is bit is set then branch */
if (BIT(i->op1, bit)) if (BIT(val, bit))
program_counter_branch(e, (int8_t) i->op2); program_counter_branch(e, (int8_t) i->op2);
else else
program_counter_increment(e, id); program_counter_increment(e, id);