From 288b39709805d80ce91c09c4f0af12fa1972f948 Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 8 Feb 2020 16:47:53 -0500 Subject: m68k: allow RTE to unwind type 1000 (68010 bus error) stack frames [R. Belmont] --- src/devices/cpu/m68000/m68k_in.lst | 34 ++++++++++++++++++++++++++++++---- src/devices/cpu/m68000/m68kops.cpp | 34 ++++++++++++++++++++++++++++++---- 2 files changed, 60 insertions(+), 8 deletions(-) diff --git a/src/devices/cpu/m68000/m68k_in.lst b/src/devices/cpu/m68000/m68k_in.lst index 94961a37451..78583dc144d 100644 --- a/src/devices/cpu/m68000/m68k_in.lst +++ b/src/devices/cpu/m68000/m68k_in.lst @@ -6886,10 +6886,36 @@ e5c0 ffc0 roxl w A+-DXWL 01:8 7:14 234fc:5 m_instr_mode = INSTRUCTION_YES; m_run_mode = RUN_MODE_NORMAL; } else { - m_instr_mode = INSTRUCTION_YES; - m_run_mode = RUN_MODE_NORMAL; - /* Not handling bus fault (9) */ - m68ki_exception_format_error(); + if (format_word == 0x8) /* type 1000 stack frame */ + { + new_sr = m68ki_pull_16(); + new_pc = m68ki_pull_32(); + m68ki_fake_pull_16(); /* format word */ + m68ki_jump(new_pc); + m68ki_set_sr(new_sr); + m_instr_mode = INSTRUCTION_YES; + m_run_mode = RUN_MODE_NORMAL; + m68ki_fake_pull_16(); /* special status */ + m68ki_fake_pull_32(); /* fault address */ + m68ki_fake_pull_32(); /* reserved and data output buffer */ + m68ki_fake_pull_32(); /* reserved and data input buffer */ + m68ki_fake_pull_32(); /* reserved and instruction input buffer */ + m68ki_fake_pull_32(); /* 8 dwords of CPU specific undocumented data */ + m68ki_fake_pull_32(); + m68ki_fake_pull_32(); + m68ki_fake_pull_32(); + m68ki_fake_pull_32(); + m68ki_fake_pull_32(); + m68ki_fake_pull_32(); + m68ki_fake_pull_32(); + } + else + { + m_instr_mode = INSTRUCTION_YES; + m_run_mode = RUN_MODE_NORMAL; + /* Not handling bus fault (9) */ + m68ki_exception_format_error(); + } } } else { m68ki_exception_privilege_violation(); diff --git a/src/devices/cpu/m68000/m68kops.cpp b/src/devices/cpu/m68000/m68kops.cpp index 3d767be723a..9413f9a6271 100644 --- a/src/devices/cpu/m68000/m68kops.cpp +++ b/src/devices/cpu/m68000/m68kops.cpp @@ -26542,10 +26542,36 @@ void m68000_base_device::x4e73_rte_l_71() m_instr_mode = INSTRUCTION_YES; m_run_mode = RUN_MODE_NORMAL; } else { - m_instr_mode = INSTRUCTION_YES; - m_run_mode = RUN_MODE_NORMAL; - /* Not handling bus fault (9) */ - m68ki_exception_format_error(); + if (format_word == 0x8) /* type 1000 stack frame */ + { + new_sr = m68ki_pull_16(); + new_pc = m68ki_pull_32(); + m68ki_fake_pull_16(); /* format word */ + m68ki_jump(new_pc); + m68ki_set_sr(new_sr); + m_instr_mode = INSTRUCTION_YES; + m_run_mode = RUN_MODE_NORMAL; + m68ki_fake_pull_16(); /* special status */ + m68ki_fake_pull_32(); /* fault address */ + m68ki_fake_pull_32(); /* reserved and data output buffer */ + m68ki_fake_pull_32(); /* reserved and data input buffer */ + m68ki_fake_pull_32(); /* reserved and instruction input buffer */ + m68ki_fake_pull_32(); /* 8 dwords of CPU specific undocumented data */ + m68ki_fake_pull_32(); + m68ki_fake_pull_32(); + m68ki_fake_pull_32(); + m68ki_fake_pull_32(); + m68ki_fake_pull_32(); + m68ki_fake_pull_32(); + m68ki_fake_pull_32(); + } + else + { + m_instr_mode = INSTRUCTION_YES; + m_run_mode = RUN_MODE_NORMAL; + /* Not handling bus fault (9) */ + m68ki_exception_format_error(); + } } } else { m68ki_exception_privilege_violation(); -- cgit v1.2.3