65C02 opcode timing and bus usage corrections

- BBR and BBS use one or two extra cycles when the branch is taken, like other conditional branches
- TRB and TSB perform an extra read of the operand instead of an extra write
This commit is contained in:
AJR 2019-11-15 15:35:10 -05:00
parent c9a6c7ff4d
commit df14344669

View File

@ -163,6 +163,10 @@ bbr_zpb
read(TMP);
TMP = read_pc();
if(!(TMP2 & (1 << ((inst_state >> 4) & 7)))) {
read_pc_noinc();
if(page_changing(PC, int8_t(TMP))) {
read_arg(set_l(PC, PC+int8_t(TMP)));
}
PC += int8_t(TMP);
}
prefetch();
@ -173,6 +177,10 @@ bbs_zpb
read(TMP);
TMP = read_pc();
if(TMP2 & (1 << ((inst_state >> 4) & 7))) {
read_pc_noinc();
if(page_changing(PC, int8_t(TMP))) {
read_arg(set_l(PC, PC+int8_t(TMP)));
}
PC += int8_t(TMP);
}
prefetch();
@ -709,7 +717,7 @@ trb_aba
TMP = read_pc();
TMP = set_h(TMP, read_pc());
TMP2 = read(TMP);
write(TMP, TMP2);
read(TMP);
if(A & TMP2)
P &= ~F_Z;
else
@ -721,7 +729,7 @@ trb_aba
trb_zpg
TMP = read_pc();
TMP2 = read(TMP);
write(TMP, TMP2);
read(TMP);
if(A & TMP2)
P &= ~F_Z;
else
@ -734,7 +742,7 @@ tsb_aba
TMP = read_pc();
TMP = set_h(TMP, read_pc());
TMP2 = read(TMP);
write(TMP, TMP2);
read(TMP);
if(A & TMP2)
P &= ~F_Z;
else
@ -746,7 +754,7 @@ tsb_aba
tsb_zpg
TMP = read_pc();
TMP2 = read(TMP);
write(TMP, TMP2);
read(TMP);
if(A & TMP2)
P &= ~F_Z;
else