Stuart Baker Software offers high quality consulting services and products to users of IBM PCs and compatibles (DOS and Windows)
    as well as Interdata, Perkin-Elmer and Concurrent Computer Corporation 3200 series machines (OS/32).



Stuart Baker Software has added a Windows shareware programmer's calculator to its product line. This 16-bit application has been tested under Windows 3.1, 3.11, 95 and NT. It is a Reverse Polish Notation (RPN) style calculator similar to the Hewlett-Packard HP16C. If you prefer to use RPN calculators, we think you will really like our implementation. ProgCalc includes a very extensive help system, it even has a screen image with hotspots over every button and label. This is a very convenient way to become familiar with the calculator layout.

The RPN implementation is identical to that used on the HP handheld calculators. All operations can be performed with a mouse or from the keyboard. This calculator allows you to perform 2's complement integer mathematical operations in four number bases (Hexadecimal, Decimal, Octal and Binary). You can select integer word sizes from 1 to 32 bits, allowing you to tailor operations to a specific machine type. In addition, you can perform 64 bit floating point operations and select the number of decimal places to display.

If you would like to download a copy for evaluation click here. You will be downloading a 16-bit Windows self extracting zip file called rpncalc.exe. It is about 72 KB and should take less than one minute to download at 28.8 Kbps. The self extracting zip contains two files, progcalc.exe and progcalc.hlp. After the download, execute the program to extract the files. By default, the files are saved into the \progcalc directory on your current drive. If you do not want the files saved in that directory, just choose a new one before selecting Unzip. Once the files have been unzipped, double click on progcalc.exe and give it a try.

After you run ProgCalc, it creates one last file in your windows directory called progcalc.ini. This file contains all of the information needed to restart ProgCalc and restore the window exactly the way it was when you exited the program. We hope you find this product useful and are looking forward to your registration. If you are not familiar with RPN, read on. You may want to print this page and keep it around as a handy reference.

What is Reverse Polish Notation?

This calculator uses Reverse Polish Notation (RPN), an operating logic that involves the use of the Enter key (you may have noticed that there is no = key). The use of Enter eliminates the need to use parentheses in calculations; instead calculations are performed using a memory stack. ProgCalc handles two types of numbers: floating point (Flt) and integer (Hex, Oct, Dec, Bin). ProgCalc maintains separate RPN and Memory registers for floating point and integer modes. This allows you to switch modes without losing any information. All information is saved between sessions in the INI file.

RPN makes using this calculator very straightforward, all you have to remember is one simple rule:

  • After you enter a number ask the question: Time to perform a function?
    • If the answer is yes, press the desired function key.
    • If the answer is no, press the Enter key.

The RPN stack contains four registers, labeled X, Y, Z and T. The bottom of the stack is the X-register and is displayed in the combo box. The combo box lets you quickly select any of the four registers as the new X-register. The next two items on the stack are the Y and Z-registers. The top of the stack is the T-register. Numbers in the stack are stored on a last-in, first-out basis. The Enter key pushes numbers onto the stack, hereinafter referred to as "lifting the stack". One-operand functions (like CHS, ABS, 1/X etc.) do not result in stack movement while two-operand functions usually result in popping the stack, also called a "stack drop". ("Lifting" and "dropping" are the terms HP uses in describing the stack operations.) On two-operand functions, Y is the first operand and X is the second, i.e., Y function X replaces X. The number in the T-register is regenerated when the stack drops, allowing this number to be used repetitively as an automatic constant.

Pressing Enter separates two numbers keyed in one after the other. It does so by lifting the stack and copying the number in the X-register into the Y-register. The number entered next writes over the value in the X-register without lifting the stack.

The addition, subtraction, multiplication, division, modulus, AND, OR, XOR and exchange X and Y functions operate on the bottom two items of the RPN stack (X and Y). All other functions operate on the bottom of the stack. The store, recall, shift left and shift right functions open a dialog box that lets you select a memory location (0-9) or the number of bits (1-32) to shift by. All operations can be performed with a mouse or from the keyboard.

Let's look at an example:

  • Set the calculator to Hexadecimal mode by clicking on the Hex button or typing Ctrl+H.
  • Now let's divide 7800 by 80:
  • Type in the number 7800. We do not yet have enough numbers to perform the divide so press Enter.
  • Type in 80 and press / to perform the divide, the display now shows F0.
  • Since dividing by 80 in Hexadecimal mode is the same as shifting to the right by 7 bits (if the number is positive), let's look at another way of doing the same operation:
  • Type in 7800 and press >7 to shift to the right by 7 bits, once again the display shows F0.

Selecting Colors

The View menu allows you to select the colors used for the text and background of the calculator. The calculators buttons retain the text and background colors defined for your system. All of your color choices are retained in the INI file, so you only need to set up your colors one time. We do not provide a keyboard shortcut because this function is not performed very often. The default colors are black text on a light blue background. The shade of blue was chosen to work on a 256 color system.

