1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-12-21 08:30:55 +00:00

Refactor the DEC/X/Y tests a bit for clarity

This commit is contained in:
Peter Evans 2018-04-30 21:37:20 -05:00
parent ad4014ced4
commit 635ff624e7

View File

@ -154,14 +154,15 @@ DEFINE_INST(cpy)
*/
DEFINE_INST(dec)
{
oper--;
MOS_CHECK_NZ(oper);
if (cpu->addr_mode == ACC) {
MOS_CHECK_NZ(cpu->A - 1);
cpu->A--;
cpu->A = oper;
return;
}
MOS_CHECK_NZ(oper - 1);
mos6502_set(cpu, cpu->eff_addr, oper - 1);
mos6502_set(cpu, cpu->eff_addr, oper);
}
/*
@ -169,8 +170,9 @@ DEFINE_INST(dec)
*/
DEFINE_INST(dex)
{
MOS_CHECK_NZ(cpu->X - 1);
cpu->X--;
oper--;
MOS_CHECK_NZ(oper);
cpu->X = oper;
}
/*
@ -178,8 +180,9 @@ DEFINE_INST(dex)
*/
DEFINE_INST(dey)
{
MOS_CHECK_NZ(cpu->Y - 1);
cpu->Y--;
oper--;
MOS_CHECK_NZ(oper);
cpu->Y = oper;
}
/*