Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Command Logger

65 views
Skip to first unread message

John Gustaf Stebbins

unread,
Oct 5, 2006, 7:49:03 PM10/5/06
to
While at HCC 2006 somebody asked about having a command logger to assist in
programming. This sounded like an interesting idea so I started working on
one. This is what I came up with. It is a library and has two visible
commands: STARTLOG and ENDLOG. It uses the vectored enter utilities in the
calculator and will mess with your user keys and flags.

STARTLOG first clears out your user keys and then assigns ENDLOG to
left-shift ENTER. Your user keys are stored in a variable 'ukeys' in the
HOME directory. It also creates alpha and beta enter functions that
actually do the work. A variable CLOG is also created to store all commands
from this point forward. The calculator is then put into user key mode and
vectored enter mode by setting the appropriate flags.

After executing STARTLOG you can do calculations and execute commands that
you might want to have in a program. When you have what you want, execute
ENDLOG (it is on the left-shift ENTER key or go to the catalogue).

ENDLOG takes the calculator out of both user key mode and vectored enter
mode by clearing the appropriate flags. It then clears the user keys and
restores what you had. The contents of CLOG are converted to a program that
is left on the stack and all the variables and programs stored in the HOME
directory are purged.

This library could mess things up if you normally keep your calculator in
user key mode, and I've not had anyone else test it. Anyone trying it out
should be sure they have a backup of their calculator, user keys and modes.
Let me know if there are any problems. I can be reached at
douglas...@comcast.net. The source code, all userRPL, is below if
someone is interested in modifying the program.

-jgs


%%HP: T(3)A(R)F(.);
DIR
STARTLOG
\<< PATH HOME RCLKEYS 'ukeys' STO CLRUKEYS 'ENDLOG' 101.2 ASN "\<<
" 'CLOG' STO
\<< DROP PATH HOME
\<< PATH \-> p
\<< HOME 'CLOG' SWAP "
" + STO+ p EVAL
\>>
\>> '\GbENTER' STO EVAL
\>> '\GbENTER' STO
\<< PATH \-> p
\<< HOME 'CLOG' OVER "
" + STO+ OBJ\-> p EVAL EVAL
\>>
\>> '\GaENTER' STO -62. SF -63. SF EVAL
\>>
ENDLOG
\<< PATH \-> p
\<< HOME -62. CF -63. CF CLRUKEYS ukeys STOKEYS CLOG OBJ\-> { ukeys CLOG
\GbENTER \GaENTER } PURGE p EVAL
\>>
\>>
CLRUKEYS
\<< RCLKEYS
IF DUP SIZE 2. >
THEN TAIL 1.
\<<
IF NSUB 2. MOD
THEN DROP
END
\>> DOSUBS DELKEYS
ELSE DROP
END
\>>
$HIDDEN { CLRUKEYS }
$VISIBLE { STARTLOG ENDLOG }
$CONFIG 1
$TITLE "Command Logger"
$ROMID 1347
END


CLLIB.hp

John H Meyers

unread,
Oct 5, 2006, 8:41:16 PM10/5/06
to
Something related, but different -- this extends the number
of remembered *typed* commands (the keyboard CMD operation)
from the built-in four to as many as you want (I keep my last 100):

http://groups.google.com/group/comp.sys.hp48/msg/097e7f215218c0ce?dmode=source

"Vectored ENTER" support was removed from ALGebraic mode eons ago,
however, so nothing is saved in ALG mode.

There are also several unusual "tracing" programs in this thread:
http://groups.google.com/group/comp.sys.hp48/browse_frm/thread/5b426da8dc63171a
[please use the "show original" option to copy any posted programs]

Best wishes from http://www.mum.edu
and http://www.maharishischooliowa.org

Berk Birand

unread,
Oct 5, 2006, 9:05:41 PM10/5/06
to
On Thu, 05 Oct 2006 19:41:16 -0500, John H Meyers wrote:

> Something related, but different -- this extends the number
> of remembered *typed* commands (the keyboard CMD operation)
> from the built-in four to as many as you want (I keep my last 100):

As a related issue, do you know of a program that will allow
you to do multiple UNDOs? It would be really useful if one could recall
several operations...

Berk

--
Posted via a free Usenet account from http://www.teranews.com

John H Meyers

unread,
Oct 6, 2006, 4:46:25 AM10/6/06
to
On Thu, 05 Oct 2006 20:05:41 -0500, Berk Birand wrote:

> As a related issue, do you know of a program
> that will allow you to do multiple UNDOs?
> It would be really useful if one could recall several operations...

You can perform HALT each time you want a new environment,
and CONT each time you want to backtrack;
each saved environment can then be UNDOne!

Example (any HP48/49/50):

