Enhanced INT 17h function definitions
This section provides definitions for the following functions: Initialize
I/O, Write I/O, and Read I/O.
Initialize I/O
Function: efh
Subfunction: 00h
Purpose:
To set the directions and to program the
initial values of an I/O port.
Calling registers:
Ah
efh
AL
00h (03h for I/O2)
DI
Port A configuration
Initial Data
Direction Mask
xxxxxxxx
xxxxxxxxB
direction: 1=output, 0=input
BX
Port B configuration
Initial Data
Direction Mask
xxxxxxxx
xxxxxxxxB
direction: 1=output, 0=input 0->input
CX
Port C configuration
Initial Data
Direction Mask
xxxxxxxx
xxxxxxxxB
direction: 1=output, 0=input
DX
ffffh
Return registers:
Carry flag cleared if successful
Carry flag set if error
AL
Error
code
Comments:
This function is used to initialize the
I/ before normal use.
Programming example:
/* Inline assembly code for Borland C++ 3.1 */
asm {
mov ax,0ef00h
mov di,00ffh /*port A all outputs,
init data=all 0’s */
mov bx,55ffh /*port B all outputs,
init data=55h*/
mov cx,0000h /*port C all inputs*
mov dx,0ffffh
int 17h
}
Write I/O
Function: efh
Subfunction: 01h
Purpose:
To write a value of an I/O port.
Calling registers:
AH
efh
83