home *** CD-ROM | disk | FTP | other *** search
-
- 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.
-
- The following files were submitted to FOG:
-
- - READ.ME this documentation
-
- - RPN.COM the executable program
-
- - RPN.C the source code
-
-
- Description:
- ------------
-
- RPN 1.0 is an integer-only screen calculator
- particlularly usefull to programmers. Values may
- be displayed and entered in any of four formats,
- ASCII character, DECIMAL integer, and HEX or
- OCTAL integers. The program is written in BDS-C
- for the Osborne-1 and would require some simple
- modifications to run on machines with different
- terminal control sequences.
-
- Data is handled on a stack in reverse polish
- notation, much like Hewlett-Packard calculators.
-
- The stack is 30 16-bit words deep, which
- should be sufficient for just about anybody.
- While not strictly necessary (you can somehow
- deconvolute ANY expression into RPN), there is
- also a convenient MEMORY cell. Data may be
- stored or recalled into or from this location
- freely.
-
- All the normal arithmetic operations are
- supplied, as well as a complete set of bitwise
- operations. For the most part "C" like notation
- is used.
-
- Fairly explicit "HELP" information is built
- into the display. The program uses a pleasant
- technique of keeping an up-to-date stack display
- while maintaining a small scrolling region for
- old commands. This keeps you fully informed
- about your current state and also shows your last
- few entries, giving you some idea how you got
- where you are.
-
-
- Usage:
- ------
-
- In response the the CP/M prompt A> enter:
-
- rpn<RETURN>
-
- There are no command line arguments.
-
-
- Examples:
- ---------
-
- To add 4 and 5, enter:
-
- 4
- 5
- +
-
- To divide 10 by 2:
-
- 10
- 2
- /
-
- To pack a BCD word from the four characters "1234":
- (You'd never do it this way, but it's an example.)
-
- <ESC>0 ; push character 0
- S ; save it in memory
- <ESC>1 ; push character 1
- r ; recall the '0'
- - ; subtract '0' from '1'
- 4 ; 4 bits to shift
- < ; shift left
- <ESC>2 ; push character 2
- r ; recall '0'
- - ; subtract
- | ; OR with the shifted '1'-'0'
- 16
- * ; shift left 4 more bits
- <ESC>3
- 0xf ; Bit mask, just to be different
- & ; AND with the mask
- | ; merge with the saved '120'
- 4
- <
- <ESC>4 ; etc.
- r
- -
- | ; BCD now on top of stack.
-
-
-
- RPN COMMANDS:
- -------------
-
- Commands are always entered by pressing
- <RETURN>. You may use any of the standard CP/M
- line editing commands, such as <DEL>, <BS>, ^U,
- ^X or the "<-" back arrow on the 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)
- E