1 2 [1 and 2 are on the stack]

HALT + SQ [result is now 9]

UNDO [back to 3, as of just before SQ]

CONT UNDO [back to 1 and 2 separately]

It could also be done by programming, but who wants to write programs
when keys are conveniently provided for banging out our frustrations? ;)

Well, let's also re-post a program [for any HP48/49/50]
which leaves arguments of all keyboard-executed RPN-mode functions
on the stack, as well as each result:

\<< DEPTH \-> d \<< LASTARG DEPTH d - 1. + \->LIST
DUP 2. OVER SIZE SUB SWAP 1. GET DUP SIZE
{ "{" SWAP + STR\-> 1. GET DUP TYPE 18. ==
{ + SWAP } { DROP2 } IFTE } { DROP2 }
IFTE "" DROP \>> \>> '\GbENTER' STO

-55. CF -62. SF -63. SF @ Required flag settings

Note that the variable name is: [GreekBeta]ENTER
(Alpha Right-shift B produces the Greek Beta character)

Left-shifted Alpha ("USER") toggles "Trace mode" on/off.

[r->] [OFF] -- oops, that toggled me off as well :)

John H Meyers

unread,
Oct 8, 2006, 5:04:45 AM10/8/06
to
On Thu, 05 Oct 2006 20:05:41 -0500, Berk Birand wrote:

> As a related issue, do you know of a program
> that will allow you to do multiple UNDOs?
> It would be really useful if one could recall several operations...

Here we go for HP49/50 (see below for HP48G[X]):

Assuming that you have previously installed the "extable" library
(to compile SysRPL) and have set flags -86 and -92
and have warmstarted the calc with ON+C:

":: DROP ' xHALT EvalNoCK ROMPTR A3 10 ;"
10 CHR + 64 CHR + ASM2 '\GbENTER' STO

\<< KILL \>> 'Kill' STO

\<< CONT \>> 'Back' STO

-62 SF -63 SF

Now calculate as usual, and any time you want to UNDO something,
use 'Back' (or CONT) -- each successive press of 'Back' (or CONT)
will UNDO the previous operation,
as far back as the stack history was saved.

Use 'Kill' (or type KILL) to wipe out all saved stacks
(obviously it takes some memory to save each stack,
so if you never clear out the saved stacks,
you'll eventually run out of memory).

The same works for HP48G[X], substituting ROMPTR A3 E
within the SysRPL program (compile with Jazz or MK).

As you can see by now, customizing your calc
to do anything you can imagine
is probably trivial :)

[r->] [OFF]

John H Meyers

unread,
Oct 8, 2006, 5:29:29 AM10/8/06
to
On Sun, 08 Oct 2006 04:04:45 -0500:

I suppose I should have **WARNED** that you should not attempt
to directly execute the '\GbENTER' program just posted,
because if the stack is empty, you might then get a
"Try To Recover Memory?", and possibly wipe out memory!

So here's a re-post in which that program
is equipped with an up-front test to protect against
any kind of problem that could occur upon direct execution;
i.e. - this version is safe to use!

----- Repost (safe version!) -----

On Thu, 05 Oct 2006 20:05:41 -0500, Berk Birand wrote:

> As a related issue, do you know of a program
> that will allow you to do multiple UNDOs?
> It would be really useful if one could recall several operations...

Here we go for HP49/50 (see below for HP48G[X]):

Assuming that you have previously installed the "extable" library
(to compile SysRPL) and have set flags -86 and -92
and have warmstarted the calc with ON+C:

":: DEPTH #0=?SEMI DROP ' xHALT EvalNoCK ROMPTR A3 10 ;"

Veli-Pekka Nousiainen

unread,
Oct 9, 2006, 3:52:48 AM10/9/06
to
John H Meyers wrote:
X> ----- Repost (safe version!) -----

Marvellous!

Sliced bread could be even better
but I thing it's impossible to select from the past UNDO levels
(except going back as far as needed)
also no REDO is possible
BUT
This program definately hsa to go to the www.hpcalc.org
as well as it goes into my personal computer (and calc)

Thanks, John!
--
Veli-Pekka


John H Meyers

unread,
Oct 9, 2006, 7:07:27 PM10/9/06
to
On Mon, 09 Oct 2006 02:52:48 -0500, Veli-Pekka Nousiainen wrote:

> Sliced bread could be even better.

I prefer "Finn Crisp" :)

