Contents of the CALCDV.DOC file
CALCDV - A POP-UP CALCULATOR FOR USE WITH DESQVIEW
Written By: Phillip A. Kaufman January, 1988
Copyright 1987,1988 Phillip A. Kaufman. All rights, except those
specifically granted herein are reserved by the author. The right
to copy and distribute this material is granted without fee for
any and all non-commercial use. This material specifically may
not be distributed or sold for a fee nor incorporated in whole or
in part into any other product that is distributed or sold for a
fee without specific permission of the author. To obtain special
permission or to report any difficulties with this material
Phillip A. Kaufman
19987 Moran Lane
Saratoga, CA 95070
THIS MATERIAL IS DISTRIBUTED "as is" WITHOUT ANY EXPRESSED OR
IMPLIED WARRANTY OR LIABILITY FOR DIRECT, INDIRECT OR
CALCDV is a general purpose pop-up calculator for use with
Desqview. It will run only within Desqview. In general, CALCDV is
a super set of the functionality of the calculator function of
Installation of CALCDV is covered in a separate section of this
CALCDV has the following features (keys are shown in parenthesis):
Addition (+), Subtraction(-), Multiplication(*),
Logical (bitwise) Operations;
And (A), Or (O), Exclusive Or(O)
Memory Clear (MC), Memory Recall (MR),
Add to Memory (M+), Subtract from Memory (M-)
Decimal (D), Hexadecimal (H), Binary (B)
Miscellaneous Commands and Keys;
Equals (=), Clear (C), Change Sign (#),
Decimal Point (.),
Hex digits: A(F5), B(F6), C(F7), D(F8), E(F9), F(F10)
BackSpace or DELete deletes the last digit entered.
Precision and Display;
Internal numeric representation is IEEE Floating Point
which generally has 53 bit precision.
Accumulator and memory are displayed simultaneously in
13 position fields including sign and decimal
Decimal mode results use a floating decimal point and
allows 11 digits.
Hex mode precision and display is 8 hex digits (integer
only). Maximum number is 7FFFFFFF.
Binary precision and display is 12 digits (integer
Full chained arithmetic is provided along with short
form squaring and reciprocals (see Arithmetic
Errors are shown on screen and automatically clear in
Arithmetic Operators operate in the normal algebraic fashion with
the addition of a full chained operation feature.
The numeric entry following an arithmetic operator is saved and
used as the second entry whenever an operation is performed that
does not include two entries. Except that on multiply the entry
prior to * is saved (Don't ask why, this is how most real
calculators do it!)
Note that an equal (=) terminates entry and Clear is not required
to begin a new computation following an equal.
Sequential entry of operators discards the prior operator and can
be used to correct an operator entry.
*= produces the square of the number in the display, /=
divides one by the number (reciprocal). += and -= operate on
the nuber and the prior result.
A negative number may be entered using the change sign key (#).
(The sign won't change though until an operation is performed.)
[The minus key (-) is an operator not the sign of the value
A decimal point (.) may be entered at any position during entry
of a number in Decimal mode only.
Examples (parenthesis show intermediate display in a sequence of
1(1) +(1) 2(2) = (3) 5(5) +(5) 6(6) = (11)
1(1) +(1) 2(2) +(3) 4(4) = (7)
1(1) +(1) 2(2) = (3) 4(4) =(6) 0(0) = (2)
4(4) *(4) 5(5) = (20) 6(6) =(24)
Corrected operator entry;
4(4) +(4) -(4) 1(1) = (3)
Square and reciprocal;
3(3) *(3) = (9)
4(4) /(4) = (.25)
The operators And, Or, and eXclusive-or operate bitwise on the
variables. These operators are allowed only in Hex and Binary
modes. Operation is similar to that of the Arithmetic Operators
except that there is no chaining.
There is a single memory location. Memory may be cleared (MC)
independent of the accumulator. Memory is not cleared by the
Clear key. Memory may be recalled to the accumulator display (MR)
(prior accumulator contents are lost). The accumulator may be
added to memory (M+) and subtracted from memory (M-).
M+ and M- act as an equal on the accumulator if there is a
pending unexecuted operation. For example,
1(1) +(1) 2(2) M+(3)
[accumulator is set to result of prior operation (3) and
memory is set to prior contents of memory plus 3].
The display may be in one of three modes, Decimal, Hexadecimal,
or Binary. Hex and Binary are integer only modes. Any fractional
part of the accumulator and memory is lost when changing to Hex or
Binary from Decimal.
Logical operations are allowed only in Hex and Binary modes. Only
the appropriate digits are allowed for entry in each mode. Hex
'A' through 'F' are represented by function keys F5 thru F10.
The memory is cleared by MC and is uneffected by the Clear key.
The Clear key clears only the entry if a numeric entry was in
process, the prior result and saved chaining value are preserved.
Hitting Clear a second time or after an operator clears the prior
result and chain value.
A backspace or DELete during a numeric entry may be used to
delete the last digit entered. For example,
5(5) +(5) 1(1) 2(12) 3(123) BS(12) 4(124) = (129)
Errors are displayed as they occur. An error clears when the next
key is struck. There is no need to use the Clear key following an
There are several types of errors possible;
Entry errors such as an illegal key or a key that is illegal in
the current mode produce the error "ILLEGAL KEY". All
results and values are preserved, the key is simply
Format errors such as attempting to enter two decimal points in
a number produce the "FORMAT ERR" error and the key is
An attempt to divide by zero produces the "DIVIDE BY 0" and the
accumulator is cleared.
If a result has too many significant digits to display the
"# TOO BIG" error is displayed along with those
significant digits that fit on the display. The right
most display position has a ">" indicating that there
are more significant digits. Note that the undisplayed
digits are preserved and will be used in any subsequent
operation. You can see these digits by dividing the
result by some large power of 10.
On entry, if too many digits are entered, the error "# TOO LONG"
is displayed and the extra digits are ignored.
If a result is too large for the internal representation an
"OVERFLOW" will be produced and the result set to zero.
CALCDV is written in C for the Microsoft C Compiler Version 4.0.
If it is recompiled you should use the small model for minimum
size. The default Microsoft stack is 2K. This should be reduced to
400 using the STACK argument or EXEMOD. The program will then fit
into a 26k Desqview memory allocation.
There are some user options that can be changed at compile time
to suit your preferences. These are primarily the colors used in
the display. (I have not tested the program on a monochrome
monitor so the compiled colors may look a little weird in
The EXE file supplied was compiled using the standard floating
point library, and does not require the 8087 coprocessor.
Install as with any other Desqview application program. A PIF
file, for DV 2.0, is included to make it easy. A copy is attached.
With appropriate chamges to the PIF it should work on older versions
of Desqview also.
It is important that the screen size not be changed or a garbage
dislay will result (the program writes directly to the DV display
buffer). The display size (both normal and start-up) should be
17 rows and 30 columns.
COPY OF CHANGE A PROGRAM SCREENS
Change a Program
Program Name............: Calculator
Keys to Use on Open Menu: CA Memory Size (in K): 26
Writes directly to screen......: [N]
Displays graphics information..: [N]
Can be swapped out of memory...: [Y]
Requires floppy diskette.......: [N]
Change a Program Advanced Options
System Memory (in K).......: 0 Maximum Program Memory Size (in K)..:
Script Buffer Size.......: 0 Maximum Expanded Memory Size (in K):
Text Pages: 1 Graphics Pages: 0 Initial Mode: Interrupts: 00 to FF
Maximum Height: 17 Starting Height: 17 Starting Row...: 1
Maximum Width.: 30 Starting Width.: 30 Starting Column: 79
Close on exit to DOS.........: [Y] Uses its own colors.........: [Y]
Allow Close Window command...: [Y] Runs only in foreground.....: [Y]
Uses math coprocessor........: [N] Keyboard conflict (0-4).....: