home *** CD-ROM | disk | FTP | other *** search
- /*-----------------------------------------------------------------------*
- * filename - inport.cas
- *
- * function(s)
- * inport - inputs from a hardware port
- * inportb - inputs from a hardware port
- *-----------------------------------------------------------------------*/
-
- /*[]------------------------------------------------------------[]*/
- /*| |*/
- /*| Turbo C Run Time Library - Version 3.0 |*/
- /*| |*/
- /*| |*/
- /*| Copyright (c) 1987,1988,1990 by Borland International |*/
- /*| All Rights Reserved. |*/
- /*| |*/
- /*[]------------------------------------------------------------[]*/
-
- #pragma inline
- #include <dos.h>
-
- #undef inportb
-
- /*-----------------------------------------------------------------------*
-
- Name inport - inputs from a hardware port
-
- Usage int inport(int port);
-
- Prototype in dos.h
-
- Description reads a word from the input port specified by port.
-
- Return value return the value read
-
- *------------------------------------------------------------------------*/
- int inport(int port)
- {
- asm mov dx,port
- asm in ax,dx
- return _AX;
- }
-
-
- /*-----------------------------------------------------------------------*
-
- Name inportb - inputs from a hardware port
-
- Usage unsigned char inportb(int port);
-
- Prototype in dos.h
-
- Description reads a byte from the input port specified by port.
-
- Return value return the value read
-
- *------------------------------------------------------------------------*/
- unsigned char inportb(int port)
- {
- asm mov dx,port
- asm in al,dx
- asm xor ah,ah
- return _AX;
- }
-