But local supermarkets no longer stock it :(

Many different sorts of "Vectored ENTER" program like this
have been offered, each for a different purpose, but since
the program name is dictated by the OS and must always be the same,
it would at first appear that you can install only one at a time.

However, you can actually maintain as many as you wish
at the same time, within the same calculator,
by distributing them into different directories to avoid conflict.

You then can just go into different directories
to get different sorts of special "trace" functions,
"undo" functions, "build algebraic expression" function
(once requested to mimic another TI-like behavior), etc.,
and even "none of the above" when you don't go into
any of those special directories which have been equipped
with special-purpose "Vectored ENTER" functions
(both 'AlphaENTER' and 'BetaENTER', as may be the case)

--

MMMmmmm... So good!

http://kuvapankki.vaasan.com/ib/fi/01_tuotteet/04_tunnelma/VAASAN_Rapeat_Ruis_iltapala/VAASAN_Rapeat_Ruis_iltapala.jpg

http://kuvapankki.vaasan.com/ib/en/01_products/01_finn_crisp/01_crisp_bread/FINN_CRISP_Caraway_200g/CARAWAY.jpg

John H Meyers

unread,
Oct 10, 2006, 1:45:22 AM10/10/06
to
For anyone who doesn't want to bother installing "extable"
for compiling a short SysRPL program, here is another way
to create the SysRPL program which saves unlimited "Last stacks"
for the UNDO function on all 49-50 series calcs (including 48Gii):

"D9D20C4130E7A434423079E60D08839136229E203A0010B2130"
IF DUP BYTES DROP #E12Ah == THEN #100001h LIBEVAL END

Having thus made sure that the checksum of the string was correct,
the final step of the above produces a SysRPL program:

:: DEPTH #0=?SEMI DROP ' xHALT EvalNoCK ROMPTR A3 10 ;

[appearing on the stack as "External..." unless flag -85 is set]
which you can store into a variable named '\GbENTER'
whose first character \Gb [Greek beta] is alpha right-shift B.

After flags -62 and -63 have also been set,
each keyboard-initated command will first save the original stack,
as usual, but the UNDO function will no longer seem to work;
instead, use CONT in place of UNDO, and it will turn out
that successive uses of CONT will successively UNDO
the various changes which have been made to the stack,
as far back as when stack saving began.

Turning off USER mode suspends the creation of additional
"environments" and allows the usual single UNDO at the
current environment level; CONT may still be used
to go back to previous stacks that had formerly
been preserved when USER mode was in effect.

You will note that the HLT indicator appears in the status area
(if the 2-line "header" is in effect), indicating that there are
HALTed programs; type KILL to clear this and remove all previously
saved stacks (otherwise those will keep filling up memory until full).

Note that ANS (last arguments) on the keyboard
is not affected; you can still use ANS (or ARG on 48G)
to recall the last arguments used in RPN mode,
which is sometimes even more useful than UNDO,
because it keeps the previous result on the stack as well.

If any UNDO or CONT (or ANS) gives an error "LAST STACK disabled,"
then type 69 MENU and press STK (or ARG for "LASTARG disabled")
until there's a white "box" in its label.

HP48G[X][+] users may also use a similar SysRPL program,
except the 48G's UNDO function is ROMPTR A3 E;
the corresponding ASC-encoded binary program for 48G is:

"D9D20C413081A164423079E602743232F8129E203A0E00B213069D0"

For information on decoding the above, see:

http://www.hpcalc.org/details.php?id=2377
http://www.hpcalc.org/hp48/utils/memory/asc.zip

http://www.hpcalc.org/details.php?id=3829
http://www.hpcalc.org/hp48/pc/misc/asc2bin.zip

http://www.hpcalc.org/hp48/docs/faq/48faq-7.html#ss7.6
http://www.hpcalc.org/hp48/docs/faq/48faq-9.html#ss9.1

Veli-Pekka Nousiainen

unread,
Oct 10, 2006, 4:58:56 AM10/10/06
to
John H Meyers wrote:
X
My this years "Helpful Poster" Award 1st nominee is John The Great


John H Meyers

unread,
Oct 10, 2006, 6:02:57 AM10/10/06
to
On Tue, 10 Oct 2006 03:58:56 -0500, VPN wrote:

> John The Great

How about a Great John?

http://greatjohn.com

2004 "Best new product" award:
http://greatjohn.com/benewprawle.html

You can't beat that!

Veli-Pekka Nousiainen

unread,
Oct 10, 2006, 6:55:18 AM10/10/06
to

Hmmm. is "john" a toilet? (Am. slang)
What is then "johnsson"? A kid-sized toilet?
:-D
o/o <= is that a procent sign or a kids toilet?


Giancarlo

unread,
Oct 10, 2006, 8:04:13 AM10/10/06
to

On Oct 10, 10:58 am, "Veli-Pekka Nousiainen" <DROP_...@dlc.fi> wrote:
> John H Meyers wrote:X
> My this years "Helpful Poster" Award 1st nominee is John The Great

Subscribed!
;)

Giancarlo

0 new messages