Previous 15994 Revisions Next

r5076 Thursday 25th June, 2009 at 07:21:19 UTC by Curt Coder
[BW12] Fixed floppy access.
[NEC765] Added null check to sense drive status command.
[src/mess/drivers]bw12.c
[src/mess/machine]nec765.c

src/mess/machine/nec765.c
r5075r5076
18471847
18481848         fdc->nec765_status[3] = fdc->drive | (fdc->side<<2);
18491849
1850         if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_DISK_WRITE_PROTECTED))
1850         if (img)
18511851         {
1852            fdc->nec765_status[3] |= 0x40;
1853         }
1852            if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_DISK_WRITE_PROTECTED))
1853            {
1854               fdc->nec765_status[3] |= 0x40;
1855            }
18541856
1855         if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
1856         {
1857            fdc->nec765_status[3] |= 0x20;
1858         }
1857            if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
1858            {
1859               fdc->nec765_status[3] |= 0x20;
1860            }
18591861
1860         if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_HEAD_AT_TRACK_0))
1861         {
1862            fdc->nec765_status[3] |= 0x10;
1862            if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_HEAD_AT_TRACK_0))
1863            {
1864               fdc->nec765_status[3] |= 0x10;
1865            }
18631866         }
18641867
18651868         fdc->nec765_status[3] |= 0x08;
src/mess/drivers/bw12.c
r5075r5076
4040 
4141   TODO:
4242 
43   - nec765 access violation
4443   - keyboard
44   - floppy motor off timer
4545 
4646*/
4747 
r5075r5076
8888 
8989   floppy_drive_set_motor_state(get_floppy_image(machine, 0), 0);
9090   floppy_drive_set_motor_state(get_floppy_image(machine, 1), 0);
91   floppy_drive_set_ready_state(get_floppy_image(machine, 0), 0, 1);
92   floppy_drive_set_ready_state(get_floppy_image(machine, 1), 0, 1);
91   floppy_drive_set_ready_state(get_floppy_image(machine, 0), 0, 0);
92   floppy_drive_set_ready_state(get_floppy_image(machine, 1), 0, 0);
9393 
9494   state->motor_on = 0;
9595}
r5075r5076
101101   if (state->motor0 || state->motor1)
102102   {
103103      /* trigger floppy motor off NE556 timer */
104      int t = 1100 * RES_K(100) * CAP_U(4.7); // t = 1.1 * R18 * C11
104//      int t = 1100 * RES_K(100) * CAP_U(4.7); // t = 1.1 * R18 * C11
105105 
106      timer_adjust_oneshot(state->floppy_motor_off_timer, ATTOTIME_IN_MSEC(t), 0);
106//      timer_adjust_oneshot(state->floppy_motor_off_timer, ATTOTIME_IN_MSEC(t), 0);
107107       
108108      state->motor_on = 1;
109109   }
r5075r5076
141141      if (data)
142142      {
143143         floppy_drive_set_motor_state(get_floppy_image(machine, 0), 1);
144         floppy_drive_set_ready_state(get_floppy_image(machine, 0), 1, 1);
144         floppy_drive_set_ready_state(get_floppy_image(machine, 0), 1, 0);
145145      }
146146 
147147      bw12_set_floppy_motor_off_timer(machine);
r5075r5076
153153      if (data)
154154      {
155155         floppy_drive_set_motor_state(get_floppy_image(machine, 1), 1);
156         floppy_drive_set_ready_state(get_floppy_image(machine, 1), 1, 1);
156         floppy_drive_set_ready_state(get_floppy_image(machine, 1), 1, 0);
157157      }
158158 
159159      bw12_set_floppy_motor_off_timer(machine);
r5075r5076
316316   driver_state->fdcint = state;
317317}
318318 
319static const nec765_interface bw12_nec765_interface =
319static NEC765_GET_IMAGE( bw12_nec765_get_image )
320320{
321   switch (floppy_index)
322   {
323   case 1: /* drive A */
324      return get_floppy_image(device->machine, 0);
325 
326   case 2: /* drive B */
327      return get_floppy_image(device->machine, 1);
328 
329   default:
330      return NULL;
331   }
332}
333 
334static const struct nec765_interface bw12_nec765_interface =
335{
321336   bw12_nec765_interrupt,      /* interrupt */
322337   NULL,                  /* DMA request */
323   NULL,                  /* image lookup */
338   bw12_nec765_get_image,      /* image lookup */
324339   NEC765_RDY_PIN_CONNECTED   /* ready pin */
325340};
326341 

Previous 15994 Revisions Next


© 1998-2018 The MESS Team