Re: Multiple Undo Program / Command Logger
- From: "John H Meyers" <jhmeyers@xxxxxxxxxxxxxx>
- Date: Sun, 06 May 2007 12:18:32 -0500
On Sat, 05 May 2007 18:43:13 -0500:
[about a kind of "push" and "pop" for "Last Stacks,"
allowing multi-level UNDO]
Flags -62 and -63 must both be set
for the following automatic programs to work.
AppMode? ?SEMI SuspendOK? NOT?SEMI ' xHALT ...
It appears that "AppMode? ?SEMI" can also be omitted,
since HALT itself is concerned only with SuspendOK?
HALT errors if suspending isn't OK, which is the problem
that Ryan Edwards had encountered with the original version
at the start of this thread (and subsequently solved).
So the bare remaining essentials are (in SysRPL):
"
:: DEPTH #0=?SEMI DROP SuspendOK? NOT?SEMI
' xHALT EvalNoCK ROMPTR A3 10 ;
@" -92 SF ASM2 '\GbENTER' STO @ Beta is Alpha RS "B"
The first ?SEMI above protects against manual execution
with an empty stack, the second ?SEMI protects against
trying to HALT when HALT is not allowed; if allowed,
it then halts (which creates a brand new "Last Stack")
ready to later resume and UNDO the original stack
upon execution of CONT. If keyboard UNDO is attempted
instead, it tries to undo the *new* "Last Stack,"
which tends to have no effect when BetaENTER (or HALT)
keeps starting a fresh new "Last Stack" each time.
Note:
On HP48G[X/+] use ROMPTR A3 E in place of ROMPTR A3 10
FWIW, you can have a different BetaENTER program
in every directory, so you can make different directories
for using different useful BetaENTER programs for different purposes
(any directory not having its own BetaENTER program
will look to higher directories to search for one).
Whenever the following (for all HP48/49/50)
performs an algebraic RPN function from the keyboard,
it first leaves on the stack
a list of the original args and function, then the result,
so it resembles what ALG mode does, but for RPN:
\<< DEPTH \-> d \<< LASTARG DEPTH d - \->LIST
"{1 " ROT + STR\-> DUP SIZE GET
DUP TYPE 18 == { + SWAP } { DROP2 } IFTE
-55 DUP SF CF \>> \>> '\GbENTER' STO
E.g. 2 3 + ==> { 2 3 + } and 5
To re-evaluate any list from above, you could use
\<< DUP EVAL \>> 'REDO' STO
The following, with flag -3 clear,
builds an algebraic expression using RPN operations;
use DUP EVAL [or REDO] to get a final numeric result:
@ HP50G/49G[+]/48Gii only
@ (needs 256 ATTACH before entering or transferring)
\<< DEPTH \-> d \<< LASTARG DEPTH d - \->LIST
"{1 " ROT + STR\-> DUP SIZE GET DUP TYPE 18 == {
+ OVER TYPE 9 == { DROP } { NIP \->ALG } IFTE
} { DROP2 } IFTE -55 DUP SF CF \>> \>> '\GbENTER' STO
The next version extends the above by *automatically*
showing the numeric result at every step:
@ HP50G/49G[+]/48Gii only
@ (needs 256 ATTACH before entering or transferring)
\<< DEPTH \-> d \<< LASTARG DEPTH d - \->LIST
"{1 " ROT + STR\-> DUP SIZE GET IF DUP TYPE 18 == THEN
+ NIP 1 \<< DUP TYPE 5 == { HEAD } IFT \>> DOLIST
DUP LIST\-> DROP EVAL -79 CF -97 SF
DUP TYPE 9 == { NIP } { DROP \->ALG } IFTE
IFERR DUP \->NUM THEN DROP ELSE 2 \->LIST END
ELSE DROP2 END -55 DUP SF CF \>> \>> '\GbENTER' STO
Does the above resemble this TI "RPN interface"?
http://www.paxm.org/symbulator/download/rpn.html
The following resets flags and modes after any operation,
thus undoing forced mode changes for CAS commands
(though it can't restore deleted variables, if any);
you should first set your preferred modes and do one PUSH
(turning off USER mode while you do this),
so that there will be something to POP the very first time:
\<< PATH POP PUSH EVAL { -62 -63 -120 } SF
DEPTH { DROP } IFT -55 DUP SF CF \>> '\GbENTER' STO
Faster replacement for the combination of POP and PUSH:
\<< { HOME CASDIR ENVSTACK } RCL DUP SIZE
{ HEAD LIST\-> 1 - SWAP EVAL \->LIST STOF }
{ DROP PUSH } IFTE \>> 'POPU' STO
Replace SWAP EVAL in the above with NIP
to avoid restoring the current directory,
thus allowing POPU to replace PATH POP PUSH EVAL
(restore flags only, allowing UPDIR
and/or entering a subdirectory).
Other uses of BetaENTER could be to automatically display
level-1 (if numeric) as degrees+minutes+seconds,
or in some other special format,
or to automatically simplify any algebraic results,
or to automatically do all sorts of other stuff
(but can it slice bread?)
[r->] [OFF]
.
- Follow-Ups:
- Re: Multiple Undo Program / Command Logger
- From: John H Meyers
- Re: Multiple Undo Program / Command Logger
- References:
- Multiple Undo Program / Command Logger
- From: ryan.edwards
- Re: Multiple Undo Program / Command Logger
- From: Andreas Möller
- Re: Multiple Undo Program / Command Logger
- From: ryan.edwards
- Re: Multiple Undo Program / Command Logger
- From: John H Meyers
- Multiple Undo Program / Command Logger
- Prev by Date: Re: I can use rechargable batteries on my HP50G
- Next by Date: Re: Multiple Undo Program / Command Logger
- Previous by thread: Re: Multiple Undo Program / Command Logger
- Next by thread: Re: Multiple Undo Program / Command Logger
- Index(es):
Relevant Pages
|