____________________________________ INSTALLING THE BACKGROUND CALCULATOR
To start the background calculator, enter
the command
BCALC
[E=CODE-NUMBER -E]
[F=FOREGROUND-COLOR]
[B=BACKGROUND-COLOR] [+U]
The 'F=' and 'B=' options are the same as
for the regular calculator. There are two
ways to choose the invocation key: by pres-
sing a key or by entering a parameter on
Page 34
PC/CALCULATOR
the command line. If no 'E=' option is en-
tered, the calculator will prompt you for
an invocation key. This key may be any key
and may be used with a shift, Alt, or Ctrl
key. The location of the key is very impor-
tant. The '1' key over the letter 'Q' is
different from the '1' key on the keypad.
When pressed, the invocation key will
suspend the current program and start the
calculator.
This method of setting the invocation key
does not work when used in a batch file
such as AUTOEXEC.BAT. Instead, you may
specify a key with the 'E=' option. To
find the code number for a key, you must
use the program FINDKEY, which is located
on the distribution diskette. Run FINDKEY
and press the invocation key that you wish
to use. FINDKEY will display the code num-
ber for that key on the screen.
Note: The '-E' option, which may not be
used with the 'E=' option, will cause the
background calculator to run in the
foreground. You may wish to use the back-
ground version in this way, brd at the
time you press this key. It must also not
be in graphics mode.
_________________________________ RUNNING THE BACKGROUND CALCULATOR
With the exceptions noted above, the back-
ground calculator will function the same
as the regular calculator. It does have
one additional key: the 'B' key. Pressing
this key will allow you to review the last
screen of the program you were running
before invoking the calculator. By using
the 'B' key, you can review any numbers
that you may want to use in your cal-
culations. After this key is pressed, the
next key entered will return you to the
calculator.
_________________________________ EXITING THE BACKGROUND CALCULATOR
You may leave the background calculator
and return to your program by pressing
either the escape key (Esc) or the 'Q'
key. The state of the calculator will
remain unchanged. If you return to the cal-
culator at a later time, the stored num-
bers will be there if you need them. If
you use the escape key to exit the cal-
culator, the program you were running will
restart immediately. However, if you use
the 'Q' key to exit, up to 14 digits of
the bottom number on the stack will be
stored in the keyboard input buffer. These
digits will then be entered to the program
you were running just as if you had keyed
them in yourself.
Page 36
PC/CALCULATOR
_______________________ V. PROGRAMMING FEATURES
_____________ PROGRAM FILES
Program files are regular DOS Ascii files
which are used as streams of data. This
data becomes input to PC/CALCULATOR just
as if it was entered from the keyboard.
All characters are always translated to up-
per case. Program files may be created
directly from the calculator in its learn
mode or may be edited by any file editor.
In learn mode, all keystrokes entered at
the keyboard are processed and sent to a
file. A combination of these two tech-
niques will probably prove best. Files can
be edited with a text editor without ex-
iting the calculator by executing a
program with the <SHELL> command described
below. In addition to the stream of
keystrokes in a program file, you may use
special commands of the form
<COMMAND>PARAMETERS
Since certain characters are ignored or
cannot be entered into a text file, such
as the return key or the function keys,
there are special commands that simulate
these keys. For example,
<CR> = return key
A number of programs have been supplied
for demonstration and illustration. Start
by running the program MENU, which
Page 37
PC/CALCULATOR
branches to these other programs.
________________________ SPECIAL PROGRAMMING KEYS
There are four special keys which are used
only for programming functions.
_________ THE L KEY
The L key puts the calculator into learn
mode. The calculator will prompt for a
file name to write to. If a return is en-
tered without a file name, any previous
name entered from the L or K key will be
used. The extension ".PCL" is
automatically appended to the file name en-
tered. The word "LEARN" will appear below
the entry line to indicate that the cal-
culator is in learn mode. All key strokes
entered from the keyboard are placed in
the program file. The enter key is trans-
lated to the string <CR>, the tab key is
translated to the string <TAB>, and func-
tion keys are translated to the string
<FUNCT>##. (See the section below on com-
mands for further information on these
keys.) Also, entering the 'Z' key will
switch you to a direct input screen. From
this screen, any data may be entered into
the program file; however, the intended
use of this screen is to enter program com-
mands.
_________ THE K KEY
The K key puts the calculator into execuds of the
format <command>parameters cause various
special features to be invoked. Command
names are similar to BASIC command names
to make learning easier. While in execute
mode, and while the screen is not cleared
with <CLS>, the word "EXEC" appears below
the entry line. In execution mode, all
keys entered from the keyboard are thrown
away except J ctrl-C or ctrl-BREAK, unless
a command that receives input from the key-
board is being executed.
_________ THE J KEY
When in learn mode, the J key closes the
file and turns off learn mode. While in ex-
ecute mode, the J key will always stop ex-
ecution.
_________ THE Z KEY
The 'Z' key may only be used in learn
mode. It immediately brings up an entry
screen, from which data may be entered
directly to the program file. Pressing the
return key without entering any data will
return you to where you left off. The pur-
pose of this screen is to allow program
commands to be entered from the cal-
culator. However, any data may be entered
this way.
Page 39
PC/CALCULATOR
___________________________ PROGRAM INVOCATION FROM DOS
Program files may be started from DOS by
using the following format
CALC K=PROGRAM-NAME
Also, the calculator may forced into learn
mode from DOS by the following command:
CALC L=PROGRAM-NAME
________________ PROGRAM COMMANDS
Once started, the calculator reads input
from the program file and processes it as
if it was entered from the keyboard with
only a few exceptions. Ascii returns and
linefeeds are ignored, making editing a
program file much simpler. Commands of the
form <command> are processed in special
ways, each of which is described below. A
command may have either optional or re-
quired parameters following it.
<X>
A label (X may be any character or
number). A label is not really a com-
mand, and it is usually ignored. It
provides a place to branch to for the
<GOTO>, <ONERROR>, and <IF> commands.
The label <*> has special
significance. When branching to a
label, the <*> label will always
cause a match.
<BEEP>
Causes a beep on the speaker to sig-
nal some event or error.
Page 40
PC/CALCULATOR
<BOX>height,length
Displays a double lined box on the
screen. The upper left-hand corner of
the box is placed at the current cur-
sor position. See the <LOCATE> com-
mand to set this cursor position. The
color of the box is set by the
<COLOR> command. The inside of the
box is automatically blanked out. If
the screen is in cleared mode, the
box will remain on the screen in-
definitely. If not in cleared mode,
the box will remain until a non-
numeric entry is entered at the key-
board or through the program file.
The height and length of the box are
set as parameters which must be en-
tered. If the right or lower bottom
edge of the box is off the screen,
the program will stop with an error
message.
<CALC>X
Causes execution to stop temporarily
until the key X is pressed. When this
happens, the program continues. The X
parameter is required.
<CHAIN>(file name)
Causes transfer to another program
file. If the optional file name
parameter is entered, the transfer
takes place immediately; otherwise,
the user is prompted for the file
name at the keyboard. The extension
".PCL" is added to the file name.
<CLS>
Clears the screen and keeps the cal-
culator in clear mode. To turn this
mode off, use the command <SCREEN>.
Page 41
and off error trap-
ping. When executed with a label
parameter X, error trapping is in ef-
fect. If a calculator error such as
dividing by zero happens, a branch to
the label X will start. This enables
recovery if there is an unexpected er-
ror. If executed without the label
parameter, error trapping is turned
off.
<FUNCT>number
Equivalent to pressing one of the
function keys. The number parameter
is required and is a number between 1
and 20.
<GOTO>(X)
Causes a branch to the specified
label X. If the label parameter is
omitted, the next key from the key-
board is used for the label.
<IF>VTVX
Similar to <GOTO> except that the
branch is executed conditionally. The
V parameters are variables, which may
be X,Y,A,B,C,D or 0-9 which cor-
respond to the stack memories or the
auxiliary memories. T is a comparison
Page 42
PC/CALCULATOR
type. The valid types are:
EQ - variables equal
NE - variables not equal
GT - first variable greater
than the second
GE - first variable greater
than or equal to the second
LT - first variable less
than the second
LE - first variable less than or
equal to the second
The X parameter is the label to be
branched to. All four parameters
are required.
<INKEY>
Causes the calculator to pause until
the next key is entered from the key-
board. This key is discarded.
<INPUT>
Causes the calculator to pause until
the next time a return key is
pressed. This allows the entry of a
number from the keyboard. Keys other
than numbers and the return key are
allowed.
<LOCATE>xcoordinate,ycoordinate
Sets the cursor position at which the
<BOX> and <PRINT> will start at. The
<BOX> command does not reposition the
cursor, while the <PRINT> command
does.
<LPRINT>FMT
Prints to the printer file, which may
be the printer. The printer file is
set with the P= parameter when the
calculator is invoked. The default
printer file is the printer device
PRN:. FMT is described in the <PRINT>
Page 43
PC/CALCULATOR
command. The FMT parameter is not re-
quired.
<PRINT>FMT
Prints variables or text on the
screen. The printing starts in the
cursor position set by the <LOCATE>
command. This cursor position is
repositioned by this command. If the
format FMT is followed by a ';', the
cursor ends up after the last item
printed; otherwise, the cursor
returns to the beginning of the next
line. The FMT consists of a list of
items separated by ','s. The items
may either be a text string which is
enclosed by double quotes '"' or a
variable (X,Y,A,B,C,D, or 0-9). The
text strings are printed directly.
The variables are formatted with the
current display format and are
printed in a 25-character field. The
FMT parameter is not required.
<REM>remark
Allows the insertion of a comment in
the program file. Both the <REM> and
the remark parameter are skipped.
<SCREEN>
Turns the screen display back on
after a <CLS> command has been ex-
ecuted.
<SHELL>
Executes a DOS 2.0 command. Do not
use this command under DOS 1.0 or
1.1: the results are unpredictable.
<SLEEP>
Causes the calculator to pause for
about 5 seconds.
Page 44
PC/CALCent to pressing the tab key
from the keyboard.
<TRACEOFF>
Turns off the trace mode.
<TRACEON>
Turns on the trace mode. When the
trace mode is on, every time a com-
mand is executed, the line number and
command is printed to the printer
file. This file is set by the P=
parameter when invoking the cal-
culator.
Page 45
PC/CALCULATOR
______________ VI. APPENDICES
__________ APPENDIX A
___________ KEY SUMMARY
Esc - Exit, save state
Tab - Switch function key mode
Shift tab - Toggle degrees/radians mode
C - Clear
M - Auxiliary memories only
S - Stack only
T - Tape trace only
C - All of the above
D - Display mode change
D - Float
F - Float
H - Hex
O - Octal
B - Binary
0-9 - Fixed
E - E+ (exponent)
F - E- (negative exponent)
J - End programming mode
K - Start program
L - Learn program
M - Toggle keyboard/mouse mode
N - Switch negative sign
P - Print stack and aux. memories
Q - Exit the calculator
R - Restore aux. memory
S - Store aux. memory
T - Toggle printer tape
U - Un-do last key
V - Switch function key mode
1 - CALC 5 - PROG
2 - CALC2 6 - FIN
3 - TRIG 7 - CONV
4 - STATS
Y - Toggle on screen tape
Z - Learn mode data entry
Page 46
PC/CALCULATOR
__________ APPENDIX B
______________ ERROR MESSAGES
8 And 9 Are Not Legal In Octal Mode
Attempted to enter an 8 or 9 in octal
mode
Add Overflow
The sum of two numbers is greater
than 1.E+308 or less than -1.E+308
Can't Open Print File Or Device
P= parameter on command line
specified a bad disk, path, file
name, or device name
Can't Enter A Decimal Now
A decimal has already been entered,
or an exponent has been entered, or
calculator is in HEX, BINARY or OCTAL
MODE
Can't Enter An Exponent Now
An exponent has already been entered,
or calculator is in HEX, BINARY, or
OCTAL MODE
Can't Round, Argument Too Large
Rounding will not accomplish anything
because the exponent is too large
Character Not Recognized: Try 'H' For Help
Unknown key pressed
Combination Error
Result would overflow 1.E+308 limit
Cube Overflow
Result would overflow 1.E+308 limit
Cube Underflow
Result would be less than 1.E-308 and
greater than -1.E-308
Divide Overflow
Result would overflow 1.E+308 limit
Page 47
PC/CALCULATOR
Divide Underflow
Result would be less than 1.E-308
Divide By Zero
What else?
Exponential Underflow
Result would be less than 1.E-308
Exponential Overflow
Result would overflow 1.E+308 limit
Factorial Overflow
Result would overflow 1.E+308 limit
Help Is Not Available In This Mode
Help file 'CALC.HEn' is not in cur-
rent directory
Input Underflow
Number entered is under the 1.E-308
limit
Input Overflow
Number entered is over the 1.E+308
limit
Maximum Entry Size Exceeded
Attempted to enter more than the max-
imum allowed on the E line
Multiply Underflow
Result would be less than the 1.E-308
limit
Multiply Overflow
Result would overflow 1.E+308 limit
No Future Value Entered
Attempted to calculate percent in-
terest, period, or PV with payment =
0 and no FV. Calculator is trying to
do a compound interest problem
No Present Value
Attempted to calculate percent in-
terest, period, or PV with payment =
0 problem
Not A Valid Memory, Try 0-9
Entered an 'S' to store or an 'R' to
restore followed by a key other than
0-9
Not A Valid Character: Try 'H' For Help
Unknown key entered
Only 1 And 0 Are Legal In Binary Mode
Attempted to enter a number other
that '0' or '1' in binary mode
Out Of Domain Of Function
Square root of a negative number, arc
sine, or cosine of a number greater
than 1 or less than -1, etc.
Permutation Error
Result would overflow 1.E+308 limit
Result Too Large
Result would overflow 1.E+308 limit
Square Underflow
Result would be smaller than the
1.E-308 limit
Square Overflow
Result would overflow 1.E+308 limit
Subtract Underflow
Result would be smaller than the
1.E-308 limit
Subtract Overflow
Result would overflow 1.E+308 limit
Page 49
PC/CALCULATOR
Too Many Iterations For Interest
Calculation
Attempted to calculate percent in-
terest in an annuity problem. Itera-
tive process will not converge; check
figures for plausibility
Unknown Floating Point Error ????
Should never happen; please record
what caused it and contact Micro Busi-
ness Applications
Use: Calc P=Print-File
F=Foreground-Color
B=Background-Color
K=Program-to-Run
L=Program-to-Write +U
Entered CALC ? <CR>; this is not an
error message
Page 50
PC/CALCULATOR
__________ APPENDIX C
________ FORMULAS
_____CALC2
Markup % = ((Sell - Cost) / Sell) * 100
Delta % = (( (X) - (Y) )/(Y)) * 100
N! = N * (N-1) * (N-2) ... 3 * 2 * 1
P x:y = x!/(x-y)!
C x:y = x!/(y! * (x-y)!)
_____STATS
MEAN x = SUM x's/(N = number of x's)
Var of x = (Sum(x*x)-(Sum(x) * Sum(x))/N)/N
Var of x
wt. (N-1) = (Sum(x*x)-(Sum(x) * Sum(x))/N)/(N-1)
Std dev = Square root(Var)
N*Sum(x*y)-Sum(x)*Sum(y)
Slope = -----------------------------
N*Sum(x*x)-Sum(x)*Sum(x)
Y intercpt = (Sum(y)-Slope*Sum(x))/N
___FIN
Compound interest equation
FV = PV * (1 + i)**(periods)
Annuity equations
PV = Pay*(1-(1+i)**(-periods))
--------------------------
i
FV = Pay*((1+i)**(periods) - 1)
--------------------------
i
Annuity due equations
PV = (i+1) (annuity PV)
FV = (i+1) (annuity FV)
Page 51
PC/CALCULATOR
Bal(X=#payments) =
Pay * (1+i)**(-periods + x)
-----------------------
i
Accrued interest(x) =
x * pay + Bal(x) - PV
Current interest(x) =
Bal(x-1) * i
Current principal(x) =
Pay - Current interest(x)
Page 52
PC/CALCULATOR
_____ INDEX
AUTOEXEC.BAT 35 E key 9
add 9 editor 37
annuity 26 enter line 9
annuity due 26 equations 51
auxiliary memory 11 error messages 10, 47
BCALC 34 ERRONON 42
background calculator 34 escape key 12, 36
backup 5 Euler's constant 16, 21
BEEP 40 exclusive OR 25
binary 13, 25 exiting 12
bitwise AND 25 exponent 9
bitwise OR 25 exponentiation 16
BOX 41, 42 F key 9
C key 11 factorial 20
CALC 41 FIN 26
CALC mode 16 FINDKEY 35
CALC2 17 install 34
D key 12 intercept 22
decimal point 9 interest 26
degrees 13 inverse trig 21
display 12 invocation key 34
divide 9 K key 38, 39
duplicate 10 keypad 9
Page 53
PC/CALCULATOR
_____ INDEX
L key 38 S key 11
learn mode 37 SCREEN 44
least squares 22 SHELL 44
LOCATE 43 shift 25
LPRINT 43 SLEEP 44
M key 14 slope 22
markup 17 SLOW 45
mean 23 square root 16
memories 11 stack 8
MENU.PCL 37 STATS mode 22
mouse mode 14 std deviation 22
multiply 9 STOP 45
N key 9 subtract 9
number range 9 summary 46
octal 12, 25 swap 10
output 6 SYSTEM 45
P key 13 T key 13
payment 26 TAB 45
percent 17 TRACEOFF 45
periods 26 TRACEON 45
permutations 20 trend 22
present value 26 TRIG mode 21
PRINT 13, 42, 44 U key 13
printer 6 un-do 13
PRN: 6 unit conversion 33
PROG 25 V key 15
program files 37 variance 22
Q key 12, 35 Y key 13
R key 11 Z key 39
radians 13
reciprocal 16
REM 44
roll operation 10
RPN 8
Page 54
45
permutations 20 trend 22
present value 26 TRIG mode 21
PRINT 13, 42, 44 U key 13
printer 6 un-do 13
PRN: 6 unit conversion 33
PROG 25 V key 15
program files 37 variance 22
Q key 12, 35 P C / C A L C U L A T O R Reference Manual Second Edition September 1984 (c) Copyright - 1984 Micro Business Applications 1133 Guerrero Street San Francisco, CA 94110 Page 1 PC/CALCULATOR _________________ TABLE OF CONTENTSI. INTRODUCTION 4 REQUIREMENTS 4 COPYRIGHT 4 GETTING STARTED 5 EXECUTING THE CALCULATOR 6II. USING THE CALCULATOR 8 REVERSE POLISH NOTATION 8 ENTERING NUMBERS 9 FOUR ARITHMETIC FUNCTIONS 9 STACK MANIPULATION 10 ERRORS 10 ARITHMETIC EXAMPLE 10 AUXILIARY MEMORIES 11 CLEAR 11 HELP 11 EXITING THE PROGRAM 12 DISPLAY AND ENTRY MODES 12 THE UN-DO KEY 13 TAPE TRACE AND PRINTING 13 RADIANS/DEGREES MODE 13 MOUSE MODE 14 III. FUNCTION KEY MODES 15 CALC FUNCTION KEY MODE 15 CALC2 FUNCTION KEY MODE 17 Markup Calculations 17 Markup Calculation Examples 17 Percent Calculations 18 Delta Percent Example 18 Sum a List of Numbers Example 19 Combinatorics 20 TRIG FUNCTION KEY MODE 20 STATS FUNCTION KEY MODE 22 29 CONV FUNCTION KEY MODE 33IV. BACKGROUND CALCULATOR 34 OVERVIEW 34 INSTALLING THE BACKGROUND CALCULATOR 34 INVOKING THE BACKGROUND CALCULATOR 35 RUNNING THE BACKGROUND CALCULATOR 36 EXITING THE BACKGROUND CALCULATOR 36V. PROGRAMMING FEATURES 37 PROGRAM FILES 37SPECIAL PROGRAMMING KEYS 38 THE L KEY 38 THE K KEY 38 THE J KEY 39 THE Z KEY 39 PROGRAM INVOCATION FROM DOS 39 PROGRAM COMMANDS 40VI. APPENDICES 45 APPENDIX A - KEY SUMMARY 46 APPENDIX B - ERROR MESSAGES 47 APPENDIX C - FORMULAS 51 INDEX 53 Page 3 PC/CALCULATOR _______________ I. INTRODUCTION ____________ REQUIREMENTS IBM PC, XT, Jr., or compatible 1 Floppy Drive 128KB RAM DOS 1.0, 1.1, or 2.0 PC/CALCULATOR is a software program that will turn your IBM PC into a programmable multi-function RPN (Reverse Polish Notation) calculator. It features 16 visible memories, 7 function key modes, and 14 number display formats. Included is a back- ground version of the calculator. Once loaded into your PC, it can be easily accessed from within another program. _________ COPYRIGHT PC/CALCULATOR may be used on only one computer at a time. The distribution diskette may be duplicated for backup purposes only. Distributing copies of the programs or documentation is il- legal. Page 4 PC/CALCULATOR _______________ GETTING STARTED Before you begin using PC/CALCULATOR, please take the time to duplicate your distribution diskette either to a backup floppy or to a hard disk. I highly recommend that you use this backup version and keep the distribu- tion diskette in a safe place. Copying the diskette with the command COPY A:*.* B: is more reliable than DISKCOPY. If you have some experience with an RPN calculator, and you can't wait to read the documentation, enter the com- mand CALC and press return when the copyright message appears. You can exit the cal- culator at any time by pressing 'Q'. If that doesn't work, press 'J' and then 'Q'. The latter will work even if you are using the programmable mode of the calculator. You may also press 'H' to access a help screen. Page 5 PC/CALCULATOR ________________________ EXECUTING THE CALCULATOR To start the calculator, enter the command CALC [P=PRINT-FILE] [F=FOREGROUND-COLOR] [B=BACKGROUND-COLOR] [K=PROGRAM-FILE-TO-RUN] [L=PROGRAM-FILE-TO-WRITE] [+U] The items in brackets are optional. The P=PRINT-FILE-OPTION is used to redirect output to either a file or a device. Some calculator functions create output which by default goes to the printer 'PRN:'. To send this output to either a serial printer or a file, enter CALC P=COM1: or CALC P=OUTPUT.FLE The F=FOREGROUND-COLOR and B=BACKGROUND-COLOR are used to modify the displayed colors on a color monitor. The color options are 0 - black 3 - cyan 6 - brown 1 - blue 4 - red 7 - white 2 - green 5 - magenta These o for 20 func- tions keys in each of the 7 function key modes. The name of the function is displayed on the screen with the function on top corresponding to the _________ function key. On most unshifted typewriters, the upper key cor- responds to the shift key. For those who wish to switch the use of the shift and unshift functions keys, use the +U option. Page 7 PC/CALCULATOR ________________________II. USING THE CALCULATOR_______________________REVERSE POLISH NOTATIONUsing an RPN calculator will take a little practice, but ultimately you may find it easier to use than an algebraic cal- culator. All RPN calculators use a number stack. This is similar to a tray stack at a cafeteria, which drops down when a tray is placed on top, and which pops up when a tray is removed. The PC/CALCULATOR stack appears on the screen upside down, with the numbers pushing each other up and pop- ping them down. If a number is pushed off the top of the stack, it disappears. Once numbers are pushed onto the stack, they