home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol077 / nzcpr-16.dif < prev    next >
Encoding:
Text File  |  1984-04-29  |  23.9 KB  |  874 lines

  1. 1,16c 0
  2.     TITLE    'NZCPR V 1.6 OF 08/03/82'
  3. ;
  4. ;  CP/M Z80 Command Processor Replacement (CPR) Version 1.6 in
  5. ; the NZCPR line.
  6. ;
  7. ;    CCPZ CREATED AND CUSTOMIZED FOR ARIES-II BY RLC
  8. .
  9. 16c 62983
  10. ;    The following individuals also provided a contribution:
  11. .
  12. 18a 39299
  13. ;  Since RLC has decided that ZCPR V1.0 is the last official version
  14. ; sanctioned by the CCPZ group, changes beyond that point are being
  15. ; called by consensus of a group of new changers "NZCPR Vx.x". The
  16. ; following individuals have put in their code or opinions:
  17. ;
  18. ;        SBB - Steve Bogolub
  19. ;        PST - Paul Traina
  20. ;        HLB - Howard Booker
  21. ;        CAF - Chuck Forsberg
  22. ;        RAF - Bob Fischer
  23. ;        BB  - Ben Bronson
  24. ;        PRG - Paul Grupp
  25. ;        PJH - Paul Homchick
  26. ;        HEW - Hal Walchli
  27. ;
  28. ;   In an attempt to maintain a link to the past, changes between the
  29. ; current version of NZCPR are provided as both a difference file
  30. ; between NZCPR's (NZ14-16.DIF) and as a difference between the current
  31. ; version and the "official" ZCPR V1.0 (NZCPR-16.DIF).  These changes
  32. ; are made and supported by individuals in contact with each other through
  33. ; the Hyde Park RCPM in Chicago. Make comments or complaints there, to
  34. ; SBB or PST or anyone else interested.
  35. ;
  36. ;   The most obvious differences between NZCPR and ZCPR are the security
  37. ; features, controlled by additional conditional assembly flags. Such
  38. ; features restrict access to ZCPR intrinsic commands, add additional
  39. ; levels of .COM file searching, and prevent access to higher drives
  40. ; or user levels, with either internal or external password control of
  41. ; these features. Less obvious differences involve code optimization to
  42. ; gain space, and some minor bug fixes in the TYPE command.
  43. .
  44. 67c 8490
  45. ;            PRNNF    CMDTBL
  46. .
  47. 75c 33828
  48. ;            RESETUSR GETUSR    SETUSR    PAGER    UCASE
  49. ;            NOECHO
  50. .
  51. 79c 14196
  52. ;            SETUD    SETU0D    REDBUF    CNVBUF    CMDSER
  53. .
  54. 83d 133
  55. 88c 58521
  56. ;     5D        TYPE
  57. .
  58. 96a 21695
  59. ;     5M        PASS    NORM
  60. .
  61. 110a 2189
  62. ;    SECURE -  TRUE to conditionally disable potentially-harmful
  63. ;           commands (GO, ERA, SAVE, REN, DFU, GET, JUMP). Under
  64. ;           SECURE, if WHEEL contains RESTRCT, do not accept those
  65. ;           commands, and search for COM files under current user
  66. ;           then user "DEFUSR" only. If WHEEL does not contain
  67. ;           RESTRCT (presumably from passworded change), allow
  68. ;           all commands, and search current user, then last user
  69. ;           set by DFU (originally "RESUSR"), then user "DEFUSR"
  70. ;           for COM files, giving access with password to an
  71. ;           additional level of COM files.
  72. ;
  73. ;           (Note: WHEEL must point to a safe place in memory that
  74. ;        won't be overlayed)
  75. ;
  76. ;    If you have chosen a SECURE system,  all resident commands may be
  77. ; activated by entering:  PASS <password> <cr>  Where <password> is a sequence
  78. ; of characters placed at PASSID (if INPASS is true, otherwise, see
  79. ; documentation in PST's PASS.ASM).  If the password is incorrect. the system
  80. ; will come back with PASS? as if it was looking for a COM file.
  81. ;    NORM is the reverse of PASS, it will disable the WHEEL mode.
  82. ;
  83. ;    INPASS -  If in the SECURE mode, you wish to use a program similar
  84. ;           to PST's PASS.ASM, set this false, otherwise, ZCPR will
  85. ;           handle the PASSword coding with a built in command.
  86. ;
  87. ;    DRUSER -  Set this EQU false if you wish to disable RAF's neat hack
  88. ;           that allows you the type B: 7 to move to drive B: user area
  89. ;           seven.  This also removes the USER command.  Basically, set
  90. ;           this equate false if you want to use USERPW or some other pgm.
  91. ;
  92. ;    RAS    -  Remote-Access System; setting this equate to TRUE disables
  93. ;           certain CPR commands that are considered harmful in a Remote-
  94. ;           Access environment; use under Remote-Access Systems (RBBS) for
  95. ;           security purposes.  Note: SECURE is the direct enemy of RAS,
  96. ;           DON'T define both equates or you will be VERY sorry.
  97. ;           The advantage SECURE has over RAS is that by saying a magic
  98. ;           word, all of the normal commands pop into existance.
  99. ;
  100. ;    MAXDRIV - Maximum legal drive number stored in this location.
  101. ;           (0 means only A:, etc.)  0000H disables this feature.
  102. ;           The value MAXDR is stuffed into MAXDRIV at cold boot,
  103. ;           and presumably will be changed later by a passworded
  104. ;           program if desired.
  105. ;
  106. ;           (This code is in addition to BIOS checks. It's needed here
  107. ;           because X: can hang if X: is off line in some BIOS
  108. ;           implementations. Personally, I think CAF and others should fix
  109. ;           their BIOS instead. Mine works right...SBB).
  110. ;
  111. ;    USRMAX -  Maximum legal user # + 1 stored in this location. 0000H
  112. ;           disables this feature, and uses the value of MAXUSR+1 instead.
  113. ;
  114. .
  115. 174,177c 45022
  116. ;    EPRMPT - Set TRUE to be prompted "OK?" after seeing what files will
  117. ;          be erased. No, this is NOT for individual file prompting,
  118. ;          it is just to confirm deletion of all selected files at once.
  119. ;
  120. ;  Various individuals keep trying to yank out the TYPE, LIST, and DIR
  121. ; commands, either to use the space for other options or just because
  122. ; they prefer replacement COM files. To these individuals, I (SBB) say
  123. ; keep your paws off these commands. For compatibility with the stock
  124. ; CCP, intrinsic DIR and TYPE commands are required. And many users in
  125. ; MY neighborhood find it more convenient to use the intrinsic LIST
  126. ; command than to have a LIST/PRINT program on every disk. If you want
  127. ; to call a transient program by an intrinsic, then CHANGE THE INTRINSIC
  128. ; NAME IN THE TABLE. Even setting the name to blanks is fine to get
  129. ; rid of it. The point is, don't remove features others may want, just
  130. ; because you disagree, then throw it back in our laps. For those who
  131. ; simply MUST be rid of these commands, the following symbols control
  132. ; generation of the code in a CLEAN ACCEPTABLE fashion that allows
  133. ; others to have these features:
  134. ;
  135. ;    CPRTYP -    Set to TRUE to generate code for intrinsic TYPE command.
  136. ;
  137. ;    WSTYPE -    Set to TRUE to generate an extra three lines of code
  138. ;        to correctly interpret the WordStar (tm) internal
  139. ;        end of line hyphen for display, which is the ASCII
  140. ;        NEWLINE code (1FH) and normally non-printing or
  141. ;        troublemaking -- thanks to PJH for this one. CPRTYP
  142. ;        must be TRUE, or this symbol will be ignored.
  143. ;
  144. ;    CPRLST -    Set to TRUE to generate code for intrinsic LIST command.
  145. ;        Since almost all of the LIST code is common to the
  146. ;        TYPE code, CPRTYP must be set TRUE as well, or this
  147. ;        symbol will be ignored.
  148. ;
  149. ;    CPRDIR -    Set to TRUE to generate code for intrinsic DIR command.
  150. ;        Note that unlike the various directory programs, a
  151. ;        restricted DIR command here allows displaying the names
  152. ;        of SYS file ONLY, so many RCPM operators WANT this code.
  153. ;
  154. ;  Remember, you only get a total of 2048 (0800H) bytes of space for
  155. ; ALL of the generated code, or many other areas of your system
  156. ; generation will be affected. For example, to be fully SECURE, you
  157. ; would set SECURE to TRUE, and define MAXDRIV and USRMAX, and maybe
  158. ; use the internal password by setting INPASS to TRUE (external is
  159. ; MUCH recommended for easier modification). Those options absolutely
  160. ; generate too much code unless either CPRTYP or CPRDIR or both are
  161. ; set FALSE. A system with SECURE set to FALSE is right on the edge,
  162. ; and requires a give and take on options to fit, i.e. you can have
  163. ; MAXDRIV and USRMAX with DIR and TYPE if you leave out LIST and
  164. ; querying on ERASE, and so on.
  165. ;
  166. ***************************************************************************
  167. ** Be careful when playing with different combinations of these equates. **
  168. ** You might not have enough memory to some combinations.  Check this    **
  169. ** if you have problems, if they still persist, gripe to me (PST).       **
  170. ***************************************************************************
  171. .
  172. 242,244c 54642
  173. MSIZE    EQU    56    ;SIZE OF MEM IN K-BYTES
  174. BIOSEX    EQU    2    ;EXTRA # K-BYTES IN BIOS
  175. CPRLOC    EQU    3400H+(MSIZE-20-BIOSEX)*1024    ;CPR ORIGIN
  176. .
  177. 248,250c 5792
  178. ; to that value as in the following line:
  179. ;
  180. ;CPRLOC    EQU    0DA00H    ;FILL IN WITH BDOSLOC SUPPLIED VALUE
  181. .
  182. 259,260c 25363
  183. ; CCP in YOUR CP/M system; several systems (Morrow Designs, P&T, Heath
  184. ; Org-0 to name a few) have the CCP located at a non-standard address in
  185. .
  186. 263,264c 35576
  187. ;CPRR    EQU    0E00H-CPRLOC    ;DDT LOAD OFFSET FOR APPLE SOFTCARD 56K
  188. CPRR    EQU    0980H-CPRLOC    ;DDT LOAD OFFSET
  189. ;CPRR    EQU    1600H-CPRLOC    ;DDT LOAD OFFSET FOR COMPUPRO DISK-1
  190. ;CPRR    EQU    1100H-CPRLOC    ;DDT LOAD OFFSET FOR MORROW DESIGNS
  191. .
  192. 269a 21005
  193.             ;AND YOU DON'T WANT TO RUN SECURE (FOO...)
  194. ;
  195. USRMAX    EQU    0000H        ;LOCATION OF BYTE IN MEMORY CONTAINING
  196.                 ; NUMBER OF HIGHEST ALLOWABLE USER CODE + 1
  197.                 ; THIS VALUE IS SET BY CPR ON COLD BOOT,
  198.                 ; AND PRESUMABLY CONTROLLED AFTER THAT
  199.                 ; BY A PASSWORD PROGRAM. IF USRMAX=0, THEN
  200.                 ; MAXUSR BELOW IS USED FOR CHECKING ONLY.
  201.                 ; 03FH IS RECOMMENDED IF USED  ***
  202. MAXUSR    EQU    15        ;MAX ALLOWED USER NUMBER, THIS + 1 IS STUFFED
  203.                 ; INTO USRMAX ON COLD BOOT, OR USED DIRECTLY
  204.                 ; IF USRMAX=0
  205. ;
  206. MAXDRIV    EQU    0000H    ;LOCATION THAT HAS MAX LEGAL DRIVE #
  207.             ;SET IT TO ZERO TO DISABLE THIS CHECK
  208.             ;03DH IS RECOMMENDED IF USED ***
  209. MAXDR    EQU    1    ;MAX DRIVE # TO SET INTO MAXDRIV ON COLD BOOT
  210. ;
  211. SECURE    EQU    FALSE    ;SET TRUE FOR SECURE ENVIRONMENT...
  212. ;
  213. DEFUSR    EQU    0        ;DEFAULT USER FOR UNRESTRICTED COM FILES
  214. ;
  215.     IF    SECURE
  216. WHEEL    EQU    3EH    ;SET TO "RESTRCT" FOR LIMITED ACCESS
  217. RESTRCT EQU    0    ;WHEN (WHEEL)==RESTRCT, LIMIT COMMANDS
  218. RESUSR    EQU    15    ;CHECK HERE FOR RESTRICTED ACCESS COM FILES (LIKE PIP)
  219.             ; UNTIL CHANGED BY DFU OR WARM BOOT
  220.     ENDIF    ;SECURE
  221. ;
  222. INPASS    EQU    FALSE    ;SET TRUE IF RUNNING SECURE AND NOT PASS.COM
  223. ;
  224. DRUSER    EQU    TRUE    ;TRUE TO ALLOW USER COMMAND AND DRIVE/USER HACK
  225. ;
  226. EPRMPT    EQU    FALSE    ;TRUE TO PROMPT BEFORE ERASING ALL FILES
  227. ;
  228. CPRTYP    EQU    TRUE    ;TRUE TO GENERATE TYPE CODE
  229. WSTYPE    EQU    TRUE    ;TRUE TO GENERATE WORDSTAR HYPHEN CHECK (CPRTYP
  230.             ; MUST BE TRUE TOO)
  231. CPRLST    EQU    TRUE    ;TRUE TO GENERATE LIST CODE (CPRTYP MUST BE TRUE TOO)
  232. CPRDIR    EQU    TRUE    ;TRUE TO GENERATE DIR CODE
  233. ;
  234. ;  ***  Note to Apple Softcard Users  ***
  235. ;
  236. ;  In their infinite (?) wisdom (???), Microsoft decided that the way to
  237. ; get a two-column directory display instead of four-column (narrow 40-col
  238. ; screen, remember) was to have their BIOS poke CCP every time it was
  239. ; loaded, if there was no terminal interface card in I/O slot 3.
  240. ; Naturally, that will turn into a random poke on any non-standard
  241. ; CCP, like this one.  The best way to get this CPR up on the Apple is to
  242. ; load it into CPM56.COM, at location 0E00H in the image.  The BIOS code
  243. ; that pokes the CPR can also be modified at that time.  The poke is done
  244. ; by "STA 0C8B2H", found at 24FEH in the CPM56 image.  To keep this
  245. ; feature, change the 0C8B2H address in that instruction by hand to
  246. ; the value generated for the symbol TWOPOK in the DIR routine.  If
  247. ; you have assembled out the DIR code by setting CPRDIR to FALSE, then
  248. ; disable this feature by changing the "STA" to "LDA", i.e. set the
  249. ; contents of location 24FEH from 32H to 3AH. If you wish to force
  250. ; a two-column display in all cases, set the TWOCOL switch below to a
  251. ; value of TRUE, and disable the poke.
  252. ;
  253. TWOCOL    EQU    FALSE        ;TRUE IF TWO COL DIR INSTEAD OF FOUR
  254. .
  255. 339a 46920
  256. ;
  257. .
  258. 346a 11745
  259. ;
  260. .
  261. 349a 8967
  262. ;
  263. .
  264. 357a 36504
  265. ;
  266. .
  267. 361a 37881
  268. ;
  269. .
  270. 365a 39543
  271. ;
  272. .
  273. 374c 64501
  274. SUBA    EQU    TRUE     ; Set to TRUE to have $$$.SUB always on A:
  275. .
  276. 378,379c 61815
  277. ; command lines.  This is for Command Level 3 of ZCPR.  Under the current
  278. ; ZCPR philosophy, three command levels exist:
  279. ;
  280. .
  281. 384c 19501
  282. ;        CIBUFF and setting the character count in CBUFF
  283. ;
  284. .
  285. 394c 12753
  286. CLEVEL3    EQU    TRUE        ;ENABLE COMMAND LEVEL 3 PROCESSING
  287. .
  288. 407,408d 22087
  289. 413,414d 41275
  290. 425a 559
  291. FFEED    EQU    0CH
  292. BEL    EQU    07H
  293. .
  294. 529a 11442
  295. ;
  296. .
  297. 535c 23153
  298. ;
  299. ;    NOTE:  Entry into ZCPR in this way is permitted under this version,
  300. .
  301. 541,549c 60847
  302. ;
  303. ;    Some user programs (such as SYNONYM3) attempt to use the default
  304. ; command facility.  Under the original CCP, it was necessary to initialize
  305. ; the pointer after the reserved space for the command buffer to point to
  306. ; the first byte of the command buffer.  Under current versions, this is
  307. ; no longer the case.  The CIBPTR (Command Input Buffer PoinTeR) is located
  308. ; to be compatible with such programs (provided they determine the buffer
  309. ; length from the byte at MBUFF [CPRLOC + 6]), but under ZCPR this is
  310. ; no longer necessary, since this buffer pointer is automatically
  311. ; initialized in all cases.
  312. .
  313. 553,555c 65249
  314.     JMP    CPR    ; Process potential default command, and set
  315.             ; USRMAX to MAXUSR default
  316.     JMP    CPR1    ; Do NOT process potential default command
  317. ;    
  318. .
  319. 560a 22919
  320. ;
  321. .
  322. 564,569c 3849
  323. ;
  324. ;    (1) by the user entering it through the BDOS READLN function at
  325. ;        the du> prompt [user input from keyboard]
  326. ;    (2) by the SUBMIT File Facility placing it there from a $$$.SUB
  327. ;        file
  328. ;    (3) by an external program or user placing the required command
  329. ;        into this buffer
  330. ;
  331. .
  332. 582c 61503
  333. ; to have the command processed.  Again, under the current ZCPR, it is not
  334. .
  335. 584a 52688
  336. ;
  337. .
  338. 596c 21830
  339.     DB    '              '    ;DEFAULT (COLD BOOT) COMMAND
  340. ;
  341. ;  The copyright notice from Digital Research is genned into the
  342. ; stock CCP at this location. It should be maintained in ZCPR,
  343. ; since Digital Research grants permission for ZCPR to exist.
  344. ;
  345.     DB    '  COPYRIGHT (C) 1979, DIGITAL RESEARCH  '
  346. .
  347. 604a 12391
  348.     DB    'NZCPR V 1.6 of 08/03/82 ' ;ZCPR ID FOR DISK DUMP
  349. .
  350. 611c 60170
  351.     DW    CIBUF        ;POINTER TO CURR COMMAND FOR
  352.                 ; ERROR REPORTING
  353. .
  354. 645d 28747
  355. 670,705d 64726
  356. 672c 21646
  357. ; CPR STARTING POINTS.  NOTE THAT SOME CP/M IMPLEMENTATIONS
  358. ; REQUIRE THE COLD START ADDRESS TO BE IN THE STARTING PAGE
  359. ; OF THE CPR, FOR DYNAMIC CCP LOADING.  CMDTBL WAS MOVED FOR
  360. ; THIS REASON.
  361. ;
  362. ; SET USRMAX AND/OR MAXDRIV TO DEFAULT VALUES ON COLD BOOT
  363. ; IF REQUIRED. NOTE THAT SOME BIOS IMPLEMENTATIONS WILL END
  364. ; UP HERE INSTEAD OF AT THE WARM BOOT, DEFEATING PASSWORDING
  365. ; OF THESE OPTIONS. RECOMMEND SUCH A BIOS BE FIXED.
  366. ;
  367.     IF    USRMAX OR MAXDRIV
  368. CPR:
  369.     IF    USRMAX
  370.     MVI    A,MAXUSR+1    ;SET USRMAX ON COLD BOOT
  371.     STA    USRMAX
  372.     ENDIF    ;USRMAX
  373. ;
  374.     IF    MAXDRIV
  375.     MVI    A,MAXDR        ;SET MAXDRIV ON COLD BOOT
  376.     STA    MAXDRIV
  377.     ENDIF    ;MAXDRIV
  378. ;
  379.     JR    CPR2        ; THEN PROCEED
  380.     ENDIF    ;USRMAX OR MAXDRIV
  381. .
  382. 711c 52498
  383.     IF    USRMAX OR MAXDRIV
  384. CPR2:
  385.     ELSE
  386. CPR:
  387.     ENDIF    ;USRMAX OR MAXDRIV
  388. ;
  389. .
  390. 836a 62900
  391. ; CPR BUILT-IN COMMAND TABLE
  392. ;
  393. NCHARS    EQU    4        ;NUMBER OF CHARS/COMMAND
  394. ;
  395. ; CPR COMMAND NAME TABLE
  396. ;   EACH TABLE ENTRY IS COMPOSED OF THE 4-BYTE COMMAND AND 2-BYTE ADDRESS
  397. ;
  398. CMDTBL:
  399. ;
  400.     IF    INPASS AND SECURE
  401.     DB    'PASS'            ;ENABLE WHEEL (SYSOP) MODE
  402.     DW    PASS
  403.     ENDIF    ;INPASS AND SECURE
  404. ;
  405.     IF    DRUSER
  406.     DB    'USER'            ;CHANGE USER AREAS
  407.     DW    USER
  408.     ENDIF    ;DRUSER
  409. ;
  410.     IF    CPRTYP
  411.     DB    'TYPE'            ;TYPE A FILE TO CON:
  412.     DW    TYPE
  413.     ENDIF    ;CPRTYP
  414. ;
  415.     IF    CPRDIR
  416.     DB    'DIR '            ;PULL A DIRECTORY OF DISK FILES
  417.     DW    DIR
  418.     ENDIF    ;CPRDIR
  419.  
  420. NRCMDS    EQU    ($-CMDTBL)/(NCHARS+2)    ;PUT ANY COMMANDS THAT ARE OK TO
  421.                     ;RUN WHEN NOT UNDER WHEEL MODE
  422.                     ;IN FRONT OF THIS LABEL
  423.     IF    CPRLST AND CPRTYP
  424.     DB    'LIST'            ;LIST FILE TO PRINTER
  425.     DW    LIST
  426.     ENDIF    ;CPRLST AND CPRTYP
  427. ;
  428.     IF    INPASS AND SECURE
  429.     DB    'NORM'            ;DISABLE WHEEL MODE
  430.     DW    NORM
  431.     ENDIF    ;INPASS AND SECURE
  432. ;
  433.     IF    NOT RAS        ;FOR NON-RAS
  434.     DB    'GO  '            ;JUMP TO 100H
  435.     DW    GO
  436.     DB    'ERA '            ;ERASE FILE
  437.     DW    ERA
  438.     DB    'SAVE'            ;SAVE MEMORY IMAGE TO DISK
  439.     DW    SAVE
  440.     DB    'REN '            ;RENAME FILE
  441.     DW    REN
  442.     DB    'DFU '            ;SET DEFAULT USER
  443.     DW    DFU
  444.     DB    'GET '            ;LOAD FILE INTO MEMORY
  445.     DW    GET
  446.     DB    'JUMP'            ;JUMP TO LOCATION IN MEMORY
  447.     DW    JUMP
  448.     ENDIF    ;RAS
  449. ;
  450. NCMNDS    EQU    ($-CMDTBL)/(NCHARS+2)
  451. ;
  452. .
  453. 914a 51203
  454.     ANI    7FH    ;PREVENT INADVERTANT GRAPHIC OUTPUT
  455.             ; TO EPSON-TYPE PRINTERS
  456. .
  457. 927,929c 34082
  458. ;
  459. ; CONVERT CHAR IN A TO UPPER CASE
  460. ;
  461. UCASE:
  462.     CPI    61H        ;LOWER-CASE A
  463.     RC
  464.     CPI    7BH        ;GREATER THAN LOWER-CASE Z?
  465.     RNC
  466.     ANI    5FH        ;CAPITALIZE
  467.     RET
  468. ;
  469. NOECHO:
  470.     PUSH    D    ;SAVE D
  471.     MVI    C,6    ;DIRECT CONSOLE I/O
  472.     MVI    E,0FFH    ;INPUT
  473.     CALL    BDOSB
  474.     POP    D
  475.     ORA    A    ;DID WE GET A CHAR?
  476.     JRZ    NOECHO    ;WAIT FOR IT IF NOT, IT'S EXPECTED
  477.     RET
  478. ;
  479.     IF    CPRTYP
  480. LCOUT:
  481.     ENDIF    ;CPRTYP
  482. ;
  483.     IF    CPRTYP AND CPRLST
  484. .
  485. 967a 17482
  486.     ENDIF    ;CPRTYP AND CPRLST
  487. ;
  488.     IF    CPRTYP
  489. .
  490. 975,976c 15925
  491.     RNZ            ;DONE IF NOT EOL YET
  492. ;
  493. ;  COUNT DOWN LINES AND PAUSE FOR INPUT (DIRECT) IF COUNT EXPIRES
  494. ;
  495.     PUSH    H
  496.     LXI    H,PAGCNT    ;COUNT DOWN
  497.     DCR    M
  498.     JRNZ    PGBAK        ;JUMP IF NOT END OF PAGE
  499.     MVI    M,NLINES-2    ;REFILL COUNTER
  500. ;
  501. PGFLG    EQU    $+1        ;POINTER TO IN-THE-CODE BUFFER PGFLG
  502.     MVI    A,0        ;0 MAY BE CHANGED BY PGFLG EQUATE
  503.     CPI    PGDFLG        ;PAGE DEFAULT OVERRIDE OPTION WANTED?
  504. ;
  505.     IF    PGDFLT        ;IF PAGING IS DEFAULT
  506.     JRZ    PGBAK        ;  PGDFLG MEANS NO PAGING, PLEASE
  507.     ELSE            ;IF PAGING NOT DEFAULT
  508.     JRNZ    PGBAK        ;  PGDFLG MEANS PLEASE PAGINATE
  509.     ENDIF
  510. ;
  511.     CALL    NOECHO        ;GET CHAR BUT DON'T ECHO TO SCREEN
  512.     CPI    'C'-'@'     ;^C
  513.     JZ    RSTCPR        ;RESTART CPR
  514. PGBAK:
  515.     POP    H        ;RESTORE HL
  516.     RET
  517.     ENDIF    ;CPRTYP
  518. .
  519. 1017c 57438
  520. ; PRINT STRING ENDING WITH ZERO BYTE OR CHAR WITH HIGH BIT SET
  521. ; PT'ED TO BY RET ADDR, START WITH <CR><LF>
  522. .
  523. 1033c 30039
  524. ; PRINT STRING ENDING WITH ZERO BYTE OR CHAR WITH HIGH BIT SET
  525. ; PT'ED TO BY HL
  526. .
  527. 1069c 20763
  528.     MOV    E,A        ;MOVE DESIRED # TO BDOS REG
  529. ;
  530.     IF    MAXDRIV
  531.     LDA    MAXDRIV        ;CHECK FOR LEGAL DRIVE #
  532.     CMP    E
  533.     JC    ERROR        ;DON'T DO IT IF TOO HIGH
  534.     ENDIF    ;MAXDRIV
  535. ;
  536. .
  537. 1161,1170d 5475
  538. 1258,1261c 39484
  539. USRNUM:        
  540.     CALL    NUMBER
  541. ;
  542.     IF    USRMAX
  543.     LXI    H,USRMAX ;PT TO MAXUSR + 1
  544.     CMP    M    ;NEW VALUE ALLOWED?
  545.     ELSE
  546.     CPI    MAXUSR+1 ;NEW VALUE ALLOWED?
  547.     ENDIF    ;USRMAX
  548. ;
  549.     RC        ;RETURN TO CALLER IF SO,
  550.             ; ELSE FLAG AS ERROR
  551. .
  552. 1619a 52360
  553. ;
  554.     IF    SECURE
  555.     MVI    C,NRCMDS
  556.     LDA    WHEEL        ;SEE IF NON-RESTRCTED
  557.     CPI    RESTRCT
  558.     JRZ    CMS1        ;PASS IF RESTRCTED
  559.     ENDIF    ;SECURE
  560. ;
  561. .
  562. 1665a 35033
  563.     IF    CPRDIR
  564. ;
  565. .
  566. 1698,1699c 62053
  567.     ENDIF    ;CPRDIR
  568. ;
  569. ; DIRECTORY PRINT ROUTINE; ON ENTRY, MSB OF A IS 1 (80H) IF SYSTEM FILES
  570. ; EXCLUDED. THIS ROUTINE IS ALSO USED BY ERA.
  571. .
  572. 1734c 52533
  573. ;
  574.     IF    TWOCOL
  575.     ANI    01H        ;OUTPUT <CRLF> IF 2 ENTRIES PRINTED IN LINE
  576.     ENDIF    ;TWOCOL
  577. ;
  578.     IF    NOT TWOCOL
  579. TWOPOK    EQU    $+1        ;FOR APPLE PATCHING
  580.     ANI    03H        ;OUTPUT <CRLF> IF 4 ENTRIES PRINTED IN LINE
  581.     ENDIF    ;NOT TWOCOL
  582. ;
  583. .
  584. 1829a 52815
  585. ERARJ:
  586. .
  587. 1838,1840c 59149
  588. ;
  589.     IF    EPRMPT
  590. ;
  591. ;  QUERY USER AFTER FILES ARE SEEN, AND GIVE ONE LAST CHANCE TO BACK OUT
  592. ;
  593.     MOV    A,E        ;HOW MANY FILES DISPLAYED?
  594.     ORA    A
  595.     JZ    RESTRT        ;IF NONE, DON'T ASK OR DELETE
  596.     CALL    PRINTC        ;PROMPT
  597.     DB    'Ok','?'+80H
  598.     CALL    CONIN        ;GET REPLY FOLDED
  599.     CPI    'Y'        ;YES?
  600.     JRNZ    ERARJ        ;GET OUT IF NOT
  601.     ENDIF    ;EPRMPT
  602. ;
  603.     LXI    D,FCBDN     ;DELETE FILE(S) SPECIFIED
  604.     JMP    DELETE        ;RESTART CPR AFTER DELETE
  605. .
  606. 1863a 59255
  607.     IF    CPRLST
  608. .
  609. 1867a 43830
  610.     ENDIF    ;CPRLST
  611. .
  612. 1877c 16742
  613.     IF    CPRTYP
  614. TYPE:
  615.     ENDIF    ;CPRTYP
  616. ;
  617.     IF    CPRTYP AND CPRLST
  618. .
  619. 1887a 53321
  620.     ENDIF    ;CPRTYP AND CPRLST
  621. ;
  622.     IF    CPRTYP
  623. .
  624. 1931,1943c 54106
  625.     IF    WSTYPE        ;WORDSTAR HYPHEN CHECK
  626.     CPI    1FH        ;IS CHAR WORDSTAR EOL HYPHEN?
  627.     JRNZ    NOHYPH        ;PASS IF NOT
  628.     MVI    A,'-'        ;YES, MAKE IT A REAL HYPHEN
  629. NOHYPH:
  630.     ENDIF    ;WSTYPE
  631. ;
  632.     CPI    ' '        ;IS CHAR CONTROL CODE?
  633.     JRNC    PRT        ;GO BOP CHAR COUNT AND PRINT IF NOT
  634.     CPI    CR        ;IS CHAR A CR?
  635.     JRZ    YESCR        ;IF SO, GO ZERO B THEN PRINT
  636.     CPI    FFEED        ;FORM FEED?
  637.     JRZ    YESCR        ;MANY PRINTERS RETURN CARRIAGE ON THIS
  638.     CPI    LF        ;LINE FEED?
  639.     JRZ    NOBOP        ;PRINT, BUT DON'T BOP B
  640.     CPI    BEL        ;BELL?
  641.     JRZ    NOBOP        ;GO RING BUT DON'T BOP B
  642.     CPI    TAB        ;TAB?
  643.     JRNZ    TYPE2L        ;IF NOT, NO OTHER CHOICES, TOSS CONTROL
  644. .
  645. 1956a 12864
  646.     JR    TYPE2L
  647. ;
  648. YESCR:    MVI    B,0FFH        ;COMBINE WITH INC BELOW TO GET ZERO
  649. ;
  650. PRT:    INR    B        ;INCREMENT CHAR COUNT
  651. NOBOP:    CALL    LCOUT        ;PRINT IT
  652. .
  653. 1965a 58295
  654. ;
  655. .
  656. 1978,2005c 23034
  657.     ENDIF    ;CPRTYP
  658. .
  659. 2030,2031c 65371
  660.     JRZ    SAVE1        ;CONTINUE IF NO WRITE ERROR
  661.     JR    PRNLE        ;GO PRINT ERROR AND RESET DMA
  662. .
  663. 2036,2041c 64352
  664.     JRNZ    SAVE3        ;PASS IF OK
  665. ;
  666. ;  PRNLE IS ALSO USED BY MEMLOAD FOR TPA FULL ERROR
  667. ;
  668. PRNLE:    CALL    PRINTC        ;DISK OR MEM FULL
  669.     DB    'Ful','l'+80H
  670. ;
  671. SAVE3:    JMP    DEFDMA        ;SET DMA TO 0080 AND RESTART CPR
  672.                 ; OR RETURN TO MLERR
  673. .
  674. 2062c 7499
  675.     JNZ    RSTCPR        ;RESTART IF NO, SP RESET EVENTUALLY
  676. .
  677. 2126a 24593
  678.     IF    DRUSER        ;IF DRIVE/USER CODE OK...
  679. .
  680. 2131c 54641
  681. SUSER:    CALL    SETUSR        ;SET SPECIFIED USER
  682.     ENDIF    ;DRUSER
  683. .
  684. 2139a 40238
  685. ;        Note: When under SECURE mode, this will select the second
  686. ;              user area to check for programs (normally user 15).
  687. ;
  688. .
  689. 2145a 41253
  690.     IF    NOT RAS        ;NOT FOR REMOTE-ACCESS SYSTEM
  691. .
  692. 2150a 26118
  693.     ENDIF    ;NOT RAS
  694. .
  695. 2170a 18976
  696.  
  697. .
  698. 2203a 47073
  699. ;
  700.     IF    DRUSER        ;DRIVE/USER HACKERY OK?
  701.     CALL    USRNUM        ;GET USER #, IF ANY
  702.     MOV    E,A        ;GET IT READY FOR BDOS
  703.     LDA    FCBFN        ;SEE IF # SPECIFIED
  704.     CPI    ' '
  705.     JRNZ    SUSER        ;SELECT IF WANTED
  706.     ENDIF    ;DRUSER
  707. ;
  708. .
  709. 2225,2226c 31871
  710.                 ; (NO RETURN IF ERROR OR TOO BIG)
  711.     POP    H        ;GET EXECUTION ADDRESS
  712. .
  713. 2229c 63411
  714. ;   PROGRAM. ON ENTRY TO THIS ROUTINE, HL MUST CONTAIN THE EXECUTION
  715. .
  716. 2251,2252c 61896
  717.     LXI    H,CIBUFF-1
  718. COM4:
  719.     INX    H
  720. .
  721. 2258,2260c 1077
  722.     JRNZ    COM4
  723. .
  724. 2263,2265c 10994
  725.     MVI    B,-1        ;SET CHAR COUNT
  726.     LXI    D,TBUFF        ;PT TO CHAR POS
  727.     DCX    H
  728. COM6:
  729.     INR    B        ;INCR CHAR COUNT
  730.     INX    H        ;PT TO NEXT
  731.     INX    D
  732. .
  733. 2273,2277c 55943
  734.     JRNZ    COM6
  735. .
  736. 2294,2304d 10203
  737. 2308c 20373
  738.     JNZ    ERROR        ;MUST BE UNAMBIGUOUS
  739. .
  740. 2317,2330c 11336
  741. ;  EXIT BACK TO CALLER IF NO ERROR.  IF COM FILE TOO BIG OR
  742. ; OTHER ERROR, EXIT DIRECTLY TO MLERR.
  743. ;
  744. MEMLOAD:
  745. .
  746. 2335,2336c 8949
  747.     IF    SECURE
  748. ;
  749. ;  IF SECURE ENABLED, SEARCH CURRENT DRIVE, CURRENT USER, THEN
  750. ; IF IN WHEEL MODE, SEARCH UNDER LAST USER SET BY DFU (ORIG
  751. ; "RESUSR" AFTER WARM BOOT) ON CURRENT DRIVE. IF NOT FOUND, OR
  752. ; NOT IN WHEEL MODE, THEN SEARCH ON CURRENT DRIVE, UNDER USER
  753. ; "DEFUSR". IF STILL NOT FOUND, LOOK AT SAME SERIES OF USERS
  754. ; ON DRIVE A.
  755. ;
  756. DFLAG    EQU    $+1        ;MARK IN-THE-CODE VARIABLE
  757.     MVI    A,0        ;HAVE WE CHECKED THIS DRIVE ALREADY?
  758.     ORA    A
  759.     JRNZ    MLA0        ;PASS IF SO TO GO TO DRIVE A:
  760.     LDA    WHEEL        ;RESTRICTED PROGS ALLOWED?
  761.     CPI    RESTRCT
  762.     JRZ    MLA00        ;PASS IF NOT
  763.     PUSH    B        ;PUSH BC
  764.     LDA    DFUSR        ;LOAD DEFAULT USER
  765.     MOV    B,A        ;PUT IT IN B
  766.     LDA    TSELUSR        ;CHECK CURR USER
  767. DFUSR    EQU    $+1        ;DEFAULT USER LOCATION
  768.     CPI    RESUSR        ;RESTRICTED USER?
  769.     MOV    A,B        ;ASSUME NOT
  770.     POP    B        ;RESTORE BC
  771.     JRNZ    SETTSE        ;GO TRY IF NOT
  772. MLA00:                ;SS IF NOT
  773. TSELUSR    EQU    $+1        ;MARK IN-THE-CODE VARIABLE
  774.     MVI    A,0        ;GET CURR USER
  775.     SUI    DEFUSR        ;IS IT UNRESTRICTED COM AREA?
  776.     JRZ    MLA0        ;NO MORE CHOICES IF SO
  777.     STA    DFLAG        ;MAKE DFLAG NON-ZERO IF NOT
  778.     MVI    A,DEFUSR    ; AND TRY UNRESTRICTED COM AREA
  779. SETTSE:
  780.     ENDIF    ;SECURE
  781. ;
  782.     IF    NOT SECURE
  783. .
  784. 2374,2376c 298
  785.     CPI    DEFUSR        ;CHECK FOR THE USER AREA..
  786.     JRZ    MLA0        ;..EQUAL DEFAULT, AND JUMP IF SO
  787.     ENDIF    ;NOT SECURE
  788. ;
  789.     STA    TSELUSR        ;PUT DOWN NEW ONE
  790. .
  791. 2388,2391c 8245
  792. ;
  793.     IF    SECURE
  794.     STA    DFLAG        ;ALLOW A: SEARCH
  795.     ENDIF    ;SECURE
  796. ;
  797.     ORA    M
  798.     JNZ    MLERR        ;ERROR IF ALREADY DISK A:
  799.     MVI    M,1        ;SELECT DRIVE A:
  800. ;
  801.     IF    NOT SECURE
  802.     JR    MLA
  803.     ENDIF    ;NOT SECURE
  804. ;
  805.     IF    SECURE
  806.     LDA    TMPUSR        ;GO TO 'CURRENT' USER CODE
  807.     JR    SETTSE
  808.     ENDIF    ;SECURE
  809. .
  810. 2409,2410c 6646
  811. LOADADR    EQU    $+1
  812.     LXI    H,TPA
  813. .
  814. 2414c 12366
  815.     JRC    ML4        ;ERROR IF SO
  816. .
  817. 2428,2437c 63695
  818.     JZ    RESETUSR    ;IF ZERO, OK, GO RESET CORRECT USER #
  819.                 ; ON WAY OUT, ELSE FALL THRU TO PRNLE
  820. ;
  821. ;  TPA FULL
  822. ;
  823. ML4:    CALL    PRNLE        ;PRINT MSG AND RESET DEF DMA
  824. ;
  825. ; TRANSIENT LOAD ERROR
  826. ;
  827. MLERR:
  828.         ;NOTE THAT THERE IS AN EXTRA RETURN ADDRESS ON
  829.         ; THE STACK.  IT WILL BE TOSSED WHEN ERROR EXITS
  830.         ; TO RESTRT, WHICH RELOADS SP.
  831.     CALL    RESETUSR    ;RESET CURRENT USER NUMBER
  832.                 ;  RESET MUST BE DONE BEFORE LOGIN
  833. ERRLOG:
  834.     CALL    DLOGIN        ;LOG IN DEFAULT DISK
  835.     JMP    ERROR        ;FLAG ERROR
  836. ;
  837. ;
  838. ;Section: 5M
  839. ;PASS:  Enable wheel mode.
  840. ;NORM:    Disable wheel mode.
  841. ;
  842. ;  Type PASS <password> <cr> to CP/M prompt to enter wheel mode.
  843. ; This code can be replaced with PST's PASS.ASM which gives many
  844. ; nice little options like no keyboard echo, etc.
  845. ;
  846.     IF    INPASS        ;WE WANT TO USE THIS CODE, NOT PASS.COM
  847. PASS:
  848.     LXI    H,PASSWD        ;SET UP POINTERS
  849.     LXI    D,CIBUFF+NCHARS+1
  850.     MVI    B,PRGEND-PASSWD        ;B= LENGTH
  851. CKPASS:    LDAX    D        ;TRIAL PW TO A
  852.     CMP    M        ;CHECK FOR MATCH
  853.     JNZ    COM        ;NOPE.. LOOK FOR PASS.COM
  854.     INX    H        ;INCREMENT COUNTER
  855.     INX    D
  856.     DJNZ    CKPASS        ;CONTINUE IF MORE
  857.     MVI    A,NOT RESTRCT    ;WHEEL = NOT RESTRCT
  858.  
  859. PWOUT:    STA    WHEEL
  860.     JMP    RESTRT
  861. ;
  862. NORM:
  863.     MVI    A,RESTRCT
  864.     JR    PWOUT
  865. ;
  866. PASSWD:
  867.     DB    'YOURPW'        ;YOUR PASSWORD
  868. PRGEND:    EQU    $            ;END OF PASSWORD
  869. ;
  870.     ENDIF    ;INPASS
  871. .
  872. $a 64465
  873. .
  874.