From: Toni Wilen Date: Sat, 23 Mar 2024 10:00:06 +0000 (+0200) Subject: JMP/JSR bus error fix X-Git-Tag: 5300~70 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=2dee58aa371452a51ba2c5adf4d47f14ece8b557;p=francis%2Fwinuae.git JMP/JSR bus error fix --- diff --git a/cpuemu_11.cpp b/cpuemu_11.cpp index 16519a2b..4e9d12c2 100644 --- a/cpuemu_11.cpp +++ b/cpuemu_11.cpp @@ -42743,7 +42743,7 @@ uae_u32 REGPARAM2 op_4e90_11_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return 4 * CYCLE_UNIT / 2 + count_cycles; } @@ -42805,7 +42805,7 @@ uae_u32 REGPARAM2 op_4ea8_11_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return 6 * CYCLE_UNIT / 2 + count_cycles; } @@ -42873,7 +42873,7 @@ uae_u32 REGPARAM2 op_4eb0_11_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return 10 * CYCLE_UNIT / 2 + count_cycles; } @@ -42933,7 +42933,7 @@ uae_u32 REGPARAM2 op_4eb8_11_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return 6 * CYCLE_UNIT / 2 + count_cycles; } @@ -42998,7 +42998,7 @@ uae_u32 REGPARAM2 op_4eb9_11_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 6; + pcoffset = (oldpc - srca) + 6; exception2_fetch_opcode(opcode, 0, pcoffset); return 8 * CYCLE_UNIT / 2 + count_cycles; } @@ -43059,7 +43059,7 @@ uae_u32 REGPARAM2 op_4eba_11_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return 6 * CYCLE_UNIT / 2 + count_cycles; } @@ -43126,7 +43126,7 @@ uae_u32 REGPARAM2 op_4ebb_11_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return 10 * CYCLE_UNIT / 2 + count_cycles; } @@ -43186,7 +43186,7 @@ uae_u32 REGPARAM2 op_4ed0_11_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return 4 * CYCLE_UNIT / 2 + count_cycles; } @@ -43222,7 +43222,7 @@ uae_u32 REGPARAM2 op_4ee8_11_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return 6 * CYCLE_UNIT / 2 + count_cycles; } @@ -43263,7 +43263,7 @@ uae_u32 REGPARAM2 op_4ef0_11_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return 10 * CYCLE_UNIT / 2 + count_cycles; } @@ -43297,7 +43297,7 @@ uae_u32 REGPARAM2 op_4ef8_11_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return 6 * CYCLE_UNIT / 2 + count_cycles; } @@ -43336,7 +43336,7 @@ uae_u32 REGPARAM2 op_4ef9_11_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return 8 * CYCLE_UNIT / 2 + count_cycles; } @@ -43371,7 +43371,7 @@ uae_u32 REGPARAM2 op_4efa_11_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return 6 * CYCLE_UNIT / 2 + count_cycles; } @@ -43411,7 +43411,7 @@ uae_u32 REGPARAM2 op_4efb_11_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return 10 * CYCLE_UNIT / 2 + count_cycles; } @@ -122336,7 +122336,7 @@ uae_u32 REGPARAM2 op_4e90_12_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return 4 * CYCLE_UNIT / 2 + count_cycles; } @@ -122398,7 +122398,7 @@ uae_u32 REGPARAM2 op_4ea8_12_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return 6 * CYCLE_UNIT / 2 + count_cycles; } @@ -122467,7 +122467,7 @@ uae_u32 REGPARAM2 op_4eb0_12_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return 10 * CYCLE_UNIT / 2 + count_cycles; } @@ -122528,7 +122528,7 @@ uae_u32 REGPARAM2 op_4eb8_12_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return 6 * CYCLE_UNIT / 2 + count_cycles; } @@ -122594,7 +122594,7 @@ uae_u32 REGPARAM2 op_4eb9_12_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 6; + pcoffset = (oldpc - srca) + 6; exception2_fetch_opcode(opcode, 0, pcoffset); return 8 * CYCLE_UNIT / 2 + count_cycles; } @@ -122656,7 +122656,7 @@ uae_u32 REGPARAM2 op_4eba_12_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return 6 * CYCLE_UNIT / 2 + count_cycles; } @@ -122724,7 +122724,7 @@ uae_u32 REGPARAM2 op_4ebb_12_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return 10 * CYCLE_UNIT / 2 + count_cycles; } @@ -122785,7 +122785,7 @@ uae_u32 REGPARAM2 op_4ed0_12_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return 4 * CYCLE_UNIT / 2 + count_cycles; } @@ -122821,7 +122821,7 @@ uae_u32 REGPARAM2 op_4ee8_12_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return 6 * CYCLE_UNIT / 2 + count_cycles; } @@ -122863,7 +122863,7 @@ uae_u32 REGPARAM2 op_4ef0_12_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return 10 * CYCLE_UNIT / 2 + count_cycles; } @@ -122898,7 +122898,7 @@ uae_u32 REGPARAM2 op_4ef8_12_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return 6 * CYCLE_UNIT / 2 + count_cycles; } @@ -122938,7 +122938,7 @@ uae_u32 REGPARAM2 op_4ef9_12_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return 8 * CYCLE_UNIT / 2 + count_cycles; } @@ -122974,7 +122974,7 @@ uae_u32 REGPARAM2 op_4efa_12_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return 6 * CYCLE_UNIT / 2 + count_cycles; } @@ -123015,7 +123015,7 @@ uae_u32 REGPARAM2 op_4efb_12_ff(uae_u32 opcode) get_word_000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return 10 * CYCLE_UNIT / 2 + count_cycles; } diff --git a/cpuemu_13.cpp b/cpuemu_13.cpp index 1d4e926c..0f3400e9 100644 --- a/cpuemu_13.cpp +++ b/cpuemu_13.cpp @@ -42969,7 +42969,7 @@ void REGPARAM2 op_4e90_13_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -43032,7 +43032,7 @@ void REGPARAM2 op_4ea8_13_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -43101,7 +43101,7 @@ void REGPARAM2 op_4eb0_13_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -43162,7 +43162,7 @@ void REGPARAM2 op_4eb8_13_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -43227,7 +43227,7 @@ void REGPARAM2 op_4eb9_13_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 6; + pcoffset = (oldpc - srca) + 6; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -43289,7 +43289,7 @@ void REGPARAM2 op_4eba_13_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -43357,7 +43357,7 @@ void REGPARAM2 op_4ebb_13_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -43417,7 +43417,7 @@ void REGPARAM2 op_4ed0_13_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -43454,7 +43454,7 @@ void REGPARAM2 op_4ee8_13_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -43496,7 +43496,7 @@ void REGPARAM2 op_4ef0_13_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -43531,7 +43531,7 @@ void REGPARAM2 op_4ef8_13_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -43570,7 +43570,7 @@ void REGPARAM2 op_4ef9_13_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -43606,7 +43606,7 @@ void REGPARAM2 op_4efa_13_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -43647,7 +43647,7 @@ void REGPARAM2 op_4efb_13_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -123542,7 +123542,7 @@ void REGPARAM2 op_4e90_14_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -123605,7 +123605,7 @@ void REGPARAM2 op_4ea8_14_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -123675,7 +123675,7 @@ void REGPARAM2 op_4eb0_14_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -123737,7 +123737,7 @@ void REGPARAM2 op_4eb8_14_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -123803,7 +123803,7 @@ void REGPARAM2 op_4eb9_14_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 6; + pcoffset = (oldpc - srca) + 6; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -123866,7 +123866,7 @@ void REGPARAM2 op_4eba_14_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -123935,7 +123935,7 @@ void REGPARAM2 op_4ebb_14_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 4; + pcoffset = (oldpc - srca) + 4; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -123996,7 +123996,7 @@ void REGPARAM2 op_4ed0_14_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -124033,7 +124033,7 @@ void REGPARAM2 op_4ee8_14_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -124076,7 +124076,7 @@ void REGPARAM2 op_4ef0_14_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -124112,7 +124112,7 @@ void REGPARAM2 op_4ef8_14_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -124152,7 +124152,7 @@ void REGPARAM2 op_4ef9_14_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -124189,7 +124189,7 @@ void REGPARAM2 op_4efa_14_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return; } @@ -124231,7 +124231,7 @@ void REGPARAM2 op_4efb_14_ff(uae_u32 opcode) get_word_ce000_prefetch(0); if(hardware_bus_error) { int pcoffset = 0; - pcoffset = oldpc + 2; + pcoffset = (oldpc - srca) + 2; exception2_fetch_opcode(opcode, 0, pcoffset); return; } diff --git a/gencpu.cpp b/gencpu.cpp index 5fe680da..ecbf2c64 100644 --- a/gencpu.cpp +++ b/gencpu.cpp @@ -7573,11 +7573,11 @@ static void gen_opcode (unsigned int opcode) } if (curi->smode == absl) { - sprintf(bus_error_code, "pcoffset = oldpc + 6;\n"); + sprintf(bus_error_code, "pcoffset = (oldpc - srca) + 6;\n"); } else if (curi->smode == Ad8r || curi->smode == PC8r || curi->smode == Ad16 || curi->smode == PC16 || curi->smode == absw) { - sprintf(bus_error_code, "pcoffset = oldpc + 4;\n"); + sprintf(bus_error_code, "pcoffset = (oldpc - srca) + 4;\n"); } else { - sprintf(bus_error_code, "pcoffset = oldpc + 2;\n"); + sprintf(bus_error_code, "pcoffset = (oldpc - srca) + 2;\n"); } fill_prefetch_1(0); bus_error_code[0] = 0; @@ -7679,7 +7679,7 @@ static void gen_opcode (unsigned int opcode) if (using_prefetch || using_ce) { out("%s(%d);\n", prefetch_word, 0); count_readw++; - sprintf(bus_error_code, "pcoffset = oldpc + 2;\n"); + sprintf(bus_error_code, "pcoffset = (oldpc - srca) + 2;\n"); check_prefetch_bus_error(-1, -1, 0); bus_error_code[0] = 0; irc2ir();