home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-1.ZIP / GCOMM / _ASSTI.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-08-14  |  3.2 KB  |  117 lines

  1.         page    60,132
  2. ;
  3. ; The Greenleaf Comm Library
  4. ;
  5. ; Copyright (C) 1984-90 Greenleaf Software Inc.  All Rights Reserved.
  6. ;
  7.  
  8.         .xlist
  9.         include model.h         ; memory model
  10.         include prologue.h      ; segmentation setups
  11.         include asiports.equ
  12.         .list
  13.  
  14. ; Modifications
  15. ;
  16. ;  ""   26-FEB-1987  17:37:54.57
  17. ;       Added new _asgetc() and _asputc() functions.
  18.  
  19.  
  20.         pseg    _assti
  21.  
  22. ;==>--  void _assti()
  23. ;
  24. ;  This function sets or enables the interrupt flag in the cpu.
  25. ;
  26.         cproc   _assti,,,,,<LRA,NOSI,NODI>
  27.         sti
  28.         xor     ax,ax
  29.         cproce
  30.  
  31. ;==>--  void _ascli()
  32. ;
  33. ;  This function clears or disables the interrupt flag in the cpu.
  34. ;
  35.         cproc   _ascli,,,,,<LRA,NOSI,NODI>
  36.         cli
  37.         xor     ax,ax
  38.         cproce
  39.  
  40. ;==>--  int _asinb(ioaddress)
  41. ;       unsigned ioaddress;
  42. ;
  43. ;       Input via 8086/88/ etc. in instruction, return value
  44. ;       read from ioaddress.
  45. ;
  46.         cproc   _asinb,,,,,<NOSI,NODI>
  47.         mov     dx,parm1_
  48.         in      al,dx
  49.         KILL_TIME
  50.         xor     ah,ah
  51.         cproce
  52.  
  53. ;==>--  int _asoutb(ioaddress,value)
  54. ;       unsigned ioaddress;
  55. ;       int value;
  56. ;
  57. ;       Output via 8086/88/etc. out instruction, return value.
  58. ;
  59.         cproc   _asoutb,,,,,<NOSI,NODI>
  60.         mov     dx,parm1_
  61.         mov     al,parm2_
  62.         out     dx,al
  63.         KILL_TIME
  64.         xor     ah,ah
  65.         cproce
  66.  
  67. ;==>--  int _asgetc(base8250address)
  68. ;       unsigned base8250address;
  69. ;
  70. ;       Read a character from 8250 if one is available and return
  71. ;       it or return ASTIMEOUT indicating no character is available
  72. ;
  73.         cproc   _asgetc,,,,,<NOSI,NODI>
  74.         mov     cx,parm1_               ;cx=base 8250
  75.         mov     dx,LSREG
  76.         add     dx,cx                   ;dx=line status register
  77.         in      al,dx
  78.         KILL_TIME
  79.         and     al,DATARDY              ;see if data ready
  80.         mov     ax,ASTIMEOUT            ;assume time-out
  81.         jz      _asgex                  ;check assumption
  82.         mov     dx,cx                   ;dx= rx buffer
  83.         in      al,dx
  84.         KILL_TIME
  85.         xor     ah,ah                   ;return character in al
  86. _asgex:
  87.         cproce
  88.  
  89.  
  90. ;==>--  int _asputc(base8250address,character)
  91. ;       unsigned base8250address;
  92. ;       int character;
  93. ;
  94. ;       Output character to port if possible return ASTIMEOUT
  95. ;       indicating that 8250 is still busy, or ASSUCCESS indicating
  96. ;       operation was completed.
  97. ;
  98.         cproc   _asputc,,,,,<NOSI,NODI>
  99.         mov     cx,parm1_               ;cx=base 8250
  100.         mov     dx,LSREG
  101.         add     dx,cx                   ;dx=line status register
  102.         in      al,dx
  103.         KILL_TIME
  104.         and     al,THRE                 ;check transmit holding
  105.         mov     ax,ASTIMEOUT            ;assume timeout
  106.         jz      _aspux                  ;check assumption
  107.         mov     ax,parm2_               ;else get character
  108.         mov     dx,cx                   ;and output to 8250/16450
  109.         out     dx,al
  110.         KILL_TIME
  111.         xor     ax,ax                   ;and return success
  112. _aspux:
  113.         cproce
  114.  
  115.         endps
  116.         end
  117.