diff --git a/AltairZ80/ibc_mcc_hdc.c b/AltairZ80/ibc_mcc_hdc.c index 71468b5b..37245a82 100644 --- a/AltairZ80/ibc_mcc_hdc.c +++ b/AltairZ80/ibc_mcc_hdc.c @@ -49,7 +49,8 @@ #define IBC_HDC_MAX_DRIVES 4 /* Maximum number of drives supported */ #define IBC_HDC_MAX_SECLEN 256 /* Maximum of 256 bytes per sector */ #define IBC_HDC_FORMAT_FILL_BYTE 0xe5 /* Real controller uses 0, but we - choose 0xe5 so the disk shows up as blank under CP/M. */ + choose 0xe5 so the disk shows + up as blank under CP/M. */ #define IBC_HDC_MAX_CYLS 1024 #define IBC_HDC_MAX_HEADS 16 #define IBC_HDC_MAX_SPT 256 @@ -67,6 +68,7 @@ #define TF_TRKH 7 #define TF_FIFO 8 +#define IBC_HDC_STATUS_BUSY (1 << 4) #define IBC_HDC_STATUS_ERROR (1 << 0) #define IBC_HDC_ERROR_ID_NOT_FOUND (1 << 4) @@ -536,7 +538,7 @@ static t_stat IBC_HDC_doCommand(void) IBC_HDC_DRIVE_INFO* pDrive = &ibc_hdc_info->drive[ibc_hdc_info->sel_drive]; uint8 cmd = ibc_hdc_info->taskfile[TF_CMD] & IBC_HDC_CMD_MASK; - pDrive->cur_cyl = ibc_hdc_info->taskfile[TF_TRKH] << 8; + pDrive->cur_cyl = (uint16)ibc_hdc_info->taskfile[TF_TRKH] << 8; pDrive->cur_cyl |= ibc_hdc_info->taskfile[TF_TRKL]; pDrive->xfr_nsects = ibc_hdc_info->taskfile[TF_NSEC]; pDrive->cur_head = ibc_hdc_info->taskfile[TF_HEAD]; @@ -569,7 +571,7 @@ static t_stat IBC_HDC_doCommand(void) if (IBC_HDC_Validate_CHSN(pDrive) != SCPE_OK) break; /* Calculate file offset */ - file_offset = (pDrive->cur_cyl * pDrive->nheads * pDrive->nsectors); /* Full cylinders */ + file_offset = (pDrive->cur_cyl * pDrive->nheads * pDrive->nsectors); /* Full cylinders */ file_offset += (pDrive->cur_head * pDrive->nsectors); /* Add full heads */ file_offset += (pDrive->cur_sect); /* Add sectors for current request */ file_offset *= pDrive->sectsize; /* Convert #sectors to byte offset */