void datasette_set_tape_image(tap_t *image) { CLOCK gap; DBG(("datasette_set_tape_image (image present:%s)", image ? "yes" : "no")); current_image = image; last_tap = next_tap = 0; datasette_internal_reset(); if (image != NULL) { /* We need the length of tape for realistic counter. */ current_image->cycle_counter_total = 0; do { gap = datasette_read_gap(1); current_image->cycle_counter_total += gap / 8; } while (gap); current_image->current_file_seek_position = 0; } datasette_set_tape_sense(0); last_tap = next_tap = 0; fullwave = 0; ui_set_tape_status(current_image ? 1 : 0); }
void datasette_reset(void) { int ds_reset; resources_get_int("DatasetteResetWithCPU", &ds_reset); if (ds_reset) datasette_internal_reset(); }
static void datasette_control_internal(int command) { if (current_image != NULL) { switch(command) { case DATASETTE_CONTROL_RESET_COUNTER: datasette_reset_counter(); break; case DATASETTE_CONTROL_RESET: datasette_internal_reset(); case DATASETTE_CONTROL_STOP: current_image->mode = DATASETTE_CONTROL_STOP; datasette_set_tape_sense(0); last_write_clk = (CLOCK)0; break; case DATASETTE_CONTROL_START: current_image->mode = DATASETTE_CONTROL_START; datasette_set_tape_sense(1); last_write_clk = (CLOCK)0; if (datasette_motor) datasette_start_motor(); break; case DATASETTE_CONTROL_FORWARD: current_image->mode = DATASETTE_CONTROL_FORWARD; datasette_forward(); datasette_set_tape_sense(1); last_write_clk = (CLOCK)0; if (datasette_motor) datasette_start_motor(); break; case DATASETTE_CONTROL_REWIND: current_image->mode = DATASETTE_CONTROL_REWIND; datasette_rewind(); datasette_set_tape_sense(1); last_write_clk = (CLOCK)0; if (datasette_motor) datasette_start_motor(); break; case DATASETTE_CONTROL_RECORD: if (current_image->read_only == 0) { current_image->mode = DATASETTE_CONTROL_RECORD; datasette_set_tape_sense(1); last_write_clk = (CLOCK)0; } break; } ui_display_tape_control_status(current_image->mode); /* clear the tap-buffer */ last_tap = next_tap = 0; } }
static void datasette_control_internal(int command) { DBG(("datasette_control_internal (%s) (image present:%s)", cmdstr[command], current_image ? "yes" : "no")); if (current_image) { switch (command) { case DATASETTE_CONTROL_RESET_COUNTER: datasette_reset_counter(); break; case DATASETTE_CONTROL_RESET: datasette_internal_reset(); case DATASETTE_CONTROL_STOP: current_image->mode = DATASETTE_CONTROL_STOP; datasette_set_tape_sense(0); last_write_clk = (CLOCK)0; break; case DATASETTE_CONTROL_START: current_image->mode = DATASETTE_CONTROL_START; datasette_set_tape_sense(1); last_write_clk = (CLOCK)0; if (datasette_motor) { datasette_start_motor(); } break; case DATASETTE_CONTROL_FORWARD: current_image->mode = DATASETTE_CONTROL_FORWARD; datasette_forward(); datasette_set_tape_sense(1); last_write_clk = (CLOCK)0; if (datasette_motor) { datasette_start_motor(); } break; case DATASETTE_CONTROL_REWIND: current_image->mode = DATASETTE_CONTROL_REWIND; datasette_rewind(); datasette_set_tape_sense(1); last_write_clk = (CLOCK)0; if (datasette_motor) { datasette_start_motor(); } break; case DATASETTE_CONTROL_RECORD: if (current_image->read_only == 0) { current_image->mode = DATASETTE_CONTROL_RECORD; datasette_set_tape_sense(1); last_write_clk = (CLOCK)0; } break; } ui_display_tape_control_status(current_image->mode); } else { switch (command) { case DATASETTE_CONTROL_RESET_COUNTER: datasette_reset_counter(); break; case DATASETTE_CONTROL_RESET: datasette_internal_reset(); case DATASETTE_CONTROL_STOP: notape_mode = DATASETTE_CONTROL_STOP; datasette_set_tape_sense(0); last_write_clk = (CLOCK)0; break; case DATASETTE_CONTROL_START: notape_mode = DATASETTE_CONTROL_START; datasette_set_tape_sense(1); last_write_clk = (CLOCK)0; if (datasette_motor) { datasette_start_motor(); } break; case DATASETTE_CONTROL_FORWARD: notape_mode = DATASETTE_CONTROL_FORWARD; datasette_forward(); datasette_set_tape_sense(1); last_write_clk = (CLOCK)0; if (datasette_motor) { datasette_start_motor(); } break; case DATASETTE_CONTROL_REWIND: notape_mode = DATASETTE_CONTROL_REWIND; datasette_rewind(); datasette_set_tape_sense(1); last_write_clk = (CLOCK)0; if (datasette_motor) { datasette_start_motor(); } break; case DATASETTE_CONTROL_RECORD: /* record can usually not be pressed when no tape is present */ break; } ui_display_tape_control_status(notape_mode); } /* clear the tap-buffer */ last_tap = next_tap = 0; }