http://physics.concordia.ca/~eddy/391/AppA.html
Exit
Registers unchanged
Comments
Drive head moved out to track 0 (outer track).
1 of 7
8/25/2011 12:22 PM
The Assemblers
http://physics.concordia.ca/~eddy/391/AppA.html
Entry:
AH = 01h DL = Drive number (0 based)
Exit
AH = status byte - floppy disk drive only (see following table). 00 = no error. Hard drives generate a somewhat different error set.
INT 13h, Service 02h - Read Disk Sector(s) INT 13h, Service 03h - Write Sectors to Disk INT 13h, Service 04h - Verify Disk Sectors INT 13h, Service 05h - Format Disk Tracks
Entry:
AH = 02, 03, 04 or 05 AL = number of sectors to read CH = Track (cylinder) number CL = Sector number (unused if AH=05) DH = head number (side of diskette, 0 or 1) DL = Drive number, zero based ES:BX = buffer address of DTA (disk transfer area). Unused if AH=04.
2 of 7
8/25/2011 12:22 PM
The Assemblers
http://physics.concordia.ca/~eddy/391/AppA.html
Exit
CF=0 if no error, AH = status byte (see above table). If AH=05, ES:BX = 4-byte address field entries, 1 per sector: byte data number 0 track number 1 head number 2 3 sector number sector-size code: bytes/sector 00 128 01 256 02 03 512 (standard) 1024
Comments
Always check status byte before reading/writing data.
Exit
AH = Line status* AL = Modem status**
Comments/Warning
A typical setting is AL = E3h (9600 bd, no parity, 1 stop bit and an 8-bit data character length).
*Line Status Register (8 bits) b7 = 1: Time-out error b6 = 1: Transfer Shift Register (TSR) empty b5 = 1: Transfer Holding Register (THR) empty b4 = 1: Break Interrupt Detected (data line is held in non-idle state for several character times)
3 of 7
8/25/2011 12:22 PM
The Assemblers
http://physics.concordia.ca/~eddy/391/AppA.html
b3 = 1: Framing error (character does not have start bit and stop bit) b2 = 1: Parity error (if even parity, character did not have an even number of bits set to one) b1 = 1: Overrun error (character not read out of UART before next character's arrival) b0 = 1: Data ready to be read out. **Modem Status Register (8 bits) b7 = 1: Data Terminal Ready (DTR) detected b6 = 1: Ring indicator b5 = 1: Data Set Ready (DSR) b4 = 1: Clear To Send (CTS) b3 - b0: Seldom used in normal operation
Exit
AH = Error code (MSB clear means transmission successful)
Comments/Warnings
UART must have been initialized before transmission of first character. Check Line Status Register (03FD for COM1:) for value 60h, which indicates no character is waiting to be read, the Transmit Holding Register is awaiting data, and the Transmitter is empty (last character has been sent). 61h means a character has arrived and needs to be read. Reading data from UART has the highest priority, because a second character could overwrite the first. Details of error code following transmission attempt may be found in Wyatt, for example (p.532).
Exit
AH = Error code AL = Incoming character (ASCII)
4 of 7
8/25/2011 12:22 PM
The Assemblers
http://physics.concordia.ca/~eddy/391/AppA.html
Comments/Warning
Line status register with b0 = 1 means a character has arrived. The LSR data is placed in AH, so the instruction BT AH,1 sets the carry flag (CF = 1) if the LSR = 61h.
Exit
AH = Line status AL = Modem status
Comments/Warning
Exit
AX = error code (use INT 21h, AH=59 for display of error codes)
Comments/Warning
This interrupt function will destroy an existing file. Use service 5Bh if you wish to avoid this possibility. 5B (not available before DOS 3.0) is identical to 3C, but returns an error code if the file already exists. Both interrupts (3C and 5B) leave the file open (contents partially in RAM). Remember to close the file (INT 21/3E) before terminating the program.
5 of 7
8/25/2011 12:22 PM
The Assemblers
http://physics.concordia.ca/~eddy/391/AppA.html
AL = File attribute DX = Offset address of path name DS = Segment address of path name (.DATA address)
Exit
Success: AX = file handle (simple digit) Failure: AX = error code (use INT 21h, AH=59 for display of error codes)
Comments
DS:DX point to label used in .DATA segment to specify file name as ASCIZ (null-terminated ASCII) string. This opens file (contents partially in RAM). Remember to close file (INT 21/3E) before terminating program.
Exit
Success: carry bit clear Failure: carry bit set, AX = error code (use INT 21h, AH=59 for display of error codes)
Comments
Failure to close file may result in its complete destruction! Always place Close File command as close behind last file operation (read or write) as possible, in case program fails to exit properly while file open
Exit
Success: AX = number of bytes read. If AX < CX or AX = 0, one has hit end-of-file. Failure: AX = error code (use INT 21h, AH=59 for display of error codes)
Comments
6 of 7
8/25/2011 12:22 PM
The Assemblers
http://physics.concordia.ca/~eddy/391/AppA.html
.Data read from file begins at location pointed to by DS:DX. For this reason, one must be sure number of bytes read does not exceed memory allocation made in data segment.
Exit
Success: CF=0, AX = CX = number of bytes read. Failure: CF = 1, AX = error code. If AX != CX an error (e.g. disk full) has occurred, even though CF=0.
Comments
.Data read from file begins at location pointed to by DS:DX. For this reason, one must be sure number of bytes read does not exceed memory allocation made in data segment.
7 of 7
8/25/2011 12:22 PM