ID (AH) Description
00h RESET DISK SUBSYSTEM
01h READ DISK STATUS
02h READ SECTOR(S)
03h WRITE SECTOR(S)
04h VERIFY SECTOR(S)
05h FORMAT TRACK

RESET DISK SUBSYSTEM (AH – 00H)

FUNCTION

  • Resets the fixed disk or diskette controller and drive, forcing recalibration of the read/write head.

SYNOPSIS

  • mov AH,00h
  • int 13h

Returns

  • AH = DISK STATUS (See Service 01h)
  • CF = Set if error, otherwise cleared

NOTES

  • If an error is reported by the disk BIOS routines, use this service to reset the floppy and/or fixed disk controllers, and retry the operation.
  • There is only one cursor size for all video pages.

READ DISK STATUS (AH = O1H)

FUNCTION

  • Returns status information about the most recent fixed or floppy disk operation.

SYNOPSIS

  • mov AH,01h
  • mov DL,Drive number
  • int 13h

Returns

  • AH & AL = DISK STATUS (see below)
  • CF = Set if error, otherwise cleared
AH Meaning DEVICE
00h No error
01h BAD COMMAND PASSED TO ROUTINE
02h ADDR MARK NOT FOUND ON TRACK
03h WRITE ATTEMPTED ON WRITE PROTECTED DISK
04h REQUESTED SECTOR NOT FOUND
05h Reset failed
06h Diskette change line active floppy
08h DATA OVERRUN
09h ATTEMPTED TO CROSS 64K BOUNDARY
10h CRC ERROR ON READING (CRC or ECC data error)
20h FDC FAILURE
40h SEEK OPERATION ERROR
80h FDC TIMEOUT ERROR (Drive not ready)

NOTES

  • The most recent diskette operation status is found at 0:441h. The most recent fixed disk operation status is at 0:474h.

READ SECTOR(S) (AH = 02H)

FUNCTION

  • Reads one or more sectors from a floppy disk into memory.

SYNOPSIS

  • mov AH, 02h
  • mov AL, NUMBER OF SECTORS TO READ
  • mov CL, SECTOR NUMBER
  • mov CH, TRACK NUMBER
  • mov DL, Drive number
  • mov DH, HEAD NUMBER
  • ES:BX = BUFFER ADDRESS
  • int 13h

Returns

  • AH = DISK STATUS
  • AL = 0

NOTES

  • The sectors read must all be on the same cylinder and same side
  • If an error is encountered reading a sector, use Service 0 to reset the drive and retry the operation. It is recommended that at least 3 retries be attempted before an error is signalled, since the error may have resulted from the diskette motor not being up to speed.
  • Because of the architecture of the DMA channel, an error will occur if the buffer in memory for the sectors overlaps a 64K page boundary. A 64K page boundary is a memory location which is one of the following (10000h, 20000h, 30000h, etc.). Ensure that no part of your buffer falls on such a boundary. If it does, create a new buffer or start the buffer just after the boundary.

WRITE SECTOR(S) (AH = 03H)

FUNCTION

  • Writes one or more sectors from memory to a floppy disk.

SYNOPSIS

  • mov AH, 03h
  • mov AL, NUMBER OF SECTORS TO WRITE
  • mov CL, SECTOR NUMBER
  • mov CH, TRACK NUMBER
  • mov DL, Drive number
  • mov DH, HEAD NUMBER
  • ES:BX = BUFFER ADDRESS
  • int 13h

Returns

  • AH = DISK STATUS
  • AL = 0

NOTES

  • The sectors read must all be on the same cylinder and same side
  • If an error is encountered reading a sector, use Service 0 to reset the drive and retry the operation. It is recommended that at least 3 retries be attempted before an error is signalled, since the error may have resulted from the diskette motor not being up to speed.
  • Because of the architecture of the DMA channel, an error will occur if the buffer in memory for the sectors overlaps a 64K page boundary. A 64K page boundary is a memory location which is one of the following (10000h, 20000h, 30000h, etc.). Ensure that no part of your buffer falls on such a boundary. If it does, create a new buffer or start the buffer just after the boundary.

VERIFY SECTOR(S) (AH = 04H)

FUNCTION

  • Verifies one or more diskette sectors.

SYNOPSIS

  • mov AH, 04h
  • mov AL, NUMBER OF SECTORS TO VERIFY
  • mov CL, SECTOR NUMBER
  • mov CH, TRACK NUMBER
  • mov DL, Drive number
  • mov DH, HEAD NUMBER
  • ES:BX = BUFFER ADDRESS
  • int 13h

Returns

  • AH = DISK STATUS
  • AL = 0

NOTES

  • The sectors read must all be on the same cylinder and same side
  • If an error is encountered reading a sector, use Service 0 to reset the drive and retry the operation. It is recommended that at least 3 retries be attempted before an error is signalled, since the error may have resulted from the diskette motor not being up to speed.

Last Update: 05.04.2024