page ;GBcbioU3.a86 - System Support Board I/O. ; CompuPro System Support 1 equates. GBSS: EQU 50h ;System Support starting port GBMP0: EQU GBSS+0 ;Master PIC port 0 GBMP1: EQU GBSS+1 ;Master PIC port 1 GBSP0: EQU GBSS+2 ;Slave PIC port 0 GBSP1: EQU GBSS+3 ;Slave PIC port 1 GBT0: EQU GBSS+4 ;Timer number 0 GBT1: EQU GBSS+5 ;Timer number 1 GBT2: EQU GBSS+6 ;Timer number 2 GBTC: EQU GBSS+7 ;Timer control port GBFPPD: EQU GBSS+8 ;Floating point processor data port GBFPPC: EQU GBSS+9 ;Floating point processor command port GBCLKC: EQU GBSS+10 ;Clock command port GBCLKD: EQU GBSS+11 ;Clock data port GBUD: EQU GBSS+12 ;Uart data port GBUS: EQU GBSS+13 ;Uart status port GBUM: EQU GBSS+14 ;Uart modem port GBUC: EQU GBSS+15 ;Uart command port SSDAV: EQU 0000_0010b ;System Support Data Available SSTBMT: EQU 0000_0001b ;System Support Transmit Buffer Empty 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 System Support UART. if @ldr sTINIT: LD AL,# 1110_1110b ;Async, 16x, 8 bits, no parity, even, 2 stops OUTB GBUM ;Set up mode register 1 LD AL,# 0111_1110b ;9600 baud OUTB GBUM ;Set up mode register 2 LD AL,# 0010_0111b ;Trans. on, dtr low, rec. on, no break, ; no reset, rts low OUTB GBUC ;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. sCONST: if @ldr <> 4 INB GBUS ;Input from port AND AL,# SSDAV ;Mask data available JZ sCNST1 ;If data not available OR AL,# 0FFH sCNST1: endif RET 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. sCONIN: if @ldr <> 4 INB GBUS ;Get status from uart AND AL,# SSDAV JZ sCONIN INB GBUD 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 CL = ASCII character to output to console. sCONOUT: INB GBUS ;Get uart status AND AL,# SSTBMT ;Test if buffer empty JZ sCONOUT MOV AL,CL OUTB GBUD RET ; Endx GBcbiou3.asm