TITLE 'LP: Parallel Printer Driver for 8255A' * * This HDOS print driver is based on a disassembly of the * driver provided with the Secured Computer Systems (SCS) * "2/3rds" card, which was designed for the H89 and * provided two serial ports plus one parallel port. The * parallel port is based on the Intel 8255A Programmable * Peripheral Interface (PPI). This driver implements * the 8255A/PPI functionality of that driver to support the * Environmental Control Systems PC-12A and other * parallel interface boards based on the 8255. * * Original disassembly and commenting by Glenn Roberts - * November 2016. * * Updates and enhancements by Glenn Roberts and Terry * Smedley - April 2021 * * August 2021 - * Conditional assembly to support 8255 MODE0 or MODE1 * Port and line assignments compatible with Z89-11 parallel port card * * Direct any comments or corrections to * glenn.f.roberts@gmail.com * * NOTES: enhancements needed: * SET PORT command * timeout management to avoid hung conditions * MODE1 EQU 377Q (0) Assemble for 8255 Mode 1 * (377Q) Assemble for 8255 Mode 0 SPACE 4 STL 'System equates' XTEXT HOSEQU HDOS system equivalences XTEXT ASCII ASCII character equivalences XTEXT DDDEF Device driver communucation flags XTEXT ECDEF System error codes XTEXT PICDEF PIC format equivalences (bytes 0-5) XTEXT DEVDEF Device table entries XTEXT DVDDEF Device driver equivalences XTEXT SETCAL Fixed address routines in SET XTEXT TBRA Branch relative thru table (in ROM) XTEXT TYPTX Type text to console (in ROM) * * ----- Begin position independent code * CODE PIC * * ----- Device header (bytes 6-21) * DB DVDFLV Flag as a Device Driver DB DT.CW Device capability: Write DB 00000001B Mounted unit mask DB 1 Only one unit (unit 0) DB DT.CW Unit 0 : capable of write DS 7 Units 1-7 : don't exist DB DVDFLV Unit capable of SET options DW 0 Pointer to INIT code . SET 025Q Header must be exactly 21 bytes ERRNZ *-. * * ----- Heath reserved area * DS DVD.STE-. Reserve through SeT Entry point EJECT STL 'Flags and assembly constants' PORTA EQU 320Q Base port address PORTB EQU PORTA+1 PORTC EQU PORTA+2 PCTRL EQU PORTA+3 CCINT EQU 040334A S.CAADR+1 * * Handshaking lines on Port C (inputs) * IF MODE1 BUSY EQU 00010000B C4 (Active High) ELSE BUSY EQU 10000000B C7 (Active High) ENDIF ACK EQU 01000000B C6 (Active Low) * Internally generated interrupt latches ACK INTRA EQU 00001000B C3 (Active High) [used only with Mode1] * * Handshaking lines on Port C (outputs) * RESET EQU 00000010B C1 STROBE EQU 00000001B C0 EJECT STL 'SET processing' *** SET processing entry point * * SET commands enter code here * * ENTRY: (DE) = line pointer * (A) = unit number * * EXIT: 'C' clear : no error * 'C' set : error * (A) = error code * * USES: ALL * SETNTR EQU * ERRNZ *-DVD.STE Must be at SET entry point ANA A Must call unit 0 (only one) JNZ SET1 if not, then return with error MOV B,D else MOV C,E (BC) = parameter list address LXI D,PRCTAB (DE) = processor table address LXI H,OPTTAB (HL) = option table address CALL $SOP Call Set Option Processor RC If error, return CALL $SNA Else Scan for Next Argument RZ if none, then return normally MVI A,EC.ILO Else flag error for ILlegal Option STC and set carry to flag error. RET Return. SET1 MVI A,EC.UUN Unknown Unit Number error STC set carry to flag error. RET Return. SPACE 4,10 *** FLAG * * Process Byte Flag * * ENTRY: (HL) = address of table vector * * EXIT: 'C' clear : no error * 'C' set : error * * USES: ALL * * FLAG EQU $PBF SPACE 4,10 *** VAL * * Process Value Flag option specification * * ENTRY: (BC) = next character address * (HL) = table vector index * * EXIT: (BC) updated * 'C' clear : no error * 'C' set : error * * USES: ALL * * VAL EQU $PBV UNK52 MVI A,EC.ILV STC RET F SPACE 4,10 ** HELP * * Type help (list valid options) on console * HELP CALL $TYPTX DB ESC,'E' DB ESC,'Y',37,60 Row 37, Col. 60 DB 'SET OPTIONS' DB ESC,'Y',38,57 Row 38, Col. 57 IF MODE1 DB 'REV H89-11 Mode 1',NL,NL ELSE DB 'REV H89-11 Mode 0',NL,NL ENDIF DB TAB,TAB,'MX80' DB TAB,TAB,'SELECT MX80',NL DB TAB,TAB,'NOMX80' DB TAB,TAB,'DESELECT MX80',NL DB TAB,TAB,'WIDTH n' DB TAB,TAB,'CHAR./LINE 1 continue looping MVI A,0 Zero STA TLP.CX Column Index * * Check if need new page * LPWR9 LDA TLP.LPP A = lines per page ANA A Check for 0 JZ LPWR10 Don't care, continue the loop... LDA TLP.LX A = Line Index PUSH H LXI H,TLP.LPP (HL) = Lines per Page INR A Next line STA TLP.LX save it CMP M at max? POP H JNZ LPWR10 no, continue the loop... MVI A,FF yes! Form Feed CALL LPOUTCH output the character JMP LPWR5 and reset LX and CX LPWR10 INX D DCX B JMP LPWR1 LPWR11 PUSH H PUSH PSW CALL LPCLOSE POP PSW POP H RET * * MXHELP - features only on MX80 * MXHELP CALL $TYPTX DB TAB,TAB,'LPI n',TAB,TAB DB 'LINES/INCH (=216/n) 1