0001 ***********************************************************
0002 *                  SOL  System  III / IV                  *
0003 *                                                         *
0004 *    Centronics  MODEL-703  Parallel  Printer  Driver     *
0005 *                                                         *
0006 *                           By                            *
0007 *                                                         *
0008 *         E S V   Computer   Service   (78/10/22)         *
0009 *                                                         *
0010 *      COPYRIGHT  (C)  1978   ALL  RIGHTS   RESERVED      *
0011 ***********************************************************
0012 *
0013 LOAD ORG 0C900H
0014  ASCF 0
0015 *
0016 ***********************************************************
0017 *        P T D O S      D r i v e r      T a b l e        *
0018 ***********************************************************
0019 *
0020 DTRB DW 0
0021 DTRNB DW 0
0022 DTRBL DW 0
0023 DTWBR DW WB
0024 DTWB DW WB
0025 DTREW DW 0
0026 DTEOF DW EOF
0027 DTCLO DW CLOSE
0028 DTSEK DW 0
0029 DTCTL DW 0
0030 DTBLK DW 874/4
0031 DTITO DB 1
0032 DTINT DW INIT
0033 *
0034 WB CALL WTBLK
0035  XTHL
0036  INX H
0037  INX H
0038  INX H
0039  XTHL
0040  LXI H,0
0041  RET
0042 *
0043 EOF CALL WTBLK
0044  LXI H,0
0045  RET
0046 *
0047 ***********************************************************
0048 *    Print Last Page Number, Output Form-Feed, Restore    *
0049 *    SOL's OPORT Value, And Close This Driver File....    *
0050 ***********************************************************
0051 *
0052 CLOSE CALL LSTPG
0053  MVI A,0CH    Form-Feed
0054  CALL PRINT
0055  MVI A,0
0056  STA OPORT
0057  RET
0058 *
0059 ***********************************************************
0060 *    Select The Printer, Set SOL's OPORT  For Parallel    *
0061 *    Output, Get System Date, And Print Title Header..    *
0062 ***********************************************************
0063 *
0064 INIT MVI A,11H   'Select' In Case Operator Forgot To Do So!
0065  OUT OUTP
0066  MVI A,2
0067  STA OPORT
0068  CALL CONVR
0069  XRA A
0070  MOV B,A
0071  CALL TITLE
0072  MVI A,0DH
0073  CALL PRINT
0074  RET
0075 *
0076 WTBLK MOV A,D
0077  ORA E
0078  RZ
0079  MOV A,M
0080  CALL PRINT
0081  INX H
0082  DCX D
0083  JMP WTBLK
0084 *
0085 ***********************************************************
0086 *   Print The Character In The Accumulator, But Prevent   *
0087 *   The Double Line Feed Option From Double Spacing Us.   *
0088 ***********************************************************
0089 *
0090 PRINT PUSH PSW
0091  CPI 0AH
0092  JZ PRNT2    Avoid Using Excessive Paper!
0093  CPI 0DH
0094  JZ CRLF
0095  MOV B,A
0096  CALL PROUT
0097 PRNT2 POP PSW
0098  RET
0099 *
0100 ***********************************************************
0101 *  Do The Carriage Return - Line Feed  Now And See If We  *
0102 *  Have Printed 56 Lines. If Yes, Do A Form-Feed & Reset  *
0103 ***********************************************************
0104 *
0105 CRLF MOV B,A
0106  CALL PROUT
0107  MVI B,0AH
0108  CALL PROUT
0109  LDA LNUM
0110  CPI 56
0111  JZ NEWPG
0112  INR A
0113  STA LNUM
0114  JMP PRNT2
0115 *
0116 ***********************************************************
0117 *            S y s t e m      E q u a t e s               *
0118 ***********************************************************
0119 *
0120 SOUT EQU 0C019H
0121 PROUT EQU SOUT
0122 OPORT EQU 0C807H
0123 GLDAT EQU 9BA9H
0124 LF EQU 0C2F9H
0125 OUTP EQU 0FDH
0126 *
0127 ***********************************************************
0128 *  Title To Be Printed At Top Of Each Page.  ONLY MODIFY  *
0129 *  'HEADER' - 'DATE' Will Receive System Date For Header  *
0130 ***********************************************************
0131 *
0132 HEADR ASC "  E  S  V    C O M P U T E R    S E R V I C E"
0133  ASC "     "
0134 DATE ASCZ "(  /  /  )"
0135 *
0136 ***********************************************************
0137 *         Reserved Data Locations For Driver Use          *
0138 ***********************************************************
0139 *
0140 TEMP1 DB 0
0141 LNUM DB 0
0142 PAGE ASC "PAGE  "
0143 PNUM DB 30H,30H,30H,30H,0
0144 NINES DB 3AH
0145 ZERO DB 30H
0146 *
0147 ***********************************************************
0148 *    Get System Date <GLDAT>, Convert BCD To ASCII And    *
0149 *   Save <DATE> For Use In Page Title Routine In Header   *
0150 ***********************************************************
0151 *
0152 CONVR PUSH PSW
0153  PUSH B
0154  PUSH H
0155  PUSH D
0156 GETDT LXI H,DATE+1
0157  LXI D,GLDAT
0158  CALL ASCII
0159  LXI H,DATE+4
0160  LXI D,GLDAT+1
0161  CALL ASCII
0162  LXI H,DATE+7
0163  LXI D,GLDAT+2
0164  CALL ASCII
0165  POP D
0166  POP H
0167  POP B
0168  POP PSW
0169  RET
0170 *
0171 ***********************************************************
0172 *       Convert The BCD Code To ASCII For Printouts       *
0173 ***********************************************************
0174 *
0175 ASCII LDAX D
0176  ANI 0F0H
0177  RAR
0178  RAR
0179  RAR
0180  RAR
0181  ADI 30H
0182  MOV M,A
0183  INX H
0184  LDAX D
0185  ANI 0FH
0186  ADI 30H
0187  MOV M,A
0188  RET
0189 *
0190 ***********************************************************
0191 *     Point To 'HEADER' And Print It At Top Of Page       *
0192 *     E L O N G A T E D  - Format For The MODEL-703       *
0193 ***********************************************************
0194 *
0195 TITLE PUSH PSW
0196  PUSH H
0197  PUSH D
0198  LXI H,HEADR
0199 LOOP MOV A,M
0200  CPI 0
0201  JZ ELONG
0202  MOV B,A
0203  CALL PROUT
0204  INX H
0205  JMP LOOP
0206 *
0207 ***********************************************************
0208 *     Tell 703 We Want  E l o n g a t e d  Print Now!     *
0209 ***********************************************************
0210 *
0211 ELONG MVI A,0EH
0212  OUT OUTP
0213  MVI A,0DH
0214  CALL PRINT
0215  MVI A,0DH
0216  CALL PRINT
0217  POP D
0218  POP H
0219  POP PSW
0220  RET
0221 *
0222 ***********************************************************
0223 *   Reached Limit - Print Page Number And Get Ready For   *
0224 *   New Page. Don't Forget To Crank Out Title & Date Too  *
0225 ***********************************************************
0226 *
0227 NEWPG STA TEMP1
0228  PUSH PSW
0229  PUSH H
0230  PUSH D
0231  PUSH B
0232  XRA A
0233  STA LNUM
0234  CALL PGNU
0235  MVI A,0CH
0236  OUT OUTP
0237  XRA A
0238  MOV B,A
0239  CALL TITLE
0240  MVI A,0DH
0241  CALL PRINT
0242  POP B
0243  POP D
0244  POP H
0245  POP PSW
0246  LDA TEMP1
0247  JMP PRNT2
0248 *
0249 ***********************************************************
0250 *  Calculate The Page Number And Print Location For This  *
0251 *  Page, Then Print It. Reset To 0000 If We Reach 9999+1  *
0252 ***********************************************************
0253 *
0254 PGNU CALL COUNT
0255  CALL LF
0256  CALL LF
0257  CALL LF
0258  MVI B,20H
0259  MVI C,58
0260  CALL TAB
0261  LXI H,PAGE
0262  CALL MESSN
0263  MVI A,0DH
0264  OUT OUTP
0265  RET
0266 *
0267 TAB CALL SOUT
0268  DCR C
0269  RZ
0270  JMP TAB
0271 *
0272 ***********************************************************
0273 *   Routine To Print Driver Memory Values <Page Number>   *
0274 ***********************************************************
0275 *
0276 MESSN MOV A,M
0277  CPI 0
0278  RZ
0279  MOV B,A
0280  CALL SOUT
0281  INX H
0282  JMP MESSN
0283 *
0284 ***********************************************************
0285 *      Update The Page Number And Reset If Necessary      *
0286 ***********************************************************
0287 *
0288 COUNT LXI H,PNUM+3
0289  LDA NINES
0290  INR M
0291  CMP M
0292  RNZ
0293  CALL CARRY
0294  DCX H
0295  INR M
0296  CMP M
0297  RNZ
0298  CALL CARRY
0299  DCX H
0300  INR M
0301  CMP M
0302  RNZ
0303  CALL CARRY
0304  DCX H
0305  INR M
0306  CMP M
0307  RNZ
0308  LDA ZERO
0309  STA PNUM
0310  STA PNUM+1
0311  STA PNUM+2
0312  STA PNUM+3
0313  RET
0314 *
0315 CARRY LDA ZERO
0316  MOV M,A
0317  LDA NINES
0318  RET
0319 *
0320 ***********************************************************
0321 *   We May Not Have Printed 56 Lines On The Last Page,    *
0322 *   So Calculate How Many Lines We Need To Skip Before    *
0323 *   Printing The Page Number On This Final Page. Then     *
0324 *   Do A Form-Feed And Close Out This Driver & Return     *
0325 ***********************************************************
0326 *
0327 LSTPG PUSH PSW
0328  PUSH H
0329  PUSH D
0330  PUSH B
0331  STA TEMP1
0332  LDA LNUM
0333  CMA
0334  ADI 3DH
0335  MOV C,A
0336  CALL VRTAB
0337  CALL COUNT
0338  MVI B,20H
0339  MVI C,58
0340  CALL TAB
0341  LXI H,PAGE
0342  CALL MESSN
0343  MVI A,0DH
0344  OUT OUTP
0345  LDA TEMP1
0346  POP B
0347  POP D
0348  POP H
0349  POP PSW
0350  RET
0351 *
0352 ***********************************************************
0353 *   'Vertical Tab' To Appropriate Line For Page Number    *
0354 ***********************************************************
0355 *
0356 VRTAB MVI B,0DH
0357  CALL SOUT
0358  MVI B,0AH
0359  CALL SOUT
0360  DCR C
0361  RZ
0362  JMP VRTAB
0363 *
0364 ***********************************************************
0365 *            Tha - Tha - That's All Folks!                *
0366 ***********************************************************
0367 *                                                         *
0368 *    Centronics  MODEL-703  Parallel  Printer  Driver     *
0369 *                                                         *
0370 *                         By                              *
0371 *                                                         *
0372 *        E S V   Computer   Service   (78/10/22)          *
0373 *                                                         *
0374 *      COPYRIGHT  (C)  1978  ALL  RIGHTS  RESERVED        *
0375 *                                                         *
0376 ***********************************************************
0377 *
0378  END
0379 *
