Path: republic.btigate.com!news-xfer.netaxs.com!europa.clark.net!4.1.16.34!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!nyd.news.ans.net!newsfeeds.ans.net!newsxfer.itd.umich.edu!newsrelay.iastate.edu!news.iastate.edu!vax1.miu.edu!JHMEYERS
From: jhmeyers@miu.edu (John H Meyers)
Newsgroups: comp.sys.hp48
Subject: "Constant" mode? (Old baby Casio better than HP48?)
Date: 17 Aug 1998 13:36:38 GMT
Organization: MIU Computer Services,  Fairfield, IA 52557.  Not Approved.
Lines: 146
Message-ID: <6r9bl6$is9$1@news.iastate.edu>
References: <35D7CD84.C1CFFE9A@a.crl.com>
Reply-To: jhmeyers@miu.edu
NNTP-Posting-Host: vax1.mum.edu
Xref: republic.btigate.com comp.sys.hp48:14682

In article <35D7CD84.C1CFFE9A@a.crl.com>,
Len Fellman <lfellman@a.crl.com> writes:

> A few years ago it struck me that the old, simple Casio
> calculators could do something that the HP48 couldn't do:
> they called it Constant Factor, and you could set up a factor
> (or dividend, summand, or minuend) to be applied repeatedly.

> E.g. you could hit 5.379 X X   and then every subsequent
> entry would be multiplied by 5.379.

  Not only Casio, but just about every basic calculator ever made
  has this ability; Casio just makes it slightly harder to invoke,
  by requiring you to press the function key twice, following the
  constant, whereas most other brands *always* remember a constant,
  e.g. 40 / 5 = [see 8 displayed] 20 = [see 4 displayed] etc.

  TI actually originally put a switch on their first calcs,
  to turn this "constant mode" on or off; either this was
  a sales ploy, or else TI engineers failed to realize
  that no switch was actually necessary, as proved by the fact
  that no one has seen such a switch ever since (except in the
  aforementioned Casio brand, where pressing a function key twice
  acts as the "switch," sometimes accompanied by a "K" annunciator).

  Originally, all brands always remembered the second number
  in all calculations, but then it became more common for the
  *first* number to be remembered for multiplication only,
  and the *second* number for all other arithmetic functions
  (come to think of it, Microsoft might have started in business
  just about when that happened :)

> But the nice thing about the 48 is that you can program it
> to do almost anything.  I wrote the following program...

  And another nice thing about the HP48 is that there are
  probably 48 ways to implement almost anything :)

  So here's yet another approach to the task of turning the
  Almighty HP48 into just another 4-function calc :)

  The program below uses only 'BetaENTER' (one of the two special
  variables used for "Vectored/Custom Enter", about which
  much interest has recently been stirred up), so be sure that you
  do *not* also keep any extraneous related 'AlphaENTER' variable
  in user memory when trying this alternative, as the calc
  will attempt to execute both, if both are present.

  OTOH, the 'AlphaENTER' used by the recently posted
  "Save unlimited Last Commands" program does not conflict
  with the program below, so you can keep that one.

  This approach works with pre-selected functions only,
  and is more automatic.  However, you can include the ability
  to use any named variable(s) as the function(s), by including
  its(their) name(s) in the list, if you want; then you can
  keep changing the stored program(s) in those variables
  (press the key for any such variable to invoke its function).

  "Vectored/Custom Enter" (and therefore the function below)
  can be turned on and off by changing the state of flag -63
  (or "User mode" flag -62, which also controls user keys).

Overheard outside a school entrance (after math class, of course):

  "Whatever happened to Elizabeth Arden?"

  "Max Factor"

-----------------------------------------------------------
With best wishes from:   John H Meyers   <jhmeyers@mum.edu>
-----------------------------------------------------------

%%HP: T(3); @ For Kermit; \-> is right-arrow, etc.

@ "at" sign precedes comments (do not type in, okay for Kermit)

@ Implement a "constant" function, like common 4-function calcs;
@ the "Enter" key repeats the last arithmetic function,
@ using its original last argument, e.g.:

@  Type this      Status area     Level 1 result
@ -----------    -------------   -----------------------------
@   4 5 *         {  4 5 }  *       20     [ remembers  5 * ]
@   8 Enter       {  8 5 }  *       40     [ repeats    5 * ]
@   Enter         { 40 5 }  *      200     [ repeats    5 * ]

@ "Constant" function applies to: + - * / ^
@ (you may add others to the list if you wish,
@ including the name of any variable containing a program,
@ but each should be a function of exactly two arguments).

@ Other functions (including CLEAR, DROP) reset "constant" mode.

@ Works also with symbolic and list arguments, e.g.
@ 4 { 3 7 } Enter * 5 Enter [using G/GX list-processing feature]
@ (perhaps good for simultaneous currency conversions :)

@ To de-activate:
@ Turn off "User" mode (left-shift USER) or do -63 CF
@ (or purge 'BetaENTER' when you get tired of it :)

@ Either type in or download the following:

\<< DEPTH 0 \-> c d a \<< LASTARG DEPTH d - 1 + \->LIST 'a' STO
  @ 'a' receives current arg list, 'c' receives current command name

  { "" "DUP" } c POS @ "Enter" key?

  @ Recall previous last argument, execute previous saved command:
  \<< '~a' '~c' { RCL SWAP RCL } WHID DUP SIZE
  { 2 GET ROT SWAP DUP2 2 \->LIST 1 DISP
    ROT DUP 2 DISP OBJ\-> 1 FREEZE }
  { DROP2 } IFTE \>> @ No action if previously reset

  @ Save (or reset) args and command:
  \<< { + - * / ^ } @ Commands to which "constant" will apply
    "{" c + OBJ\-> 1 GET POS @ is current command in list?
    { a DUP 1 DISP c DUP 2 DISP 1 FREEZE } @ Display and save
    { { } "" } @ Reset if any other command
    IFTE '~a' SWAP '~c' { STO STO } WHID \>>

  IFTE

\>> \>> '\GbENTER' STO @ BetaENTER (name for above program)

@ Purge any 'AlphaENTER' that was used for any similar function!

@ Save constants (and function name) in "hidden directory":
\<< #64037h SYSEVAL EVAL \>> 'WHID' STO @ SysRPL: WithHidden EVAL
@ Caution: *HEX* address, wrong address may cause memory loss.
@ Use only \<< EVAL \>> to store in current directory instead.

{ } '~a' "" '~c' { STO STO } WHID @ Initialize variables

-55 CF @ Activate "Last Arguments"

-63 SF -62 SF @ Activate "Custom Enter" and "User Keys"

@ Either type in or download the above using Kermit.
@ Executing the above creates the necessary variables.
@ You may purge the downloaded object after executing it.

@ Hopefully this telnet app didn't drop any more lines during 'paste'
@ than I was able to spot on the screen; let me know if it did :)
