
                WORDSTAR 4.0 ALT KEYS AND MACROS
                           Ed Zollars

     In the PATCH.LST file distributed with WordStar 4.0, there 
is a description of the methods necessary to patch WS4 to 
recognize and redefine keys using the scan codes they produce.  
Since most users are comfortable with using the Alt key to start 
macros (especially Lotus users), I have worked out the method 
below to allow macros assigned to an alphabetic key to be started 
with Alt and the key rather than hitting Esc followed by the key.

     The following instructions describe how to modify WordStar 
to recognize the Alt keys to start the macro playback in WS4.  
Please perform these changes only on a backup copy of WordStar.  
An error in this procedure could cause WordStar to fail to work 
after the changes are made.

     Also, be sure to install WordStar fully before attempting 
these changes.  The PATCH.LST file warns that WINSTALL will use 
the EXTRA area in some circumstances.  Before doing the steps 
below, look at the EXTRA patch area with WSCHANGE to see if 
anything other than "00" bytes exist at that location.  If there 
is other information in that area, you cannot use this patch, or 
must modify it accordingly to use a different area of memory 
(such as the portion of EXTRA after the patch code WINSTALL put 
in).

1.   Copy the MORPAT area to a patch file using WSCHANGE.  You 
     will modify this area to redirect the function key table to 
     point to a list of the alternate keys.  The last portion of 
     the function key definitions is stored in this area. 
     

2.   Examine the MORPAT table to see where the "00"'s begin.  At 
     the actual end of the table you must have three bytes of 
     "00".  If a single "00" byte exists followed by an address, 
     WordStar will continue reading function keys at that 
     address.  We will use this feature to install the alternate 
     keys into WS4.

     Your MORPAT file will appear somewhat like the listing below:

MORPAT=02,00,3C,01,15,02,00,3D,02,10,13,02,00,3E,02,10,02,02,00,3F,01,19,02,00,40,01,14,02,00,41,03,02
=11,10,02,00,42,04,11,13,0F,0F,02,00,54,02,0F,04,02,00,55,02,0F,03,02,00,56,02,11,0C,02,00,57,02
=11,0E,02,00,58,02,0B,19,02,00,59,02,0B,08,02,00,5A,02,0B,16,02,00,5B,02,0B,03,02,00,5C,02,0B,02
=02,00,5D,02,0B,0B,02,00,68,01,B3,02,00,69,01,C4,02,00,6A,01,DA,02,00,6B,01,BF,02,00,6C,01,C0,02
=00,6D,01,D9,02,00,6E,01,C2,02,00,6F,01,C1,02,00,70,01,C3,02,00,71,01,B4,02,00,5E,02,11,06,02,00
=5F,02,11,01,02,00,60,01,0C,02,00,61,02,11,09,02,00,62,06,11,13,2E,4C,4D,0E,02,00,63,06,11,13,2E
=52,4D,0E,02,00,64,07,11,13,2E,50,4D,36,0D,02,00,65,06,11,13,2E,50,41,0D,02,00,66,02,11,13,02,00
=67,02,11,04,02,00,3B,01,C4,02,00,43,01,12,02,00,44,01,03,00,00,00,00,00,00,00,00,00,00,00,00,00
                                                          ^^
                   This is the end of the function key table.

     You will want to edit the last line beginning with the 
     SECOND double zero to read "B8,0F" (the start of the EXTRA 
     area) and delete the remaining zeroes.  This redirects the 
     function key list to the EXTRA patch area.

     You can delete the zeroes to the right of the cursor on the 
     line with the changes on changes, and any lines following 
     that point.

     You have probably realized that the above change could 
     easily be made in WSCHANGE by locating and changing the 
     above bytes directly using the patch facility.  If so, go 
     ahead and change it that way rather than using the 
     autopatcher.  However, the patch described below is really 
     much simpler if you use the Autopatcher to install.

3.   Read the following file into your patch file immediately 
     following the changes to MORPAT:

EXTRA=02,00,10,02,1B,'Q'
=02,00,11,02,1B,'W'
=02,00,12,02,1B,'E'
=02,00,13,02,1B,'R'
=02,00,14,02,1B,'T'
=02,00,15,02,1B,'Y'
=02,00,16,02,1B,'U'
=02,00,17,02,1B,'I'
=02,00,18,02,1B,'O'
=02,00,19,02,1B,'P'
=02,00,1E,02,1B,'A'
=02,00,1F,02,1B,'S'
=02,00,20,02,1B,'D'
=02,00,21,02,1B,'F'
=02,00,22,02,1B,'G'
=02,00,23,02,1B,'H'
=02,00,24,02,1B,'J'
=02,00,25,02,1B,'K'
=02,00,26,02,1B,'L'
=02,00,2C,02,1B,'Z'
=02,00,2D,02,1B,'X'
=02,00,2E,02,1B,'C'
=02,00,2F,02,1B,'V'
=02,00,30,02,1B,'B'
=02,00,31,02,1B,'N'
=02,00,32,02,1B,'M'
=02,00,78,02,1B,'1'
=02,00,79,02,1B,'2'
=02,00,7A,02,1B,'3'
=02,00,7B,02,1B,'4'
=02,00,7C,02,1B,'5'
=02,00,7D,02,1B,'6'
=02,00,7E,02,1B,'7'
=02,00,7F,02,1B,'8'
=02,00,80,02,1B,'9'
=02,00,81,02,1B,'0'
=02,00,83,02,1B,'='
=00,00,00,00

     Each line in the above table defines one alternate key.  The 
     first character in each line tells WordStar the number of 
     bytes the scan code is contained in.  Alt keys generate 
     first a byte of "00" and then a unique byte for the key 
     pressed, so the length is 2.  The next two entries are the 
     hexadecimal codes returned by the key.  Another length byte 
     follows which tells WordStar how many characters it is to 
     translate this key press into.  Since all of the entries we 
     are replacing are "ESC" followed by one key, the length is 
     always 2.  The next two bytes are the actual keys to "send" 
     to the program, starting with ESC (hex 1B), followed by the 
     letter to send.

4.   Go back into WSCHANGE and read in the autopatcher file.  
     This selection is under the patching main menu choice.


This is an updated version of a file uploaded earlier to the 
     MicroPro forum on Compuserve.  The only change is adding the 
     Alt keys for 1 to =, which Robert Sawyer added to the patch 
     listed at 3.
