home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
cpm
/
calculat
/
rpncalc.lbr
/
RPN.DZC
/
RPN.DOC
Wrap
Text File
|
1987-09-12
|
3KB
|
49 lines
RPN.DOC Documentation August 11, 1987
This program can be distributed freely provided no charge is made for
its use. Copyright is reserved for the author, C. Scott Blackwell.
The files RPN.DOC, RPN2.PAS, RPN2.COM, RPN.PAS, and RPN.COM are the
distribution files for the RPN (Reverse Polish Notation) calculator program.
The program is written in Turbo Pascal; however, with the exception of the
Turbo string handling functions and procedures it should be pretty 'plain
vanilla' Pascal. As such it should be transportable and compilable in a
variety of systems. It compiles with Turbo on IBM PC's with no problems.
The programs were actually written for an Apple ][+ CP/M system. The RPN and
RPN2 versions differ only in that the latter can handle strings of up to
20 numbers and commands. The RPN version handles numbers and commands
strictly in the scope of a calculator, i.e. number <enter> or number command.
Addition of hyperbolic functions or other functions would be relatively
easy in the context of the Pascal code. The logic of the parser and extended
stack/command string handling is the only 'tricky' part.
The compiled code should run on CP/M-80 systems o.k. since no Apple
specific I/O or screen codes were used.
The calculator emulates most of the functions of a RPN (HP-style) calculator
with the exception of the hyperbolic functions. If needed they would be
trivial to add in the Pascal code.
The system implements the usual RPN stack; namely X,Y,Z, and T registers.
There are 10 memories, R0 to R9. They can be stored to and recalled from.
The usual STO +1 will store X and add it to the value in R1. STO 1 will
store X and overwrite previous R1 value. STO -n, +n, *n, and /n are all
legal. In the command string version STO + n, separated by spaces, is the
required syntax. The parser uses spaces to permit separation of commands
and numerical values.
The trig functions, sin, cos, and tan as well as asin, acos, and atan are
implemented. The values returned from the arc trig functions are between
2Pi and -2Pi.
I wrote this program for use on an Aspect 2000-3000 minicomputer used
in an NMR spectrometer. Admittedly a HP calculator is cheaper and more
accurate; however, sometimes it is troublesome to have to find one, so
this program can turn a $500K spectrometer into a $70 calculator.
I hope the program is useful to others; I have found it so.
C. Scott Blackwell
August 11, 1987