home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug056.arc
/
RPN.DOC
< prev
next >
Wrap
Text File
|
1979-12-31
|
5KB
|
220 lines
READ.ME:
RPN 1.0 - reverse polish programmer's calculator
(For the Osborne-1)
by David Brower, GM Software, 10/82
This program is in the public domain.
Description:
------------
RP╬ 1.░ i≤ aε integer-onl∙ screeε calculator
particlularl∙ useful∞ t∩ programmers« Value≤ may
bσ displayeΣ anΣ entereΣ iε an∙ oµ fou≥ formats,
ASCI╔ character¼ DECIMA╠ integer¼ anΣ HE╪ or
OCTA╠ integers« Thσ prograφ i≤ writteε iε BDS-C
fo≥ thσ Osborne-▒ anΣ woulΣ requirσ somσ simple
modification≤ t∩ ruε oε machine≤ witΦ different
termina∞ contro∞ sequences.
Datß i≤ handleΣ oε ß stacδ iε reversσ polish
notation¼ mucΦ likσ Hewlett-PackarΣ calculators.
Thσ stacδ i≤ 3░ 16-bi⌠ word≤ deep¼ which
shoulΣ bσ sufficien⌠ fo≥ jus⌠ abou⌠ anybody.
Whilσ no⌠ strictl∙ necessar∙ (yo⌡ caε somehow
deconvolutσ AN┘ expressioε int∩ RPN)¼ therσ is
als∩ ß convenien⌠ MEMOR┘ cell« Datß ma∙ be
storeΣ o≥ recalleΣ int∩ o≥ froφ thi≤ location
freely.
Al∞ thσ norma∞ arithmetiπ operation≤ are
supplied¼ a≤ wel∞ a≤ ß completσ se⌠ oµ bitwise
operations« Fo≥ thσ mos⌠ par⌠ "Có likσ notation
i≤ used.
Fairl∙ explici⌠ "HELPó informatioε i≤ built
int∩ thσ display« Thσ prograφ use≤ ß pleasant
techniquσ oµ keepinτ aε up-to-datσ stacδ display
whilσ maintaininτ ß smal∞ scrollinτ regioε for
olΣ commands« Thi≤ keep≤ yo⌡ full∙ informed
abou⌠ you≥ curren⌠ statσ anΣ als∩ show≤ you≥ last
fe≈ entries¼ givinτ yo⌡ somσ ideß ho≈ yo⌡ got
wherσ yo⌡ are.
Usage:
------
Iε responsσ thσ thσ CP/═ promp⌠ A╛ enter:
èrpn<RETURN>
Therσ arσ n∩ commanΣ linσ arguments.
Examples:
---------
T∩ adΣ ┤ anΣ 5¼ enter:
4
5
+
T∩ dividσ 1░ b∙ 2:
10
2
/
T∩ pqcδ ß BC─ serΣ fro-0dhe0fou≥ chara#ter≤ "1234":
(You'Σ neve≥ d∩ i⌠ thi≤ way¼ bu⌠ it'≤ aε example.)
<ESC>░ ╗ pusΦ characte≥ 0
╙ ╗ savσ i⌠ iε memory
<ESC>▒ ╗ pusΦ characte≥ 1
≥ ╗ recal∞ thσ '0'
- ╗ subtrac⌠ '0º froφ '1'
┤ ╗ ┤ bit≤ t∩ shift
╝ ╗ shif⌠ left
<ESC>▓ ╗ pusΦ characte≥ 2
≥ ╗ recal∞ '0'
- ╗ subtract
ⁿ ╗ O╥ witΦ thσ shifteΣ '1'-'0'
16
¬ ╗ shif⌠ lef⌠ ┤ morσ bits
<ESC>3
0xµ ╗ Bi⌠ mask¼ jus⌠ t∩ bσ different
ª ╗ AN─ witΦ thσ mask
ⁿ ╗ mergσ witΦ thσ saveΣ '120'
4
<
<ESC>┤ ╗ etc.
r
-
ⁿ ╗ BC─ no≈ oε to≡ oµ stack.
RP╬ COMMANDS:
-------------
Command≤ arσ alway≤ entereΣ b∙ pressing
<RETURN>« Yo⌡ ma∙ usσ an∙ oµ thσ standarΣ CP/M
linσ editinτ commands¼ sucΦ a≤ <DEL>¼ <BS>¼ ^U,è^╪ o≥ thσ "<-ó bacδ arro≈ oε thσ Osborne-1.
Entering values:
These push a value onto the top of the stack.
<ESC>c ASCII character
nnnnn decimal integer
0xhhhh HEX integer
0oooooo OCTAL integer
Binary (two operand) operations:
These replace the top two values on the stack
with the result of the operation.
+ Addition
- Subtraction
* Multiplication
/ Division
% Remainder (modulus)
< Bitwise LEFT shift
> Bitwise RIGHT shift
& Bitwise AND
| Bitwise OR (inclusive)
^ Bitwise XOR (eXclusive OR)
Unary (single operand) Operators:
These replace the top of the stack with
the result of the operation.
C bitwise complement (1's)
N negate, 2's complement.
è
MEMORY Control:
These move values to and from the MEMORY cell.
S Stores the top of the stack in MEMORY
R Recalls the MEMORY by pushing it's value
Stack Control:
These clobber elements on the stack.
E erases the top of the stack
Z Zaps (erases) the entire stack and
the MEMORY cell.
SPECIAL COMMAND:
" DITTO, repeat the last entered command.
Program Exit:
^C Ends and re-boots.
^Z Ends without re-booting.
<RETURN> asks:
rpn exit (y/n)? _
Answering 'Y' or 'y' will exit.
Programming Notes:
------------------
Originally from "The C Programming Language"
by Kernighan & Ritchie, modified for screen stack
display, ascii, hex, integer and octal modes, &
bitwise operations. Apologies to K & R for my
hacks to their nice program. The code (RPN.C) is
written in Leor Zolman's BDS-C. I could not get
it to work using the "small-c" available on FOG
disks 29-32. Sorry about that. The RPN.COM file
should run on any Osborne-1 without problem.
For all you Osborne "C" fans who haven'tèfound the magic keys:
'{' is ^, (ctrl on the '<' key)
'}' is ^. (ctrl on the '>' key)