This message was posted on Richard Jacobson's Lillipute RCPM in 
Chicago.  The information will be useful to anyone who uses RCP's 
that require a "trigger key."


Msg #6344 posted 06/26/87 at  6:21 am by Carson Wilson
To: ALL USERS     About: ARUNZ RCP Alias (85 lines)

       Using ARUNZ to Safely Load "Trigger Key" RCP's
                                                        25 Jun 87

Some very useful ZCPR Resident Command Packages (RCP's) such as 
Arnold Bailey's Z3KEY.RCP, Paul Pomerleau's SLTRAP.RCP, or my 
CALC.RCP, temporarily alter your system's BIOS to monitor for a 
"trigger key."  The reason it is necessary to alter the lowest 
level of your operating system is so that these RCP's may be 
activated even from within application programs, which normally 
take over all console input/output.

When using RCP's which monitor for trigger keys, it is imperative 
that trigger-key checking be turned OFF before removing the RCP.  
This returns control of console input to the BIOS of your 
computer.

Normally, it is the responsibility of the user to ensure that 
trigger key checking is turned off before removing these RCP's.  
This is done by giving commands to the RCP from the operating 
system prompt, and interpreting the results to ensure that 
trigger key detection is off.

There is an easier and safer way, however.  ARUNZ's ability to 
examine memory with the "$M" parameter allows automated checking 
of whether or not the BIOS has been altered.  The $M parameter in 
ARUNZ alias scripts returns the hex value of a byte at a given 
memory address.  By comparing current hex values with normal 
values in the BIOS, ARUNZ can tell whether or not it is safe to 
remove an RCP which uses trigger key detection.

Here is the ARUNZ.COM alias for my system which checks for 
trigger-key detection before changing RCP's:

 RCP if ex load:$1.rcp;if $ME10B=E2;ldr load:$1.rcp;fi;fi;h

The alias name is "RCP". It is called by specifying the file name 
of the RCP to be loaded, e.g., "/RCP SYS" to load SYS.RCP. The 
alias performs the following actions:

1. "if ex load:$1.rcp;"
   Check the directory named LOAD: (where I keep all of my RCP's) 
   to see if the RCP file exists.  If not, skip to 4 (below). 
   This command is optional, and assumes you have IF EXIST 
   installed in your Flow Command Package (FCP).

2. "if $ME10B=E2;ldr load:$1.rcp;"
   [This command assumes you have "IF =" installed in your FCP.] 
   a. Check memory location E10B hex for the normal ConIn value.  
   b. If and only if the ConIn value is E2 hex (the normal 
   value), load the specified RCP file.

4. "fi;fi;h"
   Always give the help message for the current RCP, telling 
   which RCP is now active.  If the load failed, then help for 
   the old RCP is given.

This prevents me from accidentally changing RCPs before I've 
turned off trigger key detection.

The only tricky part of building this alias is finding the 
correct values for the "$Mnnnn=nn" statement.  The first argument 
in the statement is the address of the jump to the console input 
routine in your BIOS, plus one.  This is always at BIOS+0B hex.  
The second argument to the alias is the normal value for this 
address.  Both of these values can be found using TELL.COM and a 
little math.  TELL.COM gives a report such as:

 "...
 Your CBIOS jump table begins at:        E100H.
 ...
 Console Input routine (waits for char.):E2ADH.
 ...."

To get the value for the first argument, just add 0B hex to the 
value for your CBIOS jump table (E100H in this example).  To get 
the value for the second argument, take the first two digits of 
the address for Console Input routine (E2 in this example).  
Thus, for my system, the "$Mnnnn=nn" is translated into 
"$ME10B=E2".  When the byte at E10B hex equals E2 hex in my 
system, ARUNZ can proceed to remove the current RCP, as the BIOS 
jump to Console Out has been restored to its normal value.

