/* This function is called by the `serialreceivebyte()' trap as soon as EOF is reached. */ static void disk_eof_callback(void) { if (handle_drive_true_emulation_overridden) { BYTE id[2], *buffer; unsigned int track, sector; if (orig_drive_true_emulation_state) { log_message(autostart_log, "Turning true drive emulation on."); vdrive_bam_get_disk_id(8, id); vdrive_get_last_read(&track, §or, &buffer); } set_true_drive_emulation_mode(orig_drive_true_emulation_state); if (orig_drive_true_emulation_state) { drive_set_disk_memory(id, track, sector, drive_context[0]); drive_set_last_read(track, sector, buffer, drive_context[0]); } } if (autostartmode != AUTOSTART_NONE) { if (autostart_run_mode == AUTOSTART_MODE_RUN) { log_message(autostart_log, "Starting program."); kbdbuf_feed(AutostartRunCommand); } else { log_message(autostart_log, "Program loaded."); } } autostart_done(); machine_bus_eof_callback_set(NULL); disable_warp_if_was_requested(); }
/* This function is called by the `serialreceivebyte()' trap as soon as EOF is reached. */ static void disk_eof_callback(void) { if (handle_drive_true_emulation_overridden) { BYTE id[2], *buffer = NULL; unsigned int track, sector; /* FIXME: shouldnt this loop over all drives? */ if (orig_drive_true_emulation_state) { log_message(autostart_log, "Turning true drive emulation on."); if (vdrive_bam_get_disk_id(8, id) == 0) { vdrive_get_last_read(&track, §or, &buffer); } } set_true_drive_emulation_mode(orig_drive_true_emulation_state); if (orig_drive_true_emulation_state) { if (buffer) { log_message(autostart_log, "Restoring true drive state of drive 8."); drive_set_disk_memory(id, track, sector, drive_context[0]); drive_set_last_read(track, sector, buffer, drive_context[0]); } else { log_message(autostart_log, "No Disk Image in drive 8."); } } } if (autostartmode != AUTOSTART_NONE) { autostart_finish(); } autostart_done(); machine_bus_eof_callback_set(NULL); disable_warp_if_was_requested(); }
static void advance_hassnapshot(void) { switch (check("READY.", AUTOSTART_WAIT_BLINK)) { case YES: autostart_done(); log_message(autostart_log, "Restoring snapshot."); interrupt_maincpu_trigger_trap(load_snapshot_trap, 0); break; case NO: autostart_disable(); break; case NOT_YET: break; } }
static void advance_loadingtape(void) { switch (check("READY.", AUTOSTART_WAIT_BLINK)) { case YES: disable_warp_if_was_requested(); autostart_finish(); autostart_done(); break; case NO: disable_warp_if_was_requested(); autostart_disable(); break; case NOT_YET: /* leave autostart and disable warp if ROM area was left */ check_rom_area(); break; } }
static void check_rom_area(void) { /* enter ROM ? */ if (!entered_rom) { if (reg_pc >= 0xe000) { log_message(autostart_log, "Entered ROM at $%04x", reg_pc); entered_rom = 1; } } else { /* special case for auto-starters: ROM left. We also consider * BASIC area to be ROM, because it's responsible for writing "READY." */ if (machine_addr_in_ram(reg_pc)) { log_message(autostart_log, "Left ROM for $%04x", reg_pc); disable_warp_if_was_requested(); autostart_done(); } } }
static void advance_waitloadready(void) { switch (check("READY.", AUTOSTART_WAIT_BLINK)) { case YES: log_message(autostart_log, "Ready"); disable_warp_if_was_requested(); autostart_finish(); autostart_done(); break; case NO: log_message(autostart_log, "NO Ready"); disable_warp_if_was_requested(); autostart_disable(); break; case NOT_YET: /* leave autostart and disable warp if ROM area was left */ check_rom_area(); break; } }
static void advance_loadingtape(void) { switch (check("READY.", AUTOSTART_WAIT_BLINK)) { case YES: disable_warp_if_was_requested(); if (autostart_run_mode == AUTOSTART_MODE_RUN) { log_message(autostart_log, "Starting program."); kbdbuf_feed(AutostartRunCommand); } autostart_done(); break; case NO: disable_warp_if_was_requested(); autostart_disable(); break; case NOT_YET: /* leave autostart and disable warp if ROM area was left */ check_rom_area(); break; } }
static void advance_hasdisk(void) { char *tmp; int traps; switch (check("READY.", AUTOSTART_WAIT_BLINK)) { case YES: if (autostart_program_name) log_message(autostart_log, "Loading program '%s'", autostart_program_name); else log_message(autostart_log, "Loading program '*'"); orig_drive_true_emulation_state = get_true_drive_emulation_state(); if (handle_drive_true_emulation_overridden) { resources_get_int("VirtualDevices", &traps); if (traps) { if (orig_drive_true_emulation_state) log_message(autostart_log, "Turning true drive emulation off."); set_true_drive_emulation_mode(0); } else { if (!orig_drive_true_emulation_state) log_message(autostart_log, "Turning true drive emulation on."); set_true_drive_emulation_mode(1); } } else { if (!orig_drive_true_emulation_state) { traps = 1; } else { traps = 0; } } tmp = lib_msprintf("LOAD\"%s\",8%s:\r", autostart_program_name ? autostart_program_name : "*", autostart_basic_load ? "" : ",1"); kbdbuf_feed(tmp); lib_free(tmp); if (!traps) { if (AutostartWarp) { autostartmode = AUTOSTART_WAITSEARCHINGFOR; } else { /* be most compatible if warp is disabled */ if (autostart_run_mode == AUTOSTART_MODE_RUN) { kbdbuf_feed(AutostartRunCommand); } autostart_done(); } } else { autostartmode = AUTOSTART_LOADINGDISK; machine_bus_attention_callback_set(disk_attention_callback); } deallocate_program_name(); break; case NO: orig_drive_true_emulation_state = get_true_drive_emulation_state(); disable_warp_if_was_requested(); autostart_disable(); break; case NOT_YET: break; } }
static void advance_hasdisk(void) { char *tmp, *temp_name; int traps; switch (check("READY.", AUTOSTART_WAIT_BLINK)) { case YES: /* autostart_program_name may be petscii or ascii at this point, ANDing the charcodes with 0x7f here is a cheap way to prevent illegal characters in the printed message */ if (autostart_program_name) { temp_name = tmp = lib_stralloc(autostart_program_name); while (*tmp) { *tmp++ &= 0x7f; } log_message(autostart_log, "Loading program '%s'", temp_name); lib_free(temp_name); } else { log_message(autostart_log, "Loading program '*'"); } orig_drive_true_emulation_state = get_true_drive_emulation_state(); if (handle_drive_true_emulation_overridden) { resources_get_int("VirtualDevices", &traps); if (traps) { if (orig_drive_true_emulation_state) { log_message(autostart_log, "Turning true drive emulation off."); } set_true_drive_emulation_mode(0); } else { if (!orig_drive_true_emulation_state) { log_message(autostart_log, "Turning true drive emulation on."); } set_true_drive_emulation_mode(1); } } else { if (!orig_drive_true_emulation_state) { traps = 1; } else { traps = 0; } } tmp = lib_msprintf("LOAD\"%s\",8%s:\r", autostart_program_name ? autostart_program_name : "*", autostart_basic_load ? "" : ",1"); DBG(("advance_hasdisk '%s'", tmp)); kbdbuf_feed(tmp); lib_free(tmp); if (!traps) { if (AutostartWarp) { autostartmode = AUTOSTART_WAITSEARCHINGFOR; } else { /* be most compatible if warp is disabled */ autostart_finish(); autostart_done(); } } else { autostartmode = AUTOSTART_LOADINGDISK; machine_bus_attention_callback_set(disk_attention_callback); } deallocate_program_name(); break; case NO: orig_drive_true_emulation_state = get_true_drive_emulation_state(); disable_warp_if_was_requested(); autostart_disable(); break; case NOT_YET: break; } }