Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Port I/O Functions
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The inp and inpw functions read a byte and a word, respectively,
from the specified input port. The outp and outpw functions write
a byte and a word, respectively, to the specified output port.
These functions are supported in OS/2 protected mode.
The <port> argument can be any unsigned integer in the range
0-65,535. The <databyte> argument can be any integer in the range
0-255. The <dataword> argument can be any value in the range
0-65,535.
You must use a .DEF file to declare the IOSEG segment that the
run-time library uses to perform input/output on the port. In
addition, the intrinsic (/Oi) versions of these functions do not
work unless you put the code in a segment marked with the IOPL
keyword in the .DEF file.
Since you cannot do IOPL from a regular code segment, the run-time
library has declared a separate code segment called _IOSEG. In
order to use any of these functions in any of the protected-mode
run-time libraries (?LIBCP, LLIBCDLL, LLIBCMT, or CDLLOBJS-based
DLL), you must have a .DEF file containing the following line:
SEGMENTS _IOSEG CLASS 'IOSEG_CODE' IOPL
Return Value
The inp and inpw functions return the byte or word read from
<port>. The outp and outpw functions return the data that was
output. There is no error return.
-♦-