JMP IOINIT ;Skip past initialization table ; eject DS0INI EQU offset $ DSEG 0 ORG DS0INI ;******************************************************** ;* INPUT/OUTPUT DEVICE INITIAL SELECT TABLE * ;******************************************************** BIOTBL RS 0 ;I/O byte (IOBYTE) value, Aux I/O control byte (IOCNTL) value ; Switch = 0 DB 10000001b ;LST:=LPT:, PUN:=TTY:, RDR:=TTY:, CON:=CRT: DB 01000010b ;LPT:=Interfacer I UART 1, CRT:=Interfacer I UART 0 ; Switch = 1 DB 10000001b ;LST:=LPT:, PUN:=TTY:, RDR:=TTY:, CON:=CRT: DB 00000100b ;LPT:=Interfacer 3 USER 4 xon/xoff, CRT:=USER 0 ; Switch = 2 DB 10000001b ;LST:=LPT:, PUN:=TTY:, RDR:=TTY:, CON:=CRT: DB 00000101b ;LPT:=Interfacer 3,4 USER 4, CRT:=System Support I ; Switch = 3 DB 00000011b ;LST:=TTY:, PUN:=TTY:, RDR:=TTY:, CON:=UC1: DB 00000101b ;LPT:=Interfacer 3,4 USER 4, CRT:=System Support I ; ; IOBYTE value is the first entry for each switch selection, and -- ; IOCNTL = ww$xx$yy$zzb selects the following: ;(second byte ww xx yy 00 CRT:=Interfacer 3 USER 0. ;of each entry ww xx yy 01 CRT:=System Support I. ;in BIOTBL). ww xx yy 10 CRT:=Interfacer 1,2 UART 0. ; xx yy 11 CRT:=Interfacer 1,2 UART 1 (Custom Routine). ; 00 xx yy -- LPT:=Interfacer 3,4 USER 4. ; 01 xx yy -- LPT:=Interfacer 1,2 UART 1. ; 10 xx yy -- LPT:=Interfacer 1,2 UART 2 (Custom Routine). ; 11 xx yy -- LPT:= " " " " " ; -- xx -- -- Interfacer 3,4 USER 5 list routine select, ; -- -- yy -- Interfacer 3,4 USER 4 list routine select, ;Where xx and/or yy = 00 Straight output, no software protocol. ; 01 XON/XOFF software protocol active. ; 10 ETX/ACK software protocol active. ; And (always): UC1:= Interfacer 3,4 USER 7 ; TTY:= Interfacer 3,4 USER 6 ; UL1:= Interfacer 3,4 USER 5 at all times. ;<========= If CON:=BAT: then -- ;/==| BAT:= RDR:= Interfacer 3,4 USER 3 when RDR:=UR2: on input. ;\==|__ BAT:= PUN:= " " 3 when PUN:=UP2: on output. ;/==| BAT:= RDR:= Interfacer 3,4 USER 2 when RDR:=UR1: on input. ;\==|__ BAT:= PUN:= " " 2 when PUN:=UP2: on output. ;/==| BAT:= RDR:= Interfacer 3,4 USER 1 when RDR:=PTR: on input. ;\==|__ BAT:= PUN:= " " 1 when PUN:=PTP: on output. ;x /--| BAT:= ----- Interfacer 3,4 USER 0 when RDR:=TTY: on input. ;x \--| BAT:= ----- " " 0 when PUN:=TTY: on output. ; and for reader/punch vectors only -- ;x -- ------ RDR:= Interfacer 3,4 USER 6 when RDR:=TTY: on input. ;x -- ------ PUN:= " " 6 when PUN:=TTY: on output. eject ;************************************************************************ ;* INTERRUPT CONTROLLER AND RELATED INPUT/OUTPUT DEVICE INITIALIZATION * ;************************************************************************ INISEQ RS 0 ;Port, Value to transmit sequence until Port = 0FFh. ; if FALSE if INTERFACER3 DB IF3UX, 0 ;Select Uart 0 DB IF3UM,01011010b ;Async, 16x, 7 bits, odd parity, 1 stop DB IF3UM,01111110b ; 9600 baud DB IF3UC,00100111b ;Trans. on, DTR low, rec. on, no break/ reset, RTS low ; DB IF3UX, 1 ;Select Uart 1 DB IF3UM,01011010b ;Async, 16x, 7 bits, odd parity, 1 stop DB IF3UM,01111110b ; 9600 baud DB IF3UC,00100111b ;Trans. on, DTR low, rec. on, no break/ reset, RTS low ; DB IF3UX, 2 ;Select Uart 2 DB IF3UM,01011010b ;Async, 16x, 7 bits, odd parity, 1 stop DB IF3UM,01111110b ;9600 baud DB IF3UC,00100111b ;Trans. on, DTR low, rec. on, no break/ reset, RTS low ; DB IF3UX, 3 ;Select Uart 3 DB IF3UM,01011010b ;Async, 16x, 7 bits, odd parity, 1 stop DB IF3UM,01111110b ; 9600 baud DB IF3UC,00100111b ;Trans. on, DTR low, rec. on, no break/ reset, RTS low ; DB IF3IR,00000000b ;Interrupt on data received control port (disabled) DB IF3IT,00000000b ;Interrupt on xmit ready control port (disabled) endif if INTERFACER3 or INTERFACER4 DB IF3UX, 4 ;Select Uart 4 DB IF3UM,01011010b ;Async, 16x, 7 bits, Odd parity, 1 stop DB IF3UM,01111110b ; 9600 baud DB IF3UC,00100111b ;Trans. on, DTR low, rec. on, no break/ reset, RTS low ; DB IF3UX, 5 ;Select Uart 5 DB IF3UM,01011010b ;Async, 16x, 7 bits, odd parity, 1 stop DB IF3UM,01111110b ; 9600 baud DB IF3UC,00100111b ;Trans. on, DTR low, rec. on, no break/ reset, RTS low ; DB IF3UX, 6 ;Select Uart 6 DB IF3UM,01101110b ;Async, 16x, 8 bits, no parity, 1 stop DB IF3UM,01110111b ; 1200 baud DB IF3UC,00100111b ;Trans. on, DTR low, rec. on, no break/ reset, RTS low ; DB IF3UX, 7 ;Select Uart 7 DB IF3UM,01011010b ;Async, 16x, 7 bits, odd parity, 1 stop DB IF3UM,01111110b ; 9600 baud DB IF3UC,00100111b ;Trans. on, DTR low, rec. on, no break/ reset, RTS low endif if (INTERFACER3 and INTERFACER4) DB IF3UX, 8 ;Select Uart 4 DB IF3UM,01011010b ;Async, 16x, 7 bits, odd parity, 1 stop DB IF3UM,01111110b ; 9600 baud DB IF3UC,00100111b ;Trans. on, DTR low, rec. on, no break/ reset, RTS low ; DB IF3UX, 9 ;Select Uart 5 DB IF3UM,01111111b ;Async, 16x, 8 bits, even parity, 2 stop DB IF3UM,01110101b ; 300 baud DB IF3UC,00100111b ;Trans. on, DTR low, rec. on, no break/ reset, RTS low ; DB IF3UX, 10 ;Select Uart 6 DB IF3UM,01011110b ;Async, 16x, 8 bits, odd parity, 1 stop DB IF3UM,01111110b ; 9600 baud DB IF3UC,00100111b ;Trans. on, DTR low, rec. on, no break/ reset, RTS low ; DB IF3UX, 11 ;Select Uart 7 DB IF3UM,01011110b ;Async, 16x, 8 bits, odd parity, 1 stop DB IF3UM,01111110b ; 9600 baud DB IF3UC,00100111b ;Trans. on, DTR low, rec. on, no break/ reset, RTS low ; DB IF3IR,00000000b ;Interrupt on data received control port (disabled) DB IF3IT,00000000b ;Interrupt on xmit ready control port (disabled) endif ; ; System Support I UART initialization. if SYSUP1 DB SS1UM,01011010b ;Async, 16x, 7 bits, Odd parity, 1 stop DB SS1UM,01111111b ;19200 baud DB SS1UC,00100111b ;Xmit on, DTR low, rec. on, no break, run, RTS low ; ; System Support I timer initialization. DB SS1TC,00110110b ;Timer 0, 16 bit load, square wave, binary DB SS1T0,TIMEBASE and 0FFh ;Get divisor for time base for other 2 timers DB SS1T0,TIMEBASE shr 8 ;Set up timer 0 ; DB SS1TC,01110000b ;Timer 1, 16 bit, interrupt on count, binary DB SS1T1,TIME1 and 0FFh ;Get divisor for time base for other 2 timers DB SS1T1,TIME1 shr 8 ;Set up timer 1 (Real Time Clock tick) ; DB SS1TC,10110000b ;Timer 2, 16 bit, interrupt on count, binary DB SS1T2,TIME2 and 0FFh ;Set interrupt interval in units of time base DB SS1T2,TIME2 shr 8 endif endif ; ; Initialize Slave 8259A Interrupt Controller. DB SS1SP0,00011101b ;Level trig, 4X interval, cascade, ICW4 -- ICW1 DB SS1SP1,INTBASE + 8 ;Base Number of Slave interrupts -- ICW2 DB SS1SP1,00000111b ;Slave ID is interrupt 7 -- ICW3 DB SS1SP1,00000001b ;Non-buffered, normal EOI, 8086 -- ICW4 DB SS1SP1,SMASK ;Slave PIC initial Active Interrupt Mask - OCW1 DB SS1SP0,EOI ;Clear controller of pending interrupts -- OCW2 DB SS1SP0,SETPRI+6 ;Set CRT transmit to lowest priority -- OCW2 DB SS1SP0,READISR ;Set to read interrupt service register -- OCW3 DB SS1SP0,SMMOFF ;Special mask mode off -- OCW3 ; ; Initialize Master 8259A Interrupt Controller. DB SS1MP0,00011101b ;Level trig, 4X interval, cascade, ICW4 -- ICW1 DB SS1MP1,INTBASE ;Base Address of Master interrupts -- ICW2 DB SS1MP1,10000000b ;Only interrupt 7 is a slave -- ICW3 DB SS1MP1,00010001b ;Full nest, non-buffered, norm EOI, 8086 - ICW4 DB SS1MP1,MMASK ;Master initial Active Interrupt Mask -- OCW1 DB SS1MP0,EOI ;Clear controller of pending interrupts -- OCW2 DB SS1MP0,READISR ;Set to read interrupt service register -- OCW3 DB SS1MP0,SMMOFF ;Special mask mode off -- OCW3 ; endif DB 0FFh ;End of I/O port initialization string ; if I8086 MSTRMASK EQU 11111111b ;Use masks that place controller in benign state ; ; Initialize 80130 Interrupt Controller. DB I86MP0,00111001b ;ICW6, Level trig, 4X interval, DB I86MP1,INTBASE * 8 ;Base Address of Slave interrupts -- ICW2 DB I86MP1,11111111b ;All IRs are slaves -- ICW3 DB I86MP1,00011101b ;Special Fully nested, norm EOI, 8086 -- ICW4 DB I86MP1,00000000b ;All IRs are non-local -- ICW6 DB I86MP1,MSTRMASK ;Mask off all IRs -- OCW1 ; DB 0FFh ;End of I/O port initialization string ; eject ;**************************************************************** ;* INTERRUPT VECTOR TABLE FOR RELOCATION TO LOW MEMORY * ;**************************************************************** ; Master PIC interrupt vectors: INTVEC DW offset ITRAP ;VI0 -- DW offset ITRAP ;VI1 -- Disk 2, Disk 3 service request DW offset ITRAP ;VI2 -- Interfacer 1-4 transmit request DW offset ITRAP ;VI3 -- Interfacer 1-4 receive request DW offset ITRAP ;VI4 -- Disk 1 (Disk 1A) service request DW offset ITRAP ;VI5 -- DW offset ITRAP ;VI6 -- DW offset ITRAP ;Slave interrupt (inactive vector) ; Slave PIC interrupt vectors: DW offset ITRAP ;VI7 -- DW offset ITRAP ;Timer #0 DW offset ITRAP ;Timer #1 DW offset ITRAP ;Timer #2 DW offset ITRAP ;Math chip service request DW offset ITRAP ;Math chip end of process DW offset CRTXMIT ;System Support I UART transmit data request DW offset CRTRCVR ;System Support I UART receive data request ; INTRRAM DW (INTBASE * 4),0000h ;Base address of interrupt vectors to load ; CS0INI EQU offset $ CSEG 0 ORG CS0INI ;**************************************************************** ;* INPUT/OUTPUT DEVICE INITIALIZATION SEQUENCE ROUTINE * ;**************************************************************** ; IOINIT0:MOV AL,1[BX] ;Get corresponding data byte to xmit OUT DX,AL ;Send data to specified port ADD BX,2 ;Point to next pair to xmit IOINIT1:MOV DL,[BX] ;Get output port to use for this data byte CMP DL,0FFh ;See if final port of sequence JNZ IOINIT0 ;Send next data byte to I/O port if not RET ; IOINIT: MOV CX,16 ;Sixteen interrupt vectors to initialize PUSH ES ;Save the current extra segment LES DI,Dword ptr INTRRAM ;Set destination index at base of interrupts MOV SI,offset INTVEC ;Point to table of vectors to relocate IOINIT2:MOVSW ;Put table vector into corresponding interrupt ADD DI,2 ;Point to next interrupt vector offset location LOOP IOINIT2 ;Loop until all 16 vectors relocated POP ES ;Restore the extra segment MOV DH,0 ;Clear the high byte of the I/O port to use LEA BX,INISEQ ;Point to the initialization sequence table CALL IOINIT1 ;Transmit port, data byte pairs of entire table ; if I8086 ;Lets always turn off 80130 INC BX ;Move past first end of table marker MOV DH,0FFh ;Set the high byte of the I/O port for 80130 CALL IOINIT1 ;Transmit port, data byte pairs of entire table ; endif MOV Word Ptr DATASEG,DS ;Set current data segment as data seg for interrupts STI ;And enable interrupts