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
- include prologue.h
- include asiports.equ
- .list
-
- pseg _asgetbaud
-
- ;**<< _ A S G E T D I V I S O R >>**
- ;
- ; int _asgetdivisor(ioaddress)
- ; unsigned ioaddress;
- ;
- ; Return the baud rate divisor currently set in the 8250 that has
- ; a base address of ioaddress;
- ;
- ;
- cproc _asgetdivisor,,_asgetdi,,,<NOSI,NODI>
- mov cx,parm1_
- mov dx,LCREG ; address line control register
- add dx,cx
- cli
- in al,dx ; read current line control register
- KILL_TIME
- mov bh,al ; save in bh
- or al,DLAB ; assert DLAB
- out dx,al
- KILL_TIME
- mov dx,cx ; read base address for lsb
- in al,dx
- KILL_TIME
- mov bl,al ; save in bl
- inc dx ; point to msb
- in al,dx
- KILL_TIME
- xchg al,bh ; bx=baud set, al=previous line control reg
- mov dx,LCREG
- add dx,cx
- out dx,al
- KILL_TIME
- sti
- mov ax,bx ;return baud rate
- cproce
-
- endps
- end