                  HIST197.LBR: Recalling Commands in CP/M

     Do you growl when you have to re-enter a long command line that was 
rejected because you got one letter wrong?  Don't you hate to retype the 
same line again and again with just minor changes?  Wouldn't you love to 
recall that sequence of commands you gave about 20 lines back?   
 
     Those of you who work on a VAX/VMS system know that by proper use of 
the arrow keys you can, in fact, recall any of your last 20 commands, edit 
them, and replay them to your heart's content.  (I understand that UNIX 
offers a similar capability.)  

     Well, gnash your teeth no longer -- you can now have it in CP/M too.  
HISTORY.LBR, version 1.9, from Stuart Rose of Starling RCMP+, has made it 
possible whether you use CP/M 2.2 (CP/M-80) or CP/M 3.0 (CP/M+).  That is, 
you can have it in CP/M 2.2 if you are willing to give up about 5.3K of your 
precious 64K.  

     I was willing.  I will go to any lengths to make my fingerwork at the 
keyboard more efficient, so I eagerly tried out HISTORY on my Kaypro II '83.  
It worked beautifully!  Until the first Warm Boot, when it disappeared.  Hmm 
-- there must be a way to fix that.  And, too, make it look more like 
VAX/VMS so I won't get so confused.  And make it less of a memory hog.  And 
implement the CTRL-P printer toggle.  And omit saving responses within 
applications programs that are too short to be worth recalling.  And make it 
compatible with NSWP 2.07.  And ...

     So I went to work tuning up version 1.9 to suit my own needs.  The 
result is called HIST197, nominally the seventh revision of HISTORY 1.9.  
(Believe me, there were a lot more than 7!)  No matter that the amount of 
time and fingerwork I invested vastly exceeds the grand total of what I will 
save in the rest of my CP/M life -- I am now so much more "efficient"!  Of 
course, HIST197 has a few unpolished edges, but it really works and has done 
no damage to my programs or documents.  

     HIST197 loads a memory-resident "daemon" that looks and feels almost 
exactly like VAX/VMS (4.0 or higher).  For those of you who are comfortable 
with WordStar, most of Stuart's original WordStar-like keystrokes are still 
there.  The daemon loaded by HIST197.COM saves more command lines than the 
one loaded by version 1.9, yet is substantially smaller.  

     Here's how to use HIST197.  First load the daemon by typing HIST197 
with the appropriate disk drive prefix.  Give a few commands to CP/M for a 
trial.  Now recall your last command with the up arrow (or CTRL-W).  You can 
keep recalling earlier and earlier commands this way up to a maximum of 23.  
Go back down the list with the down arrow (or CTRL-Z).  With a single ! 
command, you can see all of your previous commands, or rather, as many as 
will fit on a Kaypro II screen (23).  The commands are "numbered"; if you 
want to recall command number n, just type !n.  

     So now you have a previous command line at your disposal.  To replay 
it, press RETURN.  If you want to change some characters before replay, use 
the left arrow (or CTRL-S) or the right arrow (or CTRL-D) to move the 
cursor.  CTRL-B takes the cursor to the beginning of the line.  Then you can 
overstrike with the correct character(s).  You can toggle between overstrike 
mode and insert mode with CTRL-A (or CTRL-V).  To delete the character at 
the cursor, type CTRL-G.  To get rid of the one to the left of the cursor, 
use the DEL key.  You can also overstrike with spaces between whole words of 
a command -- CP/M won't mind the spaces.  

     The standard CP/M printer on/off toggle, CTRL-P, is implemented in 
HIST197.  The default option saves only commands to CP/M.  To enable recall 
of your responses to an applications program as well, type CTRL-O (even in 
the middle of a response); type CTRL-O again to toggle back to saving CP/M 
commands only.   

     As mentioned above, you load the daemon by simply typing HIST197.  You 
can easily patch the system tracks on your boot-up diskette so that this 
will be done automatically for you on a cold start.  If you need to recover 
the memory space occupied by the daemon and the CCP, you can unload the 
daemon by typing HIST197 u (or any character, even a space, beyond the 7).  
If you type HIST197 when the daemon is already resident, the daemon will be 
reloaded and all of your saved commands will be wiped out.  (I can't see why 
you would want to do this, but if you do it be sure to give CTRL-C as your 
first command after the reload -- there's a bug lurking here that hasn't 
been squashed.)  

     The whole story is in HIST197.LBR.  This library includes HIST197.COM, 
which is suitable for a Kaypro II and patchable for other CP/M 2.2 machines.  
If you don't like my choice of features or key assignments, you can easily 
substitute your own in the source program and reassemble.  For CP/M 3.0, it 
is essential to have HISTORY.LBR in order to build a .COM file.  


April 4, 1987                                Melvyn L. Halbert
                                             104 Morgan Road
(615) 483-0717 (voice only, 7-10 pm EDT)     Oak Ridge, TN 37830
