示例#1
0
/* 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);
}
示例#2
0
int autostart_prg_perform_injection(log_t log)
{
    unsigned int i;
    WORD start, end;

    autostart_prg_t *prg = inject_prg;

    if (prg == NULL) {
        log_error(log, "Nothing to inject!");
        return -1;
    }

    log_message(log, "Injecting program data at $%04x (size $%04x)",
                prg->start_addr,
                prg->size);

    /* store data in emu memory */
    for (i = 0; i < prg->size; i++) {
        mem_inject((WORD)(prg->start_addr + i), prg->data[i]);
    }

    /* now simulate a basic load */
    mem_get_basic_text(&start, &end);
    end = (WORD)(prg->start_addr + prg->size);
    mem_set_basic_text(start, end);

    /* clean up injected prog */
    free_prg(inject_prg);
    inject_prg = NULL;

    return 0;
}