~ubuntu-branches/ubuntu/maverick/vice/maverick

« back to all changes in this revision

Viewing changes to src/datasette.c

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2005-02-01 11:30:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050201113026-3eyakzsmmheclvjg
Tags: 1.16-1
* New upstream version
* Fixes crash on 64-bit architectures (closes: #287640)
* x128 working again (closes: #286767)
* Works fine with /dev/dsp in use (not in the main changelog, but tested
  on my local machine as working).  Presumably, this also takes care of
  the issue with dsp being held.  I'm not sure if this is because I'm
  testing it on a 2.6 kernel now -- if you are still having problems
  with /dev/dsp, please reopen the bugs. (closes: #152952, #207942)
* Don't kill Makefile.in on clean

Show diffs side-by-side

added added

removed removed

Lines of Context:
174
174
 
175
175
/* constants to make the counter-calculation a little faster */
176
176
/* see datasette.h for the complete formular                 */
177
 
const double ds_c1 = DS_V_PLAY / DS_D/PI;
178
 
const double ds_c2 = (DS_R * DS_R) / (DS_D * DS_D);
179
 
const double ds_c3 = DS_R / DS_D;
 
177
static const double ds_c1 = DS_V_PLAY / DS_D/PI;
 
178
static const double ds_c2 = (DS_R * DS_R) / (DS_D * DS_D);
 
179
static const double ds_c3 = DS_R / DS_D;
180
180
 
181
181
static void datasette_internal_reset(void);
182
182
 
430
430
    alarm_unset(datasette_alarm);
431
431
    datasette_alarm_pending = 0;
432
432
 
433
 
    if ((current_image == NULL) || !datasette_motor)
 
433
    if (current_image == NULL)
 
434
        return;
 
435
 
 
436
    /* check for delay of motor stop */
 
437
    if (motor_stop_clk > 0 && maincpu_clk > motor_stop_clk) {
 
438
        motor_stop_clk = 0;
 
439
        ui_display_tape_motor_status(0);
 
440
        datasette_motor = 0;
 
441
    }
 
442
 
 
443
    if (!datasette_motor)
434
444
        return;
435
445
 
436
446
    switch (current_image->mode) {
601
611
        datasette_long_gap_pending = 0;
602
612
        datasette_long_gap_elapsed = 0;
603
613
        datasette_last_direction = 0;
 
614
        motor_stop_clk = 0;
604
615
        datasette_update_ui_counter();
605
616
        fullwave = 0;
606
617
    }
621
632
    fseek(current_image->fd, current_image->current_file_seek_position
622
633
          + current_image->offset, SEEK_SET);
623
634
    if (!datasette_alarm_pending) {
624
 
        alarm_set(datasette_alarm, maincpu_clk + 1000);
 
635
        alarm_set(datasette_alarm, maincpu_clk + MOTOR_DELAY);
625
636
        datasette_alarm_pending = 1;
626
637
    }
627
638
}
709
720
void datasette_set_motor(int flag)
710
721
{
711
722
    if (current_image != NULL) {
712
 
        if (flag && !datasette_motor) {
713
 
            last_write_clk = (CLOCK)0;
714
 
            datasette_start_motor();
 
723
        if (flag) {
 
724
            /* abort pending motor stop */
 
725
            motor_stop_clk = 0;
 
726
            if (!datasette_motor) {
 
727
                last_write_clk = (CLOCK)0;
 
728
                datasette_start_motor();
 
729
                ui_display_tape_motor_status(flag);
 
730
                datasette_motor = 1;
 
731
            }
715
732
        }
716
 
        if (!flag && datasette_motor) {
717
 
            alarm_unset(datasette_alarm);
718
 
            datasette_alarm_pending = 0;
 
733
        if (!flag && datasette_motor && motor_stop_clk == 0) {
719
734
            motor_stop_clk = maincpu_clk + MOTOR_DELAY;
720
735
        }
721
 
        ui_display_tape_motor_status(flag);
722
736
    }
723
 
    datasette_motor = flag;
724
737
}
725
738
 
726
739
inline static void bit_write(void)
873
886
    ui_set_tape_status(current_image ? 1 : 0);
874
887
    datasette_update_ui_counter();
875
888
    ui_display_tape_motor_status(datasette_motor);
876
 
    if (current_image)
 
889
    if (current_image) {
877
890
        ui_display_tape_control_status(current_image->mode);
878
891
 
 
892
        if (current_image->mode > 0)
 
893
            datasette_set_tape_sense(1);
 
894
        else
 
895
            datasette_set_tape_sense(0);
 
896
    }
 
897
 
879
898
    /* reset buffer */
880
899
    next_tap = last_tap = 0;
881
900
 
 
901
    snapshot_module_close(m);
882
902
    return 0;
883
903
}