From: jhmeyers@miu.edu (John H Meyers)
Newsgroups: comp.sys.hp48
Subject: A Casio emulator for HP48
Date: 20 Sep 1998 11:24:29 GMT
Organization: MIU Computer Services,  Fairfield, IA 52557.  Not Approved.
Lines: 149
Message-ID: <6u2old$1rf$1@news.iastate.edu>
References: <35fb4268.0@news1.tm.net.my>,<6tga7t$di$1@news.iastate.edu>,<6tgjjs$3kf$1@news.iastate.edu>,<6tih5f$ose$1@news.iastate.edu>,<6tl90g$qu8$1@news.iastate.edu>,<6tp4h6$m82$1@news.iastate.edu>
Reply-To: jhmeyers@miu.edu
NNTP-Posting-Host: vax1.mum.edu
Xref: republic.btigate.com comp.sys.hp48:16232

This is an update to a previous version,
but slightly more convenient to use:

o Use like any ordinary algebraic-entry calculator.

o Has one "memory" register (for M+ etc.)

o Performs "constant" calculations.


Functions which surpass the ordinary Casio, however:

o Screen display includes answers, memory, and constant.

o All scientific functions are available;
  i.e. you can enter any function alone
  (e.g. COS, Sqrt, SQ, FACT),
  or any parenthesized expression,
  and you can use any HP48 functions.

o You can use symbolic names for
  existing variables and/or functions,
  and you can use 'm' and 'a' for the
  current values of memory and previous answer
  (menu keys are provided to generate 'm' and 'a' for you)


This version's principal improvements:

o You can use M+ etc. at the end of any calculation,
  as well as by itself (referencing the previous answer);
  however, you must still press ENTER after M+, etc.

o An MX function (exchange memory with answer) is added.


Precautions for use:

o Friends who didn't want to borrow your HP48
  (because they didn't know how to use it)
  may now wander off with it at unpredictable times :)

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

%%HP: T(3); @ Algebraic calculator with memory and "constant"
@ Version: 1998/09/19 14:00

@ Screen: [normal "status/clock" area at the top]
@   m: 139.75  [memory]
@   a: 18.23   [answer]
@    + 1.25    [last operation and constant, if any]
@
@   [M+]  [M-]  [MS]  [MX]   [m]  [a]   (menu keys)

@ Use ENTER as the "equals" key.

@ Press a menu key *and*then* ENTER for "memory" operations:
@  M+  M-  MS (store)  MX (exchange "memory" with "answer")
@ For MR (recall), use menu key [m].
@ Values or expressions may precede M+ etc.

@ Menu keys [m] and [a] generate symbols which represent the
@ current value of the "memory" and the most recent "answer";
@ these symbols may be used in expressions.

@ Starting value is taken from level 1, if any;
@ final answer is returned to the stack.

@ Use the normal OFF function to suspend operations.

@ Type in       Get answer
@ -------       ----------

@ 3 * 4 + 8     20       Basic calculations
@ + 5           25       Previous answer + 5
@ INV [1/x]     .04      Reciprocal of previous answer
@ [Sqrt]        .2       Square root of previous answer
@ [Sqrt] 900    30       Square root of new value
@ SIN           .5       Sine of answer (if degrees mode)
@ 0 -           -.5      Change sign ( do not use [+/-] )
@ 2 -           2.5      New value minus previous answer
@ 10 /          4        New value divided by previous answer
@ SQ [x^2]      16       Squared
@ 0 - 123       -123     Negative input ( do not use [+/-] )

@ \pi * 7.25 ^ 2         Symbolic constants may be used
@ (2 + 3) * LN (4)       Algebraic expressions
@ 5 * A + 1.74           Take values from existing variables

@ a / ( 1 + a )          Use value of previous answer
@ [Sqrt] (1 + m)         Use value from memory

@ "Universal constant" mode:

@ The most recent operation and value is always saved,
@ displayed on-screeen (just below the current answer)
@ and performed again if no new operator is supplied.

@ 18 / 3        6        See / 3 on second line of display
@ ENTER         2
@ 120 ENTER     40

@ [Sqrt] 256    16       See [Sqrt] on second line of display
@ ENTER         4
@ 25            5

@ LN (3)        ...      See LN on second line of display
@ 5 ENTER       ...      (computes logarithm of 5)
@ 5 * LN(4)     ...      See * 'LN(4)' on second line of display

\<< -55 CF DEPTH NOT 0 IFT DUP TYPE 0 IFT
  "'" "(" ")" 0 0 0 { } \-> q l r a n m c \<< @ Single ['] char
  { EVAL ::m OVER STO+ } { EVAL ::m OVER STO- }
  { EVAL DUP ::m STO }  { EVAL m SWAP ::m STO }
    \-> Mp Mm Ms Mx \<< @ Memory operations
  { { "M+" "''Mp" } { "M-" "''Mm" }
    { "MS" "''Ms" } { "MX" "''Mx" } m a } TMENU
  @ Note quoted double [']['] in first four memory key definitions
  DO "a: " OVER + "m: " m + 1 ALOG CHR ROT OVER + + + c
REVLIST @ S/SX: LIST\-> \-> n \<< 0 n FOR i i ROLL NEXT n \->LIST \>>
    \->STR 2 OVER SIZE 2 - SUB + ""
    IFERR INPUT THEN DROP2 0 MENU ERRN DOERR @ Cancel?
    ELSE 'n' STO 'a' STO
      q l + a + r + n + @ Chained calculation?
      IFERR OBJ\-> THEN DROP q n + @ New calculation?
        IFERR OBJ\-> THEN DROP q n + l + a + r + @ Function?
          IFERR OBJ\-> THEN ERRM 5 DISP DROP 2 WAIT
            'a' @ Syntax error (flash message)
          END
        END
      END
      @ Apply constant, save constant, or perform memory operation
      {     c
        9 { DUP OBJ\-> SWAP \->LIST SWAP DROP ::c STO }
        7 { RCL { } ::c STO } @ Clear constant also
      } DUP2 SWAP TYPE POS 1 + GET EVAL EVAL \->NUM
    END
  UNTIL 0 END @ Loops until CANCEL is pressed (once or twice)
\>> \>> \>> @ Checksum, bytes [G/GX]: #93D6h, 725

@ If you add an extra DUP after DO, and extra DROP after DROP2,
@ then a "history" of all answers will be saved on the stack.

@ Please distinguish lowercase 'l' from numeral 1.

@ End of program.
