| 8324 | } |
| 8325 | |
| 8326 | bool cpureset (void) |
| 8327 | { |
| 8328 | /* RESET hasn't increased PC yet, 1 word offset */ |
| 8329 | uaecptr pc; |
| 8330 | uaecptr ksboot = 0xf80002 - 2; |
| 8331 | uae_u16 ins; |
| 8332 | addrbank *ab; |
| 8333 | bool extreset = false; |
| 8334 | |
| 8335 | maybe_disable_fpu(); |
| 8336 | m68k_reset_delay = currprefs.reset_delay; |
| 8337 | set_special(SPCFLAG_CHECK); |
| 8338 | unset_special(SPCFLAG_CPUINRESET); |
| 8339 | send_internalevent(INTERNALEVENT_CPURESET); |
| 8340 | warpmode_reset(); |
| 8341 | if (cpuboard_forced_hardreset()) { |
| 8342 | custom_reset_cpu(false, false); |
| 8343 | m68k_reset(); |
| 8344 | return true; |
| 8345 | } |
| 8346 | if (currprefs.cpu_compatible || currprefs.cpu_memory_cycle_exact) { |
| 8347 | custom_reset_cpu(false, false); |
| 8348 | return false; |
| 8349 | } |
| 8350 | pc = m68k_getpc () + 2; |
| 8351 | ab = &get_mem_bank (pc); |
| 8352 | if (ab->check (pc, 2)) { |
| 8353 | write_log (_T("CPU reset PC=%x (%s)..\n"), pc - 2, ab->name); |
| 8354 | ins = get_word (pc); |
| 8355 | custom_reset_cpu(false, false); |
| 8356 | // did memory disappear under us? |
| 8357 | if (ab == &get_mem_bank (pc)) |
| 8358 | return false; |
| 8359 | // it did |
| 8360 | if ((ins & ~7) == 0x4ed0) { |
| 8361 | int reg = ins & 7; |
| 8362 | uae_u32 addr = m68k_areg (regs, reg); |
| 8363 | if (addr < 0x80000) |
| 8364 | addr += 0xf80000; |
| 8365 | write_log (_T("reset/jmp (ax) combination at %08x emulated -> %x\n"), pc, addr); |
| 8366 | m68k_setpc_normal (addr - 2); |
| 8367 | return false; |
| 8368 | } |
| 8369 | } |
| 8370 | // the best we can do, jump directly to ROM entrypoint |
| 8371 | // (which is probably what program wanted anyway) |
| 8372 | write_log (_T("CPU Reset PC=%x (%s), invalid memory -> %x.\n"), pc, ab->name, ksboot + 2); |
| 8373 | custom_reset_cpu(false, false); |
| 8374 | m68k_setpc_normal (ksboot); |
| 8375 | return false; |
| 8376 | } |
| 8377 | |
| 8378 | void do_cycles_stop(int c) |
| 8379 | { |