Ah, I'd forgotten about the trace mode for the printers. You can
get something similar by using vectored ENTER on the 48 and 49
series.
As you may expect, vectored ENTER "redirects" the normal execution
of ENTER, whether explicit by pressing the ENTER key, or implicit
by pressing an immediate entry key. For vectored ENTER to be in
effect, the calculator has to be in User keys mode (flag -62 set),
and Custom ENTER mode (flag -63 set) and at least one of the
global variables \GaENTER (alphaENTER) or \GbENTER (betaENTER) has
to be found on the current path.
You can think of \GaENTER as a pre-processing program. If you
start it with STR\-> or OBJ\->, then that command compiles and
"executes" the command line string. Note that for a "data-class"
object such as a number and character string, "execution" consists
of placing the object on the stack.
You can think of \GbENTER as a post-processing program. If it's
found, then a "key name" of whatever invoked ENTER is placed on the
stack. If you don't want the key name, then simply use DROP as the
first command in \GbENTER.
If both of these flags are set and \GaENTER is found, then instead
of parsing the command line and so on, the command line is simply
placed on the stack as a character string and \GaENTER is
executed. After \GaENTER finishes, the normal action of the key
that invoked ENTER (except for the ENTER key itself) is executed. After that, if \GbENTER is found,
then a string representing the name of the key that invoked the
ENTER is placed on the stack, and then \GbENTER is executed. Note
that for the key name, only keys that correspond to named,
programmable objects, such as built-in commands, XLIB names,
global names, or local names, return a meaningful string for
\GbENTER. For other object types, and unnamed operations such as
ENTER itself, only an empty string is returned.
Here's a pair of programs for print trace found in the 48G series
AUG:
%%HP: T(3); @ ASCII transfer header
@ Program name: \GaENTER
\<<
PR1 @ Print the command line string.
OBJ\-> @ Compile and execute string.
\>>
%%HP: T(3); @ ASCII transfer header
@ Program name: \GbENTER
\<<
PR1 @ Print the key name.
DROP @ Discard the key name.
PRSTC @ Print stack in compact form.
\>>
And another pair found in
Insights:
%%HP: T(3); @ ASCII transfer header
@ Program name: \GaENTER
\<<
PR1 @ Print the command line string.
OBJ\-> @ Compile and execute string.
\>>
%%HP: T(3); @ ASCII transfer header
@ Program name: \GbENTER
\<<
"[" SWAP + "]" + @ Surround key name with brackets.
PR1 @ Print the bracketed key name.
DROP @ Discard the key name.
PR1 @ Print the level 1 result of the operation.
\>>
My personal preference:
%%HP: T(3); @ ASCII transfer header
@ Program name: \GaENTER
\<<
PR1 @ Print the command line string.
STR\-> @ Compile and execute string.
\>>
%%HP: T(3); @ ASCII transfer header
@ Program name: \GbENTER
\<<
"[" SWAP + "]" + @ Surround key name with brackets.
PR1 @ Print the bracketed key name.
DROP @ Discard the key name.
PRST @ Print the stack.
\>>
Try the above, and maybe experiment a bit yourself.
Another possibility for \GaENTER would be prefixing a string
with "#" and suffixing it with "h" for entry of hex integers.
HP 48 INSIGHTS PART I: Principles and Programming
also has example programs BINCALC (Binary Calculator) and FRACALC
(fraction calculator) that use vectored ENTER. For anyone really
interested in the RPL models, I recommend buying the HP Museum
CD-ROM set / DVD and reading the books by William C. Wickes.
A disadvantage of vectored ENTER is that any directory can have
only one set of \GaENTER and \GbENTER variables (although each
directory can have it own set). Particularly if you want to have
more than one set of vectored ENTER variables, you may want to
have a named program store new content to these variables when you
execute it; for example:
%%HP: T(3); @ ASCII transfer header
@ Program name: TRON
\<<
\<<
PR1 @ Print the command line string.
STR\-> @ Compile and execute string.
\>>
'\GaENTER' STO @ Store above program.
\<<
"[" SWAP + "]" + @ Surround key name with brackets.
PR1 @ Print the bracketed key name.
DROP @ Discard the key name.
PRST @ Print the stack.
\>>
'\GbENTER' STO @ Store above program.
-62 SF @ Force User keys enabled.
-63 SF @ Force vectored ENTER enabled.
\>>
And maybe:
%%HP: T(3); @ ASCII transfer header
@ Program name: TROFF
\<<
-63 CF @ Force vectored ENTER disabled.
\>>
Or:
%%HP: T(3); @ ASCII transfer header
@ Program name: TROFF
\<<
{ \GaENTER \GbENTER } PURGE
-63 CF
\>>
Regards,
James
Edited: 4 Jan 2007, 7:47 p.m. after one or more responses were posted