home *** CD-ROM | disk | FTP | other *** search
- page 60,132
- ;
- ; The Greenleaf Comm Library
- ;
- ; Copyright (C) 1984-90 Greenleaf Software Inc. All Rights Reserved.
- ;
-
- .xlist
- include model.h ; memory model
- include prologue.h ; segmentation setups
- include asiports.equ
- .list
-
- ; Modifications
- ;
- ; "" 26-FEB-1987 17:37:54.57
- ; Added new _asgetc() and _asputc() functions.
-
-
- pseg _assti
-
- ;==>-- void _assti()
- ;
- ; This function sets or enables the interrupt flag in the cpu.
- ;
- cproc _assti,,,,,<LRA,NOSI,NODI>
- sti
- xor ax,ax
- cproce
-
- ;==>-- void _ascli()
- ;
- ; This function clears or disables the interrupt flag in the cpu.
- ;
- cproc _ascli,,,,,<LRA,NOSI,NODI>
- cli
- xor ax,ax
- cproce
-
- ;==>-- int _asinb(ioaddress)
- ; unsigned ioaddress;
- ;
- ; Input via 8086/88/ etc. in instruction, return value
- ; read from ioaddress.
- ;
- cproc _asinb,,,,,<NOSI,NODI>
- mov dx,parm1_
- in al,dx
- KILL_TIME
- xor ah,ah
- cproce
-
- ;==>-- int _asoutb(ioaddress,value)
- ; unsigned ioaddress;
- ; int value;
- ;
- ; Output via 8086/88/etc. out instruction, return value.
- ;
- cproc _asoutb,,,,,<NOSI,NODI>
- mov dx,parm1_
- mov al,parm2_
- out dx,al
- KILL_TIME
- xor ah,ah
- cproce
-
- ;==>-- int _asgetc(base8250address)
- ; unsigned base8250address;
- ;
- ; Read a character from 8250 if one is available and return
- ; it or return ASTIMEOUT indicating no character is available
- ;
- cproc _asgetc,,,,,<NOSI,NODI>
- mov cx,parm1_ ;cx=base 8250
- mov dx,LSREG
- add dx,cx ;dx=line status register
- in al,dx
- KILL_TIME
- and al,DATARDY ;see if data ready
- mov ax,ASTIMEOUT ;assume time-out
- jz _asgex ;check assumption
- mov dx,cx ;dx= rx buffer
- in al,dx
- KILL_TIME
- xor ah,ah ;return character in al
- _asgex:
- cproce
-
-
- ;==>-- int _asputc(base8250address,character)
- ; unsigned base8250address;
- ; int character;
- ;
- ; Output character to port if possible return ASTIMEOUT
- ; indicating that 8250 is still busy, or ASSUCCESS indicating
- ; operation was completed.
- ;
- cproc _asputc,,,,,<NOSI,NODI>
- mov cx,parm1_ ;cx=base 8250
- mov dx,LSREG
- add dx,cx ;dx=line status register
- in al,dx
- KILL_TIME
- and al,THRE ;check transmit holding
- mov ax,ASTIMEOUT ;assume timeout
- jz _aspux ;check assumption
- mov ax,parm2_ ;else get character
- mov dx,cx ;and output to 8250/16450
- out dx,al
- KILL_TIME
- xor ax,ax ;and return success
- _aspux:
- cproce
-
- endps
- end