r8640 Tuesday 27th July, 2010 at 16:00:45 UTC by Dirk Best
[UPD765] Improved ready handling when pin is not connected
[src/mess/machine]upd765.c

src/mess/machine/upd765.c
r8639r8640
236236   fdc->FDC_main &= ~0x080;
237237}
238238
239static int upd765_get_rdy(running_device *device)
240{
241   upd765_t *fdc = get_safe_token(device);
242
243   if (fdc->rdy_pin == UPD765_RDY_PIN_CONNECTED)
244   {
245      running_device *img = current_image(device);
246      return floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY);
247   }
248   else
249      return 1;
250}
251
239252static void upd765_seek_complete(running_device *device)
240253{
241254   /* tested on Amstrad CPC */
r8639r8640
299312   fdc->upd765_status[0] = 0x20;
300313
301314   /* drive ready? */
302   if (img != NULL && floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
315   if (img != NULL && upd765_get_rdy(device))
303316   {
304317      /* recalibrate? */
305318      if (fdc->upd765_flags & UPD765_SEEK_OPERATION_IS_RECALIBRATE)
r8639r8640
496509      fdc->ncn = 0;
497510
498511      /* if drive is already at track 0, or drive is not ready */
499      if (img == NULL || floppy_tk00_r(img) == CLEAR_LINE ||
500         (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
501         )
512      if (img == NULL || floppy_tk00_r(img) == CLEAR_LINE || (!upd765_get_rdy(device)))
502513      {
503514         /* seek completed */
504515//          upd765_seek_complete(device);
r8639r8640
551562      signed_tracks = fdc->ncn - fdc->pcn[fdc->drive];
552563
553564      /* if no tracks to seek, or drive is not ready, seek is complete */
554      if (img == NULL || (signed_tracks==0) || (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY)))
565      if (img == NULL || (signed_tracks==0) || (!upd765_get_rdy(device)))
555566      {
556567         upd765_seek_complete(device);
557568      }
r8639r8640
960971   upd765_t *fdc = get_safe_token(device);
961972   running_device *img = current_image(device);
962973
963   if (!(floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY)))
974   if (!upd765_get_rdy(device))
964975   {
965976      fdc->upd765_status[0] = 0x0c0 | (1<<4) | fdc->drive | (fdc->side<<2);
966977      fdc->upd765_status[1] = 0x00;
r8639r8640
11521163static void upd765_write_data(running_device *device)
11531164{
11541165   upd765_t *fdc = get_safe_token(device);
1155   if (!(floppy_drive_get_flag_state(current_image(device), FLOPPY_DRIVE_READY)))
1166   if (!upd765_get_rdy(device))
11561167   {
11571168      fdc->upd765_status[0] = 0x0c0 | (1<<4) | fdc->drive | (fdc->side<<2);
11581169        fdc->upd765_status[1] = 0x00;
r8639r8640
18791890            fdc->upd765_status[3] |= !floppy_tk00_r(img) << 4;
18801891            fdc->upd765_status[3] |= !floppy_wpt_r(img) << 6;
18811892
1882            if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
1893            if (upd765_get_rdy(device))
18831894            {
18841895               fdc->upd765_status[3] |= 0x20;
18851896            }
r8639r8640
19091920         fdc->upd765_status[2] = 0;
19101921
19111922         /* drive ready? */
1912         if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
1923         if (upd765_get_rdy(device))
19131924         {
19141925            /* is disk inserted? */
19151926            device_image_interface *image = dynamic_cast<device_image_interface *>( img);

Previous 509070 RevisionsNext 50


© 1998-2010 The MESS Team