Re: Multiple Undo Program / Command Logger



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]
.



Relevant Pages

  • Re: [ubuntu-hardened] Re: Collecting NX information
    ... >>everything PaX wants ... define exactly what the flags should do. ... Stack and heap default to +X ... kernel randomizes anything that can be randomized in the address ...
    (Linux-Kernel)
  • [Patch] no exec: sync x86_64 behaviour with i386
    ... Control non executable mappings for 64bit processes. ... -per executable using ELF header flags ... Stack is non executable, heap/data is. ...
    (Linux-Kernel)
  • Re: [KMDF] Removing FDO and let PDO running
    ... You're right, here's what my stack looks like with!devnode ... CapabilityFlags LockSupported, UniqueID, ... Unknown flags 0xe9740000 ...
    (microsoft.public.development.device.drivers)
  • Re: CPU design
    ... Simpler solution - have the microcode FSM push the flags to the stack. ... re-entrant, so a faster context switch is to re-map the Registers, Flags (and even PC? ...
    (comp.arch.fpga)