home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol100 / genins.mac < prev    next >
Encoding:
Text File  |  1984-04-29  |  40.3 KB  |  2,246 lines

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