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 / _ASGETDI.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-08-14  |  1.4 KB  |  54 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
  10.         include prologue.h
  11.         include asiports.equ
  12.         .list
  13.  
  14.         pseg    _asgetbaud
  15.  
  16. ;**<<  _ A S G E T D I V I S O R >>**
  17. ;
  18. ;  int _asgetdivisor(ioaddress)
  19. ;  unsigned ioaddress;
  20. ;
  21. ;  Return the baud rate divisor currently set in the 8250 that has
  22. ;  a base address of ioaddress;
  23. ;
  24. ;
  25.         cproc   _asgetdivisor,,_asgetdi,,,<NOSI,NODI>
  26.         mov     cx,parm1_
  27.         mov     dx,LCREG        ; address line control register
  28.         add     dx,cx
  29.         cli
  30.         in      al,dx           ; read current line control register
  31.         KILL_TIME
  32.         mov     bh,al           ; save in bh
  33.         or      al,DLAB         ; assert DLAB
  34.         out     dx,al
  35.         KILL_TIME
  36.         mov     dx,cx           ; read base address for lsb
  37.         in      al,dx
  38.         KILL_TIME
  39.         mov     bl,al           ; save in bl
  40.         inc     dx              ; point to msb
  41.         in      al,dx
  42.         KILL_TIME
  43.         xchg    al,bh           ; bx=baud set, al=previous line control reg
  44.         mov     dx,LCREG
  45.         add     dx,cx
  46.         out     dx,al
  47.         KILL_TIME
  48.         sti
  49.         mov     ax,bx           ;return baud rate
  50.         cproce
  51.  
  52.         endps
  53.         end
  54.