AltairZ80: Fix error handling of bad IMD disks and sector size computation
This commit is contained in:
parent
7e58080fb5
commit
6c84387ec0
2 changed files with 4 additions and 2 deletions
|
@ -449,8 +449,10 @@ static t_stat hdsk_attach(UNIT *uptr, CONST char *cptr) {
|
||||||
hdsk_imd[thisUnitIndex] = diskOpenEx(uptr -> fileref,
|
hdsk_imd[thisUnitIndex] = diskOpenEx(uptr -> fileref,
|
||||||
sim_deb && (hdsk_dev.dctrl & VERBOSE_MSG),
|
sim_deb && (hdsk_dev.dctrl & VERBOSE_MSG),
|
||||||
&hdsk_dev, VERBOSE_MSG, VERBOSE_MSG);
|
&hdsk_dev, VERBOSE_MSG, VERBOSE_MSG);
|
||||||
if (hdsk_imd[thisUnitIndex] == NULL)
|
if (hdsk_imd[thisUnitIndex] == NULL) {
|
||||||
|
detach_unit(uptr);
|
||||||
return SCPE_IOERR;
|
return SCPE_IOERR;
|
||||||
|
}
|
||||||
verifyDiskInfo(hdsk_imd[thisUnitIndex], '0' + thisUnitIndex);
|
verifyDiskInfo(hdsk_imd[thisUnitIndex], '0' + thisUnitIndex);
|
||||||
uptr -> HDSK_NUMBER_OF_TRACKS = hdsk_imd[thisUnitIndex] -> ntracks;
|
uptr -> HDSK_NUMBER_OF_TRACKS = hdsk_imd[thisUnitIndex] -> ntracks;
|
||||||
uptr -> HDSK_SECTORS_PER_TRACK = hdsk_imd[thisUnitIndex] -> track[1][0].nsects;
|
uptr -> HDSK_SECTORS_PER_TRACK = hdsk_imd[thisUnitIndex] -> track[1][0].nsects;
|
||||||
|
|
|
@ -164,7 +164,7 @@ static t_stat diskParse(DISK_INFO *myDisk, uint32 isVerbose)
|
||||||
sim_fread(&imd, 1, 5, myDisk->file);
|
sim_fread(&imd, 1, 5, myDisk->file);
|
||||||
if (feof(myDisk->file))
|
if (feof(myDisk->file))
|
||||||
break;
|
break;
|
||||||
sectorSize = 128 << imd.sectsize;
|
sectorSize = 128 << (imd.sectsize & 0x1f);
|
||||||
sectorHeadwithFlags = imd.head; /*AGN save the head and flags */
|
sectorHeadwithFlags = imd.head; /*AGN save the head and flags */
|
||||||
imd.head &= 1 ; /*AGN mask out flag bits to head 0 or 1 */
|
imd.head &= 1 ; /*AGN mask out flag bits to head 0 or 1 */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue