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 / _ASIQUIT.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-08-14  |  3.4 KB  |  111 lines

  1.         page    60,132
  2.  
  3. ;
  4. ; The Greenleaf Comm Library
  5. ;
  6. ; Copyright (C) 1984-90 Greenleaf Software Inc.  All Rights Reserved.
  7. ;
  8.  
  9.  
  10. ;/*
  11. ; * MODIFICATIONS
  12. ; *  ""   06-MAY-1986  01:10:42.28
  13. ; *    Modified shutdown 8259 sequence to correctly restore state
  14. ; *    of interrupt enable bit to pre-asifirst() state.
  15. ; *    Code changed is bracketed with "Start [06-May-86] Modification" and
  16. ; *    "End [06-May-86] Modification"
  17. ; */
  18.  
  19.         include model.h
  20.         include prologue.h
  21.         include asiports.equ
  22.  
  23.         pseg    _asiquit
  24.  
  25. ;==>--  void _asiquit(latch,p)
  26. ;       int latch;
  27. ;       struct PORT_TABLE *p;
  28. ;
  29.         cproc   _asiquit
  30.         push    ds
  31.         push    es
  32.         if      _LDATA
  33.          lds    bx,parm2_
  34.         else
  35.          mov    bx,parm2_
  36.         endif
  37.         mov     ax,ds
  38.         mov     es,ax                   ;es=ds
  39.         mov     cx,[bx+base_8250]       ;
  40.         mov     dx,INTER                ;shut down 8250 interrupts
  41.         add     dx,cx
  42.         xor     al,al
  43.         out     dx,al
  44.         KILL_TIME
  45.         mov     al,DLAB                 ;set baud rate first
  46.         mov     dx,LCREG
  47.         add     dx,cx
  48.         out     dx,al
  49.         KILL_TIME
  50.         mov     ax,[bx+p_8250ldl]       ;get least significant baud rate
  51.         mov     dx,cx
  52.         out     dx,al                   ;set least significant baud rate
  53.         KILL_TIME
  54.         mov     ax,[bx+p_8250mdl]       ;get most significant baud rate
  55.         inc     dx
  56.         out     dx,al                   ;and set in 8250
  57.         KILL_TIME
  58.         mov     ax,[bx+p_8250lcr]       ;read line control register
  59.         mov     dx,LCREG
  60.         add     dx,cx
  61.         out     dx,al
  62.         KILL_TIME
  63.         mov     ax,[bx+p_8250mcr]       ;read modem control register
  64.         mov     dx,MCREG
  65.         add     dx,cx
  66.         out     dx,al
  67.         KILL_TIME
  68.         test    byte ptr parm1_,1
  69.         jz      no8259
  70.         mov     ax,[bx+intrpt_num]
  71.         or      al,al                   ;see if we have one
  72.         jz      novect
  73.         push    ds
  74.         lds     dx,[bx+p_vector]        ;get previous one
  75.         mov     ah,25h                  ;set interrupt vector function
  76.         int     21h
  77.         pop     ds
  78. novect: mov     cx,[bx+irq_8259]        ;reset 8259 to previous condition
  79.         or      cx,cx                   ;check for 0
  80.         jz      no8259
  81.         mov     ax,1                    ;Start [06-May-86] Modification
  82.         shl     al,cl
  83.         mov     cx,ax                   ;cx=mask for bit in 8259
  84.         mov     dx,[bx+port_8259]       ;i/o address for 8259
  85.         inc     dx
  86.         in      al,dx
  87.         KILL_TIME
  88.         or      al,cl                   ;assume previously disabled
  89.         test    [bx+p_8259],cx          ;check assumption
  90.         jnz     rs8259                  ;jump if assumption correct
  91.         xor     al,cl                   ;else reverse assumption
  92. rs8259: out     dx,al                   ;restore 8259 to previous state
  93.         KILL_TIME
  94.                                         ;End [06-May-86] Modification
  95.  
  96. no8259: mov     ax,[bx+p_8250ier]       ;now enable 8250 interrupt register
  97.         mov     dx,[bx+base_8250]
  98.         add     dx,INTER
  99.         out     dx,al
  100.         KILL_TIME
  101.         xor     ax,ax
  102.         pop     es
  103.         pop     ds
  104.         cproce
  105.  
  106.  
  107.  
  108.         endps
  109.         end
  110.  
  111.