Skip to content

Commit b97c9c8

Browse files
author
Adam
committed
- when doing prefetch, we need to save/restore DA just as we do for regular instr fetch.
1 parent f74a066 commit b97c9c8

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/devices/cpu/m68000/m68kcpu.h

+19-2
Original file line numberDiff line numberDiff line change
@@ -604,11 +604,28 @@ inline u32 m68ki_read_imm_16()
604604
result = MASK_OUT_ABOVE_16(m_pref_data);
605605
m_pc += 2;
606606
if (!m_mmu_tmp_buserror_occurred) {
607+
608+
u32 tmp_dar[16];
609+
for (int i = 15; i >= 0; i--)
610+
{
611+
tmp_dar[i] = REG_DA()[i];
612+
}
613+
607614
// prefetch only if no bus error occurred in opcode fetch
608615
m_pref_data = m68ki_ic_readimm16(m_pc);
609616
m_pref_addr = m_mmu_tmp_buserror_occurred ? ~0 : m_pc;
610-
// ignore bus error on prefetch
611-
//AB m_mmu_tmp_buserror_occurred = 0;
617+
618+
// restore cpu address registers to value at start of instruction
619+
if (m_mmu_tmp_buserror_occurred)
620+
for (int i = 15; i >= 0; i--)
621+
{
622+
if (REG_DA()[i] != tmp_dar[i])
623+
{
624+
REG_DA()[i] = tmp_dar[i];
625+
}
626+
}
627+
628+
612629
}
613630

614631
return result;

0 commit comments

Comments
 (0)