From 3f31edc0d3debaf92750b0631debd479431b3203 Mon Sep 17 00:00:00 2001 From: Peter Kooiman Date: Fri, 28 Jun 2024 17:01:02 +0200 Subject: [PATCH 1/2] Fix Multibus diagnostic error with minor change in Musashi --- Musashi/m68kcpu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Musashi/m68kcpu.h b/Musashi/m68kcpu.h index cf242d4..c22bbca 100644 --- a/Musashi/m68kcpu.h +++ b/Musashi/m68kcpu.h @@ -1996,6 +1996,7 @@ static inline void m68ki_exception_bus_error(void) m68ki_jump_vector(EXCEPTION_BUS_ERROR); CPU_RUN_MODE = RUN_MODE_BERR_AERR_RESET; + FLAG_INT_MASK = 0x0700; longjmp(m68ki_bus_error_jmp_buf, 1); } From 6c81416f57d26eec04aa571064483dac8a779667 Mon Sep 17 00:00:00 2001 From: Peter Kooiman Date: Fri, 28 Jun 2024 19:42:42 +0200 Subject: [PATCH 2/2] Now fix it the right way.. no MBUS error interrupt on diag reads --- Musashi/m68kcpu.h | 2 +- csr.c | 3 ++- mbus.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Musashi/m68kcpu.h b/Musashi/m68kcpu.h index c22bbca..5489c64 100644 --- a/Musashi/m68kcpu.h +++ b/Musashi/m68kcpu.h @@ -1996,7 +1996,7 @@ static inline void m68ki_exception_bus_error(void) m68ki_jump_vector(EXCEPTION_BUS_ERROR); CPU_RUN_MODE = RUN_MODE_BERR_AERR_RESET; - FLAG_INT_MASK = 0x0700; + longjmp(m68ki_bus_error_jmp_buf, 1); } diff --git a/csr.c b/csr.c index 78f30de..19058b2 100644 --- a/csr.c +++ b/csr.c @@ -146,7 +146,8 @@ void csr_set_access_error(csr_t *csr, int cpu, int type, int addr, int is_write) if (type&ACCESS_ERROR_MBTO) { v|=ERR_MBTO; if (emu_get_mb_diag()) { - emu_raise_int(INT_VECT_MB_IF_ERR, INT_LEVEL_MB_IF_ERR, 1); + if (is_write) + emu_raise_int(INT_VECT_MB_IF_ERR, INT_LEVEL_MB_IF_ERR, 1); csr->reg[CSR_I_MBERR/2]=(addr>>11)&0xfe; if (!is_write) csr->reg[CSR_I_MBERR/2]|=0x1; } diff --git a/mbus.c b/mbus.c index 9c89df5..804df78 100644 --- a/mbus.c +++ b/mbus.c @@ -63,7 +63,7 @@ unsigned int mbus_read8(void *obj, unsigned int a) { MBUS_LOG_DEBUG("MBUS: rb %x->%x\n", a, a+0x780000); if (!emu_get_mb_diag()) return 0; //Mbus in diag modes errors with a MBTO. - emu_mbus_error(a|EMU_MBUS_BUSERROR); + emu_mbus_error(a|EMU_MBUS_ERROR_READ|EMU_MBUS_BUSERROR); return 0; } @@ -71,7 +71,7 @@ unsigned int mbus_read16(void *obj, unsigned int a) { MBUS_LOG_DEBUG("MBUS: rw %x->%x\n", a, a+0x780000); if (!emu_get_mb_diag()) return 0; //Mbus in diag modes errors with a MBTO. - emu_mbus_error(a|EMU_MBUS_BUSERROR); + emu_mbus_error(a|EMU_MBUS_ERROR_READ|EMU_MBUS_BUSERROR); return 0; }