Previous 15994 Revisions Next

r1209 Thursday 1st November, 2007 at 17:07:42 UTC by Wilbert Pol
[WD17xx] Added support for multi record reads. Changed the wd17xx_read_id function to not finish
immediately. The disk address mark now needs to be read byte by byte through the data register.
[src/mess/machine]wd17xx.c

src/mess/machine/wd17xx.c
r1208r1209
1717        what happens on the real hardware, this has fixed the NitrOS9 boot
1818        problems.
1919 
20   2007-Nov-01 Wilbert Pol:
21      Needed these changes to get the MB8877 for Osborne-1 to work:
22      - Added support for multiple record read
23      - Changed the wd17xx_read_id to not return after DATADONEDELAY, but
24        the host should read the id data through the data register. This
25        was accomplished by making this change in the wd17xx_read_id
26        function:
27         -               wd17xx_complete_command(w, DELAY_DATADONE);
28         +               wd17xx_set_data_request();
29
2030   TODO:
21      - Multiple record read/write
31      - Multiple record write
2232      - What happens if a track is read that doesn't have any id's on it?
2333        (e.g. unformatted disc)
2434
r1208r1209
623633      w->status |= STA_2_BUSY;
624634      w->busy_count = 0;
625635
626      wd17xx_complete_command(w, DELAY_DATADONE);
636      wd17xx_set_data_request();
627637
628638      logerror("read id succeeded.\n");
629639   }
r1208r1209
657667
658668
659669
660static int wd17xx_find_sector(wd17xx_info *w)
670static int wd17xx_locate_sector(wd17xx_info *w)
661671{
662672   UINT8 revolution_count;
663673   chrn_id id;
r1208r1209
699709         revolution_count++;
700710      }
701711   }
712   return 0;
713}
702714
715
716static int wd17xx_find_sector(wd17xx_info *w)
717{
718   if ( wd17xx_locate_sector(w) )
719   {
720      return 1;
721   }
722
703723   /* record not found */
704724   w->status |= STA_2_REC_N_FND;
705725
r1208r1209
11371157            w->status |= STA_2_REC_TYPE;
11381158         }
11391159
1140         /* not incremented after each sector - only incremented in multi-sector
1141         operation. If this remained as it was oric software would not run! */
1142      //   w->sector++;
1143         /* Delay the INTRQ 3 byte times becuase we need to read two CRC bytes and
1144            compare them with a calculated CRC */
1145         wd17xx_complete_command(w, DELAY_DATADONE);
1160         /* Check we should handle the next sector for a multi record read */
1161         if ( w->command_type == TYPE_II && w->command == FDC_READ_SEC && ( w->read_cmd & 0x10 ) ) {
1162            w->sector++;
1163            if (wd17xx_locate_sector(w))
1164            {
1165               w->data_count = w->sector_length;
11461166
1147         if (VERBOSE)
1148            logerror("wd17xx_data_r(): data read completed\n");
1167               /* read data */
1168               floppy_drive_read_sector_data(wd17xx_current_image(), hd, w->sector_data_id, (char *)w->buffer, w->sector_length);
1169
1170               wd17xx_timed_data_request();
1171
1172               w->status |= STA_2_BUSY;
1173               w->busy_count = 0;
1174            } else {
1175               wd17xx_complete_command(w, DELAY_DATADONE);
1176
1177               if (VERBOSE)
1178                  logerror("wd17xx_data_r(): multi data read completed\n");
1179            }
1180         } else {
1181            /* Delay the INTRQ 3 byte times becuase we need to read two CRC bytes and
1182               compare them with a calculated CRC */
1183            wd17xx_complete_command(w, DELAY_DATADONE);
1184
1185            if (VERBOSE)
1186               logerror("wd17xx_data_r(): data read completed\n");
1187         }
11491188      }
11501189      else
11511190      {

Previous 15994 Revisions Next


© 1998-2018 The MESS Team