0001 ***********************************************************
0002 *                  SOL  System  III / IV                  *
0003 *                                                         *
0004 *      DEC writer  MODEL-LA36  Serial Printer Driver      *
0005 *                                                         *
0006 *                           By                            *
0007 *                                                         *
0008 *         E S V   Computer   Service   (78/10/12)         *
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 Vert-Tabs, Restore    *
0049 *    SOL's OPORT Value, And Close This Driver File....    *
0050 ***********************************************************
0051 *
0052 CLOSE CALL LSTPG
0053  MVI B,0AH    'Form-Feed' Via Line Feeds
0054  MVI C,8
0055  CALL TAB
0056  MVI A,0
0057  STA OPORT
0058  RET
0059 *
0060 ***********************************************************
0061 *    Select The Printer, Set SOL's OPORT  For Serial      *
0062 *    Output, Get System Date, And Print Title Header..    *
0063 ***********************************************************
0064 *
0065 INIT EQU $
0066  MVI A,1
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 SOUT
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 Vert-Tabs & Reset  *
0103 ***********************************************************
0104 *
0105 CRLF MOV B,A
0106  CALL SOUT
0107  MVI B,0AH
0108  CALL SOUT
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 0C04AH
0121 OPORT EQU 0C807H
0122 GLDAT EQU 9BA9H
0123 LF EQU 0C2F9H
0124 *
0125 ***********************************************************
0126 *  Title To Be Printed At Top Of Each Page.  ONLY MODIFY  *
0127 *  'HEADER' - 'DATE' Will Receive System Date For Header  *
0128 ***********************************************************
0129 *
0130 HEADR ASC "  E  S  V    C O M P U T E R    S E R V I C E"
0131  ASC "     "
0132 DATE ASCZ "(  /  /  )"
0133 *
0134 ***********************************************************
0135 *         Reserved Data Locations For Driver Use          *
0136 ***********************************************************
0137 *
0138 TEMP1 DB 0
0139 LNUM DB 0
0140 PAGE ASC "PAGE  "
0141 PNUM DB 30H,30H,30H,30H,0
0142 NINES DB 3AH
0143 ZERO DB 30H
0144 *
0145 ***********************************************************
0146 *    Get System Date <GLDAT>, Convert BCD To ASCII And    *
0147 *   Save <DATE> For Use In Page Title Routine In Header   *
0148 ***********************************************************
0149 *
0150 CONVR PUSH PSW
0151  PUSH B
0152  PUSH H
0153  PUSH D
0154 GETDT LXI H,DATE+1
0155  LXI D,GLDAT
0156  CALL ASCII
0157  LXI H,DATE+4
0158  LXI D,GLDAT+1
0159  CALL ASCII
0160  LXI H,DATE+7
0161  LXI D,GLDAT+2
0162  CALL ASCII
0163  POP D
0164  POP H
0165  POP B
0166  POP PSW
0167  RET
0168 *
0169 ***********************************************************
0170 *       Convert The BCD Code To ASCII For Printouts       *
0171 ***********************************************************
0172 *
0173 ASCII LDAX D
0174  ANI 0F0H
0175  RAR
0176  RAR
0177  RAR
0178  RAR
0179  ADI 30H
0180  MOV M,A
0181  INX H
0182  LDAX D
0183  ANI 0FH
0184  ADI 30H
0185  MOV M,A
0186  RET
0187 *
0188 ***********************************************************
0189 *     Point To 'HEADER' And Print It At Top Of Page       *
0190 ***********************************************************
0191 *
0192 TITLE PUSH PSW
0193  PUSH H
0194  PUSH D
0195  MVI A,3
0196  STA LNUM
0197  MVI B,' '
0198  MVI C,33   <====<< Change As Necessary To Center Header
0199  CALL TAB
0200  LXI H,HEADR
0201 LOOP MOV A,M
0202  CPI 0
0203  JZ GOBAK
0204  MOV B,A
0205  CALL SOUT
0206  INX H
0207  JMP LOOP
0208 *
0209 ***********************************************************
0210 *     Restore Registers And Go Back To Caller Routine     *
0211 ***********************************************************
0212 *
0213 GOBAK EQU $
0214  CALL LF
0215  CALL LF
0216  CALL LF
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 B,0AH
0236  MVI C,7
0237  CALL TAB
0238  XRA A
0239  MOV B,A
0240  CALL TITLE
0241  POP B
0242  POP D
0243  POP H
0244  POP PSW
0245  LDA TEMP1
0246  JMP PRNT2
0247 *
0248 ***********************************************************
0249 *  Calculate The Page Number And Print Location For This  *
0250 *  Page, Then Print It. Reset To 0000 If We Reach 9999+1  *
0251 ***********************************************************
0252 *
0253 PGNU CALL COUNT
0254  CALL LF
0255  MVI B,' '
0256  MVI C,58
0257  CALL TAB
0258  LXI H,PAGE
0259  CALL MESSN
0260  JMP LF
0261 *
0262 TAB CALL SOUT
0263  DCR C
0264  RZ
0265  JMP TAB
0266 *
0267 ***********************************************************
0268 *   Routine To Print Driver Memory Values <Page Number>   *
0269 ***********************************************************
0270 *
0271 MESSN MOV A,M
0272  CPI 0
0273  RZ
0274  MOV B,A
0275  CALL SOUT
0276  INX H
0277  JMP MESSN
0278 *
0279 ***********************************************************
0280 *      Update The Page Number And Reset If Necessary      *
0281 ***********************************************************
0282 *
0283 COUNT LXI H,PNUM+3
0284  LDA NINES
0285  INR M
0286  CMP M
0287  RNZ
0288  CALL CARRY
0289  DCX H
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  LDA ZERO
0304  STA PNUM
0305  STA PNUM+1
0306  STA PNUM+2
0307  STA PNUM+3
0308  RET
0309 *
0310 CARRY LDA ZERO
0311  MOV M,A
0312  LDA NINES
0313  RET
0314 *
0315 ***********************************************************
0316 *   We May Not Have Printed 56 Lines On The Last Page,    *
0317 *   So Calculate How Many Lines We Need To Skip Before    *
0318 *   Printing The Page Number On This Final Page. Then     *
0319 *   Do A Vert-Tabs And Close Out This Driver & Return     *
0320 ***********************************************************
0321 *
0322 LSTPG PUSH PSW
0323  PUSH H
0324  PUSH D
0325  PUSH B
0326  STA TEMP1
0327  LDA LNUM
0328  CMA
0329  ADI 3BH
0330  MOV C,A
0331  CALL VRTAB
0332  CALL COUNT
0333  MVI B,' '
0334  MVI C,58
0335  CALL TAB
0336  LXI H,PAGE
0337  CALL MESSN
0338  MVI B,0DH
0339  CALL SOUT
0340  LDA TEMP1
0341  POP B
0342  POP D
0343  POP H
0344  POP PSW
0345  RET
0346 *
0347 ***********************************************************
0348 *   'Vertical Tab' To Appropriate Line For Page Number    *
0349 ***********************************************************
0350 *
0351 VRTAB MVI B,0DH
0352  CALL SOUT
0353  MVI B,0AH
0354  CALL SOUT
0355  DCR C
0356  RZ
0357  JMP VRTAB
0358 *
0359 ***********************************************************
0360 *            Tha - Tha - That's All Folks!                *
0361 ***********************************************************
0362 *                                                         *
0363 *     DEC writer MODEL-LA36  Serial  Printer  Driver      *
0364 *                                                         *
0365 *                         By                              *
0366 *                                                         *
0367 *        E S V   Computer   Service   (78/10/22)          *
0368 *                                                         *
0369 *      COPYRIGHT  (C)  1978  ALL  RIGHTS  RESERVED        *
0370 *                                                         *
0371 ***********************************************************
0372 *
0373  END
0374 *
