Simple RPN - Calculator

Discussion in 'Share Your Creations' started by token, Oct 7, 2007.

  1. token

    token Member Licensed User


    I've wrote a simple sciencetific rpn-calc, wich I wan't to build up to a math-tool exactely fitting my needs. It is not nearly as powerfull as for example, the wonderfull "Free42" HP42s simulator, but it has really big buttons and so one can type on it very fast, without mistakes. In the future, I would like to implement programming- and graphing capabilitys - F2-key has no funcktion for now, but you can store and recall up to 10 vars and on F1 there are some sciencetific functions - most of the BASIC4PPC-built in math functions.

    Short explenation about rpn: if you want to add 2 and 3, you type 2 ENTER 3 + instead of 2+3= on an algebraic calc. For now it is not possible in my progy to type 2 ENTER 3 ENTER + , like in traditional rpn-calcs, cause the last enter would push 3 into stack-level 2 and operations will only be done with stack-level 1 and 2. But the normal working sheme with rpn is not to press enter after the last argument, i think, so this should be no problem. You can do more complex calculations like (2+3)*4 in the form: 2 ENTER 3 + 4 * wich saves a keystroke in comparison to algebraic.

    A short description for the special buttons:

    ENTER - Push's the Stack one level upwards.
    SWP - Exchanges stack level one and two
    Up - pulls the stack - begins with level two so level one stays untouched - (somewhat special, like a history function)
    Back - Like Backspace
    F1 - Sciencetific functions
    F2 - Not used for now
    STO - Press STO and then button 0-9 to save Stack level one
    RCL - Press RCL and then button 0-9 to recall stored value into stack level one
    F1 - VAR - Lists the stored values 0-9

    Attached Files:

    Last edited: Oct 7, 2007
  2. specci48

    specci48 Well-Known Member Licensed User

    Hi token,

    nice work :sign0098:

    But I thought the deadline for the "second competition" is on November 5, 2007. :confused:
    Will we give some extra points for the fasted competitor (even he may have started before the competition was set)? Here he is... ;)

  3. token

    token Member Licensed User

    Thank you for the positive feedback - that motivates. :eek: Do not know anything about a competition and I think this calc is still to buggy and simple to win there, but perhaps sometime.

    I've recently bought a HP50g - fantastic calculator btw. and I'am impressed of the simplicity and beauty, rpn offers. There are a lot of free ppc-rpn calcs out there - to mention a few: RPN Calc, EMU48, MyPocketCalc, Free42. "Free42" is my personal favourite, cause it is very good to handle without a pen and has all the features of a real HP42s. But with Free42 you have to fidle a lot with menus and so on - like in the real one. I would like to have a ppc-calc where I can access mostly all what I need with a few keystrokes, and never have to pull out the pen. Perhaps sometimes in the future I have my own customized "supercalc"...;)
  4. alfcen

    alfcen Well-Known Member Licensed User

    Hi Token,

    Simple? Well, I do see the amazing amount of work you have invested.
    Your SuperCalc isn't far away :)

    I am not familiar with RPN, but please allow me a few suggestions:

    1. A larger colored display.
    2. Image buttons for the keys would allow you to underlay, say, a GIF with a shade of a color.
    3. Erel's tutorial at
    may help shorten the source code.

    Very nice, indeed!
  5. token

    token Member Licensed User

    Many thanks for your suggestions! The display is only a temporary solution, I have now implementet a third line for status-messages in the top and moved the two stack lines a bit more to the bottom, nearer to the keyboard. The font for the stack displayis now larger too.

    Image buttons is one thing I want to implement when I have the main framework for the calculator more finished.

    I've reworked the concept - now using somewhat like a state machine to handle the keypresses in different modes. Startet to implement a program editing- and running-mode, wich is in the very first experimental stage, but the aproach should work in the future. Different modes are really a bit confusing now and I startet to document the neccessaryest with remarks.

    The further I step, the more work I see - but it's a lot of fun and I think I will learn a lot with this proggy.

    Btw.: Congratulation to Erel, who has done a really great thing with BASIC4PPC - it has grown up to a phantastic developement kit, wich is a joy to use!

    p.S: Here is my version 0.2 - Concept reworked - Programm Edit and Run mode added - very buggy and limited, as allready mentioned. You can only use F2 - edit/run/clr, when you edit, the old program will be erased and only basic arithmetik operators are allowd - no branching, looping or conditions of course, for now.

    Example: you want to calculate hours out of seconds - you can type 60 / 60 / into the editor. With F2 and Edit again, you return to normal calculator mode. Then you put your seconds into stackline 1 (no ENTER) and hit F2 - Run to run the little programm. You will get the divided value into stackline 1. Not really usefull for now, but I think the basic concept should work with more complicated things.

    p.p.s.: the dynamic handling of controls from your link is shurely a far more elegant way to handle the key-stuff - thanks for the tip!

    Attached Files:

    Last edited: Oct 8, 2007