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 7 ;Interfacer 3 Console Port PRN: EQU 6 ;Interfacer 3 Printer port ULS: EQU 5 ;Interfacer 3 Ul1 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 AL,#CON ;Select uart number 7 OUTB GBI3U ;Select Uart 7 LD AL,#1110_1110B ;Async, 16x, 8 bits, no parity, even, 2 stops OUTB GBI3M ;Set up mode register 1 LD AL,#0111_1110B ;9600 baud OUTB GBI3M ;Set up mode register 2 LD AL,#0010_0111B ;Trans. on, dtr low, rec. on, no break, ; no reset, rts low OUTB GBI3C ;Set up command port LD AL,#PRN ;Select uart number 6 OUTB GBI3U ;Select Uart 6 LD AL,#1110_1110B ;Async, 16x, 8 bits, no parity, even, 2 stops OUTB GBI3M ;Set up mode register 1 LD AL,#0111_1110B ;9600 baud OUTB GBI3M ;Set up mode register 2 LD AL,#0010_0111B ;Trans. on, dtr low, rec. on, no break, ; no reset, rts low OUTB GBI3C ;Set up command port LD AL,#ULS ;Select uart number 5 OUTB GBI3U ;Select Uart 5 LD AL,#1110_1110B ;Async, 16x, 8 bits, no parity, even, 2 stops OUTB GBI3M ;Set up mode register 1 LD AL,#0111_1110B ;9600 baud OUTB GBI3M ;Set up mode register 2 LD AL,#0010_0111B ;Trans. on, dtr low, rec. on, no break, ; no reset, rts low OUTB GBI3C ;Set up command port 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,#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,#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,#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,#ULS JZ I3UL1 LD AL,#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,#ULS JZ I3UL LD AL,#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 ; Endx GBcbiov3