src/mess/machine/wd17xx.c
| r1208 | r1209 | |
| 17 | 17 | what happens on the real hardware, this has fixed the NitrOS9 boot |
| 18 | 18 | problems. |
| 19 | 19 | |
| 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 | |
| 20 | 30 | TODO: |
| 21 | | - Multiple record read/write |
| 31 | - Multiple record write |
| 22 | 32 | - What happens if a track is read that doesn't have any id's on it? |
| 23 | 33 | (e.g. unformatted disc) |
| 24 | 34 | |
| r1208 | r1209 | |
| 623 | 633 | w->status |= STA_2_BUSY; |
| 624 | 634 | w->busy_count = 0; |
| 625 | 635 | |
| 626 | | wd17xx_complete_command(w, DELAY_DATADONE); |
| 636 | wd17xx_set_data_request(); |
| 627 | 637 | |
| 628 | 638 | logerror("read id succeeded.\n"); |
| 629 | 639 | } |
| r1208 | r1209 | |
| 657 | 667 | |
| 658 | 668 | |
| 659 | 669 | |
| 660 | | static int wd17xx_find_sector(wd17xx_info *w) |
| 670 | static int wd17xx_locate_sector(wd17xx_info *w) |
| 661 | 671 | { |
| 662 | 672 | UINT8 revolution_count; |
| 663 | 673 | chrn_id id; |
| r1208 | r1209 | |
| 699 | 709 | revolution_count++; |
| 700 | 710 | } |
| 701 | 711 | } |
| 712 | return 0; |
| 713 | } |
| 702 | 714 | |
| 715 | |
| 716 | static int wd17xx_find_sector(wd17xx_info *w) |
| 717 | { |
| 718 | if ( wd17xx_locate_sector(w) ) |
| 719 | { |
| 720 | return 1; |
| 721 | } |
| 722 | |
| 703 | 723 | /* record not found */ |
| 704 | 724 | w->status |= STA_2_REC_N_FND; |
| 705 | 725 | |
| r1208 | r1209 | |
| 1137 | 1157 | w->status |= STA_2_REC_TYPE; |
| 1138 | 1158 | } |
| 1139 | 1159 | |
| 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; |
| 1146 | 1166 | |
| 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 | } |
| 1149 | 1188 | } |
| 1150 | 1189 | else |
| 1151 | 1190 | { |