home *** CD-ROM | disk | FTP | other *** search
- page 60,132
- ;
- ; The Greenleaf Comm Library
- ;
- ; Copyright (C) 1984-90 Greenleaf Software Inc. All Rights Reserved.
- ;
-
- include model.h
- include prologue.h
- include asiports.equ
-
- pseg _asiinit
-
- ;==>-- int _asiinit(ioaddress,divisor,pa_st_wl)
- ; unsigned ioaddress, /* I/O base address of 8250 */
- ; divisor, /*Divisor to load up, sets baud rate*/
- ; pa_st_wl; /* Parity, Stopbits & word length */
- ;
- cproc _asiinit,,,,,<NOSI,NODI>
- mov cx,parm1_ ;cx=8250 base address
- mov dx,INTER
- add dx,cx ;shut down 8250 interrupts
- in al,dx ;read how interrupts are set
- KILL_TIME
- push ax ;save 'em away
- xor al,al ;disable 8250 interrupts
- out dx,al ;
- KILL_TIME
- mov dx,LSREG ;now wait for current character to be
- add dx,cx ;be shifted out (if there is one)
- _wtmty: in al,dx
- KILL_TIME
- test al,THRE
- jz _wtmty
- mov bx,parm2_ ;bx=divisor
- mov al,DLAB ;set dlab for baud rate
- mov dx,LCREG
- add dx,cx ;dx=line control register for port
- out dx,al ;assert Divisor Latch Access Bit (DLAB)
- KILL_TIME
- mov dx,cx ;dx=base 8250
- mov al,bl ;least significant divisor byte to al
- out dx,al
- KILL_TIME
- inc dx ;dx=base 8250 + 1
- mov al,bh ;most significant divisor byte to al
- out dx,al
- KILL_TIME
- mov al,parm3_ ;get parity,stop etc.
- and al,not DLAB ;make dlab=0
- mov dx,LCREG
- add dx,cx ;dx=line control register port
- out dx,al
- KILL_TIME
- pop ax ;get interrupt setting back
- mov dx,INTER
- add dx,cx
- cli
- out dx,al ;do it twice (per National)
- KILL_TIME
- out dx,al
- KILL_TIME
- sti
- xor ax,ax ;return 0 (ASSUCCESS)
- cproce
- endps
- end