home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
TOP
/
USR
/
MAN
/
dc.prf
< prev
next >
Wrap
Text File
|
2009-11-06
|
6KB
|
224 lines
.fill
.justify
.offset 5
.rightmargin 70
.pagesize 72
.m1 3
.m2 2
.m3 2
.m4 5
.ec \
.header /Dc/Utility/Dc
.footer /Page #//Printed (%)/
.in +5
.define topic
.bold
.in -5
$1 $2 $3 $4 $5
.in +5
.en
.define endtopic
.en
.define noform
.nojustify
.nofill
.en
.define noformend
.justify
.fill
.en
.! Manual created with MWB
.! END-OF-MACRO
.topic NAME
Dc - Desk Calculator for integer aritmetic
.endtopic
.topic SYNOPSIS
.noform
dc [-b=<h,d,o,b>]
.noformend
.endtopic
.topic DESCRIPTION
.bold
Dc
offers a desk calculator for integer aritmetic. It is written as a tool
for a programmer who doesn't have enough place for a "regular" desk
calculator (it is written for me). The design of the keypad is like the
one of an Atari ST(tm) but you can use it with every other keyboard,
too. The only option in the commandline which is possible is
.ul
-b=<base>
where <base> is `h` for hexadecimal, `d` for decimal, `o` for octal and
`b` for binary. After startung the screen displays a calculator with
displayline (top-right), errormessage area (top-left), five memory slots
are displayed on the left side of the panel, on the right side you can
find the digits and functions.
In the display the current value is displayed in the actual
base, the memory entries are always displayed in the base of decimal.
To type in a number, simply hit the right digit keys on yout
keyboard. For hexadecimal input use the
.ul
lowercse
letters a-f. If the base doesn't allow a digit to be typed (e.g. 9 in
octal base) a bell rings and an errormessage will be displayed. If you
want to type in the value of an ASCII charcter you can type
.bold
'
followed by the character you wish to get the value of.
After typing the number you will choose an operator. You can
type them in as displayed on the screen. Operators available:
.in +5
.nf
.nj
+ addition
- subtraction
* multiplication
/ divison
% modulo
& binary and
| binary or
^ binary xor
~ unary binary not (2-complement)
! unary negate (1-complement)
< shift left
> shift right
= equivalance
The priority is like this:
High
~, !
<, >
*, /, %
+, -
&
^
|
=
Low
.fill
.justify
.in -5
To change the current base, type
.ul
CAPITAL
letter H, D, O or B. The actual base will be displayed highlighted. The
CLS button once will clear the current input, twice will clear all
brackets and the internal stack. The dot `.` isn't yet in use.
To access one of the five memory slots you have to type in `P`,
`G` or `F` followed by the number of the slot. `P` (put) puts the
current displayed value in the given slot. If you type CR instead of a
number the value will be put in the next free slot (a slot is free if
its value is zero). `G` (get) fetches the value of the given slot and
makes it to the actual value (which is displayed in the display). When
typeing CR instead of a number the value of the `highest` slot will be
taken. `F` (free) clears a given slot. If you type `a` (all) instead of
the number, all slots are cleared. `S` (swap) will swap the current
value in the display and the selceted slot. If you type CR instead of a
number, them the highst non-zero slot will be taken. The five slots have
been named through from `V` to `Z`. To access them directly for get and
put operations you simply type in the name. In lowercase it is like the
get operation, in uppercase it's like put.
One "special" feature of `dc`. If you redirect the
.ul
stdout
path then the output of the calculator will be written on
.ul
stderr
and only a displayed value may be outputed to the stdout path in
all four bases by pressing `.`. This is useful in using dc from an
editor like the uEmacs. For the uEmacs you can add these lines in
your configuration file:
.in +5
.nf
.nj
11 store-macro
execute-program dc
!endm
bind-to-key execute-macro-11 FNT
12 store-macro
pipe-command dc
!endm
bind-to-key execute-macro-12 FNU
.fill
.justify
.in -5
The bind-to-key key is just an example (on my system this will be
SHIFT-F1 and SHIFT-F2). SO I can call the dc with SHIFT-F1 for normal
use and with SHIFT-F2 the results will be piped in a second window so I
can see them even `dc` has gone.
To leave `dc` just type `Q` or ESC.
.endtopic
.topic OS9/68000
On OS9 you have the additional feature of a simulation of a basic poket
computer. For this you press `\$` and you get then the Basic display. To
return to DC, simply type
.ul
ESC
oder type in
.ul
bye
to leave the interpreter.
.endtopic
.topic ATARI ST
If you use `dc` with the Atari ST(tm) then you can also use the keys
.ul
Undo
for quiting and
.ul
Clr/Home
for clearing the display.
.endtopic
.topic CAVEATS
The calculator only works with 32 bit so you can't calculate with larger
values. The errorhandling may have some problems.
.endtopic
.topic ENVIROMENT
.noform
TERM
.in +5
The terminaltype for the user.
.in -5
DCGRAPHIC
.in +5
.fill
.justify
All buttons etc. are surrounded by special graphic characters. These are
offered running OS9 on an AtariST(tm) using the implementation
distributed by Cumana(tm). If oyur System doesn't support these graphics
you can change them using this enviroment varaibale. You have to set it
to an at least six charcter long value in the order:
.nf
.nj
.in +5
- Top left corner
- Top right corner
- Bottom left corner
- Bottom right corner
- Vertical bar
- Horizontal bar
.in -10
.noformend
.endtopic
.topic EXAMPLES
.noform
\$ setenv TERM h19
\$ setenv DCGRAPHIC ++++|-
\$ dc
.noformend
.endtopic
.topic SEE ALSO
.noform
On OS9 Systems, see also the documentation of Microware Basic.
.noformend
.endtopic