PAGE ; CompuPro Interfacer 3 support routines GBI3: EQU 10H ;Interfacer 3 Base address GBI3D: EQU GBI3+0 ;Uart data location GBI3S: EQU GBI3+1 ;Uart status GBI3M: EQU GBI3+2 ;Uart mode register GBI3C: EQU GBI3+3 ;Uart command register GBI3U: EQU GBI3+7 ;Uart select register GBI3DV: EQU 0000_0010B ;Interfacer 3 Data Available GBI3MT: EQU 0000_0001B ;Interfacer 3 Transmit Buffer Empty GBI3DR: EQU 1000_0000B ;Interfacer 2 Data Set Ready con: equ 0 ;Relative console port prn: equ 4 ;Relative printer port uls: equ 8 ;Relative user list 1 port PAGE ; C O N S O L I N I T I A L I Z A T I O N ; ; This routine performs the initialization required by ; the Interfacer 3. ; if @ldr I3INIT: ld bx,#bauds ;Get initialization table call i3int1 ;Initialize console call i3int1 ;Initialize printer 1 i3int1 ld al,[bx] ;Get relative port # outb gbi3u,al ;Select UART ld al,[bx+1] ;Get mode register 1 byte outb gbi3m,al ;Set up mode register 1 ld al,[bx+2] ;Get mode register 2 byte outb gbi3m,al ;Set up mode register 2 ld al,[bx+3] ;Get command register byte outb gbi3c,al ;Set up command byte add bx,#4 ;Offset to next init ret endif SPACE 4,10 ; C O N S O L S T A T U S ; ; This routine samples the Console status and returns the ; following values in the A register. ; ; EXIT A = 0 (zero), means no character ; currently ready to read. ; ; A = FFh (255), means character ; currently ready to read. I3CONST: if @ldr <> 4 LD AL,BAUDS+CON OUTB GBI3U INB GBI3S ;Input from port AND AL,#GBI3DV ;Mask data available JZ I3CNST ;If data not available OR AL,#0FFH I3CNST: RET endif SPACE 4,10 ; C O N S O L I N P U T ; ; Read the next character into the A register, clearing ; the high order bit. If no character currently ready to ; read then wait for a character to arrive before returning. ; ; EXIT A = character read from terminal. I3CONIN: if @ldr <> 4 LD AL,BAUDS+CON OUTB GBI3U INB GBI3S ;Get status from uart AND AL,#GBI3DV JZ I3CONIN INB GBI3D AND AL,#7FH endif RET SPACE 4,10 ; C O N S O L O U T P U T ; ; Send a character to the console. If the console ; is not ready to receive a character wait until ; the console is ready. ; ; ENTRY C = ASCII character to output to console. I3CONOUT: LD AL,BAUDS+CON OUTB GBI3U INB GBI3S ;Get uart status AND AL,#GBI3MT ;Test if buffer empty JZ I3CONOUT MOV AL,CL OUTB GBI3D RET SPACE 4,10 ; L i s t O u t p u t. ; ; Send a character to the list device. If the list ; device is not ready to receive a character wait ; until the device is ready. ; ; ENTRY C = ASCII character to be output. I3LIST: if @ldr <> 4 LD AL,IOBYTE AND AL,#0C0H SUB AL,#0C0H LD AL,BAUDS+ULS JZ I3UL1 LD AL,BAUDS+PRN I3UL1: OUTB GBI3U I3LS1: INB GBI3S ;Get uart status AND AL,#GBI3MT+GBI3DR ;Test if buffer empty SUB AL,#GBI3MT+GBI3DR JNZ I3LS1 MOV AL,CL OUTB GBI3D ENDIF RET SPACE 4,10 ; L i s t S t a t u s. ; ; Return the ready status for the list device. ; ; EXIT A = 0 (zero), list device is not ready to ; accept another character. ; A = FFh (255), list device is ready to accept ; a character. I3LST: IF @LDR <> 4 LD AL,IOBYTE AND AL,#0C0H SUB AL,#0C0H LD AL,BAUDS+ULS JZ I3UL LD AL,BAUDS+PRN I3UL: OUTB GBI3U INB GBI3S AND AL,#GBI3MT+GBI3DR ;Test if buffer empty SUB AL,#GBI3MT+GBI3DR LD AL,#0FFH JZ I3LST1 XOR AL,AL I3LST1: RET endif