/* This hook is called at the end of every frame. */ static void machine_vsync_hook(void) { int i; unsigned int playtime; static unsigned int time = 0; if (vsid_autostart_delay > 0) { if (-- vsid_autostart_delay == 0) { log_message(c64_log, "Triggering VSID autoload"); psid_init_tune(0); for (i = 0; i < vsid_autostart_length; i += 1) { mem_inject((WORD)(vsid_autostart_load_addr + i), vsid_autostart_data[i]); } mem_set_basic_text(vsid_autostart_load_addr, (WORD)(vsid_autostart_load_addr + vsid_autostart_length)); kbdbuf_feed_runcmd("RUN\r"); } } playtime = (psid_increment_frames() * machine_timing.cycles_per_rfsh) / machine_timing.cycles_per_sec; if (playtime != time) { vsid_ui_display_time(playtime); time = playtime; } clk_guard_prevent_overflow(maincpu_clk_guard); }
/* C64-specific reset sequence. */ void machine_specific_reset(void) { ciacore_reset(machine_context.cia1); ciacore_reset(machine_context.cia2); sid_reset(); /* The VIC-II must be the *last* to be reset. */ vicii_reset(); if (psid_basic_rsid_to_autostart(&vsid_autostart_load_addr, &vsid_autostart_data, &vsid_autostart_length)) { vsid_autostart_delay = (int)(machine_timing.rfsh_per_sec * 23 / 10); } else { vsid_autostart_delay = 0; /* disables it */ psid_init_driver(); psid_init_tune(1); } }
/* C64-specific reset sequence. */ void machine_specific_reset(void) { serial_traps_reset(); ciacore_reset(machine_context.cia1); ciacore_reset(machine_context.cia2); sid_reset(); if (!vsid_mode) { tpicore_reset(machine_context.tpi1); acia1_reset(); rs232drv_reset(); rsuser_reset(); printer_reset(); /* FIXME */ /* reset_reu(); */ } /* The VIC-II must be the *last* to be reset. */ vicii_reset(); if (vsid_mode) { psid_init_tune(); return; } cartridge_reset(); drive_reset(); datasette_reset(); reu_reset(); georam_reset(); ramcart_reset(); plus60k_reset(); plus256k_reset(); c64_256k_reset(); mmc64_reset(); }