]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
RESET special case
authorToni Wilen <twilen@winuae.net>
Mon, 27 Sep 2021 17:44:25 +0000 (20:44 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 27 Sep 2021 17:44:25 +0000 (20:44 +0300)
cpuboard.cpp
gencpu.cpp
include/cpuboard.h
include/newcpu.h
newcpu.cpp

index 2ab3c5e84c51df317cf9f0ccca26c41a5adc9914..2575c5227264885d1a72237d9eb3b1cb6eef18e9 100644 (file)
@@ -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;
 
index 180d97a924b3ee455cdea46ed0f41b4d4a87dd91..df66b895ee8f1c7b026796b57edc20caffca48c5 100644 (file)
@@ -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:
index 20da0bf5160975d8e633ec4e85a4b6adbdcec3cc..9f26ea7e4b8ffc96d2baef766e4e366169e46323 100644 (file)
@@ -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);
 
index ada5c7a8f26774949461487165e232483eb66605..9588f89f79ebf863b2fc3818ec862fdfa576f7bf 100644 (file)
@@ -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);
index 824f34720644cb358cceadaef61ef8bcab5e691c..bce60a14fad642ffaf56f65d19e60b47ce682615 100644 (file)
@@ -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;
 }