mirror of
https://github.com/rkujawa/rk65c02.git
synced 2024-12-11 18:49:16 +00:00
Introduce instruction-independent status adjustment functions.
For now only for negative and zero. Also use them in LDA emulation.
This commit is contained in:
parent
5201cfdc87
commit
3bcc7bb096
@ -10,16 +10,8 @@ emul_lda(rk65c02emu_t *e, instruction_t *i)
|
||||
|
||||
e->regs.A = instruction_data_read_1(e, &id, i);
|
||||
|
||||
/* adjust status flags */
|
||||
if (e->regs.A & NEGATIVE)
|
||||
e->regs.P |= P_NEGATIVE;
|
||||
else
|
||||
e->regs.P &= ~P_NEGATIVE;
|
||||
|
||||
if (e->regs.A == 0)
|
||||
e->regs.P |= P_ZERO;
|
||||
else
|
||||
e->regs.P &= ~P_ZERO;
|
||||
instruction_status_adjust_zero(e->regs.A);
|
||||
instruction_status_adjust_negative(e->regs.A);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -144,6 +144,24 @@ instruction_decode(uint8_t opcode)
|
||||
return id;
|
||||
}
|
||||
|
||||
void
|
||||
instruction_status_adjust_zero(rk65c02emu_t *e, uint8_t regval)
|
||||
{
|
||||
if (regval == 0)
|
||||
e->regs.P |= P_ZERO;
|
||||
else
|
||||
e->regs.P &= ~P_ZERO;
|
||||
}
|
||||
|
||||
void
|
||||
instruction_status_adjust_negative(rk65c02emu_t *e, uint8_t regval)
|
||||
{
|
||||
if (regval & NEGATIVE)
|
||||
e->regs.P |= P_NEGATIVE;
|
||||
else
|
||||
e->regs.P &= ~P_NEGATIVE;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
instruction_data_read_1(rk65c02emu_t *e, instrdef_t *id, instruction_t *i)
|
||||
{
|
||||
|
@ -44,6 +44,8 @@ instrdef_t instruction_decode(uint8_t);
|
||||
void instruction_print(instruction_t *);
|
||||
void disassemble(bus_t *, uint16_t);
|
||||
uint8_t instruction_data_read_1(rk65c02emu_t *, instrdef_t *, instruction_t *);
|
||||
void instruction_status_adjust_zero(rk65c02emu_t *, uint8_t);
|
||||
void instruction_status_adjust_negative(rk65c02emu_t *, uint8_t);
|
||||
//void instruction_execute(rk65c02emu_t *, instruction_t *);
|
||||
|
||||
#endif /* _INSTRUCTION_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user