home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / mbug / mbug144.arc / EASE16.LBR / EASE.MZN / EASE.MAN
Text File  |  1979-12-31  |  45KB  |  1,999 lines

  1.                A short manual for Ease version 1.6
  2.                -----------------------------------
  3.  
  4. Contents:
  5.         Section 1:    Ease in general.
  6.         Section 2:    The editor.
  7.         Section 3:    The options.
  8.         Section 4:    Running in high memory.
  9.  
  10.                Section 1:
  11.  
  12.         What is this Ease program anyway?
  13.  
  14.   It's one piece of software that allows you to edit the commands
  15. that you are entering and have entered.  If you make a typo,
  16. you can go back and get the line right without retyping it.  If
  17. ZCPR33 encounters a problem with a command that you type, you can
  18. make whatever changes are necessary for it to be correct and
  19. then re-execute the line.
  20.  
  21. Ease is a shell which allows you to edit the command you're typing:
  22.  
  23.   Ease provides a bunch of commands that the BDOS line input
  24. function (what you use to send commands to ZCPR3 when you don't
  25. use Ease or HSH or VCED) doesn't have the smarts to.  Commands
  26. like word forward, word back, delete word or line or character. 
  27. In fact Ease provides a fairly large subset of the commands of
  28. whatever editor you are using to change documents (eg. WordStar,
  29. NewWord, Perfect Writer, Mince, etc.).  And whatever word
  30. processor you use, Ease can be made to use the same commands.
  31.  
  32. And to recall and edit the commands you have typed:
  33.  
  34.   Using Ease, you can step backward through your commands or
  35. search for a specific command, no matter how long ago it was
  36. typed.  You can then edit it and re-execute it.
  37.  
  38. Ease is an error handler because there isn't much to an error
  39. handler, other than an editor:
  40.  
  41.   The majority of the 4k that Ease takes up is its editor.  Or
  42. rather, if you took out all the text messages that the error 
  43. handler needs, it would be.  But an error handler's a real simple 
  44. thing, so making Ease an error handler as well as a shell was no 
  45. big thing.  And because it's all one program, it takes only one 
  46. file on your disk. 
  47.  
  48.                Section 2:
  49.  
  50.            I don't particularly like WordStar.
  51.  
  52.   Ease has a lot of code in it.  But the part which you actually
  53. have to deal with is the editor.  If that editor rubs you the
  54. wrong way, you won't like the program.  To insure that you 
  55. will like it, Ease provides you with a way of changing the 
  56. command keys.
  57.  
  58.   WordStar commands have become the standard for ZCPR3.  I think
  59. Emacs commands would be infinitely preferable.  I provide Ease
  60. with WordStar command keys, but I'd rather you set them to
  61. emulate whatever you're comfortable with than leave them in the
  62. state they're in.
  63.  
  64.   At the bottom of Ease (at the start of the program) is a list
  65. of commands and the keystrokes which make them happen.  By
  66. changing this table, you change Ease.
  67.  
  68. Actually patching:
  69.  
  70.   Use a patch program to change the Command file.  Steve Cohen's
  71. Z-Patch is very good.  Go to the first page and look what you
  72. see.
  73.  
  74.   Something akin to:
  75.     ...Z3ENV......EASE    VAR......Q..D..S..E..X..A..F..
  76.  
  77.   Period represents "Whatever".  Or in other words, I don't know 
  78. what you'll see where I put the periods.  It doesn't matter.  
  79. Most (not all) of the places where I put periods should NEVER be 
  80. changed.
  81.  
  82. The changeable stuff:
  83.   EASE    VAR......Q..D..S..E..X..A..F........G..H.....T.....R.....Y..U..B..
  84.   ^^^^^^^^^^^^ ^   ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^
  85.  
  86.   The changeable stuff starts at "EASE    VAR" (location 0Eh in
  87. relation to the start of the file).  That's the name of the
  88. command history file.  If you don't like it, change it.  Be sure
  89. to think out it as "FILENAMETYP" and not a file name as you type
  90. it at the ZCPR3 or Ease prompt.  Fill out the first eight
  91. characters of the name (padding with spaces if necessary) and
  92. then the 3 character type.
  93.  
  94.   The next changeable location is the byte following "VAR". 
  95. (Location 19h) It contains a 50 (hexidecimal, which is 80
  96. decimal) in the release version and represents the number of
  97. characters in a single line.  If you have a 40 column display,
  98. change this to 28.  If you have a 132 column display, change it
  99. to 84.
  100.  
  101.   The next number is a zero (At 1Ah)--it's padding for the screen 
  102. width number, just skip it.
  103.  
  104.   The number following this zero is a 2.  (At 1Bh) It represents 
  105. the length which a command must be to be stored in the history 
  106. file. If a command is two characters or less (as released), it 
  107. will be discarded.  You could make this number bigger or 
  108. smaller, depending on your preferences.  Smaller would include 
  109. drive changes (eg. B:) and bigger would exclude the more often 
  110. used commands (eg. DIR, CLS, etc.).
  111.  
  112.   The next number is another padding zero.  (At 1Ch) Just skip it.
  113.  
  114.   The number at 1Dh is the flag GOBEGFLG.  Set it to zero if 
  115. you want  he cursor at the end of a line when you use ^B or ^O or ^N.  
  116. Set it to 0FFh if ytou want the cursor at the begining of the line.
  117.  
  118.   1Eh is also a flag (BEEPFLG).  Set it to 0FFh to beep on an error, 
  119. zero to be silent.
  120.  
  121.   1Fh is the SMARTSAV flag.  Set it to 0FFh if you don't want to 
  122. save those commands which you called up with a ^O, ^B or ^N and 
  123. haven't modified.  Set it to zero if you want all commands saved.  
  124. With this set, you might be in a position when ^B would call up 
  125. something other than your last command typed.
  126.  
  127.   Skip the next three.  (20h, 21h, 22h) They will be used in 
  128. later versions of EASE.  Skip the next three as well, they describe 
  129. the command table.  (23h, 24h, 25h)
  130.  
  131.   And now we get to the three character Key/Command entries.  
  132. The first character is a letter, the second and third make up a 
  133. location (ie. a command).  You can change the character to 
  134. anything you want.
  135.  
  136. Byte:        --  Corresponds to:
  137. 'A'        --  ^A
  138. 'A' + 80h    --  (<Meta key> and ^A) or (<Meta key> and A)
  139. 7Fh        --  Delete key
  140.  
  141.   The Meta Key is the single prefix key you can use with Ease. 
  142. In Emacs emulations, the Meta key is usually escape.  In
  143. WordStar, it's ^Q for most of the functions that Ease uses.  So
  144. by A + 80h, we mean a sequence of characters, namely (in the
  145. distribution setup) ^Q ^A or ^Q A.
  146.  
  147.   The functions which you can set your keystrokes for are:
  148.  
  149. SHIFTED        -- Meta Key            (Location 26h)
  150. FCHR        -- Right Char            (29h)
  151. BCHR        -- Left Char            (2Ch)
  152. UP        -- Up line            (2Fh)
  153. DOWN        -- Down line            (32h)
  154. MBWORD        -- Left word            (35h)
  155. MFWORD        -- Right word            (38h)
  156. GOBOLN        -- Start of line        (3Bh)
  157. GOEOLN        -- End of line            (3Eh)
  158. FDEL        -- Del char right        (41h)
  159. DELCHR        -- Del char left        (44h)
  160. DELCHR        -- Del char left        (47h)
  161. FDWORD        -- Del word right        (4Ah)
  162. BDWORD        -- Del word left        (4Dh)
  163. CMDKILL        -- Kill to semi-colon        (50h)
  164. DELTOEND    -- Delete to end of line    (53h)
  165. DELLIN        -- Delete line            (56h)
  166. UNDO        -- Reinsert deleted text    (59h)
  167. BACKLINE    -- Back in history shell    (5Ch)
  168. NEXTLINE    -- Forward in history file    (5Fh)
  169. BSEARCH        -- Search for first char    (62h)
  170. TOGLIN        -- Toggle insert        (65h)
  171. ITAB        -- Insert Tab char        (68h)
  172. QINSERT        -- Insert any char        (6Bh)
  173. REPLOT        -- Redraw line            (6Eh)
  174. WARM        -- Warm Boot            (71h)
  175. DONE        -- End edit            (73h)
  176. QUITSH        -- End EASE            (76h)
  177.                                                 
  178.   After all that garbage is the punctuation (Location 74h), this
  179. is the stuff that word functions are going to consider
  180. non-letters.  It ends with and includes the Tab (At location 91h).
  181.  
  182.   So if you don't like the way that MFWORD goes about it's
  183. business with respect to (for instance) colons, just place a
  184. space over the colon.  Or if you want it to think that double
  185. quotes are punctuation, just put one on top of a character (maybe
  186. the backslash) that you don't want as punctuation.
  187.  
  188.  
  189.                Section 3:
  190.  
  191.    All right, never mind the keystrokes, what do the commands do?
  192.  
  193. Movement commands:
  194. ------------------
  195.  
  196. FCHR:        Forward one char.  If the cursor is at the end of
  197.         the line, it will "wrap" to the beginning of the line.
  198.  
  199. BCHR:        Backward one char.  If the cursor is at the
  200.         beginning of the line, it will "wrap" to the end
  201.         of the line.
  202.  
  203. UP:        Go back the number of characters in a screen line
  204.         (the release package comes set to 80 chars for a
  205.         line).  If there aren't enough chars to to up a
  206.         screen line, go to the beginning of the command line.
  207.  
  208. DOWN:        Go forward the number of chars in a screen line. 
  209.         If there aren't enough chars to go down a screen
  210.         line, go to the end of the command line.
  211.  
  212. MBWORD:        Move back a word.  Skip backwards over letters
  213.         until a punctuation character (usually including
  214.         space) is hit, then skip all punctuation until a
  215.         letter is hit.  Punctuation is setable (see
  216.         section 1).  "Wrap" if at beginning of line.
  217.  
  218. MFWORD:        Move forward a word.  "Wrap" if at end of line.
  219.  
  220. GOBOLN:        Go to beginning of command line.
  221.  
  222. GOEOLN:        Go to end of command line.
  223.  
  224. Deletion commands:        
  225. ------------------
  226.  
  227. FDEL:        Delete forward one character.
  228.  
  229. DELCHR:        Delete backward a character.  Two are supplied,
  230.         so Backspace and Delete may be used.
  231.  
  232. FDWORD:        Delete a word Forwards.
  233.  
  234. BDWORD:        Delete a word Backwards.
  235.  
  236. CMDKILL:    Delete all chars until end of line or semi-colon.
  237.  
  238. DELTOEND:    Delete until end of command line.
  239.  
  240. DELLIN:        Delete entire command line.
  241.  
  242. UNDO:        Insert chars from last line DELTOEND or DELLIN
  243.  
  244. Buffer Commands:
  245. ----------------
  246.  
  247. BACKLINE:    Put the current line in the kill buffer (so you
  248.         can bring it back with UNDO) and put the
  249.         previous line in the history buffer on your
  250.         screen.  If there is no previous line, the
  251.         console should Beep.
  252.  
  253. NEXTLINE:    Put the current line in the kill buffer (so you
  254.         can bring it back with UNDO) and put the next
  255.         line in the history buffer on your screen.  If
  256.         there is no previous line, the console should Beep.
  257.  
  258. BSEARCH:    Search for a previous command starting with 
  259.         whatever is on the command line.  The current 
  260.         line is put in the kill buffer, and if no line is 
  261.         found, the console will Beep.  This function 
  262.         used to work differently.  People complained.
  263.  
  264. Bizarre Commands:
  265. -----------------        
  266.  
  267. SHIFTED:    The Meta key.  All commands in Ease must be one
  268.         keystroke long.  I cheated in the coding, to
  269.         make it simple.  But that's very restrictive. 
  270.         So Ease includes a Meta Shift key which turns on
  271.         a second set of commands.  ^F does one thing,
  272.         Meta ^F does another.  This is fairly
  273.         transparent to the user--He thinks he has
  274.         entered a sequence (eg. ^Q ^D (Go to the end of
  275.         the line)) when in fact, he has done two
  276.         separate commands.  The first being to set the
  277.         Meta Switch. And the second to actually execute
  278.         the end of line command.  Since the Meta switch
  279.         is on, the highbit of the command is set, and
  280.         the command table is searched for 'D' + 80h.
  281.  
  282. TOGLIN:        Toggle insert.  This command will set the prompt
  283.         to '}>', when in overwrite mode, or '>>' when in
  284.         insert mode.  Overwrite mode inserts when it
  285.         hits the end of the line.
  286.  
  287. ITAB:        Put a ^I (Tab) into the command.  The tab key
  288.         (^I) is an oddball.  It's the only control key
  289.         you have on your typewriter keyboard and expect
  290.         to be able to insert like a standard character. 
  291.         So we need a special command for it.
  292.  
  293. QINSERT:    Insert any character.  After evoking this
  294.         command, hit the key key want in the text (this
  295.         is really only needed for control keys.
  296.  
  297. REPLOT:        Redraw the line (just in case it gets scrambled). 
  298.         This should only be necessary if you get line noise.
  299.  
  300. WARM:        Cause a Warm Boot.
  301.  
  302. DONE:        Execute the command line.  If it is longer than
  303.         the user-setable maximum discard length, it will
  304.         be stored in the history file.
  305.  
  306. QUITSH:        Pop the shell stack and quit Ease.
  307.  
  308.             Section 4:
  309.  
  310.     Why do I want it to run in high memory?
  311.  
  312.   When you run a CP/M or ZCPR3 program, it usually does 
  313. everything in fairly low memory (from 100h up).  And once you 
  314. leave a program, you might want to see what it did with that 
  315. memory or you might want to re-enter or SAVE the program you just 
  316. loaded into low memory with a GET or a program load.  But if 
  317. your shell overwrites the program, you only have a shell program 
  318. down there.
  319.  
  320.   So a shell should run in high memory and leave your normal 
  321. programs alone.  The release version of Ease runs at 8000h.  
  322. This is a fairly high location which should leave most of your 
  323. smaller programs well enough alone.
  324.  
  325.   If you want to change that number to a higher one (since you 
  326. have a higher TPA, which is to say more free memory, than I do) 
  327. go right ahead.  You will need SLR's SLRNK (which I highly 
  328. recommend along with SLR's Z80ASM) or some other linker.  A copy 
  329. of EASE.REL is contained in the release package.  Just link it to 
  330. whatever location you want.  
  331.     What is this Ease program anyway?
  332.  
  333.   It's one piece of software that allows you to edit the commands
  334. that you are entering and have entered.  If you make a typo,
  335. you can go back and get the line right without retyping it.  If
  336. ZCPR33 encounters a problem with a command that you type, you can
  337. make whatever changes are necessary for it to be correct and
  338. then re-execute the line.
  339.  
  340. Ease is a shell which allows you to edit the command you're typing:
  341.  
  342.   Ease provides a bunch of commands that the BDOS line input
  343. function (what you use to send commands to ZCPR3 when you don't
  344. use Ease or HSH or VCED) doesn't have the smarts to.3 environment
  345. ENVADDR:
  346.     dw    0f300h
  347.     dw    ENTRY
  348.     defb    version
  349.  
  350.                 ; To go to the Error Handler, just
  351.                 ;   go to START with error flag set.
  352.  
  353. ;=============================================================================
  354. ;
  355. ;        C O N F I G U R A T I O N    A R E A
  356. ;
  357. ;=============================================================================
  358.  
  359. NAME:    db    'EASE    VAR'            ; Command history file
  360.  
  361. WIDTH:    dw    80                ; Length of line
  362.  
  363. TOOSHORT:
  364.     dw    02                ; Don't store in history 
  365.                         ;   if shorter than...
  366. GOBEGFLG:
  367.     db    0ffh
  368.  
  369. BEEPFLG:
  370.     db    0ffh
  371.  
  372. DO_WRITE:
  373.     db    0ffh
  374.  
  375. NOP1:    db    0                ; Future expansion
  376. NOP2:    db    0
  377. NOP34:    dw    0
  378.  
  379. TABLE:    db    [[LASTCASE - VECTOR] / 3]    ; Number of cases
  380.     dw    BEEP                ; Default case ring bell
  381.  
  382. VECTOR:    db    'Q'
  383.     dw    SHIFTED        ; Meta Key
  384.     db    'D'
  385.     dw    FCHR        ; Right Char
  386.     db    'S'
  387.     dw    BCHR        ; Left Char
  388.     db    'E'
  389.     dw    UP        ; Up line
  390.     db    'X'
  391.     dw    DOWN        ; Down line
  392.     db    'A'
  393.     dw    MBWORD        ; Left word
  394.     db    'F'
  395.     dw    MFWORD        ; Right word
  396.     db    'S'+80h
  397.     dw    GOBOLN        ; Start of line
  398.     db    'D'+80h
  399.     dw    GOEOLN        ; End of line
  400.     db    'G'
  401.     dw    FDEL        ; Del char right
  402.     db    'H'
  403.     dw    DELCHR        ; Del char left
  404.     db    127
  405.     dw    DELCHR        ; Del char left
  406.     db    'T'
  407.     dw    FDWORD        ; Del word right
  408.     db    127 + 80h
  409.     dw    BDWORD        ; Del word left
  410.     db    'R'
  411.     dw    CMDKILL        ; Kill to semi-colon
  412.     db    'Y'+80h
  413.     dw    DELTOEND    ; Delete to end of line
  414.     db    'Y'
  415.     dw    DELLIN        ; Delete line
  416.     db    'U'
  417.     dw    UNDO        ; Reinsert deleted text
  418.     db    'B'
  419.     dw    BACKLINE    ; Back in history shell
  420.     db    'N'
  421.     dw    NEXTLINE    ; Forward in history shell
  422.     db    'O'
  423.     dw    BSEARCH        ; Search for first char
  424.     db    'V'
  425.     dw    TOGLIN        ; Toggle insert
  426.     db    'I'
  427.     dw    ITAB        ; Insert Tab char
  428.     db    'P'
  429.     dw    QINSERT        ; Insert any char
  430.     db    'W'
  431.     dw    REPLOT        ; Redraw line
  432.     db    'C'
  433.     dw    WARM        ; Warm Boot
  434.     db    'M'
  435.     dw    DONE        ; End edit
  436.     db    '_'+80h
  437.     dw    QUITSH        ; End EASE
  438. LASTCASE:
  439.  
  440. PUNC:    db    ',.:!#%^&<>[]{}()_+-=`~/\|; ',tab
  441. PUNCLEN    equ    $ - PUNC
  442. ;=============================================================================
  443. ;
  444. ;        M A I N    C O D E    S E C T I O N
  445. ;
  446. ;=============================================================================
  447.  
  448. start:
  449.  
  450.     ld    hl,(envaddr)    ; Get environment address
  451.     call    z3init        ; Initialize library routines
  452.     call    z33chk
  453.     ret    nz
  454.     call    qerror        ; See if error handler invocation
  455.     jp    z,errorh    ; If so, branch to error processing
  456.     call    qshell
  457.     jp    z,RUNSH        ; Yes, don't install
  458.  
  459. ;=============================================================================
  460. ;
  461. ;        I N S T A L L A T I O N    C O D E
  462. ;
  463. ;=============================================================================
  464.  
  465. ; Program was invoked manually, so we need to set it up shell and error handler.
  466.  
  467. ;----------------------------------------
  468.  
  469. ; Subtask 1 -- determine whether to use a DU or a DIR prefix
  470. ;
  471. ; The program can examine the ZCPR33 option bytes to determine what features
  472. ; are supported (DU and/or DIR forms, which one first, wheel control over DU
  473. ; use, etc.).  For now we will just assume that a DU prefix will be used and
  474. ; will omit coding this block.
  475.  
  476. ;----------------------------------------
  477.  
  478. ; Get user option: if null, do both.  If E, then install the error handler
  479. ; else install the shell.
  480.  
  481.     ld    a,(5dh)
  482.     cp    'C'
  483.     jp    z,RUNSH
  484.     call    header
  485.     cp    ' '            ; Error handler and shell
  486.     jr    z,BOTH
  487.     cp    'E'            ; Only error handler
  488.     jr    z,ERRONLY
  489.     jr    ISHELL            ; Only the shell
  490. BOTH:    call    ISHELL
  491.  
  492. ;----------------------------------------
  493.  
  494. ; Subtask 2 -- build error handling command line including directory prefix
  495. ; using data from the external FCB.  We use the fact that the drive and user
  496. ; where the program was actually found along the path are stored in the
  497. ; command file control block.  The user number is kept in the usual place;
  498. ; the drive is kept in the following byte.  The drive is in the range 1..16
  499. ; (unless the command is resident, in which case the drive byte is 0).
  500.  
  501. ERRONLY:
  502.     call    getmsg        ; Get pointer to error command line
  503.     ld    de,10h        ; ..in message buffer
  504.     add    hl,de
  505.     call    PUT_NAME_TO_HL
  506.     call    getquiet
  507.     ret    nz
  508.     call    CLPRINT
  509.     dc    ' Error Handler'
  510.     jr    P_CLST
  511.  
  512. ISHELL:    call    GETSH        ; Is there a shell stack?
  513.     jr    nz,SHFINE    ; Yes
  514. SHBAD:    call    CLPRINT
  515. SHERR:    dc    'Shell Error'
  516.     ret
  517. SHFINE:    ld    hl,BUFFER
  518.     call    PUT_NAME_TO_HL
  519.     call    SHPUSH        ; Store the shell name
  520.     jr    nz,SHBAD    ; Push to deep?  Then abort
  521.     push    hl
  522.     call    SETFILE
  523.     call    RECOVER        ; Use existing file
  524.     call    PUTSEC
  525.     pop    hl
  526.     call    getquiet
  527.     ret    nz
  528. PRWELC:    call    CLPRINT
  529.     dc    ' Shell'
  530. P_CLST:    call    PRINT
  531.     dc    ': '
  532.     jp    PSTR        ; PRINT the string there and quit
  533.  
  534. RECOVER:
  535.     ld    hl,SSEC
  536.     ld    bc,BUFFER-SSEC-1
  537.     call    ZERO
  538.     call    SET
  539.     call    OPEN
  540.     jr    z,DELSET
  541. DOFNO:    call    FNOWRITE
  542.     jr    nz,DOFNO
  543.     call    FNOWRITE
  544.     jr    nz,DOFNO
  545.     jp    BNOWRITE
  546.  
  547. DELSET:    
  548.     ld    c,19        ; Delete
  549.     call    FBDOS
  550. SET:    xor    a
  551.     ld    (SSEC),a    ; First sector
  552.     ld    hl,SECBUF + 1    ; +1==So no long pause -- at least at first.
  553.     ld    (SFP),hl
  554.     jp    SAVETOWORK
  555.  
  556. PUT_NAME_TO_HL:
  557.     push    hl        ; Save pointer for way below
  558.     ex    de,hl        ; Switch pointer into DE
  559.  
  560.     call    getefcb        ; Get address of the command FCB
  561.     inc    hl        ; Advance pointer to name of program
  562.                 ; Get drive user from Z33's FCB.
  563.     push    hl
  564.     ld    bc,13        ; Offset to drive number
  565.     add    hl,bc        ; HL now points to the drive number
  566.  
  567. ; Here we get the drive where the program was found.  Since we know that this
  568. ; is not a resident program, there is no need to check for a zero value.
  569.  
  570.     ld    a,(hl)        ; Get it and
  571.     add    a,'A'-1        ; ..convert to a letter
  572.     ld    (de),a        ; Save in error command line
  573.     inc    de        ; Increment command line pointer
  574.  
  575.     dec    hl        ; Back up to user number
  576.     ld    a,(hl)        ; Get it and
  577.     call    mafdc        ; ..convert to decimal in command line
  578.  
  579.     ld    a,':'        ; Put in the colon
  580.     ld    (de),a
  581.     inc    de
  582.  
  583. cont1:
  584.     pop    hl        ; Restore the pointer to the command name
  585.     ld    bc,8        ; Copy 8 characters of name
  586.     ldir            ; ..into error command line
  587.  
  588.     xor    a        ; Store terminating null
  589.     ld    (de),a
  590.     pop    hl
  591.     ret
  592.  
  593. ;=============================================================================
  594. ;
  595. ;        E R R O R    H A N D L I N G    C O D E
  596. ;
  597. ;=============================================================================
  598.  
  599. ; This is the main entry point for error handling
  600.  
  601. errorh:
  602.     ld    a,(BEEPFLG)    ; Did the user want a Beep?
  603.     or    a
  604.     call    nz,BEEP
  605.  
  606. ;----------------------------------------
  607.  
  608. ; Subtask 1 -- Display program signon message
  609.  
  610. task1:
  611.     call    header
  612.  
  613. ;----------------------------------------
  614.  
  615. ; Subtask 2 -- Display system status
  616.  
  617. ; This task determines whether ZEX and/or SUBMIT are running.  Input
  618. ; redirection from either of them is turned off while error handling is
  619. ; performed (so user can provide the input).
  620.  
  621. task2:
  622.     call    stopzex        ; Stop ZEX input redirection
  623.  
  624.     call    CLPRINT
  625.     dc    lf,tab,'(ZEX '
  626.  
  627.     call    getzrun        ; Find out if ZEX is running
  628.     ld    e,a
  629.     ld    (ZEXORSUB),a
  630.     call    ponoff        ; Print on/off
  631.  
  632.     call    subon
  633.     jr    z,task2a    ; Branch if submit not supported
  634.  
  635.     call    PRINT
  636.     dc    ', SUBMIT '
  637.  
  638. ; See if submit is supported by the command processor
  639.  
  640.  
  641.     call    stopxsub    ; Stop XSUB input redirection
  642.     call    getsrun        ; Get submit running flag
  643.     call    ponoff        ; PRINT on/off
  644.     or    e
  645.     ld    (ZEXORSUB),a
  646.  
  647. ; See if wheel byte is on or off
  648.  
  649. task2a:
  650.     call    PRINT
  651.     dc    ', WHEEL '
  652.  
  653.     call    getwhl
  654.     call    ponoff
  655.     ld    a,')'
  656.     call    COUT
  657.  
  658. ;----------------------------------------
  659.  
  660. ; Subtask 3 -- Determine source of the error (internal or external) and
  661. ; display that information.
  662.  
  663. task3:
  664. ;    call    qerror
  665. ;    ret    nz        ; If not an error, then don't show the rest
  666.     call    CLPRINT
  667.     dc    tab
  668.     call    getcst        ; Get command status flag
  669.     bit    3,a        ; See if external command bit is set
  670.     jr    nz,external    ; Branch if external error
  671.  
  672.     call    PRINT        ; "IN"ternal
  673.     dc    'In'
  674.     jr    task3a
  675.  
  676. external:
  677.     call    PRINT        ; "EX"ternal
  678.     dc    'Ex'
  679.  
  680. task3a:
  681.     call    PRINT        ; "TERNAL ERROR"
  682.     dc    'ternal error #'
  683.  
  684.     call    xcmdoff        ; Clear the external command bit (and ECP bit)
  685.  
  686. ;----------------------------------------
  687.  
  688. ; Subtask 4 -- Determine the error return code and display information about
  689. ; the nature of the error.  This section of the code can be expanded to cover
  690. ; more error types as they are defined.
  691.  
  692. task4:
  693. ;    call    PRINT
  694. ;    defb    '#'
  695. ;    defb    0
  696.  
  697.     call    getmsg
  698.     ld    a,(hl)        ; Get the error return code
  699.     push    af        ; Save for use below
  700.     call    pafdc        ; Display the number
  701.     
  702.     call    PRINT
  703.     dc    ' -- '
  704.  
  705.     pop    af        ; Get error code back
  706.     cp    14
  707.     jr    c,OKERR
  708.     ld    a,4
  709. OKERR:    add    a        ; Make 8 bit skip into 16 bit
  710.     ld    e,a
  711.     ld    d,0
  712.     ld    hl,ERRSTRS - 2    ; Add to first string index
  713.     add    hl,de
  714.     ld    e,(hl)
  715.     inc    hl
  716.     ld    d,(hl)        ; Pull in string location
  717.     ex    de,hl
  718.     call    pstr        ; PRINT it
  719.     call    CRLF
  720.  
  721. ;----------------------------------------
  722.  
  723. ; Subtask 5 -- Display bad command line
  724. ;
  725. ; In the final code, much more elaborate error processing would be performed
  726. ; here (or more likely, the code here will be used as a framework for existing
  727. ; error handlers).
  728.  
  729. task5:
  730.     call    erradr        ; Get pointer to bad command line
  731.     push    hl        ; Save for reuse below
  732.     ld    de,BUFFER
  733.  
  734. scan:                ; Find end of this command
  735.     ld    a,(hl)
  736.     ld    (de),a
  737.     or    a        ; See if end of command line buffer
  738.     jr    z,GOTEND
  739.     cp    ';'        ; See if at command separator
  740.     jr    z,task5a
  741.     inc    hl        ; Point to next character
  742.     inc    de
  743.     jr    scan        ; Continue scanning
  744.  
  745. task5a:
  746.     push    af
  747.     push    hl
  748. FILLREST:
  749.     inc    hl
  750.     inc    de
  751.     ld    a,(hl)
  752.     ld    (de),a
  753.     or    a
  754.     jr    nz,FILLREST
  755.     pop    hl
  756.     pop    af
  757. GOTEND:
  758. OKT5A:    ld    a,(hl)
  759.     ld    (hl),0        ; Mark end of string
  760.     ld    (delimptr),hl    ; Save ptr to bad command's delimiter
  761.     ld    (delim),a    ; Store delimiter
  762.     push    af
  763.     ld    a,(ZEXORSUB)
  764.     or    a
  765.     jp    z,ERREDIT
  766.     call    CLPRINT
  767.     dc    tab,'Bad Command:',tab
  768.     pop    af
  769.     pop    hl        ; Restore pointer to beginning of command
  770.     push    af        ; Save delimiting character
  771.     call    pstr        ; Display the bad command
  772.  
  773.     pop    af
  774.     or    a
  775.     jr    z,task6        ; If no rest of line, get out without output
  776.     push    hl        ; Save pointer to rest of command line
  777.     call    CLPRINT
  778.     dc    tab,'Rest of Line:',tab
  779.     pop    hl
  780.  
  781. task5b:
  782.     dec    hl        ; Pt back to bad command delimiter
  783.     ld    (hl),a        ; Put semicolon back
  784.     inc    hl
  785.     call    pstr        ; PRINT rest of command line
  786.                 ;   AND RETURN!
  787.  
  788. ;----------------------------------------
  789.  
  790. ; Subtask 6 -- Deal with the bad command
  791.  
  792. ; This is where the real error handling is performed.  Here we just flush
  793. ; the entire command line and abort any submit job, but in a real error
  794. ; handler, several other functions would be performed.  With normal command
  795. ; lines (ZEX and SUBMIT not running), the user has the following three basic
  796. ; choices: fix the bad command, skip the bad command, or abort the entire
  797. ; command line.  If ZEX is running, there is an additional choice that should
  798. ; be available: abort the entire ZEX script.  Similarly, if SUBMIT is running,
  799. ; the user must be given the option to abort the entire submit job.
  800. ; This code implements all of the above with the additional feature
  801. ; that if the bad command is the last on the line, the option to skip
  802. ; to next command is not presented as it would be meaningless.
  803.  
  804. task6:
  805.     call    CLPRINT
  806.     dc    cr,lf,tab,'(E)dit/(A)bort'
  807.     ld    a,(delim)    ; Get bad command delimiter
  808.     or    a
  809.     jr    z,task6a    ; No trailing commands; skip next option
  810.     call    PRINT
  811.     dc    '/(C)ontinue'
  812. task6a:
  813.     call    PRINT
  814.     dc    ': '
  815.  
  816. task6c:    call    capin        ; get response
  817.     ld    b,a        ; Save for a moment
  818.     ld    a,(delim)    ; Get command delimiter again
  819.     or    a
  820.     ld    a,b        ; Response back in A
  821.     jr    z,task6b    ; Don't allow 's' choice if no trailing command
  822.     cp    'C'        ; Continue?
  823.     jr    z,skip
  824.  
  825. task6b:
  826.     cp    'A'        ; Abort?
  827.     jr    z,abort
  828.     cp    'E'        ; Edit?
  829.     jp    z,edit
  830.     call    beep        ; Bad input
  831.     jr    task6c
  832.  
  833. ;-----------------------------------------------------------------------------
  834.  
  835. ; Skip over bad command and resume with next in line
  836.  
  837. skip:
  838.     call    getcl1        ; Pt to command line buffer
  839.     ld    de,(delimptr)    ; DE pts to bad command's delimiter
  840.     inc    de        ; Now pointing to next command
  841.     ld    (hl),e        ; Stuff address in
  842.     inc    hl        ; ..first two bytes
  843.     ld    (hl),d        ; ..of multiple command line buffer
  844.  
  845.     call    PRINT
  846.     defb    'Continuing...',1
  847.     ret            ; Resume command execution with next command
  848.  
  849.  
  850. ;-----------------------------------------------------------------------------
  851.  
  852. ; Abort (flush) command line
  853.  
  854. abort:
  855.     call    abortmsg
  856.     call    getzrun        ; See if ZEX is running
  857.     jr    z,abort2    ; Branch if not
  858.  
  859. ; Deal with running ZEX script
  860.  
  861.     call    CLPRINT
  862.     dc    tab,'Abort ZEX script (Y/N)? '
  863.  
  864.     call    getyesno    ; Get user's answer
  865.     jr    nz,abort1    ; Branch if negative response
  866.  
  867.     call    haltzex        ; Abort ZEX
  868.     call    abortmsg
  869.     jr    abort2
  870.  
  871. abort1:
  872.     call    abort3
  873.  
  874. ; Deal with running SUBMIT job
  875.  
  876. abort2:
  877.     call    getsrun        ; Is a submit job running
  878.     ret    z        ; If not, return to command processor
  879.  
  880.     call    CLPRINT
  881.     dc    tab,'Abort SUBMIT job (Y/N)? '
  882.  
  883.     call    getyesno    ; Get user's answer
  884.     jr    nz,abort3    ; Branch if negative response
  885.  
  886.     call    haltsub        ; Abort SUBMIT
  887.  
  888. abortmsg:
  889.     call    PRINT
  890.     defb    'Aborted',1
  891.     ret
  892.  
  893. abort3:
  894.     call    PRINT
  895.     defb    ' No',1
  896.  
  897.     ret            ; Back to command processor
  898.  
  899. ;-----------------------------------------------------------------------------
  900.  
  901. ; XCMDOFF -- turn off external command flag
  902.  
  903. ; This routine turns off the external command bit and the ECP bit in the
  904. ; command status flag.
  905.  
  906. xcmdoff:
  907.     call    getcst        ; Get the command status flag
  908.     and    11110011b
  909. ;    res    3,a        ; Reset the external command bit
  910. ;    res    2,a        ; Reset the ECP bit also to prevent reentering
  911.                 ; ..the error handler on return
  912.     jp    putcst        ; Put new value back and return
  913.  
  914. ;-----------------------------------------------------------------------------
  915.  
  916. ; GETYESNO -- get yes/no answer from user
  917.  
  918. ; Only 'Y' or 'y' accepted as affirmative answers.  Routine returns Z if
  919. ; affirmative, NZ otherwise.
  920.  
  921. getyesno:
  922.     call    capin        ; Get user response
  923.     cp    'Y'
  924.     ret
  925.  
  926. ;-----------------------------------------------------------------------------
  927.  
  928. ; PONOFF -- PRINT ON or OFF in message
  929. ;
  930. ; If the Z flag is set on entry, 'OFF' is displayed; otherwize 'ON' is
  931. ; displayed.
  932.  
  933. ponoff:
  934.     jr    z,poff
  935.  
  936.     call    PRINT
  937.     dc    'ON'
  938.     ret
  939.  
  940. poff:
  941.     call    PRINT
  942.     dc    'OFF'
  943.     ret
  944.  
  945. ; ------------------------------
  946. ; header -- PRINT program name and version
  947. ;
  948. header:    call    CLPRINT
  949.     defb    'Z33 Error And Shell Editor, Vers. '
  950.     defb    version / 10 + '0'
  951.     defb    '.'
  952.     defb    version mod 10 + '0'
  953.     dc    betastage
  954.     ret
  955.  
  956. ; ------------------------------
  957. ; CLPRINT -- PRINT CR LF and then following string.
  958. CLPRINT:
  959.     call    CRLF
  960.     jp    PRINT
  961.  
  962. ;-----------------------------------------------------------------------------
  963. ; Prompt -- PRINT a DU/DIR prompt.
  964. ;
  965. PROMPT:    call    QPROMPT        ; PRINT the DU:DIR
  966.     ld    a,(INSFLG)
  967. INSPROMPT:
  968.     or    a
  969.     ld    a,'>'        ; For insert
  970.     jr    nz,INSOK
  971.     ld    a,'}'        ; For no insert
  972. INSOK:    call    COUT
  973.     ld    a,'>'
  974.     jp    COUT
  975.  
  976. QPROMPT:
  977.     call    QERROR
  978.     jr    nz,NOTERR
  979.     call    PRINT
  980.     dc    '[Error] '
  981. NOTERR:    call    getmsg
  982.     ld    bc,2eh
  983.     add    hl,bc
  984.     ld    c,(hl)
  985.     inc    hl
  986.     ld    b,(hl)
  987.     call    getduok
  988.     jr    z,NODU
  989.     ld    a,b
  990.     add    a,'A'        ; Make it a letter    
  991.     call    COUT        ; Write it
  992.     ld    a,c
  993.     call    pafdc        ; Write it as a number
  994. NODU:    call    dutdir        ; Get the NDR
  995.     ret    z
  996.     push    hl
  997.     call    getduok
  998.     ld    a,':'
  999.     call    nz,COUT        ; And the colon to separate
  1000.     pop    hl
  1001.     ld    b,8        ; Eight chars max
  1002. NAMELOOP:
  1003.     ld    a,(hl)        ; Get the first char
  1004.     cp    ' '        ; Is it the last
  1005.     ret    z        ; YUP.  done
  1006.     call    COUT        ; Write it
  1007.     inc    hl
  1008.     djnz    NAMELOOP    ; Repeat
  1009.     ret
  1010.  
  1011. ; -----------------------------------------------------------
  1012. ; FillLine
  1013. ;  Check length of the new, edited, command line.  If it will 
  1014. ; fit, copy it to the Z3 multiple command line buffer and 
  1015. ; return to the CPR to execute it.  Otherwise, display error 
  1016. ; message and branch back to the editor.
  1017.  
  1018. GETLEN:    ld    hl,BUFFER
  1019.     push    hl
  1020.     xor    a
  1021.     ld    bc,302
  1022.     cpir            ; Find the ZERO
  1023.  
  1024.     dec    hl
  1025.     pop    de
  1026.     push    hl
  1027.     sbc    hl,de        ; Get the length
  1028.     ld    b,h
  1029.     ld    c,l
  1030.     pop    hl
  1031.     ret
  1032.  
  1033. FILL:    xor    a
  1034.     call    putcst        ; No errors
  1035.     call    getcl1        ; Get Z3 command line addr in hl,
  1036.                 ; ..length in a
  1037.     cp    c        ; Compare with length of new line
  1038.     jr    c,FILLERR    ; Branch if new line too long
  1039.     ld    a,b        ; High order byte of length should be 0
  1040.     or    a
  1041.     jr    nz,FILLERR    ; Branch if not
  1042.     push    hl        ; Save Z3CL
  1043.     ld    de,4        ; Offset to first character in buffer
  1044.     add    hl,de
  1045.     ex    de,hl        ; First char address in DE
  1046.     pop    hl        ; Z3CL address in HL
  1047.     ld    (hl),e        ; Store ptr to first command
  1048.     inc    hl        ; At Z3CL
  1049.     ld    (hl),d
  1050.     ld    hl,BUFFER    ; Get back pointer to new command
  1051.     push    hl
  1052.     inc    bc        ; Adjust length to include trailing null
  1053.     ldir            ; Copy to system command line
  1054.     call    qerror
  1055.     pop    hl
  1056.     ret    z        ; Return if it was an error
  1057.     ld    a,(SAVFLG)
  1058.     or    a
  1059.     ret    z        ; Didn't change from read: Don't save
  1060.     push    hl
  1061.     call    GETLEN        ; Get length again
  1062.     ld    hl,(TOOSHORT)
  1063.     sbc    hl,bc
  1064.     pop    hl
  1065.     ret    nc        ; Too short to save
  1066.     push    hl
  1067.     call    OPEN        ; Open 'er up
  1068.     call    SAVETOWORK    ; Move the values around
  1069.     call    RRAND        ; Read in the current record
  1070.     xor    a
  1071.     call    WFFILE        ; Put the null to space the lines
  1072.     pop    hl
  1073. FILLWRITE:
  1074.     ld    a,(hl)        ; Loop to put in the whole line
  1075.     push    hl
  1076.     call    WFFILE        ; Put in the next char of the line
  1077.     pop    hl
  1078.     ld    a,(hl)
  1079.     inc    hl
  1080.     or    a
  1081.     jr    nz,FILLWRITE
  1082.     call    BNOWRITE
  1083.     call    PUTSEC
  1084.     xor    a
  1085.     call    WFFILE        ; Write final spacer null
  1086. FLUSH:    call    WRAND
  1087. CLOSE:    ld    c,16        ; Close the file
  1088. FBDOS:    ld    de,FCB
  1089.     jp    BDOS        ; Go back to CPR to execute it
  1090.  
  1091. FILLERR:            ; To long for CCP to digest
  1092.     call    CLPRINT
  1093.     defb    bell,tab
  1094.     defb    'Too long!',1
  1095.     jr    EDIT2
  1096.  
  1097. FINDSEC:
  1098.     call    getsh        ; Get the sector number from the shell stack
  1099.     ld    bc,128
  1100.     xor    a
  1101.     cpir            ; Find the ZERO
  1102.     ld    a,(hl)        ; ?? Must be 0 -- but it isn't -- It's the SEC
  1103.     ret
  1104.  
  1105. GETSEC:    call    FINDSEC        ; Put the new SEC to the saved var SEC
  1106.     ld    (SSEC),a
  1107.     inc    hl
  1108.     ld    a,(hl)
  1109.     inc    hl
  1110.     ld    h,(hl)
  1111.     ld    l,a
  1112.     ld    (SFP),hl    ; Put the File Pointer to saved FP
  1113. SAVETOWORK:
  1114.     ld    a,(SSEC)    ; Move the saved vars to the working vars 
  1115.     ld    (SEC),a
  1116.     ld    hl,(SFP)
  1117.     ld    (FP),hl
  1118.     ret
  1119.  
  1120. PUTSEC:    call    FINDSEC        ; Get location of SEC
  1121.     ld    a,(SEC)
  1122.     ld    de,(FP)        ; Get SEC & FP
  1123.     ld    (hl),a
  1124.     inc    hl
  1125.     ld    (hl),e
  1126.     inc    hl
  1127.     ld    (hl),d        ; Put the into the Shell Stack 
  1128.     ret
  1129.  
  1130. ;-----------------------------------------------------------------------------
  1131. ; Edit -- He, He, He...
  1132. ;
  1133. ERREDIT:
  1134.     pop    af
  1135.     pop    hl
  1136.     jr    EDITNOE
  1137. EDIT:    call    PRINT
  1138.     db    'Edit',1    ; PRINT the 'E' for edit choice
  1139. EDITNOE:
  1140.     call    CRLF
  1141.     ld    bc,BUFFER - ENDFLG - 1    ; Setup for zeroing out
  1142.     jr    SETUP
  1143.  
  1144. ;--------------------------
  1145.  
  1146. ; Run Shell (RUNSH) -- clear out the buffers and go to the editor.
  1147.  
  1148. RUNSH1:    call    CRLF
  1149.  
  1150. RUNSH:    call    GETSEC        ; Get the sector number
  1151.     ld    a,1        ; Z3 Cmd line for ZEX
  1152.     call    putzex        ; Make ZEX think we are Z3
  1153.     ld    bc,BUFFER - ENDFLG
  1154. SETUP:    ld    hl,INSFLG    ; Fill and Zap
  1155.     ld    (hl),0ffh
  1156.     inc    hl
  1157.     ld    (hl),0ffh
  1158.     inc    hl
  1159.     call    ZERO        ; Zero out to exhaustion of bc
  1160.  
  1161. EDIT2:
  1162. ;    ld    hl,(envaddr)    ; Get environment address
  1163. ;    call    z3init
  1164.     call    OUTPUT1
  1165. ELOOP:    xor    a
  1166.     ld    (NOOUT+1),a    ; OK for output
  1167.     call    GETKEY
  1168.     ld    b,a
  1169.     ld    a,(SHIFT)    ; Get shift mask
  1170.     or    b
  1171.     push    af
  1172.     xor    a
  1173.     ld    (SHIFT),a    ; Clear shift mask
  1174.     pop    af
  1175.     cp    ' '
  1176.     jr    c,CONTROL    ; Yes, it's a command
  1177.     cp    127
  1178.     jr    nc,CONTROL
  1179.     call    INSERT        ; No, it's just a letter
  1180.     jr    ELOOP
  1181.  
  1182. CONTROL:
  1183.     ld    hl,ELOOP    ; Return to...
  1184.     push    hl
  1185.     ld    de,TABLE    ; Go to proper command
  1186.     call    UCASE
  1187.     call    acase2
  1188.  
  1189. SHIFTED:
  1190.     ld    a,10000000b    ; Make shift mask set high bit
  1191.     ld    (SHIFT),a
  1192.     ret
  1193.  
  1194. DELCHR:    call    DPOS        ; Back up and delete forward
  1195.     ret    z
  1196.     call    DELETE
  1197.     jp    SHOWTOEND
  1198.  
  1199. FCHR:    call    FWRAP        ; Go ahead a char and wrap if EOL
  1200.     jp    IPOS
  1201.  
  1202. FWRAP:    ld    hl,(POS)    ; Check for forward wrap
  1203.     ld    a,(hl)
  1204.     or    a
  1205.     ret    nz
  1206.     pop    hl
  1207.     jp    GOBOLN
  1208.  
  1209. BCHR:    call    BWRAP        ; Go back and wrap if BOL
  1210.     jp    DPOS
  1211.  
  1212. BWRAP:    ld    hl,(POS)    ; Check for back wrap
  1213.     dec    hl
  1214.     ld    a,(hl)
  1215.     or    a
  1216.     ret    nz
  1217.     pop    hl
  1218.     jp    GOEOLN
  1219.  
  1220. MBWORD:    call    BWRAP        ; Word forward with wrap
  1221. BWORD:    call    DPOS        ; Word forward without
  1222.     ret    z
  1223.     inc    de
  1224.     call    PUNCCP        ; Looking for punctuation
  1225.     jr    z,BWORD        ; Skip punct
  1226. BWORD2:    call    DPOS
  1227.     ret    z
  1228.     inc    de
  1229.     call    PUNCCP        ; Go till we hit punct
  1230.     jr    nz,BWORD2
  1231.     dec    de
  1232.     jp    IPOS
  1233.  
  1234. PUNCCP:    ld    hl,PUNC        ; Check for punctuation
  1235.     ld    bc,PUNCLEN
  1236.     cpir
  1237.     ret
  1238.  
  1239. FDWORD:    ld    de,0        ; Delete forward a word
  1240.     call    FWORD        ; Word forward
  1241.     push    de
  1242. FDWBACK:
  1243.     ld    a,d
  1244.     or    e
  1245.     jr    z,FDWENDBACK
  1246.     dec    de
  1247.     call    DPOS        ; Back up same number of Chars
  1248.     jr    FDWBACK
  1249. FDWENDBACK
  1250.     pop    de        ; Delete same number of chars
  1251.     jr    BDWRD1
  1252.  
  1253. BDWORD:    ld    de,0        ; Delete a word backwards
  1254.     call    BWORD
  1255. BDWRD1:    ld    a,d
  1256.     or    e
  1257.     jp    z,SHOWTOEND
  1258.     dec    de
  1259.     push    de
  1260.     call    DELETE        ; Delete same number
  1261.     pop    de
  1262.     jr    BDWRD1
  1263.  
  1264. MFWORD:    call    FWRAP        ; Forward word with wrap
  1265. FWORD:    call    IPOS
  1266.     ret    z
  1267.     inc    de
  1268.     call    PUNCCP        ; Skip until punct
  1269.     jr    nz,FWORD
  1270. FWORD2:    call    IPOS
  1271.     ret    z
  1272.     inc    de
  1273.     call    PUNCCP        ; Skip punct
  1274.     jr    z,FWORD2
  1275.     dec    de
  1276.     jp    DPOS        ; Back up one
  1277.  
  1278. UP:    ld    hl,(WIDTH)    ; Back 80 chars
  1279. BACKUP:    ld    a,h
  1280.     or    l
  1281.     ret    z
  1282.     dec    hl
  1283.     push    hl
  1284.     call    DPOS        ; back up that many
  1285.     pop    hl
  1286.     ret    z
  1287.     cp    ' '
  1288.     jr    nc,BACKUP    ; Control chars count double
  1289.     ld    a,h
  1290.     or    l
  1291.     ret    z
  1292.     dec    hl
  1293.     jr    BACKUP
  1294.  
  1295. DOWN:    ld    hl,(WIDTH)    ; Go down a line
  1296. DOWNLOOP:
  1297.     ld    a,h
  1298.     or    l
  1299.     ret    z
  1300.     dec    hl
  1301.     push    hl
  1302.     call    IPOS        ; Forward 'til hl = zero
  1303.     pop    hl
  1304.     ret    z
  1305.     cp    ' '        ; Control chars count double
  1306.     jr    nc,DOWNLOOP
  1307.     ld    a,h
  1308.     or    l
  1309.     ret    z
  1310.     dec    hl
  1311.     jr    DOWNLOOP
  1312.  
  1313. WARM:    call    DONEOUT
  1314.     jp    0
  1315.  
  1316. DONE:    pop    hl        ; Save it and run it
  1317.     call    DONEOUT
  1318.     call    GETLEN        ; Get the length in BC
  1319. ;    call    qerror        ; Was it an error?
  1320. ;    jp    z,FILLL2
  1321.     ld    a,(BUFFER)
  1322.     cp    ';'        ; Comment?
  1323.     jr    z,JRUNSH
  1324.     or    a        ; Empty?
  1325.     jp    nz,FILL        ; Stuff the buffer
  1326. JRUNSH:    call    qerror
  1327.     ret    z
  1328.     call    qshell
  1329.     ret    nz
  1330.     jp    RUNSH1
  1331.  
  1332. FDEL:    call    DELETE        ; Delete forward a char
  1333.     ret    z
  1334.     jp    SHOWTOEND    ; Redisplay
  1335.  
  1336. QINSERT:
  1337.     call    GETKEY        ; Get a key and insert it -- whatever it is
  1338.     or    a
  1339.     ret    z
  1340.     jr    IJP
  1341.  
  1342. ITAB:    ld    a,tab        ; Insert a tab
  1343. IJP:    jp    INSERT
  1344.  
  1345. TOGLIN:    ld    hl,INSFLG    ; Toggle the insert flag
  1346.     ld    a,(hl)
  1347.     cpl
  1348.     ld    (hl),a
  1349.     ld    hl,(POS)
  1350.     push    hl
  1351.     push    af
  1352.     call    GOBOLN
  1353.     call    BACK
  1354.     call    BACK        ; Back up to the begining and back to ICHAR
  1355.     pop    af
  1356.     call    INSPROMPT
  1357.     pop    de
  1358. TOGLP:    ld    hl,(POS)    ; Go fwd to where we were
  1359.     sbc    hl,de
  1360.     ret    z
  1361.     call    IPOS
  1362.     jr    TOGLP
  1363.  
  1364. CMDKILL:
  1365.     ld    hl,(POS)
  1366.     ld    de,KILL
  1367.     push    de
  1368.     ld    bc,killlen    ; Stop before NULL in KILL
  1369.     ldir            ; Move it
  1370.     pop    hl
  1371. CKL:    push    hl
  1372.     call    DELETE        ; Delete to a semi-colon
  1373.     pop    hl
  1374.     inc    hl
  1375.     cp    ';'
  1376.     jr    z,CKDONE
  1377.     or    a        ; Or a NULL
  1378.     jr    nz,CKL
  1379. CKDONE:    ld    (hl),0
  1380.     jp    SHOWTOEND    ; Redisplay
  1381.  
  1382. DELLIN:    ld    hl,BUFFER
  1383.     ld    de,KILL
  1384.     ld    bc,killlen    ; Stop at NULL in KILL
  1385.     ldir            ; Move it
  1386. DELLN1:    call    GOBOLN        ; Go to start
  1387. DELTOEND:
  1388.     call    CLRTOEND    ; Wipe everything on screen
  1389.     ld    hl,(POS)
  1390.     ld    (hl),0        ; Put a null at the start
  1391.     ret
  1392.  
  1393. GOEOLN:    call    IPOS        ; Move to end of line
  1394.     jr    nz,GOEOLN
  1395.     ret
  1396.  
  1397. GOBOLN:    call    DPOS        ; Move to start of line
  1398.     jr    nz,GOBOLN
  1399.     ret
  1400.  
  1401. REPLOT:    ld    hl,(POS)    ; RePRINT entire line
  1402.     push    hl
  1403.     call    GOEOLN        ; Go to end and give us a CR LF
  1404. REPLT1:    call    CRLF
  1405.     call    OUTPUT        ; Redisplay
  1406.     pop    de
  1407. GOTOPOS:
  1408.     or    a
  1409.     call    IPOS        ; Move fwd to old position
  1410.     sbc    hl,de
  1411.     ret    z
  1412.     jr    c,GOTOPOS
  1413. GP2:    call    DPOS
  1414.     ret    z
  1415.     sbc    hl,de        ; Done?
  1416.     ret    z
  1417.     jr    GP2
  1418.  
  1419. CAPIN:    call    cin
  1420.     ; Fall through to UPCASE
  1421.  
  1422. UCASE:    push    bc        ; Upcase A
  1423.     push    af
  1424.     and    80h
  1425.     ld    b,a
  1426.     pop    af
  1427.     and    7fh        ; Keep high bit
  1428.     call    UCASE2        ; Real upcase
  1429.     or    b
  1430.     pop    bc
  1431.     ret
  1432.  
  1433. UCASE2:
  1434.     cp    ' '        ; Standard blah blah upcase funct
  1435.     jr    nc,NOTCTL
  1436.     add    '@'
  1437. NOTCTL:    cp    'a'
  1438.     ret    c        ; Not a lowercase
  1439.     cp    'z'+1
  1440.     ret    nc        ; Not a lowercase
  1441.     sub    ' '        ; Yes, a lowercase
  1442.     ret
  1443.  
  1444. BSEARCH:
  1445.     call    OPEN        ; Check for open, etc.
  1446.     ld    hl,(FP)        ; Get our locations
  1447.     ld    a,(SEC)
  1448.     push    af
  1449.     push    hl
  1450.     ld    a,(ENDFLG)    ; Did we hit the end?
  1451.     or    a
  1452.     jr    z,BBDONE
  1453.     ld    a,(BACKFLG)    ; Did we back up right before this?
  1454.     or    a
  1455.     jr    nz,BBDONE
  1456.     call    BNOWRITE
  1457.     jr    z,BSRCHNO1
  1458. BBACK:    call    BNOWRITE    ; Find the NULL
  1459.     jr    nz,BBACK
  1460. BBDONE:    ld    bc,BUFFER
  1461.     push    bc
  1462. BSRCHL:    call    BNOWRITE    ; Is this the end?
  1463. BSRCHL2:
  1464.     call    BNOWRITE
  1465.     jr    z,BSRCHNO
  1466.     call    FNOWRITE    ; No, Place us properly
  1467. BSRCL1:    call    BNOWRITE
  1468.     jr    nz,BSRCL1
  1469.     call    FNOWRITE
  1470.     ld    c,0
  1471.     pop    de
  1472.     push    de
  1473. BSRCHECKING:
  1474.     inc    c
  1475.     call    UCASE
  1476.     ld    b,a
  1477.     ld    a,(de)
  1478.     ld    hl,(POS)
  1479.     sbc     hl,de
  1480.     jr    z,BSRGOTIT
  1481.     inc    de
  1482.     call    UCASE        ; Make all upcase
  1483.     cp    b
  1484.     jr    nz,BSRGOTIT    ; Same?
  1485.     push    de
  1486.     push    bc
  1487.     call    FNOWRITE
  1488.     pop    bc
  1489.     pop    de
  1490.     jr    BSRCHECKING
  1491. BSRGOTIT:
  1492.     push    af
  1493.     ld    b,c
  1494. BSR_BACKING_UP:
  1495.     push    bc
  1496.     call    BNOWRITE
  1497.     pop    bc
  1498.     djnz    BSR_BACKING_UP
  1499.     pop    af
  1500.     jr    nz,BSRCHL2
  1501.     call    DELTOEND
  1502.     xor    a
  1503.     call    BESET        ; We went back -- Indicate it
  1504.     cpl
  1505.     ld    de,(POS)
  1506.     ld    (NOOUT+1),a
  1507.     pop    bc
  1508.     pop    hl
  1509.     pop    af
  1510.     push    de
  1511.     call    GETLINE        ; Get a whole line in
  1512.     pop    hl
  1513.     ld    (POS),hl
  1514.     call    NOSAV
  1515. ;    xor    a        ; Getline always ends with a null
  1516.     ld    (NOOUT+1),a
  1517.     jp    SHOWTOEND
  1518. BSRCHNO:
  1519.     pop    bc
  1520. BSRCHNO1:
  1521.     call    BEEP        ; Not found do the beep thing
  1522. PUTBACK:
  1523.     pop    hl
  1524.     pop    af
  1525.     ld    (FP),hl        ; Restore our pointers
  1526.     ld    (SEC),a
  1527. RRAND:    ld    c,21h
  1528.     call    DORAND        ; Read that first one back in
  1529.     or    a
  1530.     ret    z
  1531. ZBUF:    push    de
  1532.     ld    hl,SECBUF    ; Zero out our record
  1533.     ld    bc,127
  1534.     call    ZERO
  1535.     pop    de
  1536.     ret
  1537.  
  1538. QUITSH:    call    qerror        ; Pop the shell stack
  1539.     ret    z        ; Unless we are an error handler
  1540.     pop    hl
  1541.     call    SHPOP
  1542. DONEOUT:
  1543.     call    GOEOLN        ; Go to the end and CR
  1544.     ld    a,13
  1545. JCOUT:    jp    COUT
  1546.  
  1547. BEEP:    ld    a,bell
  1548.     jr    JCOUT
  1549.  
  1550. BACKLINE:            ; Go to previous command line
  1551.     call    OPEN
  1552.     ld    a,(ENDFLG)
  1553.     or    a
  1554.     call    z,EZER        ; Till we get to start
  1555. BGET:    call    BNOWRITE
  1556.     call    z,FNOWRITE
  1557.     jr    z,BEEP        ; No command line before
  1558.     ld    hl,TBUF
  1559.     ld    (hl),0
  1560.     inc    hl
  1561. BINSERT:            ; Insert the line backing up
  1562.     ld    (hl),a
  1563.     inc    hl
  1564.     push    hl
  1565.     call    BNOWRITE
  1566.     pop    hl
  1567.     jr    nz,BINSERT
  1568.     push    hl
  1569.     ld    hl,BACKFLG    ; Did we just go backwards?
  1570.     ld    a,(hl)
  1571.     ld    (hl),0ffh
  1572.     or    a
  1573.     pop    hl
  1574.     jr    z,BGET
  1575.     push    hl
  1576.     call    DELLN1        ; Kill existing line
  1577.     pop    hl
  1578.     dec    hl
  1579. BIN2:    ld    a,(hl)
  1580.     dec    hl
  1581.     or    a
  1582.     jr    z,GOBEGINOPTION    ; Put her there
  1583.     push    hl
  1584.     call    INSERT
  1585.     pop    hl
  1586.     jr    BIN2
  1587.  
  1588. GOBEGINOPTION:
  1589.     push    af
  1590.     ld    a,(GOBEGFLG)
  1591.     or    a
  1592.     call    nz,GOBOLN
  1593.     call    NOSAV
  1594.     pop    af
  1595.     ret
  1596.  
  1597. NEXTLINE:
  1598.     ld    a,(ENDFLG)    ; Are we at the end?
  1599.     or    a
  1600.     ret    z
  1601.     call    OPEN        ; Open the sucker if it ain't already
  1602. GETLINE:
  1603. FGET:    call    FNOWRITE
  1604.     jr    z,CHKTOP    ; At the end?
  1605.     push    af
  1606.     call    NOTTOP        ; Set flag
  1607.     pop    af
  1608.     ld    hl,TBUF
  1609. FINSERT:
  1610.     ld    (hl),a
  1611.     inc    hl
  1612.     push    hl
  1613.     call    FNOWRITE    ; Bring 'em in
  1614.     pop    hl
  1615.     jr    nz,FINSERT
  1616.     ld    (hl),0
  1617.     ld    hl,BACKFLG    ; Did we go back?
  1618.     ld    a,(hl)
  1619.     ld    (hl),0
  1620.     or    a
  1621.     jr    nz,FGET
  1622.     call    DELLN1        ; Delete the line
  1623.     ld    hl,TBUF
  1624. FIN2:    ld    a,(hl)
  1625.     inc    hl
  1626.     or    a
  1627.     jr    z,GOBEGINOPTION
  1628.     push    hl
  1629.     call    INSERT        ; Push the chars in
  1630.     pop    hl
  1631.     jr    FIN2
  1632.  
  1633. CHKTOP:    call    DELLN1        ; Clean out existing line
  1634.     call    BNOWRITE
  1635.     xor    a
  1636.     jr    ESET        ; Fix End Flag
  1637.  
  1638. NOTTOP:    xor    a
  1639.     cpl
  1640.     jr    ESET
  1641.  
  1642. EZER:    xor    a        ; Set the lot of them
  1643.     cpl
  1644. BESET:    ld    (BACKFLG),a
  1645. ESET:    ld    (ENDFLG),a
  1646.     ret
  1647.  
  1648. ; ---------------------------------------
  1649. ; Support routines for the commands above
  1650. ;
  1651. SETSCAN:
  1652.     push    af        ; Delete line and quiet terminal
  1653.     call    DELLN1
  1654.     xor    a
  1655.     cpl
  1656.     ld    (NOOUT+1),a
  1657.     pop    af
  1658.     ret
  1659.  
  1660. INSERT:    call    DOSAV
  1661.     ld    e,a        ; Put the char in
  1662.     ld    a,(INSFLG)
  1663.     or    a
  1664.     jr    nz,YAINS
  1665.     ld    hl,(POS)
  1666.     ld    a,(hl)
  1667.     or    a
  1668.     ld    a,e
  1669.     jr    nz,OVERWRITE    ; Do we insert?
  1670. YAINS:    xor    a
  1671.     ld    b,a
  1672.     push    de
  1673.     call    MOVEUP        ; Push them up
  1674.     pop    de
  1675.     jp    z,BEEP        ; No room
  1676.     ld    a,e
  1677. OVERWRITE:
  1678.     ld    hl,(POS)
  1679.     ld    (hl),a
  1680.     call    IPOS        ; Skip over it (PRINTing it)
  1681.     jr    SHOWTOEND    ; Redisplay
  1682.  
  1683. DELETE:    call    DOSAV
  1684.     ld    de,(POS)    ; Kill a char quiet-like
  1685.     ld    a,(de)
  1686.     or    a
  1687.     ret    z
  1688.     push    af
  1689.     ld    hl,DELETED
  1690.     inc    (hl)
  1691.     cp    ' '
  1692.     jr    nc,NOINC2    ; Increment DELETED as neccessary
  1693.     inc    (hl)
  1694. NOINC2:    call    MOVEDOWN    
  1695.     pop    af
  1696.     or    a
  1697.     ret
  1698.  
  1699. OUTPUT:    call    crlf        ; New line
  1700. OUTPUT1:
  1701.     call    PROMPT        ; Redisplay prompt
  1702. OUTPUT2:
  1703.     ld    hl,BUFFER    ; And command line
  1704.     ld    (POS),hl
  1705.     jp    SHOWTOEND
  1706.  
  1707. CLRTOEND:
  1708.     ld    hl,(POS)    ; Wipe out command line from cursor to right
  1709.     ld    de,0
  1710.     call    DOSAV
  1711. CLRLOOP:
  1712.     ld    a,(hl)        ; Loop until NULL
  1713.     or    a
  1714.     jr    z,NOWBACK
  1715.     cp    ' '
  1716.     jr    nc,CLR2
  1717.     inc    de
  1718.     call    SPACE        ; Two for Control Chars
  1719. CLR2:    call    SPACE        ; Overwrite it
  1720.     inc    hl
  1721.     inc    de
  1722.     jr    CLRLOOP
  1723. NOWBACK:
  1724.     ld    a,d
  1725.     or    e
  1726.     ret    z
  1727.     dec    de
  1728.     call    BACK        ; And return to old location
  1729.     jr    NOWBACK
  1730.  
  1731. IPOS:    ld    hl,(POS)    ; Get current char and PRINT it
  1732.     ld    a,(hl)
  1733.     or    a
  1734.     ret    z        ; Return zero if NULL
  1735.     push    af
  1736.     inc    hl
  1737.     ld    (POS),hl
  1738.     push    bc
  1739.     ld    b,a
  1740.     ld    a,(NOOUT + 1)    ; Silence?
  1741.     or    a
  1742.     ld    a,b
  1743.     pop    bc
  1744.     call    z,CCOUT
  1745.     pop    af
  1746.     ret
  1747.  
  1748. DPOS:    ld    hl,(POS)    ; Back up (^H)
  1749.     dec    hl
  1750.     ld    a,(hl)
  1751.     or    a
  1752.     ret    z
  1753.     push    af
  1754.     ld    (POS),hl
  1755.     cp    ' '
  1756.     call    c,BACK        ; Two for Control Char
  1757.     call    BACK
  1758.     pop    af
  1759.     ret
  1760.  
  1761. SHOWTOEND:
  1762.     call    PRINTHL        ; Show line to end
  1763.     jr    nz,SHOWLP
  1764.     ld    hl,DELETED    ; With spaces for deleted text
  1765.     ld    a,(hl)
  1766.     or    a
  1767.     jr    z,SHOWLP
  1768. SHW1:    push    af
  1769.     call    SPACE
  1770.     pop    af
  1771.     dec    a
  1772.     jr    nz,SHW1
  1773. SHW2:    call    BACK
  1774.     dec    (hl)
  1775.     jr    nz,SHW2
  1776. SHOWLP:    ld    a,d
  1777.     or    e
  1778.     ret    z
  1779.     dec    de
  1780.     call    DPOS
  1781.     jr    SHOWLP
  1782.  
  1783. PRINTHL:
  1784.     ld    de,0        ; Show text at HL to NULL
  1785. PHLOOP:    call    IPOS
  1786.     ret    z
  1787.     inc    de
  1788. KILLFLG:
  1789.     ld    a,0        ; Check for UNDO
  1790.     or    a
  1791.     ret    nz
  1792.     push    hl
  1793.     push    de
  1794.     push    bc
  1795.     ld    c,11        ; Check for console in
  1796.     call    BDOS
  1797.     pop    bc
  1798.     pop    de
  1799.     pop    hl
  1800.     or    a
  1801.     jr    z,PHLOOP
  1802.     call    cin        ; Check for previous input
  1803.     ld    (GETKEY+1),a
  1804.     cp    ' '
  1805.     jr    c,PHLOOP
  1806.     cp    127        ; If it's an input, don't redisplay
  1807.     ret    nz
  1808.     jr    PHLOOP
  1809.  
  1810. GETKEY:    ld    b,0
  1811.     xor    a
  1812.     ld    (GETKEY+1),a    ; Save the previous key
  1813.     ld    a,b
  1814.     or    a
  1815.     call    z,cin
  1816.     ret
  1817.  
  1818. MOVEUP:    ld    hl,(POS)    ; Move the text up to accept new char
  1819.     ld    a,' '
  1820. UPLOOP:    ld    b,(hl)
  1821.     ld    (hl),a
  1822.     inc    hl
  1823.     ld    a,b
  1824.     or    a
  1825.     jr    nz,UPLOOP
  1826.     ld    (hl),a
  1827.     ld    de,BUFFER + 300
  1828.     sbc    hl,de        ; Until the end
  1829.     jr    z,MOVEDOWN    ; No good, move it back
  1830.     or    1
  1831.     ret
  1832.  
  1833. MOVEDOWN:            ; Move a char out -- Delete
  1834.     ld    hl,(POS)
  1835.     ld    d,h
  1836.     ld    e,l
  1837. DNLOOP:    inc    hl
  1838.     ld    a,(hl)        ; Pull them down till we find a NULL
  1839.     ld    (de),a
  1840.     or    a
  1841.     inc    de
  1842.     jr    nz,DNLOOP
  1843.     ret
  1844.  
  1845. UNDO:    ld    hl,kill        ; Insert Kill buffer
  1846.     xor    a
  1847.     cpl
  1848.     ld    (KILLFLG + 1),a
  1849.     call    undo1
  1850.     xor    a
  1851.     ld    (KILLFLG + 1),a
  1852.     jp    SHOWTOEND
  1853. UNDO1:    ld    a,(hl)        ; insert at HL until NULL
  1854.     inc    hl
  1855.     or    a
  1856.     ret    z
  1857.     push    hl
  1858.     call    INSERT
  1859.     pop    hl
  1860.     jr    UNDO1
  1861.  
  1862. WFFILE:    call    RCHECK        ; Forward a char in the file with write
  1863.     ld    de,(FP)
  1864.     ld    (de),a
  1865.     ld    hl,SECTOP-1
  1866.     sbc    hl,de
  1867.     jr    nz,FNOWRITE
  1868.     call    WRAND
  1869. FNOWRITE:            ; Forward a char
  1870.     call    RCHECK
  1871.     ld    de,(FP)
  1872.     inc    de
  1873.     ld    hl,SECTOP
  1874.     sbc    hl,de
  1875.     jr    nz,NOREAD
  1876.     ld    hl,SEC
  1877.     inc    (hl)
  1878.     call    RRAND
  1879.     ld    de,SECBUF
  1880. NOREAD:    ld    a,(de)
  1881.     ld    (FP),de
  1882.     or    a
  1883.     ret
  1884.  
  1885. WBFILE:    call    RCHECK        ; Back a char in file with write
  1886.     ld    de,(FP)
  1887.     ld    (de),a
  1888.     ld    hl,SECBUF
  1889.     sbc    hl,de
  1890.     jr    nz,BNOWRITE
  1891.     call    WRAND
  1892. BNOWRITE:            ; Back a char
  1893.     call    RCHECK
  1894.     or    a
  1895.     ld    de,(FP)
  1896.     dec    de
  1897.     ld    hl,SECBUF-1
  1898.     sbc    hl,de
  1899.     jr    nz,NOREAD
  1900.     ld    hl,SEC
  1901.     dec    (hl)        ; Should never get to be ZERO... Honest.
  1902.     jr    nc,BNOZERO
  1903.     ld    (hl),0        ; But, what the hell, it's free.
  1904. BNOZERO:
  1905.     call    RRAND
  1906.     ld    de,SECTOP-1
  1907.     jr    NOREAD
  1908.  
  1909. WRAND:    ld    c,22h        ; Write random
  1910.     call    DORAND
  1911.     or    a
  1912.     ret    z
  1913.     jp    nz,WMERR
  1914.  
  1915. DORAND:    ld    a,(SEC)        ; Put random record in right place in FCB
  1916.     ld    hl,FCB+33    ; Set the DMA and call BDOS
  1917.     ld    (hl),a
  1918.     inc    hl
  1919.     xor    a
  1920.     ld    (hl),a
  1921.     inc    hl
  1922.     ld    (hl),a
  1923.     push    de
  1924.     call    SETDMA
  1925.     call    FBDOS
  1926.     pop    de
  1927.     ret
  1928.  
  1929. SETDMA:    push    bc        ; Set the DMA to the SECBUF
  1930.     ld    c,1ah
  1931.     ld    de,SECBUF
  1932.     call    BDOS
  1933.     pop    bc
  1934.     ret
  1935.  
  1936. BCD2:    push    bc        ; Format two digit numbers
  1937.     ld    c,0ffh
  1938. BCD2A:    inc    c
  1939.     sub    10
  1940.     jr    nc,BCD2A    ; Put them in BCD (??) form
  1941.     add    a,10
  1942.     ld    b,a
  1943.     ld    a,c
  1944.     rlca
  1945.     rlca
  1946.     rlca
  1947.     rlca
  1948.     or    b
  1949.     pop    bc
  1950.     ret
  1951.  
  1952. PAFDC:    ld    d,0        ; PRINT them out
  1953.  
  1954. MAFDC:    push    af        ; Put them in a memory location
  1955.     call    BCD2
  1956.     push    af
  1957.     rra
  1958.     rra
  1959.     rra
  1960.     rra
  1961.     and    1111b
  1962.     call    nz,DEPUT    ; Output tens
  1963.     pop    af
  1964.     call    DEPUT        ; Output ones
  1965.     pop    af
  1966.     ret
  1967. DEPUT:    and    1111b
  1968.     add    '0'
  1969.     inc    d
  1970.     dec    d        ; Check for output
  1971.     jp    z,COUT
  1972.     ld    (de),a        ; Else memory stuff
  1973.     inc    de
  1974.     ret
  1975.  
  1976. ;
  1977. ; Bdos console in. With no echo.
  1978. ;
  1979. CIN:    push    hl
  1980.     push    de
  1981.     push    bc
  1982.     ld    hl,(1)
  1983.     ld    de,9
  1984.     add    hl,de
  1985.     ld    (hl),0C9h
  1986.     push    hl
  1987.     ld    c,1
  1988.     call    BDOS
  1989.     pop    hl
  1990.     ld    (hl),0c3h
  1991.     pop    bc
  1992.     pop    de
  1993.     pop    hl
  1994.     ret
  1995.  
  1996. RCHECK:    push    af        ; Have we read already?
  1997.     ld    a,(RDFLG)
  1998.     or    a
  1999.     jr    nz,RCK1        ; Yes