Exemplo n.º 1
0
void datasette_set_motor(int flag)
{
    DBG(("datasette_set_motor(%d) (image present:%s)", flag, current_image ? "yes" : "no"));

    if (datasette_alarm == NULL) {
        DBG(("datasette_set_motor (datasette_alarm == NULL)"));
        return;
    }

    if (flag) {
        /* abort pending motor stop */
        motor_stop_clk = 0;
        if (!datasette_motor) {
            last_write_clk = (CLOCK)0;
            datasette_start_motor();
            ui_display_tape_motor_status(1);
            datasette_motor = 1;
        }
    }
    if (!flag && datasette_motor && motor_stop_clk == 0) {
        motor_stop_clk = maincpu_clk + MOTOR_DELAY;
        DBG(("datasette_set_motor(maincpu_clk:%d motor_stop_clk:%d)", maincpu_clk, motor_stop_clk));
        if (!datasette_alarm_pending) {
            /* make sure that the motor will stop */
            alarm_set(datasette_alarm, motor_stop_clk);
            datasette_alarm_pending = 1;
        }
    }
}
Exemplo n.º 2
0
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;
    }
}
Exemplo n.º 3
0
void datasette_set_motor(int flag)
{
    if (current_image != NULL) {
        if (flag) {
            /* abort pending motor stop */
            motor_stop_clk = 0;
            if (!datasette_motor) {
                last_write_clk = (CLOCK)0;
                datasette_start_motor();
                ui_display_tape_motor_status(1);
                datasette_motor = 1;
            }
        }
        if (!flag && datasette_motor && motor_stop_clk == 0) {
            motor_stop_clk = maincpu_clk + MOTOR_DELAY;
            if (!datasette_alarm_pending) {
                /* make sure that the motor will stop */
                alarm_set(datasette_alarm, motor_stop_clk);
                datasette_alarm_pending = 1;
            }
        }
    }
}
Exemplo n.º 4
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;
}