(MESS) corvushd: Fixed physical sector calculation. [Mike Naberezny]

This commit is contained in:
Curt Coder 2013-06-17 09:37:37 +00:00
parent 1f0d93c780
commit f16d0964b4

View file

@ -57,7 +57,6 @@
// TODO:
// Implement READY line glitch after last byte of command (Disk System Tech Ref pp. 3)
// Implement Read-after-Write (always happens on Rev B/H drives per Mass Storage GTI pp. 12)
// Implement Multiple physical drive support - Up to four
// Implement Drive Illegal Addresses (seek past last sector)
// Implement Switches on front of drive (LSI-11, MUX, Format, Reset)
// Implement an inter-sector delay during the FORMAT command (format happens too quickly now)
@ -466,7 +465,7 @@ static UINT8 parse_hdc_command(UINT8 data) {
case PREP_MODE_SELECT:
c->recv_bytes = corvus_cmd[data][0].recv_bytes;
c->xmit_bytes = corvus_cmd[data][0].xmit_bytes;
LOG(("parse_hdc_command: Single byte command recoginized: 0x%2.2x, to recv: %d, to xmit: %d\n", data,
LOG(("parse_hdc_command: Single byte command recognized: 0x%2.2x, to recv: %d, to xmit: %d\n", data,
c->recv_bytes, c->xmit_bytes));
break;
//
@ -489,7 +488,7 @@ static UINT8 parse_hdc_command(UINT8 data) {
// case DELACTIVENUM_OMNI_CODE:
// case FINDACTIVE_CODE:
c->awaiting_modifier = TRUE;
LOG(("parse_hdc_command: Double byte command recoginized: 0x%2.2x\n", data));
LOG(("parse_hdc_command: Double byte command recognized: 0x%2.2x\n", data));
break;
default: // This is an INVALID command
@ -624,6 +623,9 @@ static UINT8 corvus_write_logical_sector(running_machine &machine, dadr_t *dadr,
LOG(("corvus_write_logical_sector: Writing based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n",
dadr->address_msn_and_drive << 16 | dadr->address_lsb << 8 | dadr->address_mid, sector, drv));
// Set up the global corvus_hdc so c->tracks_per_cylinder and c->sectors_per_track are valid
corvus_hdc_file(machine, drv);
//
// Shift the logical sector address forward by the number of firmware cylinders (2) + the number of spare tracks (7)
//
@ -722,6 +724,9 @@ static UINT8 corvus_read_logical_sector(running_machine &machine, dadr_t *dadr,
LOG(("corvus_read_logical_sector: Reading based on DADR: 0x%6.6x, logical sector: 0x%5.5x, drive: %d\n",
dadr->address_msn_and_drive << 16 | dadr->address_lsb << 8 | dadr->address_mid, sector, drv));
// Set up the global corvus_hdc so c->tracks_per_cylinder and c->sectors_per_track are valid
corvus_hdc_file(machine, drv);
//
// Shift the logical sector address forward by the number of firmware cylinders (2) + the number of spare tracks (7)
//
@ -1121,6 +1126,9 @@ static UINT8 corvus_format_drive(running_machine &machine, UINT8 *pattern, UINT1
UINT8 status = 0;
UINT8 tbuffer[512];
// Set up the global corvus_hdc so c->tracks_per_cylinder and c->sectors_per_track are valid
corvus_hdc_file(machine, 0);
max_sector = c->sectors_per_track * c->tracks_per_cylinder * c->cylinders_per_drive;
//
@ -1178,14 +1186,14 @@ static hard_disk_file *corvus_hdc_file(running_machine &machine, int id) {
if (!img->exists())
return NULL;
// Pick up the Head/Cylinder/Sector info
hard_disk_file *file = img->get_hard_disk_file();
hard_disk_info *info = hard_disk_get_info(file);
// Pick up the Head/Cylinder/Sector info
hard_disk_file *file = img->get_hard_disk_file();
hard_disk_info *info = hard_disk_get_info(file);
c->sectors_per_track = info->sectors;
c->tracks_per_cylinder = info->heads;
c->cylinders_per_drive = info->cylinders;
LOG(("corvus_hdc_init: Attached to drive %u image: H:%d, C:%d, S:%d\n", id, info->heads, info->cylinders, info->sectors));
LOG(("corvus_hdc_file: Attached to drive %u image: H:%d, C:%d, S:%d\n", id, info->heads, info->cylinders, info->sectors));
return file;
}