/* this is called after successful loading */ static void autostart_finish(void) { if (autostart_run_mode == AUTOSTART_MODE_RUN) { log_message(autostart_log, "Starting program."); if ((machine_class == VICE_MACHINE_C128) && (c128_column4080_key == 0)) { kbdbuf_feed("GRAPHIC5:"); } /* log_message(autostart_log, "Run command is: '%s' (%s)", AutostartRunCommand, AutostartDelayRandom ? "delayed" : "no delay"); */ if (AutostartDelayRandom) { kbdbuf_feed_runcmd(AutostartRunCommand); } else { kbdbuf_feed(AutostartRunCommand); } } else { log_message(autostart_log, "Program loaded."); if ((machine_class == VICE_MACHINE_C128) && (c128_column4080_key == 0)) { kbdbuf_feed("GRAPHIC5\x0d"); } } /* printf("autostart_finish cmdline_get_autostart_mode(): %d\n", cmdline_get_autostart_mode()); */ /* inject string given to -keybuf option on commandline into keyboard buffer */ if (cmdline_get_autostart_mode() != AUTOSTART_MODE_NONE) { kbdbuf_feed_cmdline(); } }
/* 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); }
void kbdbuf_feed_cmdline(void) { /* printf("kbdbuf_feed_cmdline\n"); */ if (kbd_buf_string != NULL) { /* printf("kbdbuf_feed_cmdline: %d '%s'\n", KbdbufDelay, kbd_buf_string); */ if (KbdbufDelay) { kbdbuf_feed_runcmd(kbd_buf_string); } else { kbdbuf_feed(kbd_buf_string); } } }