From 79bd0e7582c26b6bbc1eaf3b56e7bb47c854e69a Mon Sep 17 00:00:00 2001 From: ekeeke Date: Mon, 5 Feb 2024 23:28:18 +0100 Subject: [PATCH] [Core/CD] improved Main-CPU & Sub-CPU idle loop detection (fixes cases where ADDQ instruction is used in tight counter incrementing loop) --- core/m68k/m68kops.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/m68k/m68kops.h b/core/m68k/m68kops.h index a3db558..f8e2b87 100644 --- a/core/m68k/m68kops.h +++ b/core/m68k/m68kops.h @@ -1868,6 +1868,9 @@ static void m68k_op_addq_8_d(void) FLAG_Z = MASK_OUT_ABOVE_8(res); *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + + /* reset idle loop detection (fixes cases where instruction is used in tight counter incrementing loop) */ + m68ki_cpu.poll.detected = 0; } @@ -2028,6 +2031,9 @@ static void m68k_op_addq_16_d(void) FLAG_Z = MASK_OUT_ABOVE_16(res); *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + + /* reset idle loop detection (fixes cases where instruction is used in tight counter incrementing loop) */ + m68ki_cpu.poll.detected = 0; } @@ -2164,6 +2170,9 @@ static void m68k_op_addq_32_d(void) FLAG_Z = MASK_OUT_ABOVE_32(res); *r_dst = FLAG_Z; + + /* reset idle loop detection (fixes cases where instruction is used in tight counter incrementing loop) */ + m68ki_cpu.poll.detected = 0; }