void gen_softreset(int state) { if (state) { /* Halt 68k */ m68k_pulse_halt(); /* Z80 bus is released & Z80 is reseted */ zstate = 0; m68k_memory_map[0xa0].read8 = m68k_read_bus_8; m68k_memory_map[0xa0].read16 = m68k_read_bus_16; m68k_memory_map[0xa0].write8 = m68k_unused_8_w; m68k_memory_map[0xa0].write16 = m68k_unused_16_w; /* Assume default bank is $000000-$007FFF */ zbank = 0; /* Reset YM2612 */ fm_reset(0); } else { /* Reset Cartridge Hardware */ cart_hw_reset(0); /* 68k & Z80 could restart anywhere in VDP frame (Bonkers, Eternal Champions, X-Men 2) */ mcycles_68k = mcycles_z80 = (uint32)((MCYCLES_PER_LINE * lines_per_frame) * ((double)rand() / (double)RAND_MAX)); /* Reset 68k, Z80 & YM2612 */ m68k_pulse_reset(); z80_reset(); fm_reset(0); } }
/************************************************** Load a new rom and performs some initialization ***************************************************/ void reloadrom (int size, char *name) { /* cartridge hot-swap support */ uint8 hotswap = 0; if (cart.romsize) hotswap = config.hot_swap; /* Load ROM */ cart.romsize = size; load_rom(name); if (hotswap) { cart_hw_init(); cart_hw_reset(); } else { /* initialize audio back-end */ /* 60hz video mode requires synchronization with Video Interrupt. */ /* VSYNC period is 16715 us on Wii/Gamecube (approx. 802.32 samples per frame) */ float framerate; if (vdp_pal) framerate = 50.0; else framerate = ((config.tv_mode == 0) || (config.tv_mode == 2)) ? (1000000.0/16715.0) : 60.0; audio_init(48000, framerate); /* System Power ON */ system_init (); ClearGGCodes (); system_reset (); } }
void reloadrom(int size, char *name) { LOG_DBG("reloadrom(%d, %s)\n", size, current_rom); bool hotswap = config.hot_swap && cart.romsize; /* load ROM file */ LOG_DBG("cart.romsize = %d\n", size); cart.romsize = size; LOG_DBG("load_rom(%s)\n", name); load_rom(name); LOG_DBG("hotswap: %d\n", hotswap); LOG_DBG("region detect: %d\n", config.region_detect); if(hotswap) { cart_hw_init(); cart_hw_reset(1); } /* initialize audio back-end */ /* 60hz video mode requires synchronization with Video Interrupt. */ /* Framerate is 59.94 fps in interlaced/progressive modes, ~59.825 fps in non-interlaced mode */ LOG_DBG("vdp_pal: %d\n", vdp_pal); LOG_DBG("config.tv_mode: %d\n", config.tv_mode); LOG_DBG("config.render: %d\n", config.render); float framerate; if (vdp_pal) { framerate = 49.82; } else { framerate = ((config.tv_mode == 0) || (config.tv_mode == 2)) ? (1000000.0/16715.0) : 60.0; } LOG_DBG("audio_init(%d, %f)\n", SAMPLERATE_48_3KHZ, framerate); LOG_DBG("framerate: %f\n", framerate); audio_init(SAMPLERATE_48_3KHZ, framerate); /* System Power ON */ LOG_DBG("system_init()\n"); system_init(); LOG_DBG("system_reset()\n"); system_reset(); /* load SRAM */ LoadSRAM(); //FIXME: TODO /* load State */ }