From c95286710dba30e46bd4e2ff6560487a4dee9652 Mon Sep 17 00:00:00 2001 From: "R. Belmont" Date: Wed, 20 Feb 2013 05:30:51 +0000 Subject: [PATCH] idectrl: words 57/58 of IDENTIFY DEVICE are total sectors, not sectors per track [R. Belmont] As commented, this is the case for ATA-1, -2, -3, -4, and -5. The CFFA2 Apple II IDE card firmware relies on this value being as documented in the standards to properly detect the drive size, and none of the usual sensitive Atari/Midway games are broken by the change. (This field is unused in ATA-6 and later). --- src/emu/machine/idectrl.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/emu/machine/idectrl.c b/src/emu/machine/idectrl.c index 4316c1173b5..ebea182b971 100644 --- a/src/emu/machine/idectrl.c +++ b/src/emu/machine/idectrl.c @@ -327,7 +327,6 @@ void ide_hdd_device::ide_build_features() { memset(m_features, 0, IDE_DISK_SECTOR_SIZE); int total_sectors = m_num_cylinders * m_num_heads * m_num_sectors; - int sectors_per_track = m_num_heads * m_num_sectors; /* basic geometry */ m_features[ 0*2+0] = 0x5a; /* 0: configuration bits */ @@ -382,13 +381,13 @@ void ide_hdd_device::ide_build_features() m_features[55*2+1] = 0;/*num_heads >> 8;*/ m_features[56*2+0] = m_num_sectors & 0xff; /* 56: number of current logical sectors per track */ m_features[56*2+1] = 0;/*num_sectors >> 8;*/ - m_features[57*2+0] = sectors_per_track & 0xff; /* 57-58: number of current logical sectors per track */ - m_features[57*2+1] = sectors_per_track >> 8; - m_features[58*2+0] = sectors_per_track >> 16; - m_features[58*2+1] = sectors_per_track >> 24; + m_features[57*2+0] = total_sectors & 0xff; /* 57-58: current capacity in sectors (ATA-1 through ATA-5; obsoleted in ATA-6) */ + m_features[57*2+1] = total_sectors >> 8; + m_features[58*2+0] = total_sectors >> 16; + m_features[58*2+1] = total_sectors >> 24; m_features[59*2+0] = 0; /* 59: multiple sector timing */ m_features[59*2+1] = 0; - m_features[60*2+0] = total_sectors & 0xff; /* 60-61: total user addressable sectors */ + m_features[60*2+0] = total_sectors & 0xff; /* 60-61: total user addressable sectors for LBA mode (ATA-1 through ATA-7) */ m_features[60*2+1] = total_sectors >> 8; m_features[61*2+0] = total_sectors >> 16; m_features[61*2+1] = total_sectors >> 24;