page ; 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 BX,#BAUDS ;Point to initialization table LD AL,[BX+1] ;Get mode register 1 byte outb gbum,al ;Set up mode register 1 ld al,[bx+2] ;Get mode register 2 byte outb gbum,al ;Set up mode register 2 ld al,[bx+3] ;Get command byte outb gbuc,al ;Set up command byte 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 space 4,10 ; ; Initialize the 8259a Interupt controllers to a known state. ; All interupts will be masked off, base is 40h (same as MP/M 816) ; sINTDIS: ld al,#0001_1101b ;Level, cascade, icw4 outb gbmp0 ld al,#40h ;Base address of interupt vectors outb gbmp1 ld al,#1000_0000b ;IR7 has slave outb gbmp1 ld al,#0001_0001b ;Special fully nested, 8088 outb gbmp1 ld al,#07Fh ;mask all interupts, but slave outb gbmp1 ld al,#0001_1101b ;Level, cascade, icw4 outb gbsp0 ld al,#40h+8 ;Base address of interput vectors out gbsp1 ld al,#0000_0111b ;Slave #7 out gbsp1 ld al,#0000_0001b ;8088 mode out gbsp1 ld al,#0FFh ;mask all registers out gbsp1 ret