home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol125 / genins.mqc / GENINS.MAC
Encoding:
Text File  |  1985-02-10  |  46.0 KB  |  2,426 lines

  1. ;
  2. ;  PROGRAM:  GENINS -- General ZCPR2 Utility Installation Program
  3. ;  AUTHOR:  RICHARD CONN
  4. ;  VERSION:  2.4
  5. ;  DATE:  25 Apr 83
  6. ;  PREVIOUS VERSIONS:  2.3 (18 Apr 83), 2.2 (29 Jan 83)
  7. ;  PREVIOUS VERSIONS:  2.1 (24 Jan 83), 2.0 (15 Jan 83), 1.9 (13 Jan 83)
  8. ;  PREVIOUS VERSIONS:  1.8 (12 Jan 83), 1.7 (11 Jan 83), 1.6 (6 Jan 83)
  9. ;  PREVIOUS VERSIONS:  1.5 (6 Jan 83), 1.4 (5 Jan 83), 1.3 (5 Jan 83)
  10. ;  PREVIOUS VERSIONS:  1.2 (8 Dec 82), 1.1 (24 NOV 82), 1.0 (9 NOV 82)
  11. ;
  12. vers    equ    24
  13.  
  14. ;
  15. ;    This program is Copyright (c) 1982, 1983 by Richard Conn
  16. ;    All Rights Reserved
  17. ;
  18. ;    ZCPR2 and its utilities, including this one, are released
  19. ; to the public domain.  Anyone who wishes to USE them may do so with
  20. ; no strings attached.  The author assumes no responsibility or
  21. ; liability for the use of ZCPR2 and its utilities.
  22. ;
  23. ;    The author, Richard Conn, has sole rights to this program.
  24. ; ZCPR2 and its utilities may not be sold without the express,
  25. ; written permission of the author.
  26. ;
  27.  
  28.  
  29. ;
  30. ;    GENINS is a program which allows the user to set the default
  31. ; conditions of many of the new ZCPR2 utilities, such as ERASE,
  32. ; without resorting to a reassembly or the use of a patch
  33. ; technique with a debugger like DDT.  It is interactive, and it allows
  34. ; to user to display the defaults and set them.
  35. ;
  36. ;    GENINS is invoked by a command line like the following:
  37. ;        GENINS or GENINS DIR:FILENAME.TYP
  38. ;    The first form will prompt the user for the name of the file to patch,
  39. ; allow him to patch it, and then save the result on disk in the same file
  40. ; or a different file.  The second form automatically prepares the indicated
  41. ; file for patching.
  42. ;
  43.  
  44. ;
  45. ;  Buffer contents
  46. ;
  47. optbuff    equ    80H    ; offset to first byte of buffer
  48. epavail    equ    optbuff+3
  49. epadr    equ    optbuff+4
  50. intpath    equ    optbuff+6
  51. mcavail    equ    optbuff+17h
  52. mcadr    equ    optbuff+18h
  53. mdisk    equ    optbuff+1ah
  54. muser    equ    optbuff+1bh
  55. dok    equ    optbuff+1ch
  56. uok    equ    optbuff+1dh
  57. puser    equ    optbuff+1eh
  58. ppass    equ    optbuff+1fh
  59. cindic    equ    optbuff+48h
  60. dmadr    equ    optbuff+49h
  61. ndradr    equ    optbuff+4bh
  62. ndnames    equ    optbuff+4dh
  63. dnfile    equ    optbuff+4eh
  64.  
  65. ;  Required features flags
  66. epreqd    equ    optbuff+59h
  67. mcreqd    equ    optbuff+5ah
  68. mxreqd    equ    optbuff+5bh
  69. udreqd    equ    optbuff+5ch
  70. pureqd    equ    optbuff+5dh
  71. cdreqd    equ    optbuff+5eh
  72. ndreqd    equ    optbuff+5fh
  73. z2class    equ    optbuff+60h
  74. z2name    equ    optbuff+61h
  75. obase    equ    optbuff+70h
  76.  
  77. ;  Size of Buffer to be Saved
  78. bufsiz    equ    epreqd-epavail    ; number of bytes in config buffer
  79.  
  80. ;  Class 1: Special Files -- DEVICE, IOLOADER, RECORD
  81. iobase    equ    obase    ; I/O Base Address
  82.  
  83. ;  Class 2: Special Files -- MCOPY
  84. verflg    equ    obase    ; Verify Flag
  85. insp    equ    obase+1    ; Inspect Flag
  86. quiet    equ    obase+2    ; Quiet Flag
  87. ncopy    equ    obase+3    ; Multiple Copy Flag
  88. ddisk    equ    obase+4    ; Default Destination Disk
  89. duser    equ    obase+5    ; Default Destination User
  90.  
  91. ;  Class 3: Special Files -- XDIR3
  92. igrp    equ    obase    ; Grouping Flag
  93. ifmt    equ    obase+1    ; Vertical Format Flag
  94. iatt    equ    obase+2    ; Default Attributes
  95. iscn    equ    obase+3    ; Default Function
  96. fenab    equ    obase+4    ; Enable F Options
  97. lenab    equ    obase+5    ; Enable FL Option
  98. asenab    equ    obase+6    ; Enable AS option
  99.  
  100. ;  Class 4: Special Files -- ZEX
  101. tnuich    equ    obase    ; End User Input Command Char
  102.  
  103. ;  Class 5: Special Files -- LRUNZ, LDIRZ, and HELP
  104. cfile    equ    obase    ; File Name for Default Search File
  105.  
  106. ;  Class 6: Special Files -- DU2 and SAK
  107. pspeed    equ    obase    ; Processor Speed
  108. ssize    equ    obase+1    ; Screen Size
  109.  
  110. ;  Class 7: Special Files -- TINIT
  111. ;pspeed    equ    obase    ; Processor Speed (from DU2)
  112. cfgfile    equ    obase+1    ; Config File Name
  113.  
  114. ;  Class 8: Special Files -- WHEEL
  115. wheel    equ    obase    ; Address of Wheel Byte
  116.  
  117. ;  Class 11: Special Files -- PRINT3 and PAGE
  118. lwidth    equ    obase    ; Printer Width
  119. ltpp    equ    obase+1    ; Number of Text Lines Per Page
  120. lspp    equ    obase+2    ; Number of Lines to Skip Per Page
  121. cwidth    equ    obase+3    ; CRT Width
  122. ctpp    equ    obase+4    ; Number of Text Lines Per Screen
  123. cspp    equ    obase+5    ; Number of Lines to Skip Per Screen
  124.  
  125. ;
  126. ;  Constants
  127. ;
  128. cr    equ    0dh
  129. lf    equ    0ah
  130. cpm    equ    0    ; Warm Boot Entry
  131. bentry    equ    cpm+5    ; BDOS Entry
  132. tfcb    equ    cpm+5ch    ; ZCPR2 FCB
  133. tbuff    equ    cpm+80h    ; Disk I/O Buffer
  134.  
  135. ;
  136. ;  Externals
  137. ;
  138.     ext    codend,bbline,eval10,eval16,print,pstr
  139.     ext    initfcb,fname,moveb,moveb,cin,cout,caps,crlf
  140.     ext    phl4hc,padc,f$open,f$close,f$read,f$write,f$rename
  141.     ext    f$delete,f$make,zfname,phldc
  142.     ext    putud,getud,retud,logud
  143.     ext    zgpins,compb
  144.  
  145. ;
  146. ;  Branch to Start of Program
  147. ;
  148.     jmp    start
  149.  
  150. ;
  151. ;******************************************************************
  152. ;
  153. ;  SINSFORM -- ZCPR2 Utility Standard General Purpose Initialization Format
  154. ;
  155. ;    This data block precisely defines the data format for
  156. ; initial features of a ZCPR2 system which are required for proper
  157. ; initialization of the ZCPR2-Specific Routines in SYSLIB.
  158. ;
  159.  
  160. ;
  161. ;  EXTERNAL PATH DATA
  162. ;
  163. ;EPAVAIL:
  164.     DB    0FFH    ; IS EXTERNAL PATH AVAILABLE? (0=NO, 0FFH=YES)
  165. ;EPADR:
  166.     DW    40H    ; ADDRESS OF EXTERNAL PATH IF AVAILABLE
  167.  
  168. ;
  169. ;  INTERNAL PATH DATA
  170. ;
  171. ;INTPATH:
  172.     DB    0,0    ; DISK, USER FOR FIRST PATH ELEMENT
  173.             ; DISK = 1 FOR A, '$' FOR CURRENT
  174.             ; USER = NUMBER, '$' FOR CURRENT
  175.     DB    0,0
  176.     DB    0,0
  177.     DB    0,0
  178.     DB    0,0
  179.     DB    0,0
  180.     DB    0,0
  181.     DB    0,0    ; DISK, USER FOR 8TH PATH ELEMENT
  182.     DB    0    ; END OF PATH
  183.  
  184. ;
  185. ;  MULTIPLE COMMAND LINE BUFFER DATA
  186. ;
  187. ;MCAVAIL:
  188.     DB    0FFH    ; IS MULTIPLE COMMAND LINE BUFFER AVAILABLE?
  189. ;MCADR:
  190.     DW    0FF00H    ; ADDRESS OF MULTIPLE COMMAND LINE BUFFER IF AVAILABLE
  191.  
  192. ;
  193. ;  DISK/USER LIMITS
  194. ;
  195. ;MDISK:
  196.     DB    4    ; MAXIMUM NUMBER OF DISKS
  197. ;MUSER:
  198.     DB    31    ; MAXIMUM USER NUMBER
  199.  
  200. ;
  201. ;  FLAGS TO PERMIT LOG IN FOR DIFFERENT USER AREA OR DISK
  202. ;
  203. ;DOK:
  204.     DB    0FFH    ; ALLOW DISK CHANGE? (0=NO, 0FFH=YES)
  205. ;UOK:
  206.     DB    0FFH    ; ALLOW USER CHANGE? (0=NO, 0FFH=YES)
  207.  
  208. ;
  209. ;  PRIVILEGED USER DATA
  210. ;
  211. ;PUSER:
  212.     DB    10    ; BEGINNING OF PRIVILEGED USER AREAS
  213. ;PPASS:
  214. tpass:
  215.     DB    'chdir',0    ; PASSWORD FOR MOVING INTO PRIV USER AREAS
  216.     DS    41-($-tpass)    ; 40 CHARS MAX IN BUFFER + 1 for ending NULL
  217.  
  218. ;
  219. ;  CURRENT USER/DISK INDICATOR
  220. ;
  221. ;CINDIC:
  222.     DB    '$'    ; USUAL VALUE (FOR PATH EXPRESSIONS)
  223.  
  224. ;
  225. ;  DMA ADDRESS FOR DISK TRANSFERS
  226. ;
  227. ;DMADR:
  228.     DW    80H    ; TBUFF AREA
  229.  
  230. ;
  231. ;  NAMED DIRECTORY INFORMATION
  232. ;
  233. ;NDRADR:
  234.     DW    00000H    ; ADDRESS OF MEMORY-RESIDENT NAMED DIRECTORY
  235. ;NDNAMES:
  236.     DB    64    ; MAX NUMBER OF DIRECTORY NAMES
  237. ;DNFILE:
  238.     DB    'NAMES   '    ; NAME OF DISK NAME FILE
  239.     DB    'DIR'        ; TYPE OF DISK NAME FILE
  240.  
  241. ;
  242. ;  REQUIREMENTS FLAGS
  243. ;
  244. ;EPREQD:
  245.     DB    0FFH    ; EXTERNAL PATH?
  246. ;MCREQD:
  247.     DB    0FFH    ; MULTIPLE COMMAND LINE?
  248. ;MXREQD:
  249.     DB    0FFH    ; MAX USER/DISK?
  250. ;UDREQD:
  251.     DB    0FFH    ; ALLOW USER/DISK CHANGE?
  252. ;PUREQD:
  253.     DB    0FFH    ; PRIVILEGED USER?
  254. ;CDREQD:
  255.     DB    0FFH    ; CURRENT INDIC AND DMA?
  256. ;NDREQD:
  257.     DB    0FFH    ; NAMED DIRECTORIES?
  258. ;Z2CLASS:
  259.     DB    0    ; CLASS 0
  260.     DB    'ZCPR2'
  261.     DS    10    ; RESERVED
  262.  
  263.  
  264. ;
  265. ;  END OF SINSFORM -- STANDARD DEFAULT PARAMETER DATA
  266. ;
  267. ;******************************************************************
  268. ;
  269.  
  270. ;
  271. ;  Start of Program
  272. ;
  273. start:
  274.     call    zgpins    ; general-purpose install
  275.     call    print
  276.     db    'GENINS Version '
  277.     db    (vers/10)+'0','.',(vers mod 10)+'0'
  278.     db    cr,lf
  279.     db    'GENINS -- General Installation Program for ZCPR2 Utilities'
  280.     db    cr,lf
  281.     db    cr,lf,'The ZCPR2 System, including ZCPR2 itself and the 30+ '
  282.     db    'utility programs'
  283.     db    cr,lf,'distributed with ZCPR2 as part of the ZCPR2 System, was'
  284.     db    ' written by'
  285.     db    cr,lf,'Richard Conn.'
  286.     db    cr,lf
  287.     db    cr,lf,'The ZCPR2 System is Copyright (c) 1982, 1983 by Richard'
  288.     db    ' Conn'
  289.     db    cr,lf,'All Rights Reserved',cr,lf
  290.     db    0
  291.  
  292.     call    putud    ; save current user/disk for return
  293.     call    retud    ; get current user/disk
  294.     mov    a,b    ; save data
  295.     sta    cdisk
  296.     mov    a,c
  297.     sta    cuser
  298.     lda    tfcb+1    ; check for file name
  299.     cpi    ' '    ; none if space
  300.     jz    openlp
  301.     lxi    h,tbuff    ; pt to input line buffer
  302.     mov    a,m    ; get char count
  303.     inx    h    ; pt to first char
  304.     push    h    ; save ptr to first char
  305.     add    l    ; pt to after last char
  306.     mov    l,a
  307.     mov    a,h
  308.     aci    0
  309.     mov    h,a    ; HL pts to after last chr
  310.     mvi    m,0
  311.     pop    h    ; HL pts to first char
  312.     call    gfile    ; extract file name
  313.     jnz    openl1
  314.     call    print
  315.     db    cr,lf,'Error in Input File Specification',0
  316. openlp:
  317.     lxi    sp,stack    ; set stack
  318.     call    print
  319.     db    cr,lf,'Please Provide Name of File to Install',0
  320.     xra    a    ; allow abort
  321.     call    getfile    ; get file name and log in user/disk
  322.     jz    cpm    ; abort?
  323. openl1:
  324.     lda    user    ; save current user/disk
  325.     sta    users
  326.     lda    disk
  327.     sta    disks
  328.     lxi    d,fcb    ; pt to FCB
  329.     call    f$open    ; try to open file
  330.     jz    openok
  331.     call    print
  332.     db    cr,lf,'Error -- File Not Found',0
  333.     call    getud    ; restore current user/disk
  334.     jmp    openlp
  335. openok:
  336.     lxi    h,fcb    ; copy FCB to FCBIN
  337.     lxi    d,fcbin
  338.     mvi    b,36    ; 36 bytes
  339.     call    moveb
  340.     lxi    d,fcbin    ; input file
  341.     call    f$read    ; read a block in
  342.     lxi    h,z2tname    ; check for ZCPR2 file
  343.     lxi    d,z2name
  344.     mvi    b,5    ; 5 bytes
  345.     call    compb    ; compare
  346.     jz    opok1
  347.     call    print
  348.     db    cr,lf,'Error -- NOT a ZCPR2 Utility -- Aborting',0
  349.     jmp    openlp
  350. opok1:
  351.     call    print
  352.     db    cr,lf,'Ready to Set Default Values',cr,lf,0
  353.     call    setup    ; perform function
  354.     cpi    'Q'    ; quit?
  355.     jz    quit
  356. exit:
  357.     call    getud    ; restore current user/disk
  358.     call    print
  359.     db    cr,lf,'Do you want to save changes',0
  360.     call    getyn    ; get Y or N
  361.     jz    openlp    ; run again if N
  362. namelp:
  363.     call    getud    ; return home in case of default
  364.     call    retud    ; get current user and disk
  365.     mov    a,b    ; save disk
  366.     sta    disk
  367.     mov    a,c    ; save user
  368.     sta    user
  369.     call    print
  370.     db    cr,lf,'Please Provide Name of Output File',0
  371.     mvi    a,0ffh    ; do not allow abort
  372.     call    getfile
  373.     call    print
  374.     db    cr,lf,'Name of Output File is ',0
  375.     lxi    h,fcb+1    ; pt to file name
  376.     call    prfn
  377.     call    print
  378.     db    ' -- Verify',0
  379.     call    getyn    ; get response
  380.     jz    namelp    ; abort if No
  381.     lxi    d,fcbout
  382.     call    initfcb
  383.     call    f$delete    ; delete file if there
  384.     call    initfcb
  385.     call    f$make        ; create output file
  386.     cpi    0ffh    ; error?
  387.     jz    derr
  388.     call    print
  389.     db    cr,lf,'Writing File ',0
  390.     lxi    h,fcb+1    ; print file name
  391.     call    prfn
  392.     call    print
  393.     db    ' to Disk --',cr,lf,0
  394.     call    f$write        ; write first block to it
  395.     ora    a    ; ok?
  396.     jnz    derr
  397. exitl:
  398.     lda    users    ; get user number
  399.     mov    c,a    ; ... in C
  400.     lda    disks    ; get disk number
  401.     mov    b,a    ; ... in B
  402.     call    logud    ; log in user/disk for source
  403.     call    f$rbuf    ; read in buffer
  404.     ora    a    ; done?
  405.     jz    exitd    ; done if no blocks read
  406.     lda    user    ; get user number
  407.     mov    c,a    ; ... in C
  408.     lda    disk    ; get disk number
  409.     mov    b,a    ; ... in B
  410.     call    logud    ; log in user/disk for destination
  411.     call    f$wbuf    ; write out a buffer
  412.     ora    a    ; error?
  413.     jz    exitl
  414. derr:
  415.     call    print
  416.     db    cr,lf,'Disk Write Error -- Abort',0
  417.     call    getud
  418.     ret
  419. exitd:
  420.     call    f$close    ; close input file
  421.     lda    user    ; get dest user/disk
  422.     mov    c,a
  423.     lda    disk
  424.     mov    b,a
  425.     call    logud
  426.     lxi    d,fcbout    ; close output file
  427.     call    f$close
  428.     lxi    d,fcb    ; now delete new file if exists
  429.     call    initfcb    ; init fcb
  430.     call    f$delete
  431.     call    initfcb    ; init fcb again
  432.     xchg        ; HL pts to new name
  433.     lxi    d,fcbout    ; DE pts to old name
  434.     call    initfcb        ; init fcb
  435.     call    f$rename    ; file renamed
  436.     call    getud    ; restore original user/disk
  437. quit:
  438.     jmp    openlp
  439.  
  440. ;
  441. ;  Print Name and Class of File
  442. ;
  443. fdata:
  444.     call    print
  445.     db    cr,lf,'File Being Installed: ',0
  446.     lxi    h,fcbin+1    ; pt to file name
  447.     call    prfn
  448.     ret
  449. ;
  450. ;  Read In a Buffer from Disk
  451. ;    Return with A<>0 if No Data to Read
  452. ;
  453. f$rbuf:
  454.     call    codend    ; get address of buffer
  455.     xchg        ; DE is address of buffer
  456.     lhld    bentry+1    ; get address of base of BDOS
  457.     mvi    l,0
  458.     mov    a,h    ; compute top of TPA
  459.     sui    10    ; 10 pages below base of BDOS
  460.     sub    d    ; compute size of TPA
  461.     cpi    41h    ; greater than 16K?
  462.     jc    f$rb1
  463.     mvi    a,40h    ; set to 16K max load
  464. f$rb1:
  465.     add    a    ; double for number of blocks
  466.     sta    nblocks    ; set number of blocks
  467.     xchg        ; HL pts to first block
  468.     mvi    c,0    ; set count to zero
  469. f$rb2:
  470.     lxi    d,fcbin    ; pt to input FCB
  471.     call    f$read    ; try to read a block
  472.     ora    a    ; error?
  473.     jnz    f$rb5
  474.     call    print
  475.     db    cr,lf,'Reading ',0
  476.     call    prdoti    ; init display
  477.     jmp    f$rb4
  478. f$rb3:
  479.     lxi    d,fcbin    ; pt to input FCB
  480.     call    f$read    ; try to read a block
  481.     ora    a    ; error?
  482.     jnz    f$rb5
  483. f$rb4:
  484.     call    prdot    ; print dot
  485.     lxi    d,tbuff    ; pt to input buffer
  486.     xchg        ; roles are interchanged
  487.     mvi    b,128    ; copy 128 bytes
  488.     call    moveb    ; copy into memory
  489.     lxi    h,128    ; pt to next buffer entry
  490.     dad    d    ; HL pts to next buffer entry
  491.     inr    c    ; increment block count
  492.     lda    nblocks    ; check for done
  493.     cmp    c    ; done if match
  494.     jnz    f$rb3
  495. f$rb5:
  496.     mov    a,c    ; get block count in A (0 if no load or done)
  497.     sta    nblocks    ; set block count
  498.     ret
  499. ;
  500. ;  Write Buffer to Disk
  501. ;    NBLOCKS contains the number of blocks to write
  502. ;    Return with A=0 if no error
  503. ;
  504. f$wbuf:
  505.     call    print
  506.     db    cr,lf,'Writing ',0
  507.     call    prdoti    ; print new line and reset count
  508.     lda    nblocks    ; get block count
  509.     call    codend    ; get address
  510.     mov    c,a    ; block count in C
  511. f$wbuf1:
  512.     call    prdot    ; print dot
  513.     lxi    d,tbuff    ; copy into TBUFF
  514.     mvi    b,128    ; 128 bytes
  515.     call    moveb
  516.     lxi    d,128    ; pt to next block
  517.     dad    d
  518.     lxi    d,fcbout    ; output FCB
  519.     call    f$write    ; write block to disk
  520.     ora    a    ; OK?
  521.     rnz        ; error if not zero
  522.     dcr    c    ; count down
  523.     jnz    f$wbuf1    ; continue until all written
  524.     xra    a    ; A=0 for OK completion
  525.     ret
  526.  
  527. ;
  528. ;  Print dot and count down
  529. ;
  530. prdot:
  531.     push    h    ; save regs
  532.     push    b
  533.     lhld    dcount    ; increment counter
  534.     inx    h
  535.     shld    dcount
  536.     mvi    b,5    ; back up 5 chars
  537.     mvi    a,8    ; back space
  538. prdot1:
  539.     call    cout    ; back up
  540.     dcr    b
  541.     jnz    prdot1
  542.     call    phldc    ; print decimal number
  543.     pop    b    ; restore regs
  544.     pop    h
  545.     ret
  546. prdoti:
  547.     push    h    ; init dot output
  548.     lxi    h,0    ; zero count
  549.     shld    dcount
  550.     call    print
  551.     db    'Block      ',0
  552.     pop    h
  553.     ret
  554.  
  555. ;
  556. ;  Get file name from user, and, goto the user/disk he specified (or implied)
  557. ;    Return with Zero Set if Abort; DE pts to FCB
  558. ;
  559. getfile:
  560.     sta    gfflag    ; save abort flag
  561. getf0:
  562.     call    print
  563.     db    cr,lf,'Name of File (<CR>=',0
  564.     lda    gfflag
  565.     ora    a    ; 0=abort
  566.     jnz    getf1
  567.     call    print
  568.     db    'Abort)? ',0
  569.     jmp    getf2
  570. getf1:
  571.     lxi    h,fcb+1    ; pt to file name
  572.     call    prfn    ; print file name
  573.     call    print
  574.     db    ')? ',0
  575. getf2:
  576.     xra    a    ; no caps
  577.     call    bbline    ; get line
  578.     ora    a    ; abort?
  579.     rz
  580. gfile:
  581.     call    sblank    ; skip blanks
  582.     ora    a    ; check for end
  583.     rz        ; spaces only?
  584.     lxi    d,fcb    ; pt to fcb
  585.     call    zfname    ; parse and get params
  586.     jnz    gf0
  587.     call    print
  588.     db    cr,lf,'Error -- Invalid User or Disk -- Reenter',0
  589.     jmp    getf0
  590. gf0:
  591.     mov    a,b    ; get disk
  592.     cpi    0ffh    ; current?
  593.     jz    gf1
  594.     dcr    a    ; adjust to 0-15
  595.     jmp    gf1a
  596. gf1:
  597.     lda    cdisk    ; set current disk
  598. gf1a:
  599.     sta    disk    ; set new disk
  600.     mov    a,c    ; get user
  601.     cpi    0ffh    ; current?
  602.     jz    gf2
  603.     cpi    '?'    ; current if all
  604.     jnz    gf2a
  605. gf2:
  606.     lda    cuser    ; set current user
  607. gf2a:
  608.     sta    user    ; set new user
  609.     mov    c,a    ; set user
  610.     lda    disk    ; set disk
  611.     mov    b,a
  612.     call    logud    ; go there
  613.     lxi    h,fcb+9    ; check for file type
  614.     mov    a,m    ; any file type?
  615.     cpi    ' '    ; <sp> if none
  616.     jnz    gf3
  617.     xchg        ; set file type
  618.     lxi    h,comtyp
  619.     mvi    b,3    ; 3 bytes
  620.     call    moveb
  621. gf3:
  622.     mvi    a,0ffh    ; set OK
  623.     ora    a
  624.     ret
  625. ;
  626. ;  Skip to Non-Blank
  627. ;
  628. sblank:
  629.     mov    a,m    ; skip to first non-blank
  630.     inx    h
  631.     cpi    ' '
  632.     jz    sblank
  633.     dcx    h    ; pt to first non-blank
  634.     ret
  635. ;
  636. ;  Buffers
  637. ;
  638. comtyp:    db    'COM'    ; default file type
  639. nblocks:
  640.     ds    1    ; block counter
  641. dcount:    ds    2    ; dot counter
  642. gfflag:    ds    1    ; file abort flag
  643. cdisk:    ds    1    ; current disk number
  644. cuser:    ds    1    ; current user number
  645. disk:    ds    1    ; disk number
  646. user:    ds    1    ; user number
  647. disks:    ds    1    ; source disk number
  648. users:    ds    1    ; source user number
  649. z2tname:
  650.     db    'ZCPR2'    ; test name to verify right kind of utility
  651. fcbout:
  652.     db    0    ; temporary output file FCB
  653.     db    'WORK    $$$'
  654.     ds    4
  655.     ds    16
  656.     ds    4
  657. dfcb:
  658.     ds    36    ; dummy FCB
  659. fcb:
  660.     ds    36    ; new file name FCB
  661. fcbin:
  662.     ds    36    ; input file FCB
  663. cpyflg:
  664.     db    0    ; no previous copy done
  665. tmpbuff:
  666.     ds    bufsiz    ; temporary buffer
  667.     ds    200    ; 100 elt stack
  668. stack:    ds    2
  669.  
  670. ;
  671. ;  Print the current options setting
  672. ;
  673. propt:
  674.     call    print
  675.     db    cr,lf,'**** Default Flag/Value Settings ****',0
  676.     call    prex    ; external paths
  677.     call    prmc    ; multiple commands
  678.     call    prmdisk    ; max disk
  679.     call    prdok    ; disk ok
  680.     call    prpu    ; privileged user
  681.     call    prcud    ; current user/disk indic
  682.     call    prnd    ; named directories
  683.     lda    z2class    ; check class
  684.     cpi    1    ; Class 1?
  685.     jz    prio
  686.     cpi    2    ; Class 2?
  687.     jz    prmcopy
  688.     cpi    3    ; Class 3?
  689.     jz    prxdir
  690.     cpi    4    ; Class 4?
  691.     jz    przex
  692.     cpi    5    ; Class 5?
  693.     jz    prlrunz
  694.     cpi    6    ; Class 6?
  695.     jz    prdu2
  696.     cpi    7    ; Class 7?
  697.     jz    prtinit
  698.     cpi    8    ; Class 8?
  699.     jz    prwheel
  700.     cpi    11    ; Class 11?
  701.     jz    prpsio
  702.     ret
  703. ;
  704. ;  Print Printer and Screen I/O Data
  705. ;
  706. prpsio:
  707.     call    print
  708.     db    cr,lf,'Printer --'
  709.     db    cr,lf,'    Width (Columns): ',0
  710.     lda    lwidth
  711.     call    padc
  712.     call    print
  713.     db    cr,lf,'    Number of Lines of Text Per Page: ',0
  714.     lda    ltpp
  715.     call    padc
  716.     call    print
  717.     db    cr,lf,'    Total Number of Lines Per Page: ',0
  718.     lda    lspp
  719.     mov    b,a
  720.     lda    ltpp
  721.     add    b
  722.     adi    2    ; 2-line header
  723.     call    padc
  724.     call    print
  725.     db    cr,lf,'CRT Screen --'
  726.     db    cr,lf,'    Width (Columns): ',0
  727.     lda    cwidth
  728.     call    padc
  729.     call    print
  730.     db    cr,lf,'    Number of Lines of Text Per Screen: ',0
  731.     lda    ctpp
  732.     call    padc
  733.     call    print
  734.     db    cr,lf,'    Total Number of Lines Per Screen: ',0
  735.     lda    cspp
  736.     mov    b,a
  737.     lda    ctpp
  738.     add    b
  739.     adi    1    ;1-line footer
  740.     call    padc
  741.     ret
  742. ;
  743. ;  Print Wheel Byte Address
  744. ;
  745. prwheel:
  746.     call    print
  747.     db    cr,lf,'Address of Wheel Byte: ',0
  748.     lhld    wheel    ; get it
  749.     call    prhnum    ; print as Hex
  750.     ret
  751. ;
  752. ;  Print LRUNZ file name
  753. ;
  754. prlrunz:
  755.     call    print
  756.     db    cr,lf,'Default Name of Search File: ',0
  757.     lxi    h,cfile    ; pt to file name
  758.     call    prfn
  759.     ret
  760. ;
  761. ;  Print TINIT Data
  762. ;
  763. prtinit:
  764.     call    print
  765.     db    cr,lf,'Processor Speed: ',0
  766.     lda    pspeed    ;get it
  767.     call    padc
  768.     call    print
  769.     db    ' MHz'
  770.     db    cr,lf,'Default Configuration File: ',0
  771.     lxi    h,cfgfile    ;pt to file name
  772.     call    prfn    ;print file name
  773.     ret
  774. ;
  775. ;  Print Class 6 Data
  776. ;
  777. prdu2:
  778.     call    print
  779.     db    cr,lf,'Processor Speed: ',0
  780.     lda    pspeed    ;get it
  781.     call    padc    ;decimal
  782.     call    print
  783.     db    ' MHz'
  784.     db    cr,lf,'Number of Lines on Screen: ',0
  785.     lda    ssize    ;get it
  786.     call    padc    ;decimal
  787.     ret
  788. ;
  789. ;  print I/O data
  790. ;
  791. prio:
  792.     lhld    iobase    ; Get I/O Base Address
  793.     call    print
  794.     db    cr,lf,'I/O Base Address: ',0
  795.     mov    a,h    ; Check for definition
  796.     ora    l
  797.     jnz    prio1
  798.     call    print
  799.     db    'NOT Defined',0
  800.     ret
  801. prio1:
  802.     jmp    prhnum    ; print as hex
  803.  
  804. ;
  805. ;  print XDIR3 data
  806. ;
  807. prxdir:
  808.     lxi    h,igrp    ; pt to first buffer
  809.     call    print
  810.     db    cr,lf,'Group by File ',0
  811.     mov    a,m    ; get flag
  812.     ora    a    ; 0=Name and Type
  813.     jz    prx1
  814.     call    print
  815.     db    'Type and Name',0
  816.     jmp    prx1a
  817. prx1:
  818.     call    print
  819.     db    'Name and Type',0
  820. prx1a:
  821.     inx    h    ; pt to next
  822.     mov    a,m    ; get flag
  823.     ora    a    ; 0=vertical
  824.     jnz    prx2
  825.     call    print
  826.     db    cr,lf,'Vertical',0
  827.     jmp    prx2a
  828. prx2:
  829.     call    print
  830.     db    cr,lf,'Horizontal',0
  831. prx2a:
  832.     call    print
  833.     db    ' Display Format',0
  834.     inx    h    ; pt to next
  835.     call    print
  836.     db    cr,lf,'Attributes of Displayed Files: ',0
  837.     mov    a,m    ; get flag
  838.     ani    80h    ; look for Non-Sys
  839.     jz    prx3
  840.     call    print
  841.     db    'Non-System ',0
  842. prx3:
  843.     mov    a,m    ; get flag
  844.     ani    40h    ; look for Sys
  845.     jz    prx4
  846.     call    print
  847.     db    'System',0
  848. prx4:
  849.     inx    h
  850.     call    print
  851.     db    cr,lf,'Default Function: ',0
  852.     mov    a,m    ; get flag
  853.     ora    a    ; 0=dir
  854.     jnz    prx5
  855.     call    print
  856.     db    'Directory Display',0
  857.     jmp    prx5a
  858. prx5:
  859.     call    print
  860.     db    'Directory File Scan',0
  861. prx5a:
  862.     inx    h
  863.     call    print
  864.     db    cr,lf,'Enable F Options: ',0
  865.     call    pryn
  866.     mov    a,m    ; get flag again
  867.     inx    h
  868.     ora    a    ; 0=no
  869.     jz    prx6
  870.     call    print
  871.     db    '    Enable FL Option: ',0
  872.     call    pryn
  873. prx6:
  874.     inx    h
  875.     call    print
  876.     db    cr,lf,'Enable AS Option: ',0
  877.     call    pryn
  878.     ret
  879. ;
  880. ;  print MCOPY data
  881. ;
  882. prmcopy:
  883.     call    print
  884.     db    cr,lf,'Verify by Default: ',0
  885.     lxi    h,verflg    ; get flag
  886.     call    pryn
  887.     call    print
  888.     db    cr,lf,'Inspect by Default: ',0
  889.     lxi    h,insp    ; get flag
  890.     call    pryn
  891.     call    print
  892.     db    cr,lf,'Quiet by Default: ',0
  893.     lxi    h,quiet
  894.     call    pryn
  895.     call    print
  896.     db    cr,lf,'Multiple Run by Default: ',0
  897.     lxi    h,ncopy
  898.     call    pryn
  899.     call    print
  900.     db    cr,lf,'Default Destination Disk/User: ',0
  901.     lda    ddisk    ; get disk
  902.     adi    'A'    ; convert to letter
  903.     call    cout
  904.     lda    duser    ; get user
  905.     call    padc    ; print as dec
  906.     mvi    a,':'
  907.     call    cout
  908.     ret
  909. ;
  910. ;  print ZEX data
  911. ;
  912. przex:
  913.     call    print
  914.     db    cr,lf,'ZEX: User Input Termination Character is ',0
  915.     lda    tnuich    ; get char
  916.     push    psw    ; save char
  917.     ani    7fh    ; mask MSB
  918.     call    cout
  919.     call    print
  920.     db    cr,lf,'    MSB is ',0
  921.     pop    psw    ; get char
  922.     ani    80h    ; check MSB
  923.     jnz    przex1
  924.     call    print
  925.     db    'NOT ',0
  926. przex1:
  927.     call    print
  928.     db    'Set',0
  929.     ret
  930. ;
  931. ;  external paths
  932. ;
  933. prex:
  934.     lda    epreqd    ; get req'd flag
  935.     ora    a    ; 0=no
  936.     rz
  937.     lxi    h,epavail
  938.     call    print
  939.     db    cr,lf,'Enable External Paths: ',0
  940.     call    pryn
  941.     ora    a    ; 0=no
  942.     jz    prex1    ; print internal path if no external paths
  943.     inx    h
  944.     mov    a,m    ; get low-order address
  945.     inx    h
  946.     mov    h,m    ; get high-order address
  947.     mov    l,a    ; low in L
  948.     call    print
  949.     db    '  External Path Address: ',0
  950.     call    prhnum    ; print hex number
  951. prex1:
  952.     call    print
  953.     db    cr,lf,'   Internal Path is -- ',0
  954.     lxi    h,intpath    ; pt to path
  955.     mov    a,m    ; get first byte
  956.     ora    a    ; any path at all?
  957.     jnz    prex2
  958.     call    print
  959.     db    'Empty',0
  960.     ret
  961. prex2:
  962.     mvi    b,'$'    ; assume current element indic is a '$'
  963.     lda    cdreqd    ; current indicator reqd?
  964.     ora    a    ; 0=no
  965.     jz    prex3
  966.     lda    cindic    ; get current element indicator
  967.     mov    b,a    ; ... in B
  968. prex3:
  969.     call    prpelt    ; print path element
  970.     mov    a,m    ; end of path?
  971.     ora    a    ; 0=yes
  972.     rz
  973.     call    print
  974.     db    ' --> ',0    ; print separator
  975.     jmp    prex2
  976. prpelt:
  977.     mov    a,m    ; get disk
  978.     cmp    b    ; current?
  979.     jz    prpe1
  980.     adi    '@'    ; convert to letter
  981. prpe1:
  982.     call    cout
  983.     inx    h    ; pt to user
  984.     mov    a,m    ; get user
  985.     cmp    b    ; current?
  986.     jz    prpe2
  987.     call    padc    ; print user number
  988.     jmp    prpe3
  989. prpe2:
  990.     call    cout    ; print current indicator
  991. prpe3:
  992.     mvi    a,':'    ; colon
  993.     call    cout
  994.     inx    h    ; pt to next element
  995.     ret
  996.  
  997. ;
  998. ;  multiple commands
  999. ;
  1000. prmc:
  1001.     lda    mcreqd    ; required?
  1002.     ora    a    ; 0=no
  1003.     rz
  1004.     lxi    h,mcavail
  1005.     call    print
  1006.     db    cr,lf,'Enable Multiple Command Line Buffer: ',0
  1007.     call    pryn
  1008.     ora    a    ; 0=no
  1009.     rz        ; done if no multiple command line buffer
  1010.     inx    h
  1011.     mov    a,m    ; get low-order address
  1012.     inx    h
  1013.     mov    h,m    ; get high-order address
  1014.     mov    l,a    ; low in L
  1015.     call    print
  1016.     db    '  Buffer Address: ',0
  1017.     call    prhnum    ; print hex number
  1018.     ret
  1019.  
  1020. ;
  1021. ;  max disk
  1022. ;
  1023. prmdisk:
  1024.     lda    mxreqd    ; reqd?
  1025.     ora    a
  1026.     rz
  1027.     call    print
  1028.     db    cr,lf,'Maximum Disk: ',0
  1029.     lda    mdisk    ; get number
  1030.     adi    '@'    ; convert to ASCII
  1031.     call    cout
  1032.     call    print
  1033.     db    '   ',0
  1034. ;
  1035. ;  max user
  1036. ;
  1037. prmuser:
  1038.     call    print
  1039.     db    'Maximum User Number: ',0
  1040.     lda    muser    ; get number
  1041.     call    padc    ; print as decimal
  1042.     ret
  1043.  
  1044. ;
  1045. ;  disk ok
  1046. ;
  1047. prdok:
  1048.     lda    udreqd    ; reqd?
  1049.     ora    a
  1050.     rz
  1051.     lxi    h,dok
  1052.     call    print
  1053.     db    cr,lf,'Disk Specification Allowed: ',0
  1054.     call    pryn    ; Yes or No
  1055.     call    print
  1056.     db    '   ',0
  1057. ;
  1058. ;  user ok
  1059. ;
  1060. pruok:
  1061.     lxi    h,uok
  1062.     call    print
  1063.     db    'User Spec Allowed: ',0
  1064.     call    pryn
  1065.     ret
  1066.  
  1067. ;
  1068. ;  priv user
  1069. ;
  1070. prpu:
  1071.     lda    pureqd    ; reqd?
  1072.     ora    a
  1073.     rz
  1074.     call    print
  1075.     db    cr,lf,'Base of Privileged User Areas: ',0
  1076.     lda    puser    ; get number
  1077.     call    padc
  1078.     call    print
  1079.     db    '   Password: ',0
  1080.     lxi    h,ppass
  1081.     call    pstr
  1082.     ret
  1083.  
  1084. ;
  1085. ;  current user/disk indicator
  1086. ;
  1087. prcud:
  1088.     lda    cdreqd    ; reqd?
  1089.     ora    a
  1090.     rz
  1091.     call    print
  1092.     db    cr,lf,'Current User/Disk Indicator: ',0
  1093.     lda    cindic    ; get char
  1094.     call    cout    ; print it
  1095.     call    print
  1096.     db    '   ',0
  1097. ;
  1098. ;  DMA Address
  1099. ;
  1100. prdma:
  1101.     call    print
  1102.     db    'DMA Address for Disk I/O: ',0
  1103.     lhld    dmadr    ; get address
  1104.     call    prhnum    ; print hex number
  1105.     ret
  1106.  
  1107. ;
  1108. ;  named directories
  1109. ;
  1110. prnd:
  1111.     lda    ndreqd    ; reqd?
  1112.     ora    a
  1113.     rz
  1114.     lhld    ndradr    ; get address
  1115.     mov    a,h    ; no memory-resident directory?
  1116.     ora    l
  1117.     jz    prnd0
  1118.     call    print
  1119.     db    cr,lf,'Address of Memory-Resident Named Directory Buffer: ',0
  1120.     call    prhnum    ; print hex number
  1121.     jmp    prnd1
  1122. prnd0:
  1123.     call    print
  1124.     db    cr,lf,'No Memory-Resident Named Directory Buffer',0
  1125. prnd1:
  1126.     call    print
  1127.     db    cr,lf,'   Number of Named Dirs Allowed: ',0
  1128.     lda    ndnames    ; get count
  1129.     call    padc    ; print as dec
  1130.     call    print
  1131.     db    '   Named Dir File: ',0
  1132.     lxi    h,dnfile    ; pt to file name
  1133.     call    prfn    ; print it
  1134.     ret
  1135.  
  1136. ;
  1137. ;  Print utilities
  1138. ;
  1139. prhnum:
  1140.     call    phl4hc    ; print hex digits
  1141.     call    print
  1142.     db    ' Hex',0
  1143.     ret
  1144. pryn:
  1145.     mov    a,m    ; get flag
  1146.     ora    a    ; 0=no
  1147.     jz    pryn1
  1148.     call    print
  1149.     db    'Yes',0
  1150.     ret
  1151. pryn1:
  1152.     call    print
  1153.     db    'No',0
  1154.     ret
  1155.  
  1156. prfn:
  1157.     mvi    b,8    ; 8 chars
  1158.     call    prch
  1159.     mvi    a,'.'
  1160.     call    cout
  1161.     mvi    b,3    ; 3 chars
  1162. prch:
  1163.     mov    a,m    ; get char
  1164.     call    cout    ; print it
  1165.     inx    h    ; pt to next
  1166.     dcr    b    ; count down
  1167.     jnz    prch
  1168.     ret
  1169.  
  1170. ;
  1171. ;  Set buffer contents
  1172. ;
  1173. setup:
  1174.     call    fdata    ; print file name
  1175.     call    print
  1176.     db    cr,lf,'** GENINS Flag/Value Setup **'
  1177.     db    cr,lf,'    Select Standard Flags and Values'
  1178.     db    cr,lf,'        (* indicates unnecessary option) --'
  1179.     db    cr,lf
  1180.     db    cr,lf,'    P  Print Flags and Values    '
  1181.     db    'S  Setup ALL Flags and Values'
  1182.     db    cr,lf,'    <  Save All Flags/Values    '
  1183.     db    '>  Restore All Flags/Values'
  1184.     db    cr,lf,'    Q  Quit and Do Not Update    '
  1185.     db    'X  Exit and Optionally Update'
  1186.     db    cr,lf
  1187.     db    cr,lf,'    0',0
  1188.     lda    ndreqd    ; named dirs required?
  1189.     call    prast
  1190.     call    print
  1191.     db    ' Setup Named Directory Data    '
  1192.     db    '5',0
  1193.     lda    udreqd    ; user/disk required?
  1194.     call    prast
  1195.     call    print
  1196.     db    ' Set Disk Allowed Flag'
  1197.     db    cr,lf,'    1',0
  1198.     lda    epreqd    ; ext path required?
  1199.     call    prast
  1200.     call    print
  1201.     db    ' Setup External Path Data    '
  1202.     db    '6',0
  1203.     lda    udreqd    ; user/disk required?
  1204.     call    prast
  1205.     call    print
  1206.     db    ' Set User Allowed Flag'
  1207.     db    cr,lf,'    2',0
  1208.     lda    mcreqd    ; multiple commands required?
  1209.     call    prast
  1210.     call    print
  1211.     db    ' Setup Multiple Command Line    '
  1212.     db    '7',0
  1213.     lda    pureqd    ; priv user required?
  1214.     call    prast
  1215.     call    print
  1216.     db    ' Setup Priv User Data'
  1217.     db    cr,lf,'    3',0
  1218.     lda    mxreqd    ; max user/disk required?
  1219.     call    prast
  1220.     call    print
  1221.     db    ' Set Max Disk            '
  1222.     db    '8',0
  1223.     lda    cdreqd    ; current disk required?
  1224.     call    prast
  1225.     call    print
  1226.     db    ' Set Current User/Disk Data'
  1227.     db    cr,lf,'    4',0
  1228.     lda    mxreqd    ; max user/disk required?
  1229.     call    prast
  1230.     call    print
  1231.     db    ' Set Max User            '
  1232.     db    '9',0
  1233.     lda    cdreqd    ; current disk required?
  1234.     call    prast
  1235.     call    print
  1236.     db    ' Set File DMA Address'
  1237.     db    0
  1238.     lda    z2class    ; check class for ZEX
  1239.     cpi    4
  1240.     jnz    su1
  1241.     call    print
  1242.     db    cr,lf,lf,'    A  Set ZEX User Input Termination Character',0
  1243.     jmp    setcmd
  1244. su1:
  1245.     cpi    2    ; check class for MCOPY
  1246.     jnz    su2
  1247.     call    print
  1248.     db    cr,lf,lf,'    A  Set MCOPY Special Default Values',0
  1249.     jmp    setcmd
  1250. su2:
  1251.     cpi    1    ; check class for I/O
  1252.     jnz    su3
  1253.     call    print
  1254.     db    cr,lf,lf,'    A  Set I/O Class Values'
  1255.     db    'Default Values',0
  1256.     jmp    setcmd
  1257. su3:
  1258.     cpi    3    ; check class for XDIR3
  1259.     jnz    su4
  1260.     call    print
  1261.     db    cr,lf,lf,'    A  Set XDIR3 Special Default Values',0
  1262.     jmp    setcmd
  1263. su4:
  1264.     cpi    5    ; check class for LRUNZ, LDIRZ, or HELP
  1265.     jnz    su5
  1266.     call    print
  1267.     db    cr,lf,lf,'    A  Set Default Search File Name',0
  1268.     jmp    setcmd
  1269. su5:
  1270.     cpi    6    ; check class for DU2
  1271.     jnz    su6
  1272.     call    print
  1273.     db    cr,lf,lf,'    A  Set Proc Speed and Screen Size Values',0
  1274.     jmp    setcmd
  1275. su6:
  1276.     cpi    7    ; check class for TINIT
  1277.     jnz    su7
  1278.     call    print
  1279.     db    cr,lf,lf,'    A  Set TINIT Special Default Values',0
  1280.     jmp    setcmd
  1281. su7:
  1282.     cpi    8    ; check class for WHEEL
  1283.     jnz    su8
  1284.     call    print
  1285.     db    cr,lf,lf,'    A  Set WHEEL Byte Address',0
  1286.     jmp    setcmd
  1287. su8:
  1288.     cpi    11    ; check for Class 11
  1289.     jnz    su11
  1290.     call    print
  1291.     db    cr,lf,lf,'    A  Set Printer and Screen Parameters',0
  1292.     jmp    setcmd
  1293. su11:
  1294. ;
  1295. ;  Function-Specific Table goes here
  1296. ;
  1297. setcmd:
  1298.     call    print
  1299.     db    cr,lf,lf,'Setup Command (? for Menu)? ',0
  1300.     call    capin    ; get input
  1301.     cpi    '?'    ; menu?
  1302.     jz    setup
  1303.     cpi    '/'    ; menu?
  1304.     jz    setup
  1305.     cpi    '<'    ; save?
  1306.     jz    setsav
  1307.     cpi    '>'    ; restore?
  1308.     jz    setres
  1309.     cpi    'Q'    ; abort?
  1310.     rz
  1311.     cpi    'X'    ; abort?
  1312.     rz
  1313.     call    stscn0    ; scan for defaults
  1314.     jz    run    ; if found, run
  1315.     lda    z2class    ; check for classes
  1316.     cpi    0    ; general?
  1317.     jz    setinv
  1318.     cpi    4    ; ZEX?
  1319.     jnz    sc1
  1320.     call    stscnz    ; scan for ZEX
  1321.     jz    run
  1322.     jmp    setinv
  1323. sc1:
  1324.     cpi    2    ; MCOPY?
  1325.     jnz    sc2
  1326.     call    stscnm    ; scan for MCOPY
  1327.     jz    run
  1328.     jmp    setinv
  1329. sc2:
  1330.     cpi    1    ; I/O?
  1331.     jnz    sc3
  1332.     call    stscni    ; scan for I/O
  1333.     jz    run
  1334.     jmp    setinv
  1335. sc3:
  1336.     cpi    3    ; XDIR3?
  1337.     jnz    sc4
  1338.     call    stscnx    ; scan for XDIR3
  1339.     jz    run
  1340.     jmp    setinv
  1341. sc4:
  1342.     cpi    5    ; LRUNZ, LDIRZ, or HELP2?
  1343.     jnz    sc5
  1344.     call    stscnl
  1345.     jz    run
  1346.     jmp    setinv
  1347. sc5:
  1348.     cpi    6    ; Class 6?
  1349.     jnz    sc6
  1350.     call    stscnd
  1351.     jz    run
  1352.     jmp    setinv
  1353. sc6:
  1354.     cpi    7    ; TINIT?
  1355.     jnz    sc7
  1356.     call    stscnt
  1357.     jz    run
  1358.     jmp    setinv
  1359. sc7:
  1360.     cpi    8    ; WHEEL?
  1361.     jnz    sc8
  1362.     call    stscnw
  1363.     jz    run
  1364.     jmp    setinv
  1365. sc8:
  1366.     cpi    11    ; Class 11?
  1367.     jnz    sc11
  1368.     call    stscps
  1369.     jz    run
  1370.     jmp    setinv
  1371. sc11:
  1372. setinv:
  1373.     call    print
  1374.     db    cr,lf,'Invalid Command',0
  1375.     jmp    setup
  1376. ;
  1377. ;  Print Asterisk if Char in A is 0, else print <SP>
  1378. ;
  1379. prast:
  1380.     mvi    b,'*'    ; prep to print asterisk
  1381.     ora    a    ; zero?
  1382.     jz    prast1
  1383.     mvi    b,' '    ; print space
  1384. prast1:
  1385.     mov    a,b    ; get char
  1386.     jmp    cout    ; print it
  1387.  
  1388. ;
  1389. ;  Save Buffer Contents
  1390. ;
  1391. setsav:
  1392.     lxi    h,epavail    ; copy buffer
  1393.     lxi    d,tmpbuff    ; ... into tmpbuff
  1394.     mvi    b,bufsiz    ; size of buffers
  1395.     call    moveb
  1396.     mvi    a,0ffh        ; set flag
  1397.     sta    cpyflg
  1398.     jmp    setcmd
  1399. ;
  1400. ;  Restore Buffer Contents
  1401. ;
  1402. setres:
  1403.     lda    cpyflg        ; check for previous save
  1404.     ora    a        ; 0=no
  1405.     jz    sreserr
  1406.     lxi    d,epavail    ; copy into optbuff
  1407.     lxi    h,tmpbuff    ; ... from tmpbuff
  1408.     mvi    b,bufsiz    ; size of buffers
  1409.     call    moveb
  1410.     jmp    setcmd
  1411. sreserr:
  1412.     call    print
  1413.     db    cr,lf,'Error -- Restore Attempted with Nothing Saved',0
  1414.     jmp    setcmd
  1415. ;
  1416. ;  Run command whose address is in HL
  1417. ;
  1418. run:
  1419.     lxi    d,setcmd    ; set up return address
  1420.     push    d
  1421.     pchl        ; "call" command
  1422. ;
  1423. ;  Scan Command Table for Command in B; return with Zero Flag Set and
  1424. ;  HL = Address if found, else A unchanged but NZ
  1425. ;
  1426. ;  On input, DE pts to command table and B=Command
  1427. ;
  1428. stscn:
  1429.     ldax    d    ; get table entry
  1430.     ora    a    ; end of table?
  1431.     jz    stsnf    ; not found if so
  1432.     cmp    b    ; match?
  1433.     jz    stsfnd    ; found if so
  1434.     inx    d    ; skip to next
  1435.     inx    d
  1436.     inx    d
  1437.     jmp    stscn
  1438. stsfnd:
  1439.     inx    d    ; pt to low
  1440.     ldax    d    ; get low
  1441.     mov    l,a
  1442.     inx    d    ; pt to high
  1443.     ldax    d    ; get high
  1444.     mov    h,a
  1445.     xra    a    ; set found flag
  1446.     ret
  1447. stsnf:
  1448.     mvi    a,0ffh    ; set not found flag
  1449.     ora    a
  1450.     ret
  1451. ;
  1452. ;  Scan Default Table
  1453. ;
  1454. stscn0:
  1455.     lxi    d,table0    ; pt to default table
  1456.     mov    b,a        ; command in B
  1457.     jmp    stscn
  1458. ;
  1459. ;  Scan Printer/Screen Table
  1460. ;
  1461. stscps:
  1462.     lxi    d,tablps    ; pt to Printer/Screen table
  1463.     jmp    stscn
  1464. ;
  1465. ;  Scan WHEEL Table
  1466. ;
  1467. stscnw:
  1468.     lxi    d,tablew    ; pt to WHEEL table
  1469.     jmp    stscn
  1470. ;
  1471. ;  Scan TINIT Table
  1472. ;
  1473. stscnt:
  1474.     lxi    d,tablet    ; pt to TINIT table
  1475.     jmp    stscn
  1476. ;
  1477. ;  Scan ZEX Table
  1478. ;
  1479. stscnz:
  1480.     lxi    d,tablez    ; pt to ZEX table
  1481.     jmp    stscn
  1482. ;
  1483. ;  Scan LRUNZ, LDIRZ, or HELP2 Table
  1484. ;
  1485. stscnl:
  1486.     lxi    d,tablel    ; pt to LRUNZ table
  1487.     jmp    stscn
  1488. ;
  1489. ;  Scan Class 6 Table
  1490. ;
  1491. stscnd:
  1492.     lxi    d,tabled    ; pt to Class 6 table
  1493.     jmp    stscn
  1494. ;
  1495. ;  Scan XDIR3 Table
  1496. ;
  1497. stscnx:
  1498.     lxi    d,tablex    ; pt to XDIR3 table
  1499.     jmp    stscn
  1500. ;
  1501. ;  Scan MCOPY Table
  1502. ;
  1503. stscnm:
  1504.     lxi    d,tablem    ; pt to MCOPY table
  1505.     jmp    stscn
  1506. ;
  1507. ;  Scan I/O Table
  1508. ;
  1509. stscni:
  1510.     lxi    d,tablei    ; pt to I/O table
  1511.     jmp    stscn
  1512. ;
  1513. ;  Setup Function Tables
  1514. ;
  1515. table0:                ; default table
  1516.     db    'P'
  1517.     dw    propt
  1518.     db    'S'
  1519.     dw    stall
  1520.     db    '0'
  1521.     dw    stnd
  1522.     db    '1'
  1523.     dw    stex
  1524.     db    '2'
  1525.     dw    stmc
  1526.     db    '3'
  1527.     dw    stmdisk
  1528.     db    '4'
  1529.     dw    stmuser
  1530.     db    '5'
  1531.     dw    stdok
  1532.     db    '6'
  1533.     dw    stuok
  1534.     db    '7'
  1535.     dw    stpu
  1536.     db    '8'
  1537.     dw    stcud
  1538.     db    '9'
  1539.     dw    stdma
  1540.     db    0    ; end of table
  1541. tablps:
  1542.     db    'A'    ; Printer/Screen Param option
  1543.     dw    stps
  1544.     db    0
  1545. tablew:
  1546.     db    'A'    ; WHEEL option
  1547.     dw    stwheel
  1548.     db    0
  1549. tablet:
  1550.     db    'A'    ; TINIT option
  1551.     dw    sttinit
  1552.     db    0
  1553. tablez:
  1554.     db    'A'    ; ZEX option
  1555.     dw    stzex
  1556.     db    0
  1557. tablem:
  1558.     db    'A'    ; MCOPY option
  1559.     dw    stmcopy
  1560.     db    0
  1561. tablei:
  1562.     db    'A'    ; I/O option
  1563.     dw    stio
  1564.     db    0
  1565. tablex:
  1566.     db    'A'    ; XDIR3 option
  1567.     dw    stxdir
  1568.     db    0
  1569. tabled:
  1570.     db    'A'    ; Class 6 option
  1571.     dw    stdu2
  1572.     db    0
  1573. tablel:
  1574.     db    'A'    ; LRUNZ option
  1575.     dw    stlrunz
  1576.     db    0
  1577. ;
  1578. ;  Set Printer/Screen Parameters
  1579. ;
  1580. stps:
  1581.     call    prpsio    ; print data
  1582.     call    print
  1583.     db    cr,lf,'1  Printer --'
  1584.     db    cr,lf,'1a Enter Printer Width in Columns or <RETURN> = ',0
  1585.     lda    lwidth
  1586.     call    padc
  1587.     call    print
  1588.     db    '? ',0
  1589.     call    getnum    ; get value
  1590.     jz    stps1
  1591.     mov    a,l    ; set new width
  1592.     sta    lwidth
  1593. stps1:
  1594.     call    print
  1595.     db    cr,lf,'1b Enter Number of Text Lines Per Page <RETURN> = ',0
  1596.     lda    ltpp
  1597.     call    padc
  1598.     call    print
  1599.     db    '? ',0
  1600.     call    getnum    ; get value
  1601.     jz    stps2
  1602.     mov    a,l    ; set new value
  1603.     sta    ltpp
  1604. stps2:
  1605.     call    print
  1606.     db    cr,lf,'1c Enter Total Number of Lines Per Page or <RETURN> = '
  1607.     db    0
  1608.     lda    lspp
  1609.     mov    b,a
  1610.     lda    ltpp
  1611.     add    b
  1612.     adi    2
  1613.     call    padc
  1614.     call    print
  1615.     db    '? ',0
  1616.     call    getnum    ; get value
  1617.     jz    stps3
  1618.     lda    ltpp    ; get text count
  1619.     mov    b,a    ; result in B
  1620.     mov    a,l    ; set new value
  1621.     sub    b    ; subtract out
  1622.     jc    stps2a
  1623.     sui    2    ; ok?
  1624.     jc    stps2a
  1625.     sta    lspp
  1626.     jmp    stps3
  1627. stps2a:
  1628.     call    print
  1629.     db    cr,lf,'ERROR -- Not Enough Room for 2-Line Header',0
  1630.     jmp    stps1
  1631. stps3:
  1632.     call    print
  1633.     db    cr,lf,'2  CRT Screen --'
  1634.     db    cr,lf,'2a Enter Screen Width in Columns or <RETURN> = ',0
  1635.     lda    cwidth
  1636.     call    padc
  1637.     call    print
  1638.     db    '? ',0
  1639.     call    getnum    ; get value
  1640.     jz    stps4
  1641.     mov    a,l    ; set new width
  1642.     sta    cwidth
  1643. stps4:
  1644.     call    print
  1645.     db    cr,lf,'2b Enter Number of Text Lines per Screen <RETURN> = ',0
  1646.     lda    ctpp
  1647.     call    padc
  1648.     call    print
  1649.     db    '? ',0
  1650.     call    getnum    ; get value
  1651.     jz    stps5
  1652.     mov    a,l    ; set new value
  1653.     sta    ctpp
  1654. stps5:
  1655.     call    print
  1656.     db    cr,lf,'2c Enter Total Number of Lines per Screen <RETURN> = '
  1657.     db    0
  1658.     lda    cspp
  1659.     mov    b,a
  1660.     lda    ctpp
  1661.     add    b
  1662.     adi    1    ; 1-line footer
  1663.     call    padc
  1664.     call    print
  1665.     db    '? ',0
  1666.     call    getnum    ; get value
  1667.     jz    stps6
  1668.     lda    ctpp
  1669.     mov    b,a    ; text count in B
  1670.     mov    a,l    ; set new value
  1671.     sub    b    ; subtract
  1672.     jc    stps5a
  1673.     sui    1    ; 1-line footer
  1674.     jc    stps5a
  1675.     sta    cspp
  1676.     jmp    stps6
  1677. stps5a:
  1678.     call    print
  1679.     db    cr,lf,'ERROR -- Not Enough Room for 1-Line Footer',0
  1680.     jmp    stps4
  1681. stps6:
  1682.     ret
  1683. ;
  1684. ;  Set WHEEL Byte Address
  1685. ;
  1686. stwheel:
  1687.     call    prwheel    ; print data
  1688.     call    print
  1689.     db    cr,lf,'1  Address of Wheel Byte?'
  1690.     db    cr,lf,'    Enter Hex Number or <RETURN> = ',0
  1691.     lhld    wheel    ; print value
  1692.     call    prhnum
  1693.     call    print
  1694.     db    '? ',0
  1695.     call    gethnum    ; get value
  1696.     rz
  1697.     shld    wheel    ; set value
  1698.     ret
  1699. ;
  1700. ;  Set TINIT Parameters
  1701. ;
  1702. sttinit:
  1703.     call    prtinit    ; print data
  1704.     call    getpspeed    ; get processor speed
  1705.     call    print
  1706.     db    cr,lf,'2  Name of Default Configuration File'
  1707.     db    cr,lf,'    Enter File Name or <RETURN> = ',0
  1708.     lxi    h,cfgfile
  1709.     call    prfn
  1710.     call    print
  1711.     db    '? ',0
  1712.     lxi    d,cfgfile    ; pt to file name storage area
  1713.     jmp    getfname
  1714. getpspeed:
  1715.     call    print
  1716.     db    cr,lf,'1  Processor Speed in MHz (<RETURN> = ',0
  1717.     lda    pspeed
  1718.     call    padc
  1719.     call    print
  1720.     db    ')? ',0
  1721.     call    getnum    ; get number in HL
  1722.     rz        ; no change?
  1723.     mov    a,l    ; set new speed
  1724.     sta    pspeed
  1725.     ret
  1726. ;
  1727. ;  Set Class 6 Parameters
  1728. ;
  1729. stdu2:
  1730.     call    prdu2    ; print data
  1731.     call    getpspeed    ; get processor speed
  1732.     call    print
  1733.     db    cr,lf,'2  Number of Lines on Your CRT (<RETURN> = ',0
  1734.     lda    ssize    ; get size
  1735.     call    padc
  1736.     call    print
  1737.     db    ')? ',0
  1738.     call    getnum    ; get number in HL
  1739.     rz
  1740.     mov    a,l    ; set new screen size
  1741.     sta    ssize
  1742.     ret
  1743. ;
  1744. ;  Set Search File Name
  1745. ;
  1746. stlrunz:
  1747.     call    prlrunz    ; print data
  1748.     call    print
  1749.     db    cr,lf,'1  Name of Search File'
  1750.     db    cr,lf,'    Enter File Name or <RETURN> = ',0
  1751.     lxi    h,cfile
  1752.     call    prfn
  1753.     call    print
  1754.     db    '? ',0
  1755.     lxi    d,cfile    ; pt to name buffer
  1756.     jmp    getfname    ; get file name
  1757. ;
  1758. ;  Set I/O Parameters
  1759. ;
  1760. stio:
  1761.     call    prio    ; print option
  1762.     call    print
  1763.     db    cr,lf,'1  I/O Base Address (Hex) (<RETURN> = ',0
  1764.     lhld    iobase    ; get current
  1765.     mov    a,h    ; any?
  1766.     ora    l
  1767.     jz    stio1
  1768.     call    phl4hc    ; print as hex
  1769.     call    print
  1770.     db    ' Hex)? ',0
  1771.     jmp    stio2
  1772. stio1:
  1773.     call    print
  1774.     db    'None)? ',0
  1775. stio2:
  1776.     call    gethnum    ; get hex number in HL
  1777.     rz
  1778.     shld    iobase    ; save it
  1779.     ret
  1780. ;
  1781. ;  Set XDIR3 Parameters
  1782. ;
  1783. stxdir:
  1784.     call    prxdir    ; print options
  1785.     lxi    h,igrp    ; pt to first param
  1786.     mvi    m,0    ; assume no
  1787.     call    print
  1788.     db    cr,lf,'1  Group by File Type and Name [No=Name and Type] ',0
  1789.     call    getyn
  1790.     jz    stx1
  1791.     mvi    m,0ffh    ; set yes
  1792. stx1:
  1793.     inx    h    ; pt to next
  1794.     mvi    m,0ffh    ; assume no
  1795.     call    print
  1796.     db    cr,lf,'2  Vertical Display [No=Horizontal] ',0
  1797.     call    getyn
  1798.     jz    stx2
  1799.     mvi    m,0    ; set yes
  1800. stx2:
  1801.     inx    h    ; pt to next
  1802.     mvi    b,0    ; set no select
  1803.     call    print
  1804.     db    cr,lf,'3a Select Non-System Files',0
  1805.     call    getyn
  1806.     jz    stx2a
  1807.     mvi    a,80h    ; select non-sys
  1808.     ora    b
  1809.     mov    b,a    ; result in B
  1810. stx2a:
  1811.     call    print
  1812.     db    cr,lf,'3b Select System Files',0
  1813.     call    getyn
  1814.     jz    stx3
  1815.     mvi    a,40h    ; select sys
  1816.     ora    b
  1817.     mov    b,a    ; result in B
  1818. stx3:
  1819.     mov    m,b    ; set flag
  1820.     inx    h    ; pt to next
  1821.     mvi    m,0ffh    ; assume no
  1822.     call    print
  1823.     db    cr,lf,'4  Display Directory [No=Scan] ',0
  1824.     call    getyn
  1825.     jz    stx4
  1826.     mvi    m,0    ; set yes
  1827. stx4:
  1828.     inx    h    ; pt to next
  1829.     mvi    m,0    ; assume no
  1830.     call    print
  1831.     db    cr,lf,'5  Enable F Options',0
  1832.     call    getyn
  1833.     jz    stx5
  1834.     mvi    m,0ffh    ; set yes
  1835. stx5:
  1836.     mov    a,m    ; get flag
  1837.     inx    h    ; pt to next
  1838.     ora    a    ; 0=no
  1839.     jz    stx6
  1840.     mvi    m,0    ; assume no
  1841.     call    print
  1842.     db    cr,lf,'5a Enable FL Option',0
  1843.     call    getyn
  1844.     jz    stx6
  1845.     mvi    m,0ffh    ; set yes
  1846. stx6:
  1847.     inx    h    ; pt to next
  1848.     mvi    m,0    ; assume no
  1849.     call    print
  1850.     db    cr,lf,'6  Enable AS Option',0
  1851.     call    getyn
  1852.     rz
  1853.     mvi    m,0ffh    ; set yes
  1854.     ret
  1855. ;
  1856. ;  Set MCOPY Parameters
  1857. ;
  1858. stmcopy:
  1859.     call    prmcopy    ; print current values
  1860.     lxi    h,verflg    ; pt to flag
  1861.     mvi    m,0    ; turn verify off
  1862.     call    print
  1863.     db    cr,lf,'1  Enable Verify Default',0
  1864.     call    getyn    ; get response
  1865.     jz    stm1
  1866.     mvi    m,0ffh    ; turn verify on
  1867. stm1:
  1868.     inx    h    ; pt to next
  1869.     mvi    m,0    ; turn inspect off
  1870.     call    print
  1871.     db    cr,lf,'2  Enable Inspect Default',0
  1872.     call    getyn    ; get response
  1873.     jz    stm2
  1874.     mvi    m,0ffh    ; turn inspect on
  1875. stm2:
  1876.     inx    h    ; pt to next
  1877.     mvi    m,0    ; turn quiet off
  1878.     call    print
  1879.     db    cr,lf,'3  Enable Quiet Default',0
  1880.     call    getyn    ; get response
  1881.     jz    stm3
  1882.     mvi    m,0ffh    ; turn quiet on
  1883. stm3:
  1884.     inx    h    ; pt to next
  1885.     mvi    m,0    ; turn multiple run off
  1886.     call    print
  1887.     db    cr,lf,'4  Enable Multiple Run Default',0
  1888.     call    getyn
  1889.     jz    stm4
  1890.     mvi    m,0ffh    ; turn multiple run on
  1891. stm4:
  1892.     inx    h
  1893. stm4a:
  1894.     call    print
  1895.     db    cr,lf,'5a Default Destination Disk Letter? ',0
  1896.     call    cin    ; get response
  1897.     call    caps
  1898.     call    cout
  1899.     sui    'A'    ; convert to number
  1900.     jc    stm4b
  1901.     mov    b,a    ; save in B
  1902.     lda    mdisk    ; compare to max
  1903.     dcr    a
  1904.     cmp    b
  1905.     jc    stm4b
  1906.     mov    m,b    ; store disk number
  1907.     jmp    stm5
  1908. stm4b:
  1909.     call    print
  1910.     db    cr,lf,'    Invalid Disk Letter -- Out of Range of A to ',0
  1911.     lda    mdisk    ; get max
  1912.     adi    '@'    ; convert to letter
  1913.     call    cout
  1914.     call    print
  1915.     db    ' -- Reenter',0
  1916.     jmp    stm4a
  1917. stm5:
  1918.     inx    h    ; pt to user
  1919. stm5a:
  1920.     call    print
  1921.     db    cr,lf,'5b Default Destination User Number (<RETURN> = ',0
  1922.     mov    a,m    ; get user number
  1923.     call    padc
  1924.     call    print
  1925.     db    ')? ',0
  1926.     push    h    ; save HL
  1927.     call    getnum    ; get number
  1928.     xchg        ; number in DE
  1929.     pop    h    ; get HL
  1930.     rz        ; no change
  1931.     mov    a,d    ; check for range
  1932.     ora    a    ; must be zero
  1933.     jnz    stm5b
  1934.     lda    muser    ; check for max user
  1935.     cmp    e
  1936.     jc    stm5b
  1937.     mov    m,e    ; store user number
  1938.     ret
  1939. stm5b:
  1940.     call    print
  1941.     db    cr,lf,'    User Number Out of Range -- Must be Less Than ',0
  1942.     lda    muser    ; get max
  1943.     adi    1    ; add 1 for LT
  1944.     call    padc
  1945.     call    print
  1946.     db    ' -- Reenter',0
  1947.     jmp    stm5a
  1948.  
  1949. ;
  1950. ;  Set ZEX Parameter
  1951. ;
  1952. stzex:
  1953.     call    przex    ; print data
  1954.     call    print
  1955.     db    cr,lf,'1  New Command Character? ',0
  1956.     call    cin    ; get response
  1957.     call    cout    ; echo
  1958.     mov    b,a    ; save in B
  1959.     call    print
  1960.     db    cr,lf,'1a Set MSB',0
  1961.     call    getyn    ; get response
  1962.     jz    stzex1
  1963.     mvi    a,80h    ; set MSB
  1964.     ora    b
  1965.     mov    b,a
  1966. stzex1:
  1967.     mov    a,b    ; get char
  1968.     sta    tnuich    ; save it
  1969.     ret
  1970. ;
  1971. ;  Set Up All Flags/Values
  1972. ;
  1973. stall:
  1974.     call    crlf
  1975.     call    stnd    ; named directory data
  1976.     call    crlf
  1977.     call    stex    ; configure external path data
  1978.     call    crlf
  1979.     call    stmc    ; store multiple command line buffer data
  1980.     call    crlf
  1981.     call    stmdisk    ; store max disk number
  1982.     call    crlf
  1983.     call    stmuser    ; store max user number
  1984.     call    crlf
  1985.     call    stdok    ; set disk allowed
  1986.     call    crlf
  1987.     call    stuok    ; set user allowed
  1988.     call    crlf
  1989.     call    stpu    ; set privileged user info
  1990.     call    crlf
  1991.     call    stcud    ; set current user/disk indicator
  1992.     call    crlf
  1993.     call    stdma    ; set DMA address
  1994.     call    crlf
  1995.     lda    z2class    ; get class
  1996.     cpi    1    ; I/O?
  1997.     jz    stio
  1998.     cpi    2    ; MCOPY?
  1999.     jz    stmcopy
  2000.     cpi    3    ; XDIR3?
  2001.     jz    stxdir
  2002.     cpi    4    ; ZEX?
  2003.     jz    stzex
  2004.     cpi    5    ; LRUNZ?
  2005.     jz    stlrunz
  2006.     cpi    6    ; Class 6?
  2007.     jz    stdu2
  2008.     cpi    7    ; TINIT?
  2009.     jz    sttinit
  2010.     cpi    8    ; WHEEL?
  2011.     jz    stwheel
  2012.     cpi    11    ; Class 11?
  2013.     jz    stps
  2014.     ret
  2015.  
  2016. ;
  2017. ;  external paths
  2018. ;
  2019. stex:
  2020.     lda    epreqd    ; get req'd flag
  2021.     ora    a    ; 0=no
  2022.     rz
  2023.     call    prex    ; print data
  2024.     xra    a    ; assume no external paths
  2025.     sta    epavail    ; set flag
  2026.     call    pq    ; print question prompt
  2027.     call    print
  2028.     db    cr,lf,'1  Enable External Paths',0
  2029.     call    getyn    ; get Y/N from user
  2030.     jz    stex1    ; if no, continue
  2031.     mvi    a,0ffh    ; set external paths on
  2032.     sta    epavail
  2033.     call    print
  2034.     db    cr,lf,'1a Address of External Path in Hex (<RETURN> = ',0
  2035.     lhld    epadr
  2036.     call    phl4hc
  2037.     call    print
  2038.     db    ' Hex)? ',0
  2039.     call    gethnum    ; get number
  2040.     jz    stex1
  2041.     shld    epadr    ; set address of external path
  2042. stex1:
  2043.     lxi    d,intpath    ; pt to internal path
  2044.     xra    a    ; set empty path
  2045.     stax    d
  2046.     call    print
  2047.     db    cr,lf,'2  Enable Internal Path',0
  2048.     call    getyn    ; get Y/N from user
  2049.     rz        ; done if no
  2050.     call    print
  2051.     db    cr,lf,'2a Define Internal Path Using Symbolic Notation --',0
  2052.     mvi    b,'0'    ; set element number
  2053. stex2:
  2054.     inr    b    ; increment count
  2055. stex3:
  2056.     call    crlf    ; new line
  2057.     mov    a,b    ; get value
  2058.     call    cout    ; print value
  2059.     call    print
  2060.     db    '.  Path Element (<CR>=Done)? ',0
  2061.     xra    a    ; A=0
  2062.     stax    d    ; assume end of path
  2063.     cma        ; A=0ffh for capitalize
  2064.     call    bbline    ; get line from user
  2065.     ora    a    ; empty?
  2066.     rz
  2067.     mov    a,m    ; get disk letter
  2068.     cpi    '$'    ; current?
  2069.     jz    stex4
  2070.     sui    'A'    ; convert to binary
  2071.     jc    peerr    ; path element error
  2072.     cpi    16    ; range?
  2073.     jnc    peerr
  2074.     inr    a    ; adjust to 1-16
  2075.     jmp    stex4
  2076. peerr:
  2077.     call    print
  2078.     db    cr,lf,'Invalid Path Element -- Reenter',0
  2079.     jmp    stex3
  2080. stex4:
  2081.     stax    d    ; store it
  2082.     inx    h    ; pt to next
  2083.     inx    d    ; pt to next
  2084.     mov    a,m    ; get character
  2085.     cpi    '$'    ; current?
  2086.     jz    stex5
  2087.     push    d    ; save DE
  2088.     call    eval10    ; convert chars to number in A
  2089.     pop    d
  2090. stex5:
  2091.     stax    d    ; store current
  2092.     inx    d    ; pt to next
  2093.     mov    a,b    ; check for done
  2094.     cpi    '8'    ; done if 8 completed
  2095.     jnz    stex2
  2096.     xra    a    ; terminate path
  2097.     stax    d    ; store binary 0
  2098.     ret
  2099.  
  2100. ;
  2101. ;  multiple commands
  2102. ;
  2103. stmc:
  2104.     lda    mcreqd    ; required?
  2105.     ora    a    ; 0=no
  2106.     rz
  2107.     call    prmc
  2108.     call    pq
  2109.     lxi    d,mcavail    ; pt to multiple command line buffer
  2110.     xra    a    ; A=0
  2111.     stax    d
  2112.     call    print
  2113.     db    cr,lf,'1  Enable Multiple Command Line Buffer',0
  2114.     call    getyn    ; get Y/N
  2115.     rz        ; done if no multiple command line buffer
  2116.     mvi    a,0ffh    ; turn buffer flag on
  2117.     stax    d
  2118.     call    print
  2119.     db    cr,lf,'1a Address of Multiple Command Line Buffer'
  2120.     db    cr,lf,'    Enter Hex Number or <RETURN> = ',0
  2121.     inx    d
  2122.     ldax    d
  2123.     mov    l,a
  2124.     inx    d
  2125.     ldax    d
  2126.     mov    h,a
  2127.     dcx    d
  2128.     dcx    d
  2129.     call    phl4hc
  2130.     call    print
  2131.     db    ' Hex? ',0
  2132.     call    gethnum
  2133.     rz
  2134.     inx    d
  2135.     mov    a,l    ; get low-order address
  2136.     stax    d    ; set low
  2137.     inx    d
  2138.     mov    a,h    ; get high-order address
  2139.     stax    d    ; set high
  2140.     ret
  2141.  
  2142. ;
  2143. ;  max disk
  2144. ;
  2145. stmdisk:
  2146.     lda    mxreqd    ; reqd?
  2147.     ora    a
  2148.     rz
  2149.     call    prmdisk
  2150.     call    pq
  2151. stmd1:
  2152.     call    print
  2153.     db    cr,lf,'1  Maximum Disk Allowed? ',0
  2154.     call    capin    ; get response
  2155.     sui    '@'    ; convert to 1-n
  2156.     jz    stmder
  2157.     sta    mdisk    ; set max disk
  2158.     cpi    17    ; range?
  2159.     rc
  2160. stmder:
  2161.     call    print
  2162.     db    cr,lf,'Invalid Disk Letter -- Reenter',0
  2163.     jmp    stmd1
  2164.  
  2165. ;
  2166. ;  max user
  2167. ;
  2168. stmuser:
  2169.     lda    mxreqd    ; reqd?
  2170.     ora    a
  2171.     rz
  2172.     call    crlf    ; new line
  2173.     call    prmuser
  2174.     call    pq
  2175. stmu1:
  2176.     call    print
  2177.     db    cr,lf,'1  Maximum User Number Allowed (<RETURN> = ',0
  2178.     lda    muser
  2179.     call    padc
  2180.     call    print
  2181.     db    ')? ',0
  2182.     call    getnum    ; get number from user
  2183.     rz
  2184.     mov    a,h    ; must be zero
  2185.     ora    a
  2186.     jnz    stmu2
  2187.     mov    a,l    ; get low-order
  2188.     sta    muser    ; set user number
  2189.     cpi    32    ; range?
  2190.     rc
  2191. stmu2:
  2192.     call    print
  2193.     db    cr,lf,'Invalid User Number -- Reenter',0
  2194.     jmp    stmu1
  2195.  
  2196. ;
  2197. ;  disk ok
  2198. ;
  2199. stdok:
  2200.     lda    udreqd    ; reqd?
  2201.     ora    a
  2202.     rz
  2203.     call    prdok
  2204.     call    pq
  2205.     lxi    h,dok    ; pt to flag
  2206.     mvi    m,0    ; assume not allowed
  2207.     call    print
  2208.     db    cr,lf,'1  Specification of Disk Allowed',0
  2209.     call    getyn    ; get response
  2210.     rz
  2211.     mvi    m,0ffh    ; disk allowed
  2212.     ret
  2213.  
  2214. ;
  2215. ;  user ok
  2216. ;
  2217. stuok:
  2218.     lda    udreqd    ; reqd?
  2219.     ora    a
  2220.     rz
  2221.     call    crlf
  2222.     call    pruok
  2223.     call    pq
  2224.     lxi    h,uok
  2225.     mvi    m,0    ; assume not allowed
  2226.     call    print
  2227.     db    cr,lf,'1  Specification of User Allowed',0
  2228.     call    getyn
  2229.     rz
  2230.     mvi    m,0ffh    ; set user allowed
  2231.     ret
  2232.  
  2233. ;
  2234. ;  priv user
  2235. ;
  2236. stpu:
  2237.     lda    pureqd    ; reqd?
  2238.     ora    a
  2239.     rz
  2240.     call    prpu
  2241.     call    pq
  2242.     call    print
  2243.     db    cr,lf,'1  Base of Privileged User Areas (<RETURN> = ',0
  2244.     lda    puser
  2245.     call    padc
  2246.     call    print
  2247.     db    ')? ',0
  2248.     call    getnum    ; get number
  2249.     jz    stpu0
  2250.     mov    a,l    ; get number into A
  2251.     sta    puser    ; set number
  2252. stpu0:
  2253.     call    print
  2254.     db    cr,lf,'2  Privileged User Password? ',0
  2255.     lxi    d,ppass    ; pt to password
  2256.     xra    a    ; don't capitalize
  2257.     stax    d    ; set no password
  2258.     call    bbline    ; get user response
  2259.     ora    a    ; any input?
  2260.     rz
  2261. stpu1:
  2262.     mov    a,m    ; copy to end of string
  2263.     stax    d
  2264.     inx    h    ; pt to next
  2265.     inx    d
  2266.     ora    a    ; done?
  2267.     jnz    stpu1
  2268.     ret
  2269.  
  2270. ;
  2271. ;  current user/disk indicator
  2272. ;
  2273. stcud:
  2274.     lda    cdreqd    ; reqd?
  2275.     ora    a
  2276.     rz
  2277.     call    prcud
  2278.     call    pq
  2279.     call    print
  2280.     db    cr,lf,'1  Current User/Disk Indicator? ',0
  2281.     call    capin    ; get response
  2282.     sta    cindic    ; set flag
  2283.     ret
  2284.  
  2285. ;
  2286. ;  DMA Address
  2287. ;
  2288. stdma:
  2289.     lda    cdreqd    ; reqd?
  2290.     ora    a
  2291.     rz
  2292.     call    crlf
  2293.     call    prdma
  2294.     call    pq
  2295.     call    print
  2296.     db    cr,lf,'1  DMA Address for Disk I/O'
  2297.     db    cr,lf,'    Enter Hex Number or <RETURN> = ',0
  2298.     lhld    dmadr
  2299.     call    phl4hc
  2300.     call    print
  2301.     db    ' Hex? ',0
  2302.     call    gethnum    ; get number
  2303.     rz
  2304.     shld    dmadr    ; set dma address
  2305.     ret
  2306.  
  2307. ;
  2308. ;  named directories
  2309. ;
  2310. stnd:
  2311.     lda    ndreqd    ; reqd?
  2312.     ora    a
  2313.     rz
  2314.     call    prnd
  2315.     call    pq
  2316.     call    print
  2317.     db    cr,lf,'1  Address of Memory-Resident Named Directory Buffer'
  2318.     db    cr,lf,'    Enter Hex Number or <RETURN> = None? ',0
  2319.     call    gethnum    ; get number
  2320.     shld    ndradr    ; set address
  2321. stnd0:
  2322.     call    print
  2323.     db    cr,lf,'2  Number of Named Directories Permitted? '
  2324.     db    cr,lf,'    Enter Decimal Number or <RETURN> = ',0
  2325.     lda    ndnames    ; get count
  2326.     call    padc
  2327.     call    print
  2328.     db    '? ',0
  2329.     call    getnum    ; get number
  2330.     jz    stnd2    ; skip if no entry
  2331.     mov    a,h    ; must be 8-bit number
  2332.     ora    a    ; must be zero
  2333.     jz    stnd1
  2334.     call    print
  2335.     db    cr,lf,'Number is out of range (>255) -- Reenter',0
  2336.     jmp    stnd0
  2337. stnd1:
  2338.     mov    a,l    ; get low-order number
  2339.     sta    ndnames    ; get count
  2340. stnd2:
  2341.     call    print
  2342.     db    cr,lf,'3  Name of Named Directory File? '
  2343.     db    cr,lf,'    Enter only File Name and Type -- DIR: form will be '
  2344.     db    'ignored'
  2345.     db    cr,lf,'    Directory File Name (<RETURN> = ',0
  2346.     lxi    h,dnfile    ; pt to current entry
  2347.     call    prfn
  2348.     call    print
  2349.     db    ')? ',0
  2350.     lxi    d,dnfile    ; pt to buffer
  2351.     jmp    getfname    ; get file name
  2352. ;
  2353. ;  Supporting Input Routines
  2354. ;
  2355. pq:
  2356.     call    print
  2357.     db    cr,lf,'** Setup Questions **',0
  2358.     ret
  2359. getyn:
  2360.     call    print
  2361.     db    ' (Y/N/other=Y)? ',0
  2362.     call    capin    ; get response and capitalize
  2363.     cpi    'N'    ; check for No
  2364.     ret
  2365. capin:
  2366.     call    cin    ; get response
  2367.     call    caps    ; capitalize
  2368.     call    cout    ; echo
  2369.     ret
  2370. getnum:
  2371.     mvi    a,0ffh    ; capitalize
  2372.     call    bbline    ; input line
  2373.     ora    a    ; any input?
  2374.     jz    gnerr    ; process error if none
  2375.     push    d    ; save DE
  2376.     call    eval10    ; evaluate input
  2377.     xchg        ; number in HL
  2378.     pop    d
  2379.     mvi    a,0ffh    ; ok
  2380.     ora    a
  2381.     ret
  2382. gnerr:
  2383.     lxi    h,0    ; return zero
  2384.     xra    a    ; no input
  2385.     ret
  2386. gethnum:
  2387.     mvi    a,0ffh    ; capitalize
  2388.     call    bbline    ; input line
  2389.     ora    a    ; any input?
  2390.     jz    gnerr    ; process error if none
  2391.     push    d    ; save DE
  2392.     call    eval16    ; assume hex and evaluate
  2393.     xchg        ; number in HL
  2394.     pop    d
  2395.     mvi    a,0ffh    ; OK
  2396.     ora    a
  2397.     ret
  2398.  
  2399. ;
  2400. ;  Get File Name into Buffer pted to by DE
  2401. ;
  2402. getfname:
  2403.     mvi    a,0ffh    ; capitalize
  2404.     call    bbline    ; input line
  2405.     ora    a    ; noname permitted
  2406.     rz
  2407.     push    d    ; save ptr
  2408.     lxi    d,dfcb    ; dummy fcb
  2409.     call    fname    ; extract file name info
  2410.     jnz    stlrz1
  2411.     pop    d    ; get ptr
  2412.     call    print
  2413.     db    cr,lf,'Input Error -- Reenter'
  2414.     db    cr,lf,'File Name? ',0
  2415.     jmp    getfname
  2416. stlrz1:
  2417.     pop    d        ; get ptr to buffer
  2418.     lxi    h,dfcb+1    ; pt to file name
  2419.     mvi    b,11        ; 11 bytes
  2420.     call    moveb        ; copy file name into buffer
  2421.     mvi    a,0ffh        ; OK
  2422.     ora    a
  2423.     ret
  2424.  
  2425.     end
  2426.