home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / ZCPR2 / GENINS.MQC / GENINS.MAC
Text File  |  2000-06-30  |  48KB  |  2,463 lines

  1. ;
  2. ;  PROGRAM:  GENINS -- General ZCPR2 Utility Installation Program
  3. ;  AUTHOR:  RICHARD CONN
  4. ;  VERSION:  2.5
  5. ;  DATE:  17 Aug 83
  6. ;  PREVIOUS VERSIONS:  2.5 (25 Apr 83), 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    25
  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 40+ '
  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,'    -------- Print ----------       '
  1181.     db    '---- Load Flags and Values ----'
  1182.     db    cr,lf,'    P  Print Flags and Values    '
  1183.     db    '<  Save All Flags and Values'
  1184.     db    cr,lf,'                                    '
  1185.     db    '>  Restore All Flags and Values'
  1186.     db    cr,lf,'    ----------- Exits ------------  '
  1187.     db    'L  Load GENINS Flags and Values'
  1188.     db    cr,lf,'    G  Load from GENINS and Update  '
  1189.     db    'S  Setup ALL Flags and Values'
  1190.     db    cr,lf,'    Q  Quit and Do Not Update'
  1191.     db    cr,lf,'    X  Exit and Optionally Update'
  1192.     db    cr,lf
  1193.     db    cr,lf,'    --------- Setup List ---------  '
  1194.     db    '  --------- Setup List ---------'
  1195.     db    cr,lf,'    0',0
  1196.     lda    ndreqd    ; named dirs required?
  1197.     call    prast
  1198.     call    print
  1199.     db    ' Setup Named Directory Data    '
  1200.     db    '5',0
  1201.     lda    udreqd    ; user/disk required?
  1202.     call    prast
  1203.     call    print
  1204.     db    ' Set Disk Allowed Flag'
  1205.     db    cr,lf,'    1',0
  1206.     lda    epreqd    ; ext path required?
  1207.     call    prast
  1208.     call    print
  1209.     db    ' Setup External Path Data    '
  1210.     db    '6',0
  1211.     lda    udreqd    ; user/disk required?
  1212.     call    prast
  1213.     call    print
  1214.     db    ' Set User Allowed Flag'
  1215.     db    cr,lf,'    2',0
  1216.     lda    mcreqd    ; multiple commands required?
  1217.     call    prast
  1218.     call    print
  1219.     db    ' Setup Multiple Command Line    '
  1220.     db    '7',0
  1221.     lda    pureqd    ; priv user required?
  1222.     call    prast
  1223.     call    print
  1224.     db    ' Setup Priv User Data'
  1225.     db    cr,lf,'    3',0
  1226.     lda    mxreqd    ; max user/disk required?
  1227.     call    prast
  1228.     call    print
  1229.     db    ' Set Max Disk            '
  1230.     db    '8',0
  1231.     lda    cdreqd    ; current disk required?
  1232.     call    prast
  1233.     call    print
  1234.     db    ' Set Current User/Disk Data'
  1235.     db    cr,lf,'    4',0
  1236.     lda    mxreqd    ; max user/disk required?
  1237.     call    prast
  1238.     call    print
  1239.     db    ' Set Max User            '
  1240.     db    '9',0
  1241.     lda    cdreqd    ; current disk required?
  1242.     call    prast
  1243.     call    print
  1244.     db    ' Set File DMA Address'
  1245.     db    0
  1246.     lda    z2class    ; check class for ZEX
  1247.     cpi    4
  1248.     jnz    su1
  1249.     call    print
  1250.     db    cr,lf,lf,'    A  Set ZEX User Input Termination Character',0
  1251.     jmp    setcmd
  1252. su1:
  1253.     cpi    2    ; check class for MCOPY
  1254.     jnz    su2
  1255.     call    print
  1256.     db    cr,lf,lf,'    A  Set MCOPY Special Default Values',0
  1257.     jmp    setcmd
  1258. su2:
  1259.     cpi    1    ; check class for I/O
  1260.     jnz    su3
  1261.     call    print
  1262.     db    cr,lf,lf,'    A  Set I/O Class Values'
  1263.     db    'Default Values',0
  1264.     jmp    setcmd
  1265. su3:
  1266.     cpi    3    ; check class for XDIR3
  1267.     jnz    su4
  1268.     call    print
  1269.     db    cr,lf,lf,'    A  Set XDIR3 Special Default Values',0
  1270.     jmp    setcmd
  1271. su4:
  1272.     cpi    5    ; check class for LRUNZ, LDIRZ, or HELP
  1273.     jnz    su5
  1274.     call    print
  1275.     db    cr,lf,lf,'    A  Set Default Search File Name',0
  1276.     jmp    setcmd
  1277. su5:
  1278.     cpi    6    ; check class for DU2
  1279.     jnz    su6
  1280.     call    print
  1281.     db    cr,lf,lf,'    A  Set Proc Speed and Screen Size Values',0
  1282.     jmp    setcmd
  1283. su6:
  1284.     cpi    7    ; check class for TINIT
  1285.     jnz    su7
  1286.     call    print
  1287.     db    cr,lf,lf,'    A  Set TINIT Special Default Values',0
  1288.     jmp    setcmd
  1289. su7:
  1290.     cpi    8    ; check class for WHEEL
  1291.     jnz    su8
  1292.     call    print
  1293.     db    cr,lf,lf,'    A  Set WHEEL Byte Address',0
  1294.     jmp    setcmd
  1295. su8:
  1296.     cpi    11    ; check for Class 11
  1297.     jnz    su11
  1298.     call    print
  1299.     db    cr,lf,lf,'    A  Set Printer and Screen Parameters',0
  1300.     jmp    setcmd
  1301. su11:
  1302. ;
  1303. ;  Function-Specific Table goes here
  1304. ;
  1305. setcmd:
  1306.     call    print
  1307.     db    cr,lf,lf,'Setup Command (? for Menu)? ',0
  1308.     call    capin    ; get input
  1309.     cpi    '?'    ; menu?
  1310.     jz    setup
  1311.     cpi    '/'    ; menu?
  1312.     jz    setup
  1313.     cpi    '<'    ; save?
  1314.     jz    setsav
  1315.     cpi    '>'    ; restore?
  1316.     jz    setres
  1317.     cpi    'G'    ; restore from GENINS and update
  1318.     jz    genresu
  1319.     cpi    'L'    ; load from GENINS
  1320.     jz    genres
  1321.     cpi    'Q'    ; abort?
  1322.     rz
  1323.     cpi    'X'    ; abort?
  1324.     rz
  1325.     call    stscn0    ; scan for defaults
  1326.     jz    run    ; if found, run
  1327.     lda    z2class    ; check for classes
  1328.     cpi    0    ; general?
  1329.     jz    setinv
  1330.     cpi    4    ; ZEX?
  1331.     jnz    sc1
  1332.     call    stscnz    ; scan for ZEX
  1333.     jz    run
  1334.     jmp    setinv
  1335. sc1:
  1336.     cpi    2    ; MCOPY?
  1337.     jnz    sc2
  1338.     call    stscnm    ; scan for MCOPY
  1339.     jz    run
  1340.     jmp    setinv
  1341. sc2:
  1342.     cpi    1    ; I/O?
  1343.     jnz    sc3
  1344.     call    stscni    ; scan for I/O
  1345.     jz    run
  1346.     jmp    setinv
  1347. sc3:
  1348.     cpi    3    ; XDIR3?
  1349.     jnz    sc4
  1350.     call    stscnx    ; scan for XDIR3
  1351.     jz    run
  1352.     jmp    setinv
  1353. sc4:
  1354.     cpi    5    ; LRUNZ, LDIRZ, or HELP2?
  1355.     jnz    sc5
  1356.     call    stscnl
  1357.     jz    run
  1358.     jmp    setinv
  1359. sc5:
  1360.     cpi    6    ; Class 6?
  1361.     jnz    sc6
  1362.     call    stscnd
  1363.     jz    run
  1364.     jmp    setinv
  1365. sc6:
  1366.     cpi    7    ; TINIT?
  1367.     jnz    sc7
  1368.     call    stscnt
  1369.     jz    run
  1370.     jmp    setinv
  1371. sc7:
  1372.     cpi    8    ; WHEEL?
  1373.     jnz    sc8
  1374.     call    stscnw
  1375.     jz    run
  1376.     jmp    setinv
  1377. sc8:
  1378.     cpi    11    ; Class 11?
  1379.     jnz    sc11
  1380.     call    stscps
  1381.     jz    run
  1382.     jmp    setinv
  1383. sc11:
  1384. setinv:
  1385.     call    print
  1386.     db    cr,lf,'Invalid Command',0
  1387.     jmp    setup
  1388. ;
  1389. ;  Print Asterisk if Char in A is 0, else print <SP>
  1390. ;
  1391. prast:
  1392.     mvi    b,'*'    ; prep to print asterisk
  1393.     ora    a    ; zero?
  1394.     jz    prast1
  1395.     mvi    b,' '    ; print space
  1396. prast1:
  1397.     mov    a,b    ; get char
  1398.     jmp    cout    ; print it
  1399.  
  1400. ;
  1401. ;  Load GENINS Flags/Values and Continue
  1402. ;
  1403. genres:
  1404.     call    ldgenins    ; load flags/values
  1405.     jmp    setcmd
  1406.  
  1407. ;
  1408. ;  Load GENINS Flags/Values and Update
  1409. ;
  1410. genresu:
  1411.     call    ldgenins    ; load flags/values
  1412.     mvi    a,'X'        ; exit
  1413.     ret
  1414.  
  1415. ;
  1416. ;  Load GENINS Flags/Values
  1417. ;
  1418. ldgenins:
  1419.     lxi    h,103h        ; copy genins flags/values
  1420.     lxi    d,epavail    ; ... into optbuff
  1421.     mvi    b,bufsiz    ; size of buffer
  1422.     call    moveb
  1423.     ret
  1424.  
  1425. ;
  1426. ;  Save Buffer Contents
  1427. ;
  1428. setsav:
  1429.     lxi    h,epavail    ; copy buffer
  1430.     lxi    d,tmpbuff    ; ... into tmpbuff
  1431.     mvi    b,bufsiz    ; size of buffers
  1432.     call    moveb
  1433.     mvi    a,0ffh        ; set flag
  1434.     sta    cpyflg
  1435.     jmp    setcmd
  1436. ;
  1437. ;  Restore Buffer Contents
  1438. ;
  1439. setres:
  1440.     lda    cpyflg        ; check for previous save
  1441.     ora    a        ; 0=no
  1442.     jz    sreserr
  1443.     lxi    d,epavail    ; copy into optbuff
  1444.     lxi    h,tmpbuff    ; ... from tmpbuff
  1445.     mvi    b,bufsiz    ; size of buffers
  1446.     call    moveb
  1447.     jmp    setcmd
  1448. sreserr:
  1449.     call    print
  1450.     db    cr,lf,'Error -- Restore Attempted with Nothing Saved',0
  1451.     jmp    setcmd
  1452. ;
  1453. ;  Run command whose address is in HL
  1454. ;
  1455. run:
  1456.     lxi    d,setcmd    ; set up return address
  1457.     push    d
  1458.     pchl        ; "call" command
  1459. ;
  1460. ;  Scan Command Table for Command in B; return with Zero Flag Set and
  1461. ;  HL = Address if found, else A unchanged but NZ
  1462. ;
  1463. ;  On input, DE pts to command table and B=Command
  1464. ;
  1465. stscn:
  1466.     ldax    d    ; get table entry
  1467.     ora    a    ; end of table?
  1468.     jz    stsnf    ; not found if so
  1469.     cmp    b    ; match?
  1470.     jz    stsfnd    ; found if so
  1471.     inx    d    ; skip to next
  1472.     inx    d
  1473.     inx    d
  1474.     jmp    stscn
  1475. stsfnd:
  1476.     inx    d    ; pt to low
  1477.     ldax    d    ; get low
  1478.     mov    l,a
  1479.     inx    d    ; pt to high
  1480.     ldax    d    ; get high
  1481.     mov    h,a
  1482.     xra    a    ; set found flag
  1483.     ret
  1484. stsnf:
  1485.     mvi    a,0ffh    ; set not found flag
  1486.     ora    a
  1487.     ret
  1488. ;
  1489. ;  Scan Default Table
  1490. ;
  1491. stscn0:
  1492.     lxi    d,table0    ; pt to default table
  1493.     mov    b,a        ; command in B
  1494.     jmp    stscn
  1495. ;
  1496. ;  Scan Printer/Screen Table
  1497. ;
  1498. stscps:
  1499.     lxi    d,tablps    ; pt to Printer/Screen table
  1500.     jmp    stscn
  1501. ;
  1502. ;  Scan WHEEL Table
  1503. ;
  1504. stscnw:
  1505.     lxi    d,tablew    ; pt to WHEEL table
  1506.     jmp    stscn
  1507. ;
  1508. ;  Scan TINIT Table
  1509. ;
  1510. stscnt:
  1511.     lxi    d,tablet    ; pt to TINIT table
  1512.     jmp    stscn
  1513. ;
  1514. ;  Scan ZEX Table
  1515. ;
  1516. stscnz:
  1517.     lxi    d,tablez    ; pt to ZEX table
  1518.     jmp    stscn
  1519. ;
  1520. ;  Scan LRUNZ, LDIRZ, or HELP2 Table
  1521. ;
  1522. stscnl:
  1523.     lxi    d,tablel    ; pt to LRUNZ table
  1524.     jmp    stscn
  1525. ;
  1526. ;  Scan Class 6 Table
  1527. ;
  1528. stscnd:
  1529.     lxi    d,tabled    ; pt to Class 6 table
  1530.     jmp    stscn
  1531. ;
  1532. ;  Scan XDIR3 Table
  1533. ;
  1534. stscnx:
  1535.     lxi    d,tablex    ; pt to XDIR3 table
  1536.     jmp    stscn
  1537. ;
  1538. ;  Scan MCOPY Table
  1539. ;
  1540. stscnm:
  1541.     lxi    d,tablem    ; pt to MCOPY table
  1542.     jmp    stscn
  1543. ;
  1544. ;  Scan I/O Table
  1545. ;
  1546. stscni:
  1547.     lxi    d,tablei    ; pt to I/O table
  1548.     jmp    stscn
  1549. ;
  1550. ;  Setup Function Tables
  1551. ;
  1552. table0:                ; default table
  1553.     db    'P'
  1554.     dw    propt
  1555.     db    'S'
  1556.     dw    stall
  1557.     db    '0'
  1558.     dw    stnd
  1559.     db    '1'
  1560.     dw    stex
  1561.     db    '2'
  1562.     dw    stmc
  1563.     db    '3'
  1564.     dw    stmdisk
  1565.     db    '4'
  1566.     dw    stmuser
  1567.     db    '5'
  1568.     dw    stdok
  1569.     db    '6'
  1570.     dw    stuok
  1571.     db    '7'
  1572.     dw    stpu
  1573.     db    '8'
  1574.     dw    stcud
  1575.     db    '9'
  1576.     dw    stdma
  1577.     db    0    ; end of table
  1578. tablps:
  1579.     db    'A'    ; Printer/Screen Param option
  1580.     dw    stps
  1581.     db    0
  1582. tablew:
  1583.     db    'A'    ; WHEEL option
  1584.     dw    stwheel
  1585.     db    0
  1586. tablet:
  1587.     db    'A'    ; TINIT option
  1588.     dw    sttinit
  1589.     db    0
  1590. tablez:
  1591.     db    'A'    ; ZEX option
  1592.     dw    stzex
  1593.     db    0
  1594. tablem:
  1595.     db    'A'    ; MCOPY option
  1596.     dw    stmcopy
  1597.     db    0
  1598. tablei:
  1599.     db    'A'    ; I/O option
  1600.     dw    stio
  1601.     db    0
  1602. tablex:
  1603.     db    'A'    ; XDIR3 option
  1604.     dw    stxdir
  1605.     db    0
  1606. tabled:
  1607.     db    'A'    ; Class 6 option
  1608.     dw    stdu2
  1609.     db    0
  1610. tablel:
  1611.     db    'A'    ; LRUNZ option
  1612.     dw    stlrunz
  1613.     db    0
  1614. ;
  1615. ;  Set Printer/Screen Parameters
  1616. ;
  1617. stps:
  1618.     call    prpsio    ; print data
  1619.     call    print
  1620.     db    cr,lf,'1  Printer --'
  1621.     db    cr,lf,'1a Enter Printer Width in Columns or <RETURN> = ',0
  1622.     lda    lwidth
  1623.     call    padc
  1624.     call    print
  1625.     db    '? ',0
  1626.     call    getnum    ; get value
  1627.     jz    stps1
  1628.     mov    a,l    ; set new width
  1629.     sta    lwidth
  1630. stps1:
  1631.     call    print
  1632.     db    cr,lf,'1b Enter Number of Text Lines Per Page <RETURN> = ',0
  1633.     lda    ltpp
  1634.     call    padc
  1635.     call    print
  1636.     db    '? ',0
  1637.     call    getnum    ; get value
  1638.     jz    stps2
  1639.     mov    a,l    ; set new value
  1640.     sta    ltpp
  1641. stps2:
  1642.     call    print
  1643.     db    cr,lf,'1c Enter Total Number of Lines Per Page or <RETURN> = '
  1644.     db    0
  1645.     lda    lspp
  1646.     mov    b,a
  1647.     lda    ltpp
  1648.     add    b
  1649.     adi    2
  1650.     call    padc
  1651.     call    print
  1652.     db    '? ',0
  1653.     call    getnum    ; get value
  1654.     jz    stps3
  1655.     lda    ltpp    ; get text count
  1656.     mov    b,a    ; result in B
  1657.     mov    a,l    ; set new value
  1658.     sub    b    ; subtract out
  1659.     jc    stps2a
  1660.     sui    2    ; ok?
  1661.     jc    stps2a
  1662.     sta    lspp
  1663.     jmp    stps3
  1664. stps2a:
  1665.     call    print
  1666.     db    cr,lf,'ERROR -- Not Enough Room for 2-Line Header',0
  1667.     jmp    stps1
  1668. stps3:
  1669.     call    print
  1670.     db    cr,lf,'2  CRT Screen --'
  1671.     db    cr,lf,'2a Enter Screen Width in Columns or <RETURN> = ',0
  1672.     lda    cwidth
  1673.     call    padc
  1674.     call    print
  1675.     db    '? ',0
  1676.     call    getnum    ; get value
  1677.     jz    stps4
  1678.     mov    a,l    ; set new width
  1679.     sta    cwidth
  1680. stps4:
  1681.     call    print
  1682.     db    cr,lf,'2b Enter Number of Text Lines per Screen <RETURN> = ',0
  1683.     lda    ctpp
  1684.     call    padc
  1685.     call    print
  1686.     db    '? ',0
  1687.     call    getnum    ; get value
  1688.     jz    stps5
  1689.     mov    a,l    ; set new value
  1690.     sta    ctpp
  1691. stps5:
  1692.     call    print
  1693.     db    cr,lf,'2c Enter Total Number of Lines per Screen <RETURN> = '
  1694.     db    0
  1695.     lda    cspp
  1696.     mov    b,a
  1697.     lda    ctpp
  1698.     add    b
  1699.     adi    1    ; 1-line footer
  1700.     call    padc
  1701.     call    print
  1702.     db    '? ',0
  1703.     call    getnum    ; get value
  1704.     jz    stps6
  1705.     lda    ctpp
  1706.     mov    b,a    ; text count in B
  1707.     mov    a,l    ; set new value
  1708.     sub    b    ; subtract
  1709.     jc    stps5a
  1710.     sui    1    ; 1-line footer
  1711.     jc    stps5a
  1712.     sta    cspp
  1713.     jmp    stps6
  1714. stps5a:
  1715.     call    print
  1716.     db    cr,lf,'ERROR -- Not Enough Room for 1-Line Footer',0
  1717.     jmp    stps4
  1718. stps6:
  1719.     ret
  1720. ;
  1721. ;  Set WHEEL Byte Address
  1722. ;
  1723. stwheel:
  1724.     call    prwheel    ; print data
  1725.     call    print
  1726.     db    cr,lf,'1  Address of Wheel Byte?'
  1727.     db    cr,lf,'    Enter Hex Number or <RETURN> = ',0
  1728.     lhld    wheel    ; print value
  1729.     call    prhnum
  1730.     call    print
  1731.     db    '? ',0
  1732.     call    gethnum    ; get value
  1733.     rz
  1734.     shld    wheel    ; set value
  1735.     ret
  1736. ;
  1737. ;  Set TINIT Parameters
  1738. ;
  1739. sttinit:
  1740.     call    prtinit    ; print data
  1741.     call    getpspeed    ; get processor speed
  1742.     call    print
  1743.     db    cr,lf,'2  Name of Default Configuration File'
  1744.     db    cr,lf,'    Enter File Name or <RETURN> = ',0
  1745.     lxi    h,cfgfile
  1746.     call    prfn
  1747.     call    print
  1748.     db    '? ',0
  1749.     lxi    d,cfgfile    ; pt to file name storage area
  1750.     jmp    getfname
  1751. getpspeed:
  1752.     call    print
  1753.     db    cr,lf,'1  Processor Speed in MHz (<RETURN> = ',0
  1754.     lda    pspeed
  1755.     call    padc
  1756.     call    print
  1757.     db    ')? ',0
  1758.     call    getnum    ; get number in HL
  1759.     rz        ; no change?
  1760.     mov    a,l    ; set new speed
  1761.     sta    pspeed
  1762.     ret
  1763. ;
  1764. ;  Set Class 6 Parameters
  1765. ;
  1766. stdu2:
  1767.     call    prdu2    ; print data
  1768.     call    getpspeed    ; get processor speed
  1769.     call    print
  1770.     db    cr,lf,'2  Number of Lines on Your CRT (<RETURN> = ',0
  1771.     lda    ssize    ; get size
  1772.     call    padc
  1773.     call    print
  1774.     db    ')? ',0
  1775.     call    getnum    ; get number in HL
  1776.     rz
  1777.     mov    a,l    ; set new screen size
  1778.     sta    ssize
  1779.     ret
  1780. ;
  1781. ;  Set Search File Name
  1782. ;
  1783. stlrunz:
  1784.     call    prlrunz    ; print data
  1785.     call    print
  1786.     db    cr,lf,'1  Name of Search File'
  1787.     db    cr,lf,'    Enter File Name or <RETURN> = ',0
  1788.     lxi    h,cfile
  1789.     call    prfn
  1790.     call    print
  1791.     db    '? ',0
  1792.     lxi    d,cfile    ; pt to name buffer
  1793.     jmp    getfname    ; get file name
  1794. ;
  1795. ;  Set I/O Parameters
  1796. ;
  1797. stio:
  1798.     call    prio    ; print option
  1799.     call    print
  1800.     db    cr,lf,'1  I/O Base Address (Hex) (<RETURN> = ',0
  1801.     lhld    iobase    ; get current
  1802.     mov    a,h    ; any?
  1803.     ora    l
  1804.     jz    stio1
  1805.     call    phl4hc    ; print as hex
  1806.     call    print
  1807.     db    ' Hex)? ',0
  1808.     jmp    stio2
  1809. stio1:
  1810.     call    print
  1811.     db    'None)? ',0
  1812. stio2:
  1813.     call    gethnum    ; get hex number in HL
  1814.     rz
  1815.     shld    iobase    ; save it
  1816.     ret
  1817. ;
  1818. ;  Set XDIR3 Parameters
  1819. ;
  1820. stxdir:
  1821.     call    prxdir    ; print options
  1822.     lxi    h,igrp    ; pt to first param
  1823.     mvi    m,0    ; assume no
  1824.     call    print
  1825.     db    cr,lf,'1  Group by File Type and Name [No=Name and Type] ',0
  1826.     call    getyn
  1827.     jz    stx1
  1828.     mvi    m,0ffh    ; set yes
  1829. stx1:
  1830.     inx    h    ; pt to next
  1831.     mvi    m,0ffh    ; assume no
  1832.     call    print
  1833.     db    cr,lf,'2  Vertical Display [No=Horizontal] ',0
  1834.     call    getyn
  1835.     jz    stx2
  1836.     mvi    m,0    ; set yes
  1837. stx2:
  1838.     inx    h    ; pt to next
  1839.     mvi    b,0    ; set no select
  1840.     call    print
  1841.     db    cr,lf,'3a Select Non-System Files',0
  1842.     call    getyn
  1843.     jz    stx2a
  1844.     mvi    a,80h    ; select non-sys
  1845.     ora    b
  1846.     mov    b,a    ; result in B
  1847. stx2a:
  1848.     call    print
  1849.     db    cr,lf,'3b Select System Files',0
  1850.     call    getyn
  1851.     jz    stx3
  1852.     mvi    a,40h    ; select sys
  1853.     ora    b
  1854.     mov    b,a    ; result in B
  1855. stx3:
  1856.     mov    m,b    ; set flag
  1857.     inx    h    ; pt to next
  1858.     mvi    m,0ffh    ; assume no
  1859.     call    print
  1860.     db    cr,lf,'4  Display Directory [No=Scan] ',0
  1861.     call    getyn
  1862.     jz    stx4
  1863.     mvi    m,0    ; set yes
  1864. stx4:
  1865.     inx    h    ; pt to next
  1866.     mvi    m,0    ; assume no
  1867.     call    print
  1868.     db    cr,lf,'5  Enable F Options',0
  1869.     call    getyn
  1870.     jz    stx5
  1871.     mvi    m,0ffh    ; set yes
  1872. stx5:
  1873.     mov    a,m    ; get flag
  1874.     inx    h    ; pt to next
  1875.     ora    a    ; 0=no
  1876.     jz    stx6
  1877.     mvi    m,0    ; assume no
  1878.     call    print
  1879.     db    cr,lf,'5a Enable FL Option',0
  1880.     call    getyn
  1881.     jz    stx6
  1882.     mvi    m,0ffh    ; set yes
  1883. stx6:
  1884.     inx    h    ; pt to next
  1885.     mvi    m,0    ; assume no
  1886.     call    print
  1887.     db    cr,lf,'6  Enable AS Option',0
  1888.     call    getyn
  1889.     rz
  1890.     mvi    m,0ffh    ; set yes
  1891.     ret
  1892. ;
  1893. ;  Set MCOPY Parameters
  1894. ;
  1895. stmcopy:
  1896.     call    prmcopy    ; print current values
  1897.     lxi    h,verflg    ; pt to flag
  1898.     mvi    m,0    ; turn verify off
  1899.     call    print
  1900.     db    cr,lf,'1  Enable Verify Default',0
  1901.     call    getyn    ; get response
  1902.     jz    stm1
  1903.     mvi    m,0ffh    ; turn verify on
  1904. stm1:
  1905.     inx    h    ; pt to next
  1906.     mvi    m,0    ; turn inspect off
  1907.     call    print
  1908.     db    cr,lf,'2  Enable Inspect Default',0
  1909.     call    getyn    ; get response
  1910.     jz    stm2
  1911.     mvi    m,0ffh    ; turn inspect on
  1912. stm2:
  1913.     inx    h    ; pt to next
  1914.     mvi    m,0    ; turn quiet off
  1915.     call    print
  1916.     db    cr,lf,'3  Enable Quiet Default',0
  1917.     call    getyn    ; get response
  1918.     jz    stm3
  1919.     mvi    m,0ffh    ; turn quiet on
  1920. stm3:
  1921.     inx    h    ; pt to next
  1922.     mvi    m,0    ; turn multiple run off
  1923.     call    print
  1924.     db    cr,lf,'4  Enable Multiple Run Default',0
  1925.     call    getyn
  1926.     jz    stm4
  1927.     mvi    m,0ffh    ; turn multiple run on
  1928. stm4:
  1929.     inx    h
  1930. stm4a:
  1931.     call    print
  1932.     db    cr,lf,'5a Default Destination Disk Letter? ',0
  1933.     call    cin    ; get response
  1934.     call    caps
  1935.     call    cout
  1936.     sui    'A'    ; convert to number
  1937.     jc    stm4b
  1938.     mov    b,a    ; save in B
  1939.     lda    mdisk    ; compare to max
  1940.     dcr    a
  1941.     cmp    b
  1942.     jc    stm4b
  1943.     mov    m,b    ; store disk number
  1944.     jmp    stm5
  1945. stm4b:
  1946.     call    print
  1947.     db    cr,lf,'    Invalid Disk Letter -- Out of Range of A to ',0
  1948.     lda    mdisk    ; get max
  1949.     adi    '@'    ; convert to letter
  1950.     call    cout
  1951.     call    print
  1952.     db    ' -- Reenter',0
  1953.     jmp    stm4a
  1954. stm5:
  1955.     inx    h    ; pt to user
  1956. stm5a:
  1957.     call    print
  1958.     db    cr,lf,'5b Default Destination User Number (<RETURN> = ',0
  1959.     mov    a,m    ; get user number
  1960.     call    padc
  1961.     call    print
  1962.     db    ')? ',0
  1963.     push    h    ; save HL
  1964.     call    getnum    ; get number
  1965.     xchg        ; number in DE
  1966.     pop    h    ; get HL
  1967.     rz        ; no change
  1968.     mov    a,d    ; check for range
  1969.     ora    a    ; must be zero
  1970.     jnz    stm5b
  1971.     lda    muser    ; check for max user
  1972.     cmp    e
  1973.     jc    stm5b
  1974.     mov    m,e    ; store user number
  1975.     ret
  1976. stm5b:
  1977.     call    print
  1978.     db    cr,lf,'    User Number Out of Range -- Must be Less Than ',0
  1979.     lda    muser    ; get max
  1980.     adi    1    ; add 1 for LT
  1981.     call    padc
  1982.     call    print
  1983.     db    ' -- Reenter',0
  1984.     jmp    stm5a
  1985.  
  1986. ;
  1987. ;  Set ZEX Parameter
  1988. ;
  1989. stzex:
  1990.     call    przex    ; print data
  1991.     call    print
  1992.     db    cr,lf,'1  New Command Character? ',0
  1993.     call    cin    ; get response
  1994.     call    cout    ; echo
  1995.     mov    b,a    ; save in B
  1996.     call    print
  1997.     db    cr,lf,'1a Set MSB',0
  1998.     call    getyn    ; get response
  1999.     jz    stzex1
  2000.     mvi    a,80h    ; set MSB
  2001.     ora    b
  2002.     mov    b,a
  2003. stzex1:
  2004.     mov    a,b    ; get char
  2005.     sta    tnuich    ; save it
  2006.     ret
  2007. ;
  2008. ;  Set Up All Flags/Values
  2009. ;
  2010. stall:
  2011.     call    crlf
  2012.     call    stnd    ; named directory data
  2013.     call    crlf
  2014.     call    stex    ; configure external path data
  2015.     call    crlf
  2016.     call    stmc    ; store multiple command line buffer data
  2017.     call    crlf
  2018.     call    stmdisk    ; store max disk number
  2019.     call    crlf
  2020.     call    stmuser    ; store max user number
  2021.     call    crlf
  2022.     call    stdok    ; set disk allowed
  2023.     call    crlf
  2024.     call    stuok    ; set user allowed
  2025.     call    crlf
  2026.     call    stpu    ; set privileged user info
  2027.     call    crlf
  2028.     call    stcud    ; set current user/disk indicator
  2029.     call    crlf
  2030.     call    stdma    ; set DMA address
  2031.     call    crlf
  2032.     lda    z2class    ; get class
  2033.     cpi    1    ; I/O?
  2034.     jz    stio
  2035.     cpi    2    ; MCOPY?
  2036.     jz    stmcopy
  2037.     cpi    3    ; XDIR3?
  2038.     jz    stxdir
  2039.     cpi    4    ; ZEX?
  2040.     jz    stzex
  2041.     cpi    5    ; LRUNZ?
  2042.     jz    stlrunz
  2043.     cpi    6    ; Class 6?
  2044.     jz    stdu2
  2045.     cpi    7    ; TINIT?
  2046.     jz    sttinit
  2047.     cpi    8    ; WHEEL?
  2048.     jz    stwheel
  2049.     cpi    11    ; Class 11?
  2050.     jz    stps
  2051.     ret
  2052.  
  2053. ;
  2054. ;  external paths
  2055. ;
  2056. stex:
  2057.     lda    epreqd    ; get req'd flag
  2058.     ora    a    ; 0=no
  2059.     rz
  2060.     call    prex    ; print data
  2061.     xra    a    ; assume no external paths
  2062.     sta    epavail    ; set flag
  2063.     call    pq    ; print question prompt
  2064.     call    print
  2065.     db    cr,lf,'1  Enable External Paths',0
  2066.     call    getyn    ; get Y/N from user
  2067.     jz    stex1    ; if no, continue
  2068.     mvi    a,0ffh    ; set external paths on
  2069.     sta    epavail
  2070.     call    print
  2071.     db    cr,lf,'1a Address of External Path in Hex (<RETURN> = ',0
  2072.     lhld    epadr
  2073.     call    phl4hc
  2074.     call    print
  2075.     db    ' Hex)? ',0
  2076.     call    gethnum    ; get number
  2077.     jz    stex1
  2078.     shld    epadr    ; set address of external path
  2079. stex1:
  2080.     lxi    d,intpath    ; pt to internal path
  2081.     xra    a    ; set empty path
  2082.     stax    d
  2083.     call    print
  2084.     db    cr,lf,'2  Enable Internal Path',0
  2085.     call    getyn    ; get Y/N from user
  2086.     rz        ; done if no
  2087.     call    print
  2088.     db    cr,lf,'2a Define Internal Path Using Symbolic Notation --',0
  2089.     mvi    b,'0'    ; set element number
  2090. stex2:
  2091.     inr    b    ; increment count
  2092. stex3:
  2093.     call    crlf    ; new line
  2094.     mov    a,b    ; get value
  2095.     call    cout    ; print value
  2096.     call    print
  2097.     db    '.  Path Element (<CR>=Done)? ',0
  2098.     xra    a    ; A=0
  2099.     stax    d    ; assume end of path
  2100.     cma        ; A=0ffh for capitalize
  2101.     call    bbline    ; get line from user
  2102.     ora    a    ; empty?
  2103.     rz
  2104.     mov    a,m    ; get disk letter
  2105.     cpi    '$'    ; current?
  2106.     jz    stex4
  2107.     sui    'A'    ; convert to binary
  2108.     jc    peerr    ; path element error
  2109.     cpi    16    ; range?
  2110.     jnc    peerr
  2111.     inr    a    ; adjust to 1-16
  2112.     jmp    stex4
  2113. peerr:
  2114.     call    print
  2115.     db    cr,lf,'Invalid Path Element -- Reenter',0
  2116.     jmp    stex3
  2117. stex4:
  2118.     stax    d    ; store it
  2119.     inx    h    ; pt to next
  2120.     inx    d    ; pt to next
  2121.     mov    a,m    ; get character
  2122.     cpi    '$'    ; current?
  2123.     jz    stex5
  2124.     push    d    ; save DE
  2125.     call    eval10    ; convert chars to number in A
  2126.     pop    d
  2127. stex5:
  2128.     stax    d    ; store current
  2129.     inx    d    ; pt to next
  2130.     mov    a,b    ; check for done
  2131.     cpi    '8'    ; done if 8 completed
  2132.     jnz    stex2
  2133.     xra    a    ; terminate path
  2134.     stax    d    ; store binary 0
  2135.     ret
  2136.  
  2137. ;
  2138. ;  multiple commands
  2139. ;
  2140. stmc:
  2141.     lda    mcreqd    ; required?
  2142.     ora    a    ; 0=no
  2143.     rz
  2144.     call    prmc
  2145.     call    pq
  2146.     lxi    d,mcavail    ; pt to multiple command line buffer
  2147.     xra    a    ; A=0
  2148.     stax    d
  2149.     call    print
  2150.     db    cr,lf,'1  Enable Multiple Command Line Buffer',0
  2151.     call    getyn    ; get Y/N
  2152.     rz        ; done if no multiple command line buffer
  2153.     mvi    a,0ffh    ; turn buffer flag on
  2154.     stax    d
  2155.     call    print
  2156.     db    cr,lf,'1a Address of Multiple Command Line Buffer'
  2157.     db    cr,lf,'    Enter Hex Number or <RETURN> = ',0
  2158.     inx    d
  2159.     ldax    d
  2160.     mov    l,a
  2161.     inx    d
  2162.     ldax    d
  2163.     mov    h,a
  2164.     dcx    d
  2165.     dcx    d
  2166.     call    phl4hc
  2167.     call    print
  2168.     db    ' Hex? ',0
  2169.     call    gethnum
  2170.     rz
  2171.     inx    d
  2172.     mov    a,l    ; get low-order address
  2173.     stax    d    ; set low
  2174.     inx    d
  2175.     mov    a,h    ; get high-order address
  2176.     stax    d    ; set high
  2177.     ret
  2178.  
  2179. ;
  2180. ;  max disk
  2181. ;
  2182. stmdisk:
  2183.     lda    mxreqd    ; reqd?
  2184.     ora    a
  2185.     rz
  2186.     call    prmdisk
  2187.     call    pq
  2188. stmd1:
  2189.     call    print
  2190.     db    cr,lf,'1  Maximum Disk Allowed? ',0
  2191.     call    capin    ; get response
  2192.     sui    '@'    ; convert to 1-n
  2193.     jz    stmder
  2194.     sta    mdisk    ; set max disk
  2195.     cpi    17    ; range?
  2196.     rc
  2197. stmder:
  2198.     call    print
  2199.     db    cr,lf,'Invalid Disk Letter -- Reenter',0
  2200.     jmp    stmd1
  2201.  
  2202. ;
  2203. ;  max user
  2204. ;
  2205. stmuser:
  2206.     lda    mxreqd    ; reqd?
  2207.     ora    a
  2208.     rz
  2209.     call    crlf    ; new line
  2210.     call    prmuser
  2211.     call    pq
  2212. stmu1:
  2213.     call    print
  2214.     db    cr,lf,'1  Maximum User Number Allowed (<RETURN> = ',0
  2215.     lda    muser
  2216.     call    padc
  2217.     call    print
  2218.     db    ')? ',0
  2219.     call    getnum    ; get number from user
  2220.     rz
  2221.     mov    a,h    ; must be zero
  2222.     ora    a
  2223.     jnz    stmu2
  2224.     mov    a,l    ; get low-order
  2225.     sta    muser    ; set user number
  2226.     cpi    32    ; range?
  2227.     rc
  2228. stmu2:
  2229.     call    print
  2230.     db    cr,lf,'Invalid User Number -- Reenter',0
  2231.     jmp    stmu1
  2232.  
  2233. ;
  2234. ;  disk ok
  2235. ;
  2236. stdok:
  2237.     lda    udreqd    ; reqd?
  2238.     ora    a
  2239.     rz
  2240.     call    prdok
  2241.     call    pq
  2242.     lxi    h,dok    ; pt to flag
  2243.     mvi    m,0    ; assume not allowed
  2244.     call    print
  2245.     db    cr,lf,'1  Specification of Disk Allowed',0
  2246.     call    getyn    ; get response
  2247.     rz
  2248.     mvi    m,0ffh    ; disk allowed
  2249.     ret
  2250.  
  2251. ;
  2252. ;  user ok
  2253. ;
  2254. stuok:
  2255.     lda    udreqd    ; reqd?
  2256.     ora    a
  2257.     rz
  2258.     call    crlf
  2259.     call    pruok
  2260.     call    pq
  2261.     lxi    h,uok
  2262.     mvi    m,0    ; assume not allowed
  2263.     call    print
  2264.     db    cr,lf,'1  Specification of User Allowed',0
  2265.     call    getyn
  2266.     rz
  2267.     mvi    m,0ffh    ; set user allowed
  2268.     ret
  2269.  
  2270. ;
  2271. ;  priv user
  2272. ;
  2273. stpu:
  2274.     lda    pureqd    ; reqd?
  2275.     ora    a
  2276.     rz
  2277.     call    prpu
  2278.     call    pq
  2279.     call    print
  2280.     db    cr,lf,'1  Base of Privileged User Areas (<RETURN> = ',0
  2281.     lda    puser
  2282.     call    padc
  2283.     call    print
  2284.     db    ')? ',0
  2285.     call    getnum    ; get number
  2286.     jz    stpu0
  2287.     mov    a,l    ; get number into A
  2288.     sta    puser    ; set number
  2289. stpu0:
  2290.     call    print
  2291.     db    cr,lf,'2  Privileged User Password? ',0
  2292.     lxi    d,ppass    ; pt to password
  2293.     xra    a    ; don't capitalize
  2294.     stax    d    ; set no password
  2295.     call    bbline    ; get user response
  2296.     ora    a    ; any input?
  2297.     rz
  2298. stpu1:
  2299.     mov    a,m    ; copy to end of string
  2300.     stax    d
  2301.     inx    h    ; pt to next
  2302.     inx    d
  2303.     ora    a    ; done?
  2304.     jnz    stpu1
  2305.     ret
  2306.  
  2307. ;
  2308. ;  current user/disk indicator
  2309. ;
  2310. stcud:
  2311.     lda    cdreqd    ; reqd?
  2312.     ora    a
  2313.     rz
  2314.     call    prcud
  2315.     call    pq
  2316.     call    print
  2317.     db    cr,lf,'1  Current User/Disk Indicator? ',0
  2318.     call    capin    ; get response
  2319.     sta    cindic    ; set flag
  2320.     ret
  2321.  
  2322. ;
  2323. ;  DMA Address
  2324. ;
  2325. stdma:
  2326.     lda    cdreqd    ; reqd?
  2327.     ora    a
  2328.     rz
  2329.     call    crlf
  2330.     call    prdma
  2331.     call    pq
  2332.     call    print
  2333.     db    cr,lf,'1  DMA Address for Disk I/O'
  2334.     db    cr,lf,'    Enter Hex Number or <RETURN> = ',0
  2335.     lhld    dmadr
  2336.     call    phl4hc
  2337.     call    print
  2338.     db    ' Hex? ',0
  2339.     call    gethnum    ; get number
  2340.     rz
  2341.     shld    dmadr    ; set dma address
  2342.     ret
  2343.  
  2344. ;
  2345. ;  named directories
  2346. ;
  2347. stnd:
  2348.     lda    ndreqd    ; reqd?
  2349.     ora    a
  2350.     rz
  2351.     call    prnd
  2352.     call    pq
  2353.     call    print
  2354.     db    cr,lf,'1  Address of Memory-Resident Named Directory Buffer'
  2355.     db    cr,lf,'    Enter Hex Number or <RETURN> = None? ',0
  2356.     call    gethnum    ; get number
  2357.     shld    ndradr    ; set address
  2358. stnd0:
  2359.     call    print
  2360.     db    cr,lf,'2  Number of Named Directories Permitted? '
  2361.     db    cr,lf,'    Enter Decimal Number or <RETURN> = ',0
  2362.     lda    ndnames    ; get count
  2363.     call    padc
  2364.     call    print
  2365.     db    '? ',0
  2366.     call    getnum    ; get number
  2367.     jz    stnd2    ; skip if no entry
  2368.     mov    a,h    ; must be 8-bit number
  2369.     ora    a    ; must be zero
  2370.     jz    stnd1
  2371.     call    print
  2372.     db    cr,lf,'Number is out of range (>255) -- Reenter',0
  2373.     jmp    stnd0
  2374. stnd1:
  2375.     mov    a,l    ; get low-order number
  2376.     sta    ndnames    ; get count
  2377. stnd2:
  2378.     call    print
  2379.     db    cr,lf,'3  Name of Named Directory File? '
  2380.     db    cr,lf,'    Enter only File Name and Type -- DIR: form will be '
  2381.     db    'ignored'
  2382.     db    cr,lf,'    Directory File Name (<RETURN> = ',0
  2383.     lxi    h,dnfile    ; pt to current entry
  2384.     call    prfn
  2385.     call    print
  2386.     db    ')? ',0
  2387.     lxi    d,dnfile    ; pt to buffer
  2388.     jmp    getfname    ; get file name
  2389. ;
  2390. ;  Supporting Input Routines
  2391. ;
  2392. pq:
  2393.     call    print
  2394.     db    cr,lf,'** Setup Questions **',0
  2395.     ret
  2396. getyn:
  2397.     call    print
  2398.     db    ' (Y/N/other=Y)? ',0
  2399.     call    capin    ; get response and capitalize
  2400.     cpi    'N'    ; check for No
  2401.     ret
  2402. capin:
  2403.     call    cin    ; get response
  2404.     call    caps    ; capitalize
  2405.     call    cout    ; echo
  2406.     ret
  2407. getnum:
  2408.     mvi    a,0ffh    ; capitalize
  2409.     call    bbline    ; input line
  2410.     ora    a    ; any input?
  2411.     jz    gnerr    ; process error if none
  2412.     push    d    ; save DE
  2413.     call    eval10    ; evaluate input
  2414.     xchg        ; number in HL
  2415.     pop    d
  2416.     mvi    a,0ffh    ; ok
  2417.     ora    a
  2418.     ret
  2419. gnerr:
  2420.     lxi    h,0    ; return zero
  2421.     xra    a    ; no input
  2422.     ret
  2423. gethnum:
  2424.     mvi    a,0ffh    ; capitalize
  2425.     call    bbline    ; input line
  2426.     ora    a    ; any input?
  2427.     jz    gnerr    ; process error if none
  2428.     push    d    ; save DE
  2429.     call    eval16    ; assume hex and evaluate
  2430.     xchg        ; number in HL
  2431.     pop    d
  2432.     mvi    a,0ffh    ; OK
  2433.     ora    a
  2434.     ret
  2435.  
  2436. ;
  2437. ;  Get File Name into Buffer pted to by DE
  2438. ;
  2439. getfname:
  2440.     mvi    a,0ffh    ; capitalize
  2441.     call    bbline    ; input line
  2442.     ora    a    ; noname permitted
  2443.     rz
  2444.     push    d    ; save ptr
  2445.     lxi    d,dfcb    ; dummy fcb
  2446.     call    fname    ; extract file name info
  2447.     jnz    stlrz1
  2448.     pop    d    ; get ptr
  2449.     call    print
  2450.     db    cr,lf,'Input Error -- Reenter'
  2451.     db    cr,lf,'File Name? ',0
  2452.     jmp    getfname
  2453. stlrz1:
  2454.     pop    d        ; get ptr to buffer
  2455.     lxi    h,dfcb+1    ; pt to file name
  2456.     mvi    b,11        ; 11 bytes
  2457.     call    moveb        ; copy file name into buffer
  2458.     mvi    a,0ffh        ; OK
  2459.     ora    a
  2460.     ret
  2461.  
  2462.     end
  2463.