Previous 15994 Revisions Next

r6672 Wednesday 16th December, 2009 at 12:43:24 UTC by Dirk Best
Use floppy_mon_w() instead of floppy_drive_set_motor_state()
[src/mess/devices]flopdrv.c flopdrv.h sonydriv.c thomflop.c
[src/mess/drivers]act.c bw12.c bw2.c elwro800.c fm7.c fmtowns.c mikromik.c nanos.c newbrain.c pcw.c prof80.c pyl601.c qx10.c sg1000.c sord.c specpls3.c tiki100.c v1050.c x1.c x68k.c xerox820.c xor100.c
[src/mess/machine]amstrad.c c1541.c c1581.c conkort.c i8271.c mc6843.c pc8801.c pc_fdc.c tf20.c wd17xx.c

src/mess/devices/flopdrv.c
r6671r6672
4343   int drtn; /* direction */
4444   int stp;  /* step */
4545   int wtg;  /* write gate */
46   int mon;  /* motor on */
4647
4748   /* state of output lines */
4849   int idx;  /* index pulse */
r6671r6672
371372   }
372373}
373374
374void floppy_drive_set_motor_state(const device_config *img, int state)
375{
376   int new_motor_state = 0;
377   int previous_state = 0;
378
379   /* previous state */
380   if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_MOTOR_ON))
381      previous_state = 1;
382
383   /* calc new state */
384
385   /* drive present? */
386   if (image_slotexists(img))
387   {
388      /* disk inserted? */
389      if (image_exists(img))
390      {
391         /* drive present and disc inserted */
392
393         /* state of motor is same as the programmed state */
394         if (state)
395         {
396            new_motor_state = 1;
397         }
398      }
399   }
400
401   if ((new_motor_state^previous_state)!=0)
402   {
403      /* if timer already setup remove it */
404      if (image_slotexists(img))
405      {
406         floppy_drive *pDrive = get_safe_token( img );
407
408         pDrive->idx = 0;
409         if (new_motor_state)
410         {
411            /* off->on */
412            /* check it's in range */
413
414            /* setup timer to trigger at rpm */
415            floppy_drive_index_func(img);
416         }
417         else
418         {
419            /* on->off */
420            timer_adjust_oneshot(pDrive->index_timer, attotime_zero, 0);
421         }
422      }
423   }
424
425   floppy_drive_set_flag_state(img, FLOPPY_DRIVE_MOTOR_ON, new_motor_state);
426
427}
428
429375/* for pc, drive is always ready, for amstrad,pcw,spectrum it is only ready under
430376a fixed set of circumstances */
431377/* use this to set ready state of drive */
432378void floppy_drive_set_ready_state(const device_config *img, int state, int flag)
433379{
380   floppy_drive *drive = get_safe_token(img);
381
434382   if (flag)
435383   {
436384      /* set ready only if drive is present, disk is in the drive,
r6671r6672
442390         /* disk inserted? */
443391         if (image_exists(img))
444392         {
445            if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_MOTOR_ON))
393            if (drive->mon == CLEAR_LINE)
446394            {
447395               /* set state */
448396               floppy_drive_set_flag_state(img, FLOPPY_DRIVE_READY, state);
r6671r6672
471419   drive_flags = drv->flags;
472420
473421   /* these flags are independant of a real drive/disk image */
474    flags |= drive_flags & (FLOPPY_DRIVE_READY | FLOPPY_DRIVE_MOTOR_ON | FLOPPY_DRIVE_INDEX);
422    flags |= drive_flags & (FLOPPY_DRIVE_READY | FLOPPY_DRIVE_INDEX);
475423
476424    flags &= flag;
477425
r6671r6672
682630   /* not at track 0 */
683631   floppy->tk00 = ASSERT_LINE;
684632
633   /* motor off */
634   floppy->mon = ASSERT_LINE;
635
685636   /* resolve callbacks */
686637   devcb_resolve_write_line(&floppy->out_idx_func, &floppy->config->out_idx_func, device);
687638   devcb_resolve_read_line(&floppy->in_mon_func, &floppy->config->in_mon_func, device);
r6671r6672
888839   floppy_ds3_w(device, BIT(data, 3));
889840}
890841
842/* motor on, active low */
843WRITE_LINE_DEVICE_HANDLER( floppy_mon_w )
844{
845   floppy_drive *drive = get_safe_token(device);
846
847   /* force off if there is no attached image */
848   if (!image_exists(device))
849      state = ASSERT_LINE;
850
851   if (image_slotexists(device))
852   {
853      /* off -> on */
854      if (drive->mon && state == CLEAR_LINE)
855      {
856         drive->idx = 0;
857         floppy_drive_index_func(device);
858      }
859
860      /* on -> off */
861      else if (drive->mon == CLEAR_LINE && state)
862         timer_adjust_oneshot(drive->index_timer, attotime_zero, 0);
863   }
864
865   drive->mon = state;
866}
867
891868/* direction */
892869WRITE_LINE_DEVICE_HANDLER( floppy_drtn_w )
893870{
r6671r6672
913890      if (drive->drtn)
914891      {
915892         /* move head outward */
916         drive->current_track--;
893         if (drive->current_track > 0)
894            drive->current_track--;
917895
918896         /* are we at track 0 now? */
919         if (drive->current_track <= 0)
920         {
921            drive->current_track = 0;
922            drive->tk00 = CLEAR_LINE;
923         }
924         else
925            drive->tk00 = ASSERT_LINE;
897         drive->tk00 = (drive->current_track == 0) ? CLEAR_LINE : ASSERT_LINE;
926898      }
927899      else
928900      {
929901         /* move head inward */
930         drive->current_track++;
902         if (drive->current_track < drive->max_track)
903            drive->current_track++;
931904
932         /* are we over the maximum? */
933         if (drive->current_track >= drive->max_track)
934            drive->current_track = drive->max_track - 1;
935
936905         /* we can't be at track 0 here, so reset the line */
937906         drive->tk00 = ASSERT_LINE;
938907      }
src/mess/devices/sonydriv.c
r6671r6672
8484   unsigned int disk_switched : 1;   /* disk-in-place status bit */
8585   unsigned int head : 1;         /* active head (-> floppy side) */
8686   unsigned int step : 1;
87   int motor_on;
8788
8889   unsigned int loadedtrack_valid : 1;   /* is data in track buffer valid ? */
8990   unsigned int loadedtrack_dirty : 1;   /* has data in track buffer been modified? */
r6671r6672
297298            result = 0;
298299         break;
299300      case 0x08:   /* Motor on 0=on 1=off */
300         if (cur_image)
301            result = floppy_drive_get_flag_state(cur_image, FLOPPY_DRIVE_MOTOR_ON) ? 1 : 0;
302         else
303            result = 0;
301            result = f->motor_on;
304302         break;
305303      case 0x09:   /* Number of sides: 0=single sided, 1=double sided */
306304         if (cur_image)
r6671r6672
394392         }
395393         break;
396394      case 0x08:   /* Turn motor on */
395         f->motor_on = CLEAR_LINE;
397396         if (cur_image)
398            floppy_drive_set_flag_state(cur_image, FLOPPY_DRIVE_MOTOR_ON, 1);
397            floppy_mon_w(cur_image, f->motor_on);
399398         break;
400399      case 0x09:   /* Turn motor off */
400         f->motor_on = ASSERT_LINE;
401401         if (cur_image)
402            floppy_drive_set_flag_state(cur_image, FLOPPY_DRIVE_MOTOR_ON, 0);
402            floppy_mon_w(cur_image, f->motor_on);
403403         break;
404404      case 0x0d:   /* Eject disk */
405405         if (cur_image)
src/mess/devices/flopdrv.h
r6671r6672
6666#define FLOPPY_DRIVE_READY                  0x0010
6767/* set if index has just occured */
6868#define FLOPPY_DRIVE_INDEX                  0x0020
69/* motor state */
70#define FLOPPY_DRIVE_MOTOR_ON               0x0040
7169
7270/* a callback which will be executed if the ready state of the drive changes e.g. not ready->ready, ready->not ready */
7371void floppy_drive_set_ready_state_change_callback(const device_config *img, void (*callback)(const device_config *controller,const device_config *img, int state));
r6671r6672
8785disk is in drive, and motor is on. Otherwise set ready state to the state passed */
8886void floppy_drive_set_ready_state(const device_config *img, int state, int flag);
8987
90void floppy_drive_set_motor_state(const device_config *img, int state);
91
9288/* seek up or down */
9389void floppy_drive_seek(const device_config *img, signed int signed_tracks);
9490
r6671r6672
138134WRITE_LINE_DEVICE_HANDLER( floppy_ds3_w );
139135WRITE8_DEVICE_HANDLER( floppy_ds_w );
140136
137WRITE_LINE_DEVICE_HANDLER( floppy_mon_w );
141138WRITE_LINE_DEVICE_HANDLER( floppy_drtn_w );
142139WRITE_LINE_DEVICE_HANDLER( floppy_stp_w );
143140WRITE_LINE_DEVICE_HANDLER( floppy_wtd_w );
src/mess/devices/thomflop.c
r6671r6672
7676#define THOM_SIZE_DATA_HI    (256+80)
7777#define THOM_SIZE_SYNCHRO     12
7878
79static int motor_on;
7980
81
8082/* build an identifier, with header & space */
8183static int thom_floppy_make_addr( chrn_id id, UINT8* dst, int sector_size )
8284{
r6671r6672
839841      if (img) {
840842         floppy_drive_set_index_pulse_callback( img, to7_qdd_index_pulse_cb );
841843         floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
842         floppy_drive_set_motor_state( img, 1 );
844
845         motor_on = CLEAR_LINE;
846         floppy_mon_w(img, motor_on);
847
843848         /* pulse each time the whole-disk spiraling track ends */
844849         /* at 90us per byte read, the disk can be read in 6s */
845850         floppy_drive_set_rpm( img, 60. / 6. );
r6671r6672
12871292         if ( flags & FLOPPY_DRIVE_READY )
12881293            data |= 0x02;
12891294      }
1290      if ( ! (flags & FLOPPY_DRIVE_MOTOR_ON ) )
1295      if (!motor_on)
12911296         data |= 0x10;
12921297      if (!floppy_wpt_r(img))
12931298         data |= 0x04;
r6671r6672
14661471           set motor to 1 every few seconds.
14671472           instead of counting, we assume the motor is always running...
14681473        */
1469      floppy_drive_set_motor_state( img, 1 /* motor */ );
1474      motor_on = CLEAR_LINE /* motor */;
1475      floppy_mon_w(img, motor_on);
14701476   }
14711477   break;
14721478
src/mess/machine/conkort.c
r6671r6672
277277//  if (BIT(data, 2)) wd17xx_set_drive(conkort->wd1791, 2);
278278
279279   /* motor enable */
280   floppy_drive_set_motor_state(get_floppy_image(space->machine, 0), BIT(data, 3));
281   floppy_drive_set_motor_state(get_floppy_image(space->machine, 1), BIT(data, 3));
280   floppy_mon_w(get_floppy_image(space->machine, 0), !BIT(data, 3));
281   floppy_mon_w(get_floppy_image(space->machine, 1), !BIT(data, 3));
282282   floppy_drive_set_ready_state(get_floppy_image(space->machine, 0), 1, 1);
283283   floppy_drive_set_ready_state(get_floppy_image(space->machine, 1), 1, 1);
284284
r6671r6672
914914
915915static DEVICE_RESET( luxor_55_21046 )
916916{
917   floppy_drive_set_motor_state(get_floppy_image(device->machine, 0), 1);
918   floppy_drive_set_motor_state(get_floppy_image(device->machine, 1), 1);
917   floppy_mon_w(get_floppy_image(device->machine, 0), CLEAR_LINE);
918   floppy_mon_w(get_floppy_image(device->machine, 1), CLEAR_LINE);
919919   floppy_drive_set_ready_state(get_floppy_image(device->machine, 0), 1, 1);
920920   floppy_drive_set_ready_state(get_floppy_image(device->machine, 1), 1, 1);
921921}
src/mess/machine/c1581.c
r6671r6672
177177   wd17xx_set_side(c1581->wd1770, !BIT(data, 0));
178178
179179   /* motor */
180   floppy_drive_set_motor_state(c1581->image, !motor);
180   floppy_mon_w(c1581->image, motor);
181181   floppy_drive_set_ready_state(c1581->image, !motor, 1);
182182
183183   /* power led */
src/mess/machine/c1541.c
r6671r6672
765765   }
766766
767767   /* spindle motor */
768   floppy_drive_set_motor_state(c1541->image, mtr ? FLOPPY_DRIVE_MOTOR_ON : 0);
768   floppy_mon_w(c1541->image, !mtr);
769769   timer_enable(c1541->bit_timer, mtr);
770770
771771   /* activity LED */
src/mess/machine/amstrad.c
r6671r6672
25542554               /* FDC Motor Control - Bit 0 defines the state of the FDD motor:
25552555                     * "1" the FDD motor will be active.
25562556                     * "0" the FDD motor will be in-active.*/
2557               floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), (data & 0x01));
2558               floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), (data & 0x01));
2557               floppy_mon_w(floppy_get_device(space->machine, 0), !BIT(data, 0));
2558               floppy_mon_w(floppy_get_device(space->machine, 1), !BIT(data, 0));
25592559               floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1,1);
25602560               floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 1,1);
25612561              break;
src/mess/machine/wd17xx.c
r6671r6672
14441444{
14451445   wd1770_state *w = get_safe_token(device);
14461446
1447   floppy_drive_set_motor_state(w->drive, 1);
1447   floppy_mon_w(w->drive, CLEAR_LINE);
14481448   floppy_drive_set_ready_state(w->drive, 1,0);
14491449
14501450   /* also cleared by writing command */
src/mess/machine/i8271.c
r6671r6672
10041004
10051005               /* load head - on mini-sized drives this turns on the disc motor,
10061006                    on standard-sized drives this loads the head and turns the motor on */
1007               floppy_drive_set_motor_state(img, i8271->CommandParameters[1] & 0x08);
1007               floppy_mon_w(img, !BIT(i8271->CommandParameters[1], 3));
10081008               floppy_drive_set_ready_state(img, 1, 1);
10091009
10101010               /* step pin changed? if so perform a step in the direction indicated */
src/mess/machine/pc8801.c
r6671r6672
732732
733733   cpu_set_input_line_vector(cputag_get_cpu(machine, "sub"), 0, 0);
734734
735   floppy_drive_set_motor_state(floppy_get_device(machine, 0), 1);
736   floppy_drive_set_motor_state(floppy_get_device(machine, 1), 1);
735   floppy_mon_w(floppy_get_device(machine, 0), CLEAR_LINE);
736   floppy_mon_w(floppy_get_device(machine, 1), CLEAR_LINE);
737737   floppy_drive_set_ready_state(floppy_get_device(machine, 0), 1, 1);
738738   floppy_drive_set_ready_state(floppy_get_device(machine, 1), 1, 1);
739739}
src/mess/machine/pc_fdc.c
r6671r6672
265265
266266   /* set floppy drive motor state */
267267   if (floppy_count > 0)
268      floppy_drive_set_motor_state(floppy_get_device(machine, 0),   (data>>4) & 0x0f);
268      floppy_mon_w(floppy_get_device(machine, 0), !BIT(data, 4));
269269   if (floppy_count > 1)
270      floppy_drive_set_motor_state(floppy_get_device(machine, 1),   (data>>5) & 0x01);
270      floppy_mon_w(floppy_get_device(machine, 1), !BIT(data, 5));
271271   if (floppy_count > 2)
272      floppy_drive_set_motor_state(floppy_get_device(machine, 2),   (data>>6) & 0x01);
272      floppy_mon_w(floppy_get_device(machine, 2), !BIT(data, 6));
273273   if (floppy_count > 3)
274      floppy_drive_set_motor_state(floppy_get_device(machine, 3),   (data>>7) & 0x01);
274      floppy_mon_w(floppy_get_device(machine, 3), !BIT(data, 7));
275275
276276   if ((data>>4) & (1<<selected_drive))
277277   {
r6671r6672
365365
366366   /* set floppy drive motor state */
367367   if (floppy_count > 0)
368      floppy_drive_set_motor_state(floppy_get_device(machine, 0), data & 0x01);
368      floppy_mon_w(floppy_get_device(machine, 0), BIT(data, 0) ? CLEAR_LINE : ASSERT_LINE);
369369
370370   if ( data & 0x01 )
371371   {
src/mess/machine/mc6843.c
r6671r6672
782782   for ( i = 0; i < 4; i++ )
783783   {
784784      const device_config * img = floppy_get_device( device->machine, i );
785      floppy_drive_set_motor_state( img, 1 );
785      floppy_mon_w(img, CLEAR_LINE);
786786      floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
787787      floppy_drive_set_rpm( img, 300. );
788788   }
src/mess/machine/tf20.c
r6671r6672
7878   memory_install_readwrite_bank(prg, 0x0000, 0x7fff, 0, 0,"bank21");
7979   memory_set_bankptr(space->machine, "bank21", messram_get_ptr(tf20->ram));
8080
81   /* clear tc */
82   upd765_tc_w(tf20->upd765a, CLEAR_LINE);
83
8184   return 0xff;
8285}
8386
8487static READ8_HANDLER( tf20_dip_r )
8588{
89   tf20_state *tf20 = get_safe_token(space->cpu->owner);
8690   logerror("%s: tf20_dip_r\n", cpuexec_describe_context(space->machine));
8791
92   /* clear tc */
93   upd765_tc_w(tf20->upd765a, CLEAR_LINE);
94
8895   return 0xff;
8996}
9097
r6671r6672
104111   logerror("%s: tf20_fdc_control_w %02x\n", cpuexec_describe_context(space->machine), data);
105112
106113   /* bit 0, motor on signal */
107   floppy_drive_set_motor_state(tf20->floppy_0, BIT(data, 0));
114   floppy_mon_w(tf20->floppy_0, !BIT(data, 0));
115   floppy_mon_w(tf20->floppy_1, !BIT(data, 0));
108116   floppy_drive_set_ready_state(tf20->floppy_0, BIT(data, 0), 1);
109   floppy_drive_set_motor_state(tf20->floppy_1, BIT(data, 0));
110117   floppy_drive_set_ready_state(tf20->floppy_1, BIT(data, 0), 1);
111118
112   /* clear tc on write */
113   upd765_tc_w(tf20->upd765a, CLEAR_LINE);
119   /* set tc on write */
120   upd765_tc_w(tf20->upd765a, ASSERT_LINE);
114121}
115122
116123static IRQ_CALLBACK( tf20_irq_ack )
src/mess/drivers/act.c
r6671r6672
140140
141141//  printf("%02x\n",offset);
142142
143   floppy_drive_set_motor_state(floppy_get_device(space->machine, xi_sys_ctrl.fdrv_num), 1);
143   floppy_mon_w(floppy_get_device(space->machine, xi_sys_ctrl.fdrv_num), CLEAR_LINE);
144144   floppy_drive_set_ready_state(floppy_get_device(space->machine, xi_sys_ctrl.fdrv_num), 1,0);
145145
146146   switch(offset)
r6671r6672
167167
168168//  printf("%02x %02x\n",offset,data);
169169
170   floppy_drive_set_motor_state(floppy_get_device(space->machine, xi_sys_ctrl.fdrv_num), 1);
170   floppy_mon_w(floppy_get_device(space->machine, xi_sys_ctrl.fdrv_num), CLEAR_LINE);
171171   floppy_drive_set_ready_state(floppy_get_device(space->machine, xi_sys_ctrl.fdrv_num), 1,0);
172172
173173   switch(offset)
src/mess/drivers/x1.c
r6671r6672
956956         break;
957957      case 0x0ffc:
958958         wd17xx_set_drive(dev,data & 3);
959         floppy_drive_set_motor_state(floppy_get_device(space->machine, data & 3), data & 0x80);
959         floppy_mon_w(floppy_get_device(space->machine, data & 3), !BIT(data, 7));
960960         floppy_drive_set_ready_state(floppy_get_device(space->machine, data & 3), data & 0x80,0);
961961         wd17xx_set_side(dev,(data & 0x10)>>4);
962962         break;
src/mess/drivers/xor100.c
r6671r6672
216216   if (BIT(data, 0)) wd17xx_set_drive(state->wd1795, 0);
217217   if (BIT(data, 1)) wd17xx_set_drive(state->wd1795, 1);
218218
219   floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), 1);
220   floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), 1);
219   floppy_mon_w(floppy_get_device(space->machine, 0), CLEAR_LINE);
220   floppy_mon_w(floppy_get_device(space->machine, 1), CLEAR_LINE);
221221   floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1, 1);
222222   floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 1, 1);
223223}
src/mess/drivers/sg1000.c
r6671r6672
637637   sg1000_state *state = device->machine->driver_data;
638638
639639   /* floppy motor */
640   floppy_drive_set_motor_state(floppy_get_device(device->machine, 0), BIT(data, 1) ? 0 : 1);
640   floppy_mon_w(floppy_get_device(device->machine, 0), BIT(data, 1));
641641   floppy_drive_set_ready_state(floppy_get_device(device->machine, 0), 1, 1);
642642
643643   /* FDC terminal count */
src/mess/drivers/mikromik.c
r6671r6672
115115
116116   case 7: /* MOTOR ON */
117117      //logerror("MOTOR %u\n", d);
118      floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), d);
118      floppy_mon_w(floppy_get_device(space->machine, 0), !d);
119      floppy_mon_w(floppy_get_device(space->machine, 1), !d);
119120      floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), d, 1);
120      floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), d);
121121      floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), d, 1);
122122
123123      if (input_port_read(space->machine, "T5")) upd765_ready_w(state->upd765, d);
src/mess/drivers/pcw.c
r6671r6672
534534      /* disc motor on */
535535      case 9:
536536      {
537         floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), 1);
538         floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), 1);
537         floppy_mon_w(floppy_get_device(space->machine, 0), CLEAR_LINE);
538         floppy_mon_w(floppy_get_device(space->machine, 1), CLEAR_LINE);
539539         floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1,1);
540540         floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 1,1);
541541      }
r6671r6672
544544      /* disc motor off */
545545      case 10:
546546      {
547         floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), 0);
548         floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), 0);
547         floppy_mon_w(floppy_get_device(space->machine, 0), ASSERT_LINE);
548         floppy_mon_w(floppy_get_device(space->machine, 1), ASSERT_LINE);
549549         floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 0,1);
550550         floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 0,1);
551551      }
src/mess/drivers/v1050.c
r6671r6672
811811   wd17xx_set_side(state->mb8877, BIT(data, 4));
812812
813813   /* floppy motor */
814   floppy_drive_set_motor_state(get_floppy_image(device->machine, 0), f_motor_on);
815   floppy_drive_set_motor_state(get_floppy_image(device->machine, 1), f_motor_on);
814   floppy_mon_w(get_floppy_image(device->machine, 0), BIT(data, 6));
815   floppy_mon_w(get_floppy_image(device->machine, 1), BIT(data, 6));
816816   floppy_drive_set_ready_state(get_floppy_image(device->machine, 0), f_motor_on, 1);
817817   floppy_drive_set_ready_state(get_floppy_image(device->machine, 1), f_motor_on, 1);
818818
src/mess/drivers/qx10.c
r6671r6672
167167   qx10_state *driver_state = space->machine->driver_data;
168168   driver_state->fdcmotor = 1;
169169
170   floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), 1);
170   floppy_mon_w(floppy_get_device(space->machine, 0), CLEAR_LINE);
171171   floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1,1);
172172   // motor off controlled by clock
173173};
src/mess/drivers/fmtowns.c
r6671r6672
447447         // bit 5 - CLKSEL
448448         if(towns_selected_drive != 0 && towns_selected_drive < 2)
449449         {
450            floppy_drive_set_motor_state(floppy_get_device(space->machine, towns_selected_drive-1), data & 0x10);
450            floppy_mon_w(floppy_get_device(space->machine, towns_selected_drive-1), !BIT(data, 4));
451451            floppy_drive_set_ready_state(floppy_get_device(space->machine, towns_selected_drive-1), data & 0x10,0);
452452         }
453453         wd17xx_set_side(fdc,(data & 0x04)>>2);
src/mess/drivers/newbrain.c
r6671r6672
661661
662662   newbrain_state *state = space->machine->driver_data;
663663
664   floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), BIT(data, 0));
664   floppy_mon_w(floppy_get_device(space->machine, 0), !BIT(data, 0));
665665   floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1, 0);
666666
667667   upd765_reset_w(state->upd765, BIT(data, 1));
src/mess/drivers/tiki100.c
r6671r6672
214214   wd17xx_set_density(state->fd1797, BIT(data, 4) ? DEN_FM_LO : DEN_FM_HI);
215215
216216   /* floppy motor */
217   floppy_drive_set_motor_state(get_floppy_image(space->machine, 0), BIT(data, 6));
218   floppy_drive_set_motor_state(get_floppy_image(space->machine, 1), BIT(data, 6));
217   floppy_mon_w(get_floppy_image(space->machine, 0), !BIT(data, 6));
218   floppy_mon_w(get_floppy_image(space->machine, 1), !BIT(data, 6));
219219   floppy_drive_set_ready_state(get_floppy_image(space->machine, 0), BIT(data, 6), 1);
220220   floppy_drive_set_ready_state(get_floppy_image(space->machine, 1), BIT(data, 6), 1);
221221
src/mess/drivers/nanos.c
r6671r6672
408408   memory_set_bankptr(machine, "bank2", messram_get_ptr(devtag_get_device(machine, "messram")) + 0x1000);
409409   memory_set_bankptr(machine, "bank3", messram_get_ptr(devtag_get_device(machine, "messram")));
410410
411   floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), 1);
412
411   floppy_mon_w(floppy_get_device(space->machine, 0), CLEAR_LINE);
413412   floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1,1);
414413   timer_pulse(machine, ATTOTIME_IN_HZ(24000), NULL, 0, keyboard_callback);
415414}
src/mess/drivers/fm7.c
r6671r6672
515515         else
516516         {
517517            wd17xx_set_drive(dev,data & 0x03);
518            floppy_drive_set_motor_state(floppy_get_device(space->machine, data & 0x03), data & 0x80);
518            floppy_mon_w(floppy_get_device(space->machine, data & 0x03), !BIT(data, 7));
519519            floppy_drive_set_ready_state(floppy_get_device(space->machine, data & 0x03), data & 0x80,0);
520520            logerror("FDC: wrote %02x to 0x%04x (drive)\n",data,offset+0xfd18);
521521         }
src/mess/drivers/sord.c
r6671r6672
119119   cpu_yield(space->cpu);
120120}
121121
122static WRITE8_HANDLER(fd5_drive_control_w)
122static WRITE8_HANDLER( fd5_drive_control_w )
123123{
124124   int state;
125125
r6671r6672
130130
131131   LOG(("fd5 drive state w: %02x\n",state));
132132
133   floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), state);
134   floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), state);
133   floppy_mon_w(floppy_get_device(space->machine, 0), !state);
134   floppy_mon_w(floppy_get_device(space->machine, 1), !state);
135   floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1,1);
135136   floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 1,1);
136   floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 1,1);
137137}
138138
139static WRITE8_HANDLER(fd5_tc_w)
139static WRITE8_HANDLER( fd5_tc_w )
140140{
141141   const device_config *fdc = devtag_get_device(space->machine, "upd765");
142142   upd765_tc_w(fdc, 1);
src/mess/drivers/bw12.c
r6671r6672
8989{
9090   bw12_state *state = machine->driver_data;
9191
92   floppy_drive_set_motor_state(get_floppy_image(machine, 0), 0);
93   floppy_drive_set_motor_state(get_floppy_image(machine, 1), 0);
92   floppy_mon_w(get_floppy_image(machine, 0), ASSERT_LINE);
93   floppy_mon_w(get_floppy_image(machine, 1), ASSERT_LINE);
94
9495   floppy_drive_set_ready_state(get_floppy_image(machine, 0), 0, 0);
9596   floppy_drive_set_ready_state(get_floppy_image(machine, 1), 0, 0);
9697
r6671r6672
150151
151152      if (data)
152153      {
153         floppy_drive_set_motor_state(get_floppy_image(machine, 0), 1);
154         floppy_mon_w(get_floppy_image(machine, 0), CLEAR_LINE);
154155         floppy_drive_set_ready_state(get_floppy_image(machine, 0), 1, 0);
155156      }
156157
r6671r6672
162163
163164      if (data)
164165      {
165         floppy_drive_set_motor_state(get_floppy_image(machine, 1), 1);
166         floppy_mon_w(get_floppy_image(machine, 1), CLEAR_LINE);
166167         floppy_drive_set_ready_state(get_floppy_image(machine, 1), 1, 0);
167168      }
168169
src/mess/drivers/prof80.c
r6671r6672
197197{
198198   prof80_state *state = machine->driver_data;
199199
200   floppy_drive_set_motor_state(floppy_get_device(machine, 0), 0);
201   floppy_drive_set_motor_state(floppy_get_device(machine, 1), 0);
200   floppy_mon_w(floppy_get_device(machine, 0), ASSERT_LINE);
201   floppy_mon_w(floppy_get_device(machine, 1), ASSERT_LINE);
202202   floppy_drive_set_ready_state(floppy_get_device(machine, 0), 0, 1);
203203   floppy_drive_set_ready_state(floppy_get_device(machine, 1), 0, 1);
204204
r6671r6672
249249      else
250250      {
251251         /* turn on floppy motor */
252         floppy_drive_set_motor_state(floppy_get_device(machine, 0), 1);
253         floppy_drive_set_motor_state(floppy_get_device(machine, 1), 1);
252         floppy_mon_w(floppy_get_device(machine, 0), CLEAR_LINE);
253         floppy_mon_w(floppy_get_device(machine, 1), CLEAR_LINE);
254254         floppy_drive_set_ready_state(floppy_get_device(machine, 0), 1, 1);
255255         floppy_drive_set_ready_state(floppy_get_device(machine, 1), 1, 1);
256256
src/mess/drivers/specpls3.c
r6671r6672
318318   /* D3 - Disk motor on/off */
319319   /* D4 - parallel port strobe */
320320
321   floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), data & (1<<3));
322   floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), data & (1<<3));
321   floppy_mon_w(floppy_get_device(space->machine, 0), !BIT(data, 3));
322   floppy_mon_w(floppy_get_device(space->machine, 1), !BIT(data, 3));
323323   floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1, 1);
324324   floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 1, 1);
325325
src/mess/drivers/x68k.c
r6671r6672
982982               if(data & 0x20)  // ejects disk
983983               {
984984                  image_unload(floppy_get_device(space->machine, drive));
985                  floppy_drive_set_motor_state(floppy_get_device(space->machine, drive), 0);  // I'll presume ejecting the disk stops the drive motor :)
985                  floppy_mon_w(floppy_get_device(space->machine, drive), ASSERT_LINE);
986986               }
987987            }
988988         }
r6671r6672
993993   case 0x03:
994994      x68k_sys.fdc.media_density[data & 0x03] = data & 0x10;
995995      x68k_sys.fdc.motor[data & 0x03] = data & 0x80;
996      floppy_drive_set_motor_state(floppy_get_device(space->machine, data & 0x03), (data & 0x80));
996      floppy_mon_w(floppy_get_device(space->machine, data & 0x03), !BIT(data, 7));
997997      if(data & 0x80)
998998      {
999999         for(drive=0;drive<4;drive++) // enable motor for this drive
10001000         {
10011001            if(drive == (data & 0x03))
10021002            {
1003               floppy_drive_set_motor_state(floppy_get_device(space->machine, drive), 1);
1003               floppy_mon_w(floppy_get_device(space->machine, drive), CLEAR_LINE);
10041004               output_set_indexed_value("access_drv",drive,0);
10051005            }
10061006            else
r6671r6672
10111011      {
10121012         for(drive=0;drive<4;drive++)
10131013         {
1014            floppy_drive_set_motor_state(floppy_get_device(space->machine, drive), 0);
1014            floppy_mon_w(floppy_get_device(space->machine, drive), ASSERT_LINE);
10151015            output_set_indexed_value("access_drv",drive,1);
10161016         }
10171017      }
src/mess/drivers/bw2.c
r6671r6672
475475   driver_state->mtron = state;
476476   driver_state->mfdbk = !state;
477477
478   floppy_drive_set_motor_state(get_floppy_image(device->machine, 0), !driver_state->mtron);
479   floppy_drive_set_motor_state(get_floppy_image(device->machine, 1), !driver_state->mtron);
478   floppy_mon_w(get_floppy_image(device->machine, 0), driver_state->mtron);
479   floppy_mon_w(get_floppy_image(device->machine, 1), driver_state->mtron);
480480
481481   floppy_drive_set_ready_state(get_floppy_image(device->machine, 0), 1, 1);
482482   floppy_drive_set_ready_state(get_floppy_image(device->machine, 1), 1, 1);
src/mess/drivers/elwro800.c
r6671r6672
8585{
8686   const device_config *fdc = devtag_get_device(space->machine, "upd765");
8787
88   floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), (data & 0x01));
89   floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), (data & 0x02));
88   floppy_mon_w(floppy_get_device(space->machine, 0), !BIT(data, 0));
89   floppy_mon_w(floppy_get_device(space->machine, 1), !BIT(data, 1));
9090   floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1,1);
9191   floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 1,1);
9292
src/mess/drivers/pyl601.c
r6671r6672
156156   return get_floppy_image(device->machine, (floppy_index & 1)^1);
157157}
158158static UINT8 floppy_ctrl = 0;
159static WRITE8_HANDLER (floppy_w)
159static WRITE8_HANDLER( floppy_w )
160160{
161161   // bit 0 is reset (if zero)
162162   // bit 1 is TC state
r6671r6672
167167      //reset
168168      upd765_reset(floppy,0);
169169   }
170   floppy_drive_set_motor_state(get_floppy_image(space->machine, BIT(data,2)), BIT(data,3));
170   floppy_mon_w(get_floppy_image(space->machine, BIT(data,2)), !BIT(data, 3));
171171
172172   floppy_drive_set_ready_state(get_floppy_image(space->machine, 0), BIT(data,2), 0);
173173
src/mess/drivers/xerox820.c
r6671r6672
366366   if (dvsel1) wd17xx_set_drive(state->wd1771, 0);
367367   if (dvsel2) wd17xx_set_drive(state->wd1771, 1);
368368
369   floppy_drive_set_motor_state(floppy_get_device(device->machine, 0), dvsel1);
370   floppy_drive_set_motor_state(floppy_get_device(device->machine, 1), dvsel2);
369   floppy_mon_w(floppy_get_device(device->machine, 0), !dvsel1);
370   floppy_mon_w(floppy_get_device(device->machine, 1), !dvsel2);
371
371372   floppy_drive_set_ready_state(floppy_get_device(device->machine, 0), dvsel1, 1);
372373   floppy_drive_set_ready_state(floppy_get_device(device->machine, 1), dvsel2, 1);
373374

Previous 15994 Revisions Next


© 1998-2018 The MESS Team