MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / cpureset

Function cpureset

src/newcpu.cpp:8326–8376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8324}
8325
8326bool 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
8378void do_cycles_stop(int c)
8379{

Callers 14

op_4e70_31_ffFunction · 0.70
op_4e70_21_ffFunction · 0.70
op_4e70_22_ffFunction · 0.70
op_4e70_35_ffFunction · 0.70
op_4e70_95_test_ffFunction · 0.70
op_4e70_32_ffFunction · 0.70
op_4e70_24_ffFunction · 0.70
op_4e70_34_ffFunction · 0.70
op_4e70_94_test_ffFunction · 0.70
op_4e70_33_ffFunction · 0.70
op_4e70_92_test_ffFunction · 0.70
op_4e70_23_ffFunction · 0.70

Calls 12

maybe_disable_fpuFunction · 0.85
set_specialFunction · 0.85
unset_specialFunction · 0.85
send_internaleventFunction · 0.85
warpmode_resetFunction · 0.85
custom_reset_cpuFunction · 0.85
m68k_resetFunction · 0.85
m68k_getpcFunction · 0.85
m68k_setpc_normalFunction · 0.85
write_logFunction · 0.70
get_wordFunction · 0.50

Tested by 4

op_4e70_95_test_ffFunction · 0.56
op_4e70_94_test_ffFunction · 0.56
op_4e70_92_test_ffFunction · 0.56
op_4e70_93_test_ffFunction · 0.56