; ;************************************************************************ ;** ;** CP/M multi lister routine 09/15/82 ;** ;************************************************************************ ; ; these equates are the baud rate values for the 8116. ; these should never change values!!! ; B110 EQU 02H ; baud rate of 110 baud. B150 EQU 04H ; baud rate of 150 baud. B300 EQU 05H ; baud rate of 300 baud. B600 EQU 06H ; baud rate of 600 baud. B1200 EQU 07H ; baud rate of 1200 baud. B1800 EQU 08H ; baud rate of 1800 baud. B2000 EQU 09H ; baud rate of 2000 baud. B2400 EQU 0AH ; baud rate of 2400 baud. B3600 EQU 0BH ; baud rate of 3600 baud. B4800 EQU 0CH ; baud rate of 4800 baud. B7200 EQU 0DH ; baud rate of 7200 baud. B9600 EQU 0EH ; baud rate of 9600 baud. B19200 EQU 0FH ; baud rate of 19200 baud. ; ; These next four are for the individual baud rate channels for the 8116's.. ; Each 8116 has two separatly programable channels. This is what they will ; programed to upon init. execpt for the terminal io channel (cpu channel 1, ; BAUDB). ; BAUDA EQU B9600 ; 8116 cpu channel a BAUDB EQU B9600 ; 8116 cpu channel b BAUDC EQU B1200 ; 8116 serial io channel a BAUDD EQU B9600 ; 8116 serial io channel b ; ; these are the status port address for the respective printers ; LSTSTS0 EQU 01H ; status port cpu 8251 LSTSTS1 EQU 0A1H ; status port serial io channel 0 LSTSTS2 EQU 0A3H ; status port serial io channel 1 LSTSTS3 EQU 0A5H ; status port serial io channel 2 LSTSTS4 EQU 0A7H ; status port serial io channel 3 LSTSTS5 EQU 06H ; status port cpu 8255 ; ; These are the data port address for the respective printers ; LSTDAT0 EQU 00H ; data port cpu 8251 LSTDAT1 EQU 0A0H ; data port serial io channel 0 LSTDAT2 EQU 0A2H ; data port serial io channel 1 LSTDAT3 EQU 0A4H ; data port serial io channel 2 LSTDAT4 EQU 0A6H ; data port serial io channel 3 LSTDAT5 EQU 04H ; data port cpu 8255 ; BAUD EQU 3CH ; ram storage location for baud rate LSTNUM EQU 3DH ; ram storage location for list number ; LIST: ; LDA PTSTFLG ; pstflg is a flag to indicate if the INR A ; printers have been init. yet or not. JZ PRNTLP ; only init. printers once!!! ; MVI A,0FFH ; set ptstflg to already done state STA PTSTFLG ; store it ; PUSH B ; save PUSH D ; LDA 3DH ; see if printer.com has been run CPI 1DH ; code from boot routine JZ DOINIT ; if so, user has already set baud CPI 0FCH ; special for quantum JNZ SKIPIT ; ; DOINIT: IN 0BH ; get baud from cpu switch MVI C,BAUDA ; put channel a baud in c ANI 0F0H ; mask channel b baud ORA C ; ora nibbles together and OUT 0BH ; set baud for cpu channels a,b ; MVI A,BAUDD ; baud for channel a of serial io board MVI C,BAUDC ; baud for channel b of serial io board RLC!RLC!RLC!RLC ; rotate the nibble to the upper position ORA C ; ora nibbles together and OUT 0BAH ; set baud for the serial io board. STA 3CH ; store byte in ram for future use. XRA A ; STA 3DH ; select printer 1 (on cpu) ; SKIPIT: MVI A,0ACH ; init 8255 OUT 7 ; cmd port ; MVI A,0FFH ; set b port high OUT 5 ; port b ; MVI E,4 ; no. of ports MVI C,LSTSTS1-2 ; first io port less 2 INIZLOOP: LXI H,INIZLST ; table MVI B,LCOUNT ; table length INR C ; point at next cmd port INR C ; OUTIR ; block move DCR E ; last sio ? JRZ EXIT ; find printer # and exicute routine JR INIZLOOP ; for that printer ; INIZLST: DB 18H ; channel reset DB 4 ; select wr4 DB 44H ; x 16 and 1 stop bit DB 5 ; select wr5 DB 0EAH ; dtr/, 8 bits, tx en, rts/ DB 3 ; select wr3 DB 0C1H ; 8 bits, rx en ; LCOUNT EQU $-INIZLST ; generate table length ; PTSTFLG: DB 00H ; zero for do init ff for already done ; EXIT: POP D ; restore POP B ; ; ; list status routine ; LISTST: LDA LSTNUM ; find current list number ANI 07H ; RAL ; double it LXI H,STATTBL ; point at status routine table MVI D,0 ; MOV E,A ; mov list number into e DAD D ; MOV E,M ; INX H ; MOV D,M ; we now have the addrss for the status XCHG ; routine of the current list device. PCHL ; doit toit. ; ; main list rountines ; PRNTLP: LDA BAUD ; read baud byte OUT 0BAH ; set baud rate on board ; LDA LSTNUM ; find curent list number ANI 07H ; RAL ; double it LXI H,TABLE ; point at list rountine table MVI D,0 ; MOV E,A ; move list number into e DAD D ; MOV E,M ; INX H ; MOV D,M ; we now have the address of the data XCHG ; out rountine of the current list device PCHL ; do it to it ; ; this printer port is normally reserved for the serial network ; LISTER0: CALL STAT0 ; ORA A ; JZ LISTER0 ; MOV A,C ; OUT LSTDAT0 ; RET ; ; ; this routine is to be used for the DIABLO 1620 printer. ; buad rate fot the DIABLO is normally set to 1200 baud. ; LISTER1: MVI A,10H ; this is only for sio's OUT LSTSTS1 ; IN LSTSTS1 ;CHECK STAT ANI 01H ;RECIEVE BIT ON? JRZ CHKBUF ;NO DATA READY IN LSTDAT1 ;SOME DATA!! ANI 7FH ;MASK PARITY CPI 06H ;ACK? JRZ RSTCNT ;RESET COUNT THIER BUFFER EMPTY CPI 20H ;NEW LISTING JRZ NEWLIST ;CLEAR COUNTER CHKBUF: LDA STOR ;CHAR SENT CPI 4EH ;1 LESS THAN MAX JRZ ETXOUT ;SEND FIRST ETX FOR FIRST OF 2 79 BYTE SETS CPI 0CEH ;TOP OF BUFFER JRZ ETXOUT1 ;ANOTHER ETX CPI 0CFH ;TOP OF BUFFER JRZ LISTER1 ;OVER LIMIT WAIT FOR ACK OUTDAT: MVI A,10H ; this is only for sio's OUT LSTSTS1 ; IN LSTSTS1 ;CHECK STAT ANI 2CH ; CPI 2CH ; JRNZ OUTDAT ;STAT OK? MOV A,C OUTDAT1: OUT LSTDAT1 ; LDA STOR ; INR A ;INCRIMENT BUFFER COUNT STA STOR ; RET ETXOUT: MVI A,80H ;FIRST CLR OF BUFFER COUNTER USED ONCE STA STOR ;AT START ONLY OR NEWLST ETXOUT1: MVI A,10H ; this is only for sio's OUT LSTSTS1 ; IN LSTSTS1 ;CHECK STAT ANI 2CH ; CPI 2CH ; JRNZ ETXOUT1 ; MVI A,03H ;SET A FOR ETX OUTPUT CALL OUTDAT1 JR LISTER1 ;JMP LST TO WAIT FOR ACK NEWLIST: XRA A ;CLEAR A TO 00H FOR NEW COUNT STA STOR ; JR OUTDAT ; RSTCNT: MVI A,80H ;CLR BUFFER COUNT FOR COUNT OF 80H TO CFH STA STOR ; JR LISTER1 ; STOR: DB 00 ; ; ; this routine is to be used for the COMET 8300R printer. ; Baud for the COMET 8300R is normally set to 9600 baud. ; LISTER2: MVI A,10H ; RESET EXT/STATUS INTERRUPTS OUT LSTSTS2 ; IN LSTSTS2 ; ANI 24H ; MASK ALL BUT CTS,DCD,TxBUFFER EMPTY CPI 24H ; CTS,DCD, & TxBUFFER EMPTY MUST BE HIGH JNZ LISTER2 ; IF NOT, WAIT MOV A,C ; OUT LSTDAT2 ; RET ; ; this routine is to be used for the TI810 printer. ; Baud for the TI810 is normally set to 9600 baud. ; LISTER3: MVI A,10H ; RESET EXT/STATUS INTERRUPTS OUT LSTSTS3 ; IN LSTSTS3 ; ANI 2CH ; MASK ALL BUT CTS,DCD,TxBUFFER EMPTY CPI 2CH ; CTS,DCD, & TxBUFFER EMPTY MUST BE HIGH JRNZ LISTER3 ; IF NOT, WAIT MOV A,C ; OUT LSTDAT3 ; RET ; ; ; this routine is to be used for the COMET 8300R printer. ; Baud for the COMET 8300R is normally set to 9600 baud. ; LISTER4: MVI A,10H ; RESET EXT/STATUS INTERRUPTS OUT LSTSTS4 ; IN LSTSTS4 ; ANI 24H ; MASK ALL BUT CTS,DCD,TxBUFFER EMPTY CPI 24H ; CTS,DCD, & TxBUFFER EMPTY MUST BE HIGH JNZ LISTER4 ; IF NOT, WAIT MOV A,C ; OUT LSTDAT4 ; RET ; ; this port is for a Centronics parallel interface from the CPU board. ; LISTER5: ; IN LSTSTS5 ; status check ANI 0B0H ; CPI 90H ; JNZ LISTER5 ; ; TXLSTRDY5: ; MOV A,C ; OUT LSTDAT5 ; MVI A,0FFH ; strobe all 8 data lines OUT 05H ; CMA ; OUT 05H ; CMA ; OUT 05H ; RET ; ; STAT0: IN LSTSTS0 ; ANI 85H ; get CTS, DSR and xmit buffer status CPI 85H ; all must be on MVI A,1 ; RZ ; XRA A ; RET ; ; STAT1: IN LSTSTS1 ; ANI 2CH ; CPI 2CH ; MVI A,0FFH ; RZ ; CMA ; RET ; STAT2: IN LSTSTS2 ; ANI 24H ; CPI 24H ; MVI A,0FFH ; RZ ; CMA ; RET ; STAT3: IN LSTSTS3 ; ANI 2CH ; CPI 2CH ; MVI A,0FFH ; RZ ; CMA ; RET ; STAT4: IN LSTSTS4 ; ANI 24H ; CPI 24H ; MVI A,0FFH ; RZ ; CMA ; RET ; STAT5: IN LSTSTS5 ; ANI 0B0H ; CPI 90H ; MVI A,0FFH ; RZ ; CMA ; RET ; ; ; positon look-up tables. ; ; these table must match correct STATX to the the correct LISTERX ; ; X = number after STATX and LISTERX ; STATTBL: DW STAT0 ; status routine for printer X DW STAT1 ; DW STAT2 ; DW STAT3 ; DW STAT4 ; DW STAT5 ; ; TABLE: DW LISTER0 ; data out routine for printer X DW LISTER1 ; DW LISTER2 ; DW LISTER3 ; DW LISTER4 ; DW LISTER5 ; ;