home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / arc-lbr / typel36.lbr / TYPEL36.MQC / TYPEL36.MAC
Encoding:
Text File  |  1985-02-10  |  14.9 KB  |  730 lines

  1. .comment \
  2.  
  3.                  TYPEL.MAC v3.6
  4.  
  5.          (c) 1984,1985 ESKAY Software Services
  6.                7120 Skillman #2104
  7.                 Dallas, TX  75231
  8.  
  9.  
  10. NOTE:
  11. =====
  12.     If you feel the urge to "improve" this program,
  13.     PLEASE, call the SENECA RCPM first to see if there
  14.     is a later version. THEN send me your update.
  15.  
  16.  Created from the LDIR code in LDIR12, LTYPE17, SYSLIB routines, and,
  17.  of course, thanks to Dave Rand for the USQ baseline code.
  18.  
  19.  Revision history:
  20.  
  21.  01/01/85    Added page eject for $L mode, minor changes
  22.  08/19/84    Rewrote USQB, added prompted mode
  23.  07/21/84    Allowed type of $SYS files, adapted for SYSLIB3
  24.  07/07/84    Fixed bug introduced in 3.2
  25.  05/23/84    Fixed problem with end-of-file detection
  26.  05/06/84    Added $L argument option
  27.  04/14/84    General cleanup, added $N argument option
  28.  02/15/84    Fixed problem in lbr member filename scanner
  29.  02/13/84    Single file mode skipped logging - could only
  30.         type files in default drive/user.
  31.  02/12/84    MAJOR REVISION AND NAME CHANGE v2.00
  32.         Program now called TYPEL. It is now able to type
  33.         (almost) any single file. See doc for more info
  34.  ...
  35.  11/20/83    Initially written.
  36.  
  37.  For further info and reassembly instructions read the DOC file!
  38. \
  39. .8080
  40. ;
  41.     EXTRN    BBLINE        ;SYSLIB line input
  42.     EXTRN    CCOUT        ;SYSLIB character out (convert ctl chars)
  43.     EXTRN    LOUT        ;SYSLIB list char out
  44.     EXTRN    COMPB        ;SYSLIB compare .DE-.HL
  45.     EXTRN    CIN        ;SYSLIB character in
  46.     EXTRN    DIVHD        ;SYSLIB HL DIV DE
  47.     EXTRN    F$OPEN        ;SYSLIB open file
  48.     EXTRN    F$READ        ;SYSLIB file read
  49.     EXTRN    BDOS        ;SYSLIB BDOS call
  50.     EXTRN    FNAME        ;SYSLIB file name parser
  51.     EXTRN    PUTUD        ;SYSLIB save current DU
  52.     EXTRN    GETUD        ;SYSLIB restore default DU
  53.     EXTRN    LOGUD        ;SYSLIB log drive/user
  54.     EXTRN    PRINT        ;SYSLIB print routine
  55.     EXTRN    PSTR        ;SYSLIB print <HL>
  56.     EXTRN    R$READ        ;SYSLIB random read
  57.     EXTRN    RETUD        ;SYSLIB return drive/user
  58. ;
  59.     EXTRN    USQ        ;Baseline USQ code
  60.     EXTRN    UINIT        ;USQ init code
  61.     PUBLIC    FCB
  62.     PUBLIC    BUFF        ;start of buffer
  63.     PUBLIC    TOPRAM        ;end of buffer location
  64.     PUBLIC    EREXT        ;error intercept from USQ
  65.     PUBLIC    TABLE        ;1032 bytes
  66.     PUBLIC    BUFULL        ;buffer full (print) routine
  67. ;
  68. .REQUEST USQB,SYSLIB        ;take the workload off the user
  69. ;
  70. CR    EQU    0DH
  71. LF    EQU    0AH
  72. FF    EQU    12
  73. ARGCH    EQU    '$'        ;option delimiter
  74. ;
  75. BUFSZ    EQU    1        ;buffer size in K bytes
  76. DBUF    EQU    80H        ;default buffer
  77. DFCB    EQU    5CH        ;default fcb
  78. ;
  79. BEGIN:    JMP    SKIPC
  80. MAXDRV:    DB    1+'P'-40H    ;highest accessible drive + 1 (A=2)
  81. MAXUSR:    DB    1+31        ;highest accessible user + 1
  82. MAXLIN:    DB    0        ;number of lines to print max (0=all)
  83. MAXLPS:    DB    23        ;max lines per screen -1 (0= no page)
  84. LSTEN:    DB    1        ;zero=list disable, nz=list enable
  85. SYSEN:    DB    1        ;zero=no sys files, nz=sys files ok
  86. EJECTP:    DB    56        ;eject page after EJECTP lines in $L mode
  87. ;
  88. ; refuse to type these file types
  89. ; (note that type check is done after USQ so no need to
  90. ; check for .CQM etc)
  91. ;
  92. NOTYP:    'COM'
  93.     'OBJ'            ;renamed COM
  94.     'LBR'            ;library
  95.     'OV?'            ;OVR,OVL,OV1,OV2 etc
  96.     'ARC'            ;archive file
  97. ;    'DIR'            ;archive directory
  98.     'BAD'            ;locked out bad spot
  99.     'SYS'            ;system file
  100.     '??#'            ;specially marked file (USERS.TX# etc)
  101. ;    'LOG'            ;log file
  102.     'INT'            ;intermediate file (CBASIC etc)
  103.     'REL'            ;relocatable object file
  104.     '?RL'            ;PRL, CRL, IRL
  105. ;    'CMD'            ;hard to say... (dbase ok, cp/m86 no-go)
  106.     'EXE'            ;executable MSDOS file, renamed COMs
  107.     DB    0        ;end of table
  108.     DS    9*3        ;room for 9 more types
  109. ;
  110. SKIPC:    LXI    H,0        ;save CP/M stack pointer
  111.     DAD    SP
  112.     SHLD    STACK
  113.     LXI    SP,STACK    ;set up local stack
  114.     CALL    PRINT
  115.     'TYPEL v3.60 (c) ESKAY 01-01-85',CR,LF,0
  116.     LXI    H,DBUF        ;point to buffer
  117.     MOV    B,M        ;char count to b
  118.     INR    B
  119. ;
  120. ARGLP:    DCR    B
  121.     JZ    SK1
  122.     INX    H
  123.     MOV    A,M
  124.     CPI    ARGCH        ;check for option delimiter
  125.     JNZ    ARGLP
  126.     DCX    H
  127.     MOV    A,M
  128.     INX    H
  129.     CPI    ' '        ;option must come after a blank
  130.     JNZ    ARGLP
  131.     DCX    H
  132.     MVI    M,0        ;remove option
  133.     INX    H
  134.     INX    H        ;point to arg
  135.     MOV    A,M
  136.     CPI    'N'        ;N=nopage
  137.     MVI    M,0
  138.     JZ    NA
  139.     CPI    'L'
  140.     JNZ    EXARG
  141.     STA    LSTOT
  142. ;
  143. NA:    XRA    A
  144.     STA    MAXLPS        ;non paging
  145. ;
  146. EXARG:    LDA    LSTEN
  147.     ORA    A
  148.     JNZ    SK1
  149.     STA    LSTOT
  150. ;
  151. SK1:    CALL    PUTUD        ;save default DU
  152.     LXI    D,BUFSZ*1024    ;compute...
  153.     LXI    H,BUFF        ;...buffer size
  154.     DAD    D        ;for disk read
  155.     MOV    A,H
  156.     STA    TOPRAM
  157.     CALL    RETUD        ;get current drive/user
  158.     MOV    H,B
  159.     MOV    L,C
  160.     SHLD    USERNO        ;save current DU
  161.     LDA    DFCB+1        ;check if no file name specified
  162.     CPI    ' '
  163.     JNZ    SINGLE
  164. ;
  165. LOOP:    CALL    PRINT
  166.     CR,LF,'* ',0
  167.     MVI    A,1
  168.     STA    SINGFL
  169.     CALL    BBLINE
  170.     CALL    PRINT
  171.     CR,LF,LF,0
  172.     ORA    A
  173.     JZ    FINISH
  174.     LXI    SP,STACK
  175.     JMP    NEXTFL
  176. ;
  177. STLIN:    LDA    MAXLIN        ;max number of lines displayed
  178.     STA    MAXLS
  179.     STA    MAXLS1
  180.     LDA    EJECTP        ;max # of lines in $L mode
  181.     STA    EJECT
  182.     LDA    MAXLPS
  183.     ORA    A
  184.     JZ    MLS
  185.     DCR    A        ;first page is one less than normal
  186. ;
  187. MLS:    STA    LPS
  188.     RET
  189. ;
  190. SINGLE:    LXI    H,DBUF+2    ;point to argument
  191. ;
  192. NEXTFL:    LXI    D,FCB
  193.     CALL    STLIN
  194.     CALL    FNAME        ;parse file name
  195.     JZ    WHAT        ;not a valid file name
  196.     MOV    A,M        ;get delimiter
  197.     STA    FFLAG        ;set flag LBR/non-LBR
  198.     PUSH    H        ;save command line ptr
  199.     INX    B        ;check if current DU:
  200.     MOV    A,B
  201.     ORA    C
  202.     DCX    B        ;restore DU: value
  203.     JZ    CURRDU        ;skip this if current
  204.     MOV    A,B        ;get specified drive
  205.     DCR    B        ;get into range 0..f
  206.     CPI    0FFH        ;ff means current drive
  207.     LXI    H,MAXDRV
  208.     JNZ    NEWDSK        ;skip if different
  209.     LDA    DRIVENO
  210.     MOV    B,A
  211.     JMP    CURDSK
  212. ;
  213. NEWDSK:    CMP    M
  214.     JNC    ILLDU        ;yes - complain
  215. ;
  216. CURDSK:    MOV    A,C        ;get specified user area
  217.     CPI    '?'        ;all user areas???
  218.     JZ    ILLDU        ;yes - complain
  219.     CPI    0FFH        ;current user area?
  220.     JNZ    NEWUSR
  221.     LDA    USERNO
  222.     MOV    C,A
  223.     JMP    CURUSR
  224. ;
  225. NEWUSR:    INX    H        ;illegal user specified?
  226.     CMP    M
  227.     JNC    ILLDU        ;yes - complain
  228. ;
  229. CURUSR:    CALL    LOGUD        ;log into specified DU:
  230. ;
  231. CURRDU:    LDA    FFLAG        ;get flag
  232.     CPI    ' '        ;LBR member request?
  233.     POP    H        ;get cmd line ptr back
  234.     JNZ    NOLBF        ;nope, must be singlefile
  235.     INX    H        ;get next char
  236.     LXI    D,MEMFCB    ;point to member fcb
  237.     CALL    FNAME        ;parse member name
  238.     LXI    H,FCB+1
  239.     CALL    CKAMB        ;check ambiguity
  240.     LXI    H,MEMFCB+1
  241.     CALL    CKAMB
  242.     LXI    H,FCB+9        ;default to .LBR
  243.     MVI    M,'L'
  244.     INX    H
  245.     MVI    M,'B'
  246.     INX    H
  247.     MVI    M,'R'
  248.     LXI    D,FCB
  249.     CALL    F$OPEN        ;attempt to open file
  250.     JNZ    NOFILE        ;not a LBR file
  251.     XRA    A
  252.     STA    DIRS        ;set directory check size to 0
  253.     LDA    SYSEN        ;if $SYS suppress
  254.     ORA    A        ;then...
  255.     CZ    SYSCK        ;check for $sys bit
  256.     XRA    A
  257.     STA    LIN        ;set line count to 0
  258.     LXI    H,MEMFCB+9    ;point to member type
  259.     CALL    TYPCK        ;check valid type
  260.     CALL    F$READ        ;read directory into default buffer
  261.     JNZ    RDERR
  262.     LXI    H,DBUF        ;point to dbuf
  263.     LXI    D,DIRNAME    ;point to 8 blanks
  264.     CALL    CPFN        ;compare
  265.     JNZ    NOLBR        ;not equal
  266.     LXI    D,14
  267.     DAD    D
  268.     MOV    A,M
  269.     STA    DIRSIZ        ;directory size
  270.     XRA    A
  271.     STA    MEMFCB
  272.     JMP    C00        ;skip into directory check
  273. ;
  274. DIRLP:    LXI    D,FCB
  275.     CALL    F$READ
  276.     JNZ    RDERR
  277. ;
  278. C00:    LXI    B,20H
  279.     LXI    H,DBUF
  280.     LXI    D,MEMFCB
  281.     CALL    CPFN
  282.     JZ    FOUND
  283.     DAD    B
  284.     CALL    CPFN
  285.     JZ    FOUND
  286.     DAD    B
  287.     CALL    CPFN
  288.     JZ    FOUND
  289.     DAD    B
  290.     CALL    CPFN
  291.     JZ    FOUND
  292.     LDA    DIRS
  293.     INR    A
  294.     STA    DIRS
  295.     MOV    B,A
  296.     LDA    DIRSIZ
  297.     CMP    B
  298.     JNZ    DIRLP
  299.     CALL    PRINT
  300.     CR,LF
  301.     'Member file not found in LBR directory',CR,LF,0
  302.     JMP    EREXT
  303. ;
  304. ; Found the member file name in the LDIR
  305. ;
  306. FOUND:    LXI    D,12
  307.     DAD    D
  308.     PUSH    H        ;save pointer for now,
  309.     INX    H        ;point to size
  310.     INX    H
  311.     MOV    A,M        ;get low byte
  312.     INX    H
  313.     ORA    M        ;if a=0 then file is 0k
  314.     JZ    NULLEN        ;go complain
  315.     POP    H        ;get pointer back
  316.     MOV    A,M        ;get file address
  317.     INX    H
  318.     MOV    H,M
  319.     MOV    L,A
  320. ;
  321. ; Enter here from non-LBR routine with HL=0000
  322. ;
  323. DOTYP:    LXI    D,FCB        ;get fcb...
  324.     CALL    R$READ        ;...and read random
  325.     JNZ    RDERR
  326.     LXI    B,DBUF        ;point to buffer
  327.     LDAX    B        ;get first byte
  328.     CPI    76H        ;if not 76H (=not squeezed)...
  329.     JNZ    PLAIN        ;...then process as text
  330.     INX    B        ;point to and...
  331.     LDAX    B        ;...get next byte
  332.     CPI    0FFH        ;if FF then squeezed..
  333.     JNZ    PLAIN        ;...else plain text (?)
  334.     CALL    UINIT
  335.     LXI    H,DBUF+4    ;point to original name
  336.     CALL    CHKTP        ;check it's type
  337.     MVI    A,'('        ;print the original name...
  338.     CALL    CCOUT        ;...in parentheses
  339.     LXI    H,DBUF+4
  340.     CALL    PSTR
  341.     CALL    PRINT
  342.     ')',CR,LF,0
  343.     CALL    USQ        ;now unsqueeze and print
  344.     JMP    GOTEOF
  345. ;
  346. ; This routine fills the buffer then calls the print routine
  347. ;
  348. PLAIN:    LXI    D,FCB
  349.     LXI    B,DBUF        ;default buffer
  350. ;
  351. FNEXT:    LXI    H,BUFF
  352. ;
  353. RDLP:    CALL    F$READ        ;changed to properly detect eof...
  354.     JNZ    GOTEOF        ;...in unsqueezed single files
  355. ;
  356. MLP:    LDAX    B
  357.     MOV    M,A
  358.     INX    H
  359.     INR    C
  360.     JNZ    MLP
  361.     MVI    C,80H
  362.     LDA    TOPRAM
  363.     CMP    H
  364.     JNZ    RDLP
  365.     CALL    BUFULL        ;print buffer contents
  366.     JMP    FNEXT
  367. ;
  368. GOTEOF:    CALL    BUFULL
  369.     JMP    EREXT
  370. ;
  371. ; This is the print buffer routine (BUFULL)
  372. ;
  373. BUFULL:    PUSH    H
  374.     PUSH    D
  375.     PUSH    B
  376.     PUSH    PSW
  377.     LXI    H,BUFF
  378. ;
  379. BUFLP:    MOV    A,M
  380.     CPI    1AH
  381.     JZ    EREXT
  382.     CPI    'I'-40H
  383.     JZ    PROCTAB
  384.     ANI    7FH        ;strip high bits
  385.     CALL    PUTCHR
  386.     CPI    LF
  387.     JZ    EOLN
  388.     CALL    CONDIN        ;get keybd char if available
  389.     JZ    GOON        ;none there, go on
  390.     CPI    'C'-40H        ;if ^C...
  391.     JZ    EREXT        ;...then finished
  392.     CPI    'S'-40H        ;if not ^S...
  393.     JNZ    GOON        ;...then go on, else...
  394.     CALL    CIN        ;...wait for keypress
  395.     CPI    'C'-40H
  396.     JZ    EREXT
  397.     JMP    GOON
  398. ;
  399. ; This is NOT the SYSLIB routine by same name...
  400. ;
  401. CONDIN:    PUSH    H
  402.     PUSH    D
  403.     PUSH    B
  404.     MVI    C,6
  405.     MVI    E,0FFH
  406.     CALL    BDOS
  407.     ORA    A
  408.     POP    B
  409.     POP    D
  410.     POP    H
  411.     RET
  412. ;
  413. EOLN:    MVI    A,0FFH        ;reset tab counter
  414.     STA    TAB
  415.     LDA    MAXLPS        ;get max lines per screen
  416.     ORA    A
  417.     JZ    NOPAG        ;skip if no page mode
  418.     LDA    LPS
  419.     DCR    A
  420.     STA    LPS
  421.     JNZ    NOPAG
  422.     CALL    PRINT
  423.     '[more]',CR,0
  424.     CALL    CIN
  425.     CPI    'C'-40H
  426.     JZ    EREXT
  427.     CALL    PRINT
  428.     '      ',CR,0
  429.     LDA    MAXLPS
  430.     STA    LPS
  431. ;
  432. NOPAG:    MVI    A,0        ;filled by program
  433. ;
  434. MAXLS    EQU    $-1        ;if maxln=0...
  435.     ORA    A
  436.     JZ    GOON        ;..then skip line counter
  437.     LDA    LIN        ;else increment...
  438.     INR    A
  439.     STA    LIN        ;...the line counter
  440.     CPI    0        ;see if maxlin reached
  441. ;
  442. MAXLS1    EQU    $-1
  443.     JNZ    GOON        ;no, continue
  444.     CALL    PRINT        ;else abort with message
  445.     CR,LF
  446.     'TYPEL aborted  - maximum number of lines exceeded.',CR,LF
  447.     'Please use XMODEM to transfer file to your system.'
  448.     CR,LF,LF,0
  449.     JMP    EREXT
  450. ;
  451. PROCTAB:LDA    TAB        ;get current tab value
  452.     MOV    B,A        ;save current
  453.     ANI    0F8H        ;round down to last full 8
  454.     ADI    8        ;make next tab stop
  455. ;
  456. TABLP:    CALL    SPOUT        ;put space
  457.     INR    B        ;continue spaces to..
  458.     CMP    B        ;...next tab stop
  459.     JNZ    TABLP
  460.     STA    TAB        ;save next tab stop
  461.     JMP    GO1
  462. ;
  463. ; Print a space
  464. ;
  465. SPOUT:    PUSH    PSW
  466.     MVI    A,' '
  467.     CALL    PUTCHR
  468.     POP    PSW
  469.     RET
  470. ;
  471. GOON:    LDA    TAB        ;increment...
  472.     INR    A
  473.     STA    TAB        ;...tab counter
  474. ;
  475. GO1:    INX    H        ;increment buffer pointer
  476.     LDA    TOPRAM        ;get top of ram
  477.     CMP    H        ;if not yet reached...
  478.     JNZ    BUFLP        ;...then get next char
  479.     POP    PSW        ;else return to caller...
  480.     POP    B        ;...to get more
  481.     POP    D
  482.     POP    H
  483.     RET
  484. ;
  485. ; Process non-LBR file
  486. ;
  487. NOLBF:    LXI    H,FCB+1
  488.     CALL    CKAMB
  489.     LXI    H,FCB+9        ;point to type
  490.     CALL    TYPCK        ;check valid type
  491.     LXI    D,FCB
  492.     CALL    F$OPEN        ;open the file
  493.     JNZ    NOFILE        ;not found...
  494.     LDA    SYSEN
  495.     ORA    A
  496.     CZ    SYSCK        ;$sys file?
  497.     CALL    F$READ        ;read first sector
  498.     LXI    H,0
  499.     JZ    DOTYP        ;type it now...
  500.     CALL    PRINT
  501.     CR,LF
  502.     'Unable to type - empty file?',CR,LF,0
  503.     JMP    EREXT
  504. ;
  505. ; Check type of squeezed file (HL=original fn)
  506. ;
  507. CHKTP:    PUSH    B
  508.     MVI    B,9        ;9 char max
  509. ;
  510. CHKT1:    MOV    A,M
  511.     INX    H
  512.     CPI    '.'        ;end of fn?
  513.     JZ    TYPCK1
  514.     DCR    B
  515.     JNZ    CHKT1
  516.     POP    B
  517.     RET
  518. ;
  519. ; Check file type at <HL> against table PSW, HL munched, ret only if ok
  520. ;
  521. TYPCK:    PUSH    B
  522. ;
  523. TYPCK1:    PUSH    D
  524.     PUSH    H
  525.     LXI    D,NOTYP        ;point to no-type table
  526. ;
  527. TCK1:    POP    H
  528.     PUSH    H
  529.     MVI    B,3        ;3 chars to compare
  530. ;
  531. TCK2:    LDAX    D
  532.     ORA    A        ;if end of table...
  533.     JZ    TYPOK        ;...then return
  534.     CPI    '?'        ;ambiguous?
  535.     JZ    TCK3        ;yes, skip
  536.     CMP    M        ;if no match...
  537.     JNZ    TCK4        ;...then skip to next table entry
  538.     INX    H
  539.     INX    D
  540.     DCR    B
  541.     JNZ    TCK2        ;loop until all 3 match
  542.     POP    H
  543.     POP    D
  544.     POP    B
  545.     JMP    TCKNO        ;not ok to type
  546. ;
  547. ; Skip next character in table and filetype
  548. ;
  549. TCK3:    INX    H
  550.     INX    D
  551.     DCR    B
  552.     JNZ    TCK2
  553.     JMP    TCK1
  554. ;
  555. ; Skip to next table entry
  556. ;
  557. TCK4:    INX    D
  558.     DCR    B
  559.     JNZ    TCK4
  560.     JMP    TCK1
  561. ;
  562. ; Restore registers and return (ok to type)
  563. ;
  564. TYPOK:    POP    H
  565.     POP    D
  566.     POP    B
  567.     RET
  568. ;
  569. ; Complain and abort (type found in table)
  570. ;
  571. TCKNO:    CALL    PRINT
  572.     CR,LF
  573.     'Can''t type a .',0
  574.     MVI    B,3
  575. ;
  576. TCL:    MOV    A,M
  577.     INX    H
  578.     CALL    CCOUT
  579.     DCR    B
  580.     JNZ    TCL
  581.     CALL    PRINT
  582.     ' file!',CR,LF,0
  583.     JMP    EREXT
  584. ;
  585. ; Check if DE+10 has bit 7 set ($SYS file)
  586. ;
  587. SYSCK:    PUSH    H        ;save HL
  588.     LXI    H,10
  589.     DAD    D
  590.     MOV    A,M
  591.     POP    H
  592.     ANI    80H
  593.     RZ
  594.     JMP    NOFILE        ;pretend not there
  595. ;
  596. ; Here are the messages
  597. ;
  598. ILLDU:    CALL    PRINT
  599.     CR,LF
  600.     'Drive/user out of bounds',CR,LF,0
  601.     JMP    EREXT
  602. ;
  603. NOFILE:    CALL    PRINT
  604.     CR,LF
  605.     'No such file on disk',CR,LF,0
  606.     JMP    EREXT
  607. ;
  608. CPFN:    PUSH    H
  609.     PUSH    D
  610.     PUSH    B
  611.     MVI    B,12    ;12 characters
  612.     CALL    COMPB
  613.     POP    B
  614.     POP    D
  615.     POP    H
  616.     RET
  617. ;
  618. CKAMB:    MVI    A,'?'        ;see if there is any...
  619.     MVI    E,11        ;...ambiguity in the file spec
  620. CKAMLP:    CMP    M
  621.     JZ    NOAMB        ;complain if ambiguous fn
  622.     INX    H
  623.     DCR    E
  624.     JNZ    CKAMLP
  625.     RET
  626. ;
  627. PUTCHR:    PUSH    B
  628.     MOV    B,A
  629.     LDA    LSTOT
  630.     ORA    A
  631.     MOV    A,B
  632.     JNZ    COT
  633.     CALL    CCOUT
  634.     POP    B
  635.     RET
  636. ;
  637. COT:    CALL    LOUT        ;output to list device
  638.     CPI    LF        ;if not linefeed...
  639.     JNZ    ..CTE        ;...then exit list out routine
  640.     MVI    A,0FFH
  641.     STA    TAB
  642.     LDA    EJECTP
  643.     ORA    A        ;if no page length...
  644.     JZ    ..CTE        ;...then do not paginate
  645.     LDA    EJECT        ;get current line count
  646.     DCR    A        ;decrement it
  647.     STA    EJECT        ;store count back
  648.     JNZ    ..CTE        ;continue if end of page not reached
  649.     LDA    EJECTP        ;get line count for one page
  650.     STA    EJECT        ;reset counter
  651.     MVI    A,FF        ;get a form feed
  652.     CALL    LOUT        ;kick a page
  653. ;
  654. ..CTE:    POP    B
  655.     RET
  656. ;
  657. NOLBR:    CALL    PRINT
  658.     CR,LF
  659.     'LBR directory may be damaged - aborting',CR,LF,0
  660.     JMP    EREXT
  661. ;
  662. NOMEM:    CALL    PRINT
  663.     CR,LF
  664.     'No member file name specified.',CR,LF,0
  665.     JMP    WHAT
  666. ;
  667. NULLEN:    CALL    PRINT
  668.     CR,LF
  669.     'Member file is 0k - cannot type.',CR,LF,0
  670.     JMP    EREXT
  671. ;
  672. RDERR:    CALL    PRINT
  673.     CR,LF
  674.     'Cannot read file',CR,LF,0
  675.     JMP    EREXT
  676. ;
  677. NOAMB:    CALL    PRINT
  678.     CR,LF
  679.     'No ambiguous file names allowed',CR,LF,0
  680. ;
  681. WHAT:    CALL    PRINT
  682.     CR,LF
  683.     'TYPEL v3.60 universal single-file lister',CR,LF
  684.     'Usage:',CR,LF
  685.     9,'TYPEL [du:]fn[.ft] [fn.ft]',CR,LF
  686.     'Examples:',CR,LF
  687.     9,'TYPEL MDM722 MDM722.IQF     types member file in LBR',CR,LF
  688.     9,'TYPEL TEST.AQM              types normal file',CR,LF
  689.     9,'TYPEL F4:TEST.BQS           accepts ZCPR drive/user',CR,LF
  690.     9,'TYPEL FOO.ASM $N            $N option=not paging',CR,LF
  691.     9,'TYPEL BAR.ZOT $L            $L option=LST: device',CR,LF
  692.     'If 1 argument is supplied, single file is typed.',CR,LF
  693.     'If 2 arguments, TYPEL assumes first arg is type LBR',CR,LF
  694.     'and attempts to type LBR member.',CR,LF
  695.     9,'Typing TYPEL without argument starts interactive mode.'
  696.     CR,LF,'You can enter individual filenames or RETURN to stop.'
  697.     CR,LF,LF,0
  698. ;
  699. EREXT:    CALL    GETUD        ;restore default DU
  700.     LDA    SINGFL
  701.     ORA    A
  702.     JNZ    LOOP
  703. ;
  704. FINISH:    LHLD    STACK
  705.     SPHL
  706.     RET
  707. ;
  708. SINGFL:    DB    0        ;0=single files, 1=prompted
  709. LSTOT:    DB    0        ;flag for list out
  710. FFLAG:    DB    0        ;flag for LBR/non-LBR
  711. TOPRAM:    DB    0        ;hi byte of buffer end
  712. DIRS:    DB    0        ;# of dir sectors processed
  713. DIRSIZ:    DB    0        ;# of total dir sectors
  714. TAB:    DB    0        ;current line tab
  715. LIN:    DB    0        ;line count
  716. LPS:    DB    0        ;line count for page mode
  717. EJECT:    DB    0        ;line count in $L mode
  718. USERNO:    DB    0        ;current user #
  719. DRIVENO:DB    0        ;current drive
  720. FCB:    DS    36        ;out fcb
  721. MEMFCB:    DS    12
  722.     DS    50        ;25 level stack
  723. STACK:    DW    0        ;save CP/M stack pointer here
  724. DIRNAME:DB    0,'           '
  725. BUFF    EQU    2000H        ;start buffer
  726. TABLE    EQU    BUFF-1048    ;usq table
  727. ;
  728. ;
  729.     END
  730.