Choosing Select Background Color... or Select Text Color... will open a common dialog box that allows you to make color selections. If you are not happy with the color selections that Windows offers, you can define a custom color selection. If your system supports only 256 colors, Windows severely limits the color choices that you can make. Your current color choice is displayed in a box with the title Color|Solid. Many color choices will display two different colors within this box. Windows uses the Solid color for text and text background. It uses Color for all other background colors. If the two colors do not match, you end up with a very unattractive display. If you type Alt+O for a color selection that displays two colors, the selection will be changed to the Solid color. If your system supports more than 256 colors, you will not need to worry about this problem.

Pasting Rules

ProgCalc processes characters from the clipboard just as if you entered them from the keyboard. If you have a complex calculation, that you need to perform many times with just a few variations, pasting is the answer. Enter the calculation into a program like Notepad and copy it into the clipboard. Then go to ProgCalc and perform the paste. It is then a simple process to make changes to the data and paste it again. You can even save your paste string to a file and process it at a later date.

There are a few simple rules for pasting. Characters that you enter may be in upper or lower case. You enter control characters with the ^C convention. If you need to enter a caret (^) use ^^. When you need to push a number onto the stack, just start a new line. If you need to start a new line without pushing the number onto the stack, end the line with a caret (^). You can also use ^M to push a number onto the stack.

When you paste data into ProgCalc, you will notice that the keypad buttons depress as each character is pasted. Each button stays down for 50 ms, making the paste operation interesting to watch. If you are pasting a long string, you may want to speed up the operation by eliminating the button press delay. You can do this by selecting the Display Only mode. If an error occurs during the paste process, the operation aborts and displays a dialog box that identifies the location of the error. The character that caused the abort is identified by surrounding it with inverted question marks (i.e., X).

Several functions cannot be performed while pasting. Obviously Paste (Ctrl+V) is not allowed since we are already pasting. Also Exit (Ctrl+X) is off limits. The Show mode is not allowed because it requires the use of the Shift key.

Functions that open dialog boxes are supported, but you are limited to keyboard the equivalents. When in doubt about which characters can be used, open the respective dialog box and look for the underlined characters. For example, the Copy (Ctrl+C) mode allows: 0-9, X, Y, Z, T, R, S, and O or C (one of which must be the last entry). Word Size (Ctrl+W) on the other hand can be followed with: 1, 2, 3 or 8 to select 16, 24, 32 and 8 bits respectively, or C to select Cancel.

A short example follows:


When this string is pasted the following steps are performed:

^F Select Flt mode
^P9 Select Decimal Place 9
355^M Enter 355 and push it onto the stack
113/ Enter 113 and perform a divide

Keyboard Usage:

Function Key Description
Help F1 Invoke Windows Help
About Ctrl+A Display About Box
Exit Ctrl+X Exit ProgCalc (conformation box)
(Use with shift key to prevent updating the INI file.)
Copy Ctrl+C Copy to Windows Clipboard
Paste Ctrl+V Paste from Windows Clipboard
Display Only Ctrl+L Show display only, no keyboard
Keyboard & Display Ctrl+K Show complete keyboard and display
Decimal Place Ctrl+P Select floating point Decimal Position
Word Size Ctrl+W Select integer Word Size
RPN Top Ctrl+R Open RPN Combo Box to select a new X Register. (Use Arrow Keys to Select and F4 to Close Combo Box)
Show Stack Ctrl+S Toggle RPN/Memory Stack display (Use with Shift key to align Stack Display to left or right side of main window. Main window position determines the default choice of side.)
Hex Ctrl+H Select Hexadecimal Base *
Dec Ctrl+D Select Decimal Base *
Oct Ctrl+O Select Octal Base *
Bin Ctrl+B Select Binary Base *
Flt Ctrl+F Select Floating Point Mode *
* Use Shift with Hex, Dec, Oct or Bin to convert the floating point X register to integer and place it into the integer X register. Use Shift with Flt to convert the integer X register to float and place it into the floating point X register.
SHOW P Show (Peek) at Numbers in a new Base until the Shift Key is Released
STO n S Store into Memory Location 0-9
RCL n R Recall from Memory Location 0-9
x<=>y X Exchange X and Y
CLX Esc Clear-X (Use with shift key to clear RPN Stack and all Memory locations)
BSP Backspace Correct Entry
LSTX L Last X Register
0 - F 0 - F Numeric Data (Base Dependent)
. . Decimal Point in Floating Point Mode
CHS N Change Sign (Negate )
Enter Enter Push Onto Stack
EEX G Enter Floating Point Exponent Mode
SL n < Shift Left by 1-32 Bit(s)
ABS I Absolute Value
/ / Division
* * Multiplication
- - Subtraction
+ + Addition
1/X H Reciprocal
SR n > Shift Right Logical (no sign extension) by 1-32 Bit(s)
RMD % Remainder Function
XOR ^ Bitwise Exclusive OR
AND & Bitwise AND
OR | Bitwise Inclusive OR
NOT ~ One's Complement
SQR Q Square Root

This SBSW.COM page has been optimized for printing.
Web Content Copyright © 1997 - 2010 Stuart Baker Software. All rights reserved.

Please use our Feedback form to submit questions or comments about this web site.
Web Content Copyright © 1997 - 2010 Stuart Baker Software. All rights reserved.
This site was last modified: Wednesday, December 29, 2010