From: Toni Wilen Date: Mon, 27 Sep 2021 17:44:25 +0000 (+0300) Subject: RESET special case X-Git-Tag: 4900~62 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=717e10f7966286a8b0970e783b99b6cf1db0e0bb;p=francis%2Fwinuae.git RESET special case --- diff --git a/cpuboard.cpp b/cpuboard.cpp index 2ab3c5e8..2575c522 100644 --- a/cpuboard.cpp +++ b/cpuboard.cpp @@ -1721,6 +1721,14 @@ void cpuboard_map(void) } } +bool cpuboard_forced_hardreset(void) +{ + if (is_blizzardppc(&currprefs)) { + return true; + } + return false; +} + void cpuboard_reset(int hardreset) { #if 0 @@ -1743,6 +1751,7 @@ void cpuboard_reset(int hardreset) } if (hardreset || is_keyboardreset()) a2630_io = 0; + flash_unlocked = 0; cpuboard_non_byte_ea = false; diff --git a/gencpu.cpp b/gencpu.cpp index 180d97a9..df66b895 100644 --- a/gencpu.cpp +++ b/gencpu.cpp @@ -6599,8 +6599,11 @@ static void gen_opcode (unsigned int opcode) next_level_000(); break; case i_RESET: - out("cpureset();\n"); + out("bool r = cpureset();\n"); addcycles000(128); + out("if (r) {\n"); + write_return_cycles(0); + out("}\n"); fill_prefetch_next_t(); break; case i_NOP: diff --git a/include/cpuboard.h b/include/cpuboard.h index 20da0bf5..9f26ea7e 100644 --- a/include/cpuboard.h +++ b/include/cpuboard.h @@ -23,6 +23,7 @@ void cpuboard_setboard(struct uae_prefs *p, int type, int subtype); uaecptr cpuboard_get_reset_pc(uaecptr *stack); void cpuboard_set_flash_unlocked(bool unlocked); void cpuboard_set_cpu(struct uae_prefs *p); +bool cpuboard_forced_hardreset(void); bool ppc_interrupt(int new_m68k_ipl); diff --git a/include/newcpu.h b/include/newcpu.h index ada5c7a8..9588f89f 100644 --- a/include/newcpu.h +++ b/include/newcpu.h @@ -759,7 +759,7 @@ extern void exception2_write(uae_u32 opcode, uaecptr addr, int size, uae_u32 val extern void exception2_fetch_opcode(uae_u32 opcode, int offset, int pcoffset); extern void exception2_fetch(uae_u32 opcode, int offset, int pcoffset); extern void m68k_reset (void); -extern void cpureset (void); +extern bool cpureset (void); extern void cpu_halt (int id); extern int cpu_sleep_millis(int ms); extern void cpu_change(int newmodel); diff --git a/newcpu.cpp b/newcpu.cpp index 824f3472..bce60a14 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -7536,21 +7536,27 @@ void exception2_fetch(uae_u32 opcode, int offset, int pcoffset) } -void cpureset (void) +bool cpureset (void) { /* RESET hasn't increased PC yet, 1 word offset */ uaecptr pc; uaecptr ksboot = 0xf80002 - 2; uae_u16 ins; addrbank *ab; + bool extreset = false; maybe_disable_fpu(); m68k_reset_delay = currprefs.reset_delay; set_special(SPCFLAG_CHECK); send_internalevent(INTERNALEVENT_CPURESET); + if (cpuboard_forced_hardreset()) { + custom_reset_cpu(false, false); + m68k_reset(); + return true; + } if ((currprefs.cpu_compatible || currprefs.cpu_memory_cycle_exact) && currprefs.cpu_model <= 68020) { custom_reset_cpu(false, false); - return; + return false; } pc = m68k_getpc () + 2; ab = &get_mem_bank (pc); @@ -7560,7 +7566,7 @@ void cpureset (void) custom_reset_cpu(false, false); // did memory disappear under us? if (ab == &get_mem_bank (pc)) - return; + return false; // it did if ((ins & ~7) == 0x4ed0) { int reg = ins & 7; @@ -7569,7 +7575,7 @@ void cpureset (void) addr += 0xf80000; write_log (_T("reset/jmp (ax) combination at %08x emulated -> %x\n"), pc, addr); m68k_setpc_normal (addr - 2); - return; + return false; } } // the best we can do, jump directly to ROM entrypoint @@ -7577,6 +7583,7 @@ void cpureset (void) write_log (_T("CPU Reset PC=%x (%s), invalid memory -> %x.\n"), pc, ab->name, ksboot + 2); custom_reset_cpu(false, false); m68k_setpc_normal (ksboot); + return false; }