From ea2ca07e94ce14c46f653d1780ccd33715a95627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Fabre?= Date: Fri, 25 Mar 2022 19:15:51 +0100 Subject: m68k: fixed PC increment location on TRAPcc instructions (#9461) --- src/devices/cpu/m68000/m68k_in.lst | 8 ++-- src/devices/cpu/m68000/m68kops.cpp | 86 +++++++++++++------------------------- 2 files changed, 34 insertions(+), 60 deletions(-) diff --git a/src/devices/cpu/m68000/m68k_in.lst b/src/devices/cpu/m68000/m68k_in.lst index 5206d3de1b4..a87fef44540 100644 --- a/src/devices/cpu/m68000/m68k_in.lst +++ b/src/devices/cpu/m68000/m68k_in.lst @@ -7821,10 +7821,12 @@ e5c0 ffc0 roxl w A+-DXWL 01:8 7:14 234fc:5 50fa ffff trapt w . 234fc:6 + m_pc += 2; // increase before else stackframe & return addresses are incorrect m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ 50fb ffff trapt l . 234fc:8 + m_pc += 4; // increase before else stackframe & return addresses are incorrect m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ @@ -7845,18 +7847,16 @@ e5c0 ffc0 roxl w A+-DXWL 01:8 7:14 234fc:5 50fa f0ff trapcc w . 234fc:6 + m_pc += 2; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(M68KMAKE_CC) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 2; } 50fb f0ff trapcc l . 234fc:8 + m_pc += 4; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(M68KMAKE_CC) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 4; } diff --git a/src/devices/cpu/m68000/m68kops.cpp b/src/devices/cpu/m68000/m68kops.cpp index 06b30a61553..e8fbeff2aa6 100644 --- a/src/devices/cpu/m68000/m68kops.cpp +++ b/src/devices/cpu/m68000/m68kops.cpp @@ -30365,12 +30365,14 @@ void m68000_base_device::x50fc_trapt_234fc() } void m68000_base_device::x50fa_trapt_w_234fc() { + m_pc += 2; // increase before else stackframe & return addresses are incorrect m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ } void m68000_base_device::x50fb_trapt_l_234fc() { + m_pc += 4; // increase before else stackframe & return addresses are incorrect m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ @@ -30492,280 +30494,252 @@ void m68000_base_device::x5ffc_traple_234fc() } void m68000_base_device::x52fa_traphi_w_234fc() { + m_pc += 2; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_HI()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 2; } } void m68000_base_device::x53fa_trapls_w_234fc() { + m_pc += 2; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_LS()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 2; } } void m68000_base_device::x54fa_trapcc_w_234fc() { + m_pc += 2; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_CC()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 2; } } void m68000_base_device::x55fa_trapcs_w_234fc() { + m_pc += 2; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_CS()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 2; } } void m68000_base_device::x56fa_trapne_w_234fc() { + m_pc += 2; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_NE()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 2; } } void m68000_base_device::x57fa_trapeq_w_234fc() { + m_pc += 2; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_EQ()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 2; } } void m68000_base_device::x58fa_trapvc_w_234fc() { + m_pc += 2; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_VC()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 2; } } void m68000_base_device::x59fa_trapvs_w_234fc() { + m_pc += 2; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_VS()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 2; } } void m68000_base_device::x5afa_trappl_w_234fc() { + m_pc += 2; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_PL()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 2; } } void m68000_base_device::x5bfa_trapmi_w_234fc() { + m_pc += 2; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_MI()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 2; } } void m68000_base_device::x5cfa_trapge_w_234fc() { + m_pc += 2; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_GE()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 2; } } void m68000_base_device::x5dfa_traplt_w_234fc() { + m_pc += 2; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_LT()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 2; } } void m68000_base_device::x5efa_trapgt_w_234fc() { + m_pc += 2; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_GT()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 2; } } void m68000_base_device::x5ffa_traple_w_234fc() { + m_pc += 2; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_LE()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 2; } } void m68000_base_device::x52fb_traphi_l_234fc() { + m_pc += 4; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_HI()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 4; } } void m68000_base_device::x53fb_trapls_l_234fc() { + m_pc += 4; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_LS()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 4; } } void m68000_base_device::x54fb_trapcc_l_234fc() { + m_pc += 4; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_CC()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 4; } } void m68000_base_device::x55fb_trapcs_l_234fc() { + m_pc += 4; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_CS()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 4; } } void m68000_base_device::x56fb_trapne_l_234fc() { + m_pc += 4; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_NE()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 4; } } void m68000_base_device::x57fb_trapeq_l_234fc() { + m_pc += 4; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_EQ()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 4; } } void m68000_base_device::x58fb_trapvc_l_234fc() { + m_pc += 4; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_VC()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 4; } } void m68000_base_device::x59fb_trapvs_l_234fc() { + m_pc += 4; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_VS()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 4; } } void m68000_base_device::x5afb_trappl_l_234fc() { + m_pc += 4; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_PL()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 4; } } void m68000_base_device::x5bfb_trapmi_l_234fc() { + m_pc += 4; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_MI()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 4; } } void m68000_base_device::x5cfb_trapge_l_234fc() { + m_pc += 4; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_GE()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 4; } } void m68000_base_device::x5dfb_traplt_l_234fc() { + m_pc += 4; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_LT()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 4; } } void m68000_base_device::x5efb_trapgt_l_234fc() { + m_pc += 4; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_GT()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 4; } } void m68000_base_device::x5ffb_traple_l_234fc() { + m_pc += 4; /* increase _before_ calling handler or 1) stackframe is incorrect 2) RTE address is wrong if trap is taken */ if(COND_LE()) { m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - } else { - m_pc += 4; } -- cgit v1.2.3