Re: [hatari-devel] Bug in hdc.c |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
On 23 Sep 2013 at 20:33, Roger Burrows wrote:
> I'm adding real drive capacity detection to EmuTOS, by issuing a READ CAPACITY
> command. In Hatari, the wrong value for capacity is returned because
> HDC_Cmd_ReadCapacity() divides hdSize by 512 to get the capacity in sectors;
> however, hdSize is already in sectors.
>
Some more details:
line 404 in hdc.c is currently:
int nSectors = hdSize / 512;
It should be:
int nSectors = hdSize - 1;
The -1 is because Read Capacity reports the sector number of the last sector,
rather than the actual capacity.
Roger