Performs hp49g CAS commands (in RPN mode)
so that they don't delete any variables,
don't fail because of variables which already exist,
don't prompt for any mode changes,
and don't leave any modes changed after execution.
Usage examples (assuming 'X' STOVX):
'X-1' { INTVX } XC @ without purging 'X' or changing modes
'Y-1' 'Y' { SOLVE } XC @ without purging 'X' or 'Y'
'\GS(X=2,3,X^2)' XC @ without mode changes or purging 'X'
This update:
o Can evaluate expressions (see last example above).
o Automatically works on all typed commands
or command keys pressed after Right-shift ENTRY
(this option may be omitted or turned off if desired)
You may also of course use it within programs or menus,
either on individual CAS commands or on whole programs
(use XC anywhere in place of EVAL).
Perform HOME 256 ATTACH before transfer:
%%HP: T(3)F(.); \<< @ cable transfer prefix
@ (execute transferred program to install)
\<< IF DEPTH 1. > THEN OVER ELSE 0. END
IF TYPE 6. == THEN OVER ELSE RCLVX END
RCLF PATH \-> v. f. p. \<< RCLVX VRENP v. VRENP
-120. SF IFERR EVAL THEN 1. ELSE 0. END f. STOF p. EVAL
RCLVX S~N NOT S~N VRENP v. S~N NOT S~N VRENP
{ ERRN DOERR } IFT \>> \>> 'XC' STO @ updated
"D9D200036234133D9D20881309EB5079E6031BC39136251B502A170D9D20"
"03D53B7970A3B63CA620400960018A30B2130F046385230B2130B2130" +
DUP BYTES DROP #DB72h == { H\-> } IFT 'VRENP' STO
@ Caution: Backup memory before using.
@ This evaluates all typed commands using XC [corrected]
\<< { STR\-> } + XC \>> '\GaENTER' STO @ AlphaENTER
-62 SF -63 SF @ Required flags
@ End of downloadable file
If you already use an AlphaENTER program (operating on typed entries),
you may replace its STR\-> by { STR\-> } + XC to add XC functionality.
Example of another AlphaENTER program:
Subject: Save unlimited command-line entries [HP49 version]
http://groups.google.com/group/comp.sys.hp48/msg/26859a719f2eae0d?dmode=source
(the ALG mode option is obsolete, but harmless)
[r->] [OFF]
What XC does (in 49G or 49G+):
Performs hp49g CAS commands (in RPN mode)
so that they don't delete any variables,
don't fail because of variables which already exist,
don't prompt for any mode changes,
and don't leave any modes changed after execution.
Usage examples (set Exact mode before starting):
'X' STOVX @ set Indep. var. to 'X' for the following
{ 11 22 } { X Y } STO @ and create variables 'X' and 'Y'
'X-1' { INTVX } XC @ without purging 'X' or changing modes
'Y-1' 'Y' { SOLVE } XC @ without purging 'X' or 'Y'
'\GS(X=2,3,X^2)' XC @ without mode changes or purging 'X'
This update:
o Evaluates expressions (see last example above).
o Automatically works on all typed commands
or command keys pressed after Right-shift ENTRY
(this option may be omitted or turned off if desired)
o "Object In Use" error on variable name conflicts [very rare]
o Reduces overhead (execution time).
You may also of course use it within programs or menus
(use XC anywhere in place of EVAL).
Perform HOME 256 ATTACH before transfer:
%%HP: T(3)F(.); \<< @ cable transfer prefix
@ (execute transferred program to install)
\<< CASE DUP TYPE 9. == THEN DUP END
DEPTH 1. > THEN OVER END 0. END
IF TYPE 6. == THEN OVER ELSE RCLVX END
RCLF PATH \-> v. f. p. \<< RCLVX DUP VRENP
v. SAME NOT { v. VRENP } IFT -120. SF
IFERR EVAL THEN 1. ELSE 0. END f. STOF p. EVAL
RCLVX DUP S~N NOT S~N VRENP
v. SAME NOT { v. S~N NOT S~N VRENP } IFT
{ ERRN DOERR } IFT \>> \>> 'XC' STO
"D9D20792628236234133D9D20881309EB5079E6031BC39136251"
"B50C2C539F943D9D201613338863B21302A170D9D2003D53B7" +
"97041963CA62040096000CA30B21308C1702D143B2130B2130" +
DUP BYTES DROP #67EDh == { H\-> } IFT 'VRENP' STO
@ Caution: Backup memory before using.
@ This evaluates all typed commands using XC
\<< { STR\-> } + XC \>> '\GaENTER' STO @ AlphaENTER
-62 SF -63 SF @ Required flags
@ End of downloadable file
If you already use an AlphaENTER program (operating on typed entries),
you may replace its STR\-> by { STR\-> } + XC to add XC functionality.
Example of another AlphaENTER program:
Subject: Save unlimited command-line entries [HP49 version]
http://groups.google.com/group/comp.sys.hp48/msg/26859a719f2eae0d?dmode=source
(the ALG mode option is obsolete, but harmless)
( VRENP source )
::
CK1NOLASTWD CK&DISPATCH1
SIX
:: DUP ID>$ ' xNOT EvalNoCK $>ID
DUP@ case :: NINE ERROROUT ; ( name collision test )
BEGIN
:: DUP3PICK @ NOTcaseTRUE FPTR2 ^RENAME FALSE ;
UNTIL 3DROP
;
;
[r->] [OFF]
The update before last, I all of a sudden started having issues with it Not
Working At All -- something to do with OVER not having anything on the
stack to play with
The last update, you fixed that.
I got the Right-shift ENTRY thing working, but, as I thought might be the
case, it was too laggy to leave on all the time. Most vectored entered
stuff is, anyway...
Now this update, guess what I see in the changelog?
> o Reduces overhead (execution time).
*Adds trying it out to todo list*
Thanks for a great program...
Greg
How XC stops CAS commands from conflicting with you
(see previous posts in thread for practical examples):
Besides saving and restoring flags and current directory,
XC temporarily renames the affected variables (the CAS
default variable and any CAS command argument variable),
in the current and any higher directories,
which effectively hides them.
In other words:
o Save and hide stuff
o Do a user EVAL (on the command or formula)
o Restore and unhide
%%HP: T(3)F(.); \<< @ ascii file transfer header
@ All SysRPL XC in hex
"D9D2079262D9D20361539F94388130C413011133D3F632C2"
"3070133B2130B4053E3B432C230CA6207004C0079E60517B" +
"391362A5D8079E60D9D20881309EB5079E6031BC39136251" +
"B50C2C539F943D9D2011920C310038863B21302A170D9D20" +
"03D53B797041963CA62040096000CA30B21308C1702D143B" +
"21307B3B20D470CA6207004C008813061643E8F604364379" +
"B30A2170D9D204364361643E8F60B21301192087000D4162" +
"E5E40D9D2079E60CA593913620CA30B21308BE4018A30A26" +
"4379E60947B3913620264380D80CA6207004C00881304364" +
"379B30A2170D9D20436439EB5079E6031BC39136251B5061" +
"643E8F60B21309EB5079E6031BC39136251B5061643E8F60" +
"9F9431DE4079470B2130" + DUP BYTES DROP #C675h ==
{ H\-> } IFT 'XC' STO @ #F386h 274.
"
( All SysRPL XC source )
::
CK1NOLASTWD
::
DUPTYPESYMB? case DUP ( Expression? )
DEPTH ONE #>ITE OVER ZERO ( Arg variable? )
;
TYPEIDNT? ITE OVER FPTR2 ^RCLVX ( var or default )
' xRCLF EvalNoCK CONTEXT@ ( flags and rrp )
' ( program to rename variables along path )
:: DUP ID>$ ' xNOT EvalNoCK $>ID ( bitwise complement )
DUP@ case :: # 13C ERROROUT ; ( name conflict? )
BEGIN ( rename along path until not found )
:: DUP3PICK @ NOTcaseTRUE FPTR2 ^RENAME FALSE ;
UNTIL 3DROP
;
4NULLLAM{} BIND ( renpgm rrp flags argvar )
FPTR2 ^RCLVX DUP 1GETLAM EVAL ( rename default var )
4GETLAM EQUAL ?SKIP :: 4GETLAM 1GETLAM EVAL ; ( arg var? )
# 78 SetSysFlag ( CAS silent mode )
ERRSET :: ' xEVAL EvalNoCK FALSE ; ERRTRAP TRUE ( xEVAL )
3GETLAM ' xSTOF EvalNoCK 2GETLAM CONTEXT! ( flags, rrp )
FPTR2 ^RCLVX DUP 4GETLAM EQUAL ?SKIP ( unrename arg var? )
:: 4GETLAM ID>$ ' xNOT EvalNoCK $>ID 1GETLAM EVAL ;
ID>$ ' xNOT EvalNoCK $>ID 1GETLAM EVAL ( unrename default )
case ERRJMP ABND
;
@" 'XC.s' STO
@ Manual, individual var renamer for testing or fix-up
@ Arg: current variable name (or list of names)
@ [to bypass syntax errors, RCL via VAR menu key, then ANS]
@ Result: variable gets renamed
\<< DUP S~N NOT S~N SWAP RENAME \>> 'NOTREN' STO
@ End
Examples of 1-character name pairs which conflict:
(if one name needs renaming to hide it,
its complement must not also exist)
s and \Ga alpha
n \Gg gamma
m \Gd delta
l \Ge epsilon
j \Gh theta
J \Gm mu
k \Gn nu
h \Gr rho
g \Gs sigma
f \Gt tau
d \GD Delta
c \PI Pi
b \GW Omega
Timing:
On Emu48 "authentic speed" HP49G (much slower than 49G+),
I get .23_sec to .47_sec typical overhead per evaluation,
depending on whether command is VX-based (e.g. INTVX)
or has a different name argument (e.g. 'Y-5' 'Y' SOLVE),
and whether variables exist or not, and who knows what else.
A CAS command itself may take lots of time, however
(e.g. I've seen ISOL on 49G take 16 times as long as on 48GX);
all I can do is hide and restore stuff,
then wait for the CAS command :)
Things are of course much better, speed-wise, on the 49G+
(maybe that explains why it may wear faster; the time
compression applies to all parts at the same time :)
[End]
For example: { INTVX SOLVEVX TEXPAND TSIMP SOLVE XC }
The menu builder then installs that as your
CUSTOM menu (on the MODE key) for the current directory,
so that each command in the menu will be executed by XC,
thus operating without changing modes or deleting variables.
If you had an original CST menu in the same directory,
it will be renamed CSTSV, which you can re-activate
at any later time by doing 'CSTSV' MENU; once saved,
CSTSV will be preserved until you purge or rename it.
XCM program listing:
(please do HOME 256 ATTACH before transfer to calc)
@ Supply a list of CAS or other commands, E.g.
@ { INTVX SOLVEVX TEXPAND TSIMP SOLVE XC }
\<< -55. CF 1.
\<< { 14. 18. } OVER TYPE POS { DUP 1. \->LIST
::XC DTAG 2. \->PRG 2. \->LIST } IFT \>> DOLIST
'CSTSV' 'CST' IFERR RENAME THEN DROP2 ELSE CLLCD
"Old CST menu renamed CSTSV" MSGBOX END MENU \>>
'XCM' STO
@ End
@ A custom CAS menu system to use with XC
@ (try it with the XCM command from the previous post).
@ This is obviously extensible to add even more CAS functions.
{
@ Page 1
{ "\|>CALC" \<< 1.02 MENU \>> }
{ "\|>SOLV" \<< 1.03 MENU \>> }
{ "\|>EXLN" \<< 1.04 MENU \>> }
{ "\|>TRIG" \<< 1.05 MENU \>> }
SIMPLIFY XC
@ Page 2
DERVX INTVX DERIV RISCH IBP
{ "\|>CAS" \<< 1.01 MENU \>> }
@ Page 3
SOLVEVX ISOL SOLVE DESOLVE LINSOLVE
{ "\|>CAS" \<< 1.01 MENU \>> }
@ Page 4
EXPLN EXPM LIN LNCOLLECT LNP1
{ "\|>CAS" \<< 1.01 MENU \>> }
@ Page 5
{ "\|>CAS" \<< 1.01 MENU \>> }
ACOS2S ASIN2C ASIN2T ATAN2S HALFTAN
@ Page 6
SINCOS TAN2SC TAN2SC2 TCOLLECT TEXPAND TLIN
@ Page 7
TRIG TRIGCOS TRIGSIN TRIGTAN TSIMP
{ "\|>CAS" \<< 1.01 MENU \>> }
}
@ End