From 71a11cce49b79cb4a3b2beef3cc10bf113f4df3a Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 17 May 2020 12:19:20 +0300 Subject: [PATCH] Fix 68000 MOVE write address error stacked PC. --- gencpu.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/gencpu.cpp b/gencpu.cpp index 5531df2c..502a5266 100644 --- a/gencpu.cpp +++ b/gencpu.cpp @@ -3085,9 +3085,21 @@ static void check_address_error(const char *name, int mode, const char *reg, in setapdiback = 1; } + int pcextra = 0; + + // adjust MOVE write address error stacked PC + if (g_instr->mnemo == i_MOVE && getv == 2) { + if (g_instr->smode >= Aind && g_instr->smode != imm && g_instr->dmode == absl) { + pcextra = -2; + } else if (g_instr->dmode >= Ad16) { + pcextra = 0; + } else { + pcextra = 2; + } + } - if (exception_pc_offset || exception_pc_offset_extra) { - incpc("%d", exception_pc_offset + exception_pc_offset_extra); + if (exception_pc_offset + exception_pc_offset_extra + pcextra) { + incpc("%d", exception_pc_offset + exception_pc_offset_extra + pcextra); } if (g_instr->mnemo == i_MOVE) { -- 2.47.3