trunk/src/mess/machine/corvushd.c
r23743 | r23744 | |
57 | 57 | // TODO: |
58 | 58 | // Implement READY line glitch after last byte of command (Disk System Tech Ref pp. 3) |
59 | 59 | // Implement Read-after-Write (always happens on Rev B/H drives per Mass Storage GTI pp. 12) |
60 | | // Implement Multiple physical drive support - Up to four |
61 | 60 | // Implement Drive Illegal Addresses (seek past last sector) |
62 | 61 | // Implement Switches on front of drive (LSI-11, MUX, Format, Reset) |
63 | 62 | // Implement an inter-sector delay during the FORMAT command (format happens too quickly now) |
r23743 | r23744 | |
466 | 465 | case PREP_MODE_SELECT: |
467 | 466 | c->recv_bytes = corvus_cmd[data][0].recv_bytes; |
468 | 467 | c->xmit_bytes = corvus_cmd[data][0].xmit_bytes; |
469 | | LOG(("parse_hdc_command: Single byte command recoginized: 0x%2.2x, to recv: %d, to xmit: %d\n", data, |
| 468 | LOG(("parse_hdc_command: Single byte command recognized: 0x%2.2x, to recv: %d, to xmit: %d\n", data, |
470 | 469 | c->recv_bytes, c->xmit_bytes)); |
471 | 470 | break; |
472 | 471 | // |
r23743 | r23744 | |
489 | 488 | // case DELACTIVENUM_OMNI_CODE: |
490 | 489 | // case FINDACTIVE_CODE: |
491 | 490 | c->awaiting_modifier = TRUE; |
492 | | LOG(("parse_hdc_command: Double byte command recoginized: 0x%2.2x\n", data)); |
| 491 | LOG(("parse_hdc_command: Double byte command recognized: 0x%2.2x\n", data)); |
493 | 492 | break; |
494 | 493 | |
495 | 494 | default: // This is an INVALID command |
r23743 | r23744 | |
624 | 623 | LOG(("corvus_write_logical_sector: Writing based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n", |
625 | 624 | dadr->address_msn_and_drive << 16 | dadr->address_lsb << 8 | dadr->address_mid, sector, drv)); |
626 | 625 | |
| 626 | // Set up the global corvus_hdc so c->tracks_per_cylinder and c->sectors_per_track are valid |
| 627 | corvus_hdc_file(machine, drv); |
| 628 | |
627 | 629 | // |
628 | 630 | // Shift the logical sector address forward by the number of firmware cylinders (2) + the number of spare tracks (7) |
629 | 631 | // |
r23743 | r23744 | |
722 | 724 | LOG(("corvus_read_logical_sector: Reading based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n", |
723 | 725 | dadr->address_msn_and_drive << 16 | dadr->address_lsb << 8 | dadr->address_mid, sector, drv)); |
724 | 726 | |
| 727 | // Set up the global corvus_hdc so c->tracks_per_cylinder and c->sectors_per_track are valid |
| 728 | corvus_hdc_file(machine, drv); |
| 729 | |
725 | 730 | // |
726 | 731 | // Shift the logical sector address forward by the number of firmware cylinders (2) + the number of spare tracks (7) |
727 | 732 | // |
r23743 | r23744 | |
1121 | 1126 | UINT8 status = 0; |
1122 | 1127 | UINT8 tbuffer[512]; |
1123 | 1128 | |
| 1129 | // Set up the global corvus_hdc so c->tracks_per_cylinder and c->sectors_per_track are valid |
| 1130 | corvus_hdc_file(machine, 0); |
| 1131 | |
1124 | 1132 | max_sector = c->sectors_per_track * c->tracks_per_cylinder * c->cylinders_per_drive; |
1125 | 1133 | |
1126 | 1134 | // |
r23743 | r23744 | |
1178 | 1186 | if (!img->exists()) |
1179 | 1187 | return NULL; |
1180 | 1188 | |
1181 | | // Pick up the Head/Cylinder/Sector info |
1182 | | hard_disk_file *file = img->get_hard_disk_file(); |
1183 | | hard_disk_info *info = hard_disk_get_info(file); |
| 1189 | // Pick up the Head/Cylinder/Sector info |
| 1190 | hard_disk_file *file = img->get_hard_disk_file(); |
| 1191 | hard_disk_info *info = hard_disk_get_info(file); |
1184 | 1192 | c->sectors_per_track = info->sectors; |
1185 | 1193 | c->tracks_per_cylinder = info->heads; |
1186 | 1194 | c->cylinders_per_drive = info->cylinders; |
1187 | 1195 | |
1188 | | LOG(("corvus_hdc_init: Attached to drive %u image: H:%d, C:%d, S:%d\n", id, info->heads, info->cylinders, info->sectors)); |
| 1196 | LOG(("corvus_hdc_file: Attached to drive %u image: H:%d, C:%d, S:%d\n", id, info->heads, info->cylinders, info->sectors)); |
1189 | 1197 | |
1190 | 1198 | return file; |
1191 | 1199 | } |