1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-11-27 20:51:17 +00:00

Carry is set by left- or right-most bits

Don't rely on modify_status() to get it right.
This commit is contained in:
Peter Evans 2018-01-21 16:21:15 -06:00
parent 3206332a7d
commit d119854631

View File

@ -142,11 +142,13 @@ DEFINE_INST(rol)
carry = 1;
}
cpu->P &= ~MOS_CARRY;
if (carry) {
result |= 0x01;
cpu->P |= MOS_CARRY;
}
mos6502_modify_status(cpu, MOS_NZC, oper, result);
mos6502_modify_status(cpu, MOS_NZ, oper, result);
if (cpu->eff_addr) {
mos6502_set(cpu, cpu->eff_addr, result & 0xff);
@ -168,11 +170,13 @@ DEFINE_INST(ror)
carry = 1;
}
cpu->P &= ~MOS_CARRY;
if (carry) {
result |= 0x80;
cpu->P |= MOS_CARRY;
}
mos6502_modify_status(cpu, MOS_NZC, oper, result);
mos6502_modify_status(cpu, MOS_NZ, oper, result);
if (cpu->eff_addr) {
mos6502_set(cpu, cpu->eff_addr, result & 0xff);