File CALQUX.ZIP from The Programmer’s Corner in
Category Databases and related files
Excellent little calculator type program.
File Name File Size Zip Size Zip Type
CALQUE.DOC 42105 13154 deflated
Q.EXE 39232 17021 deflated

## Contents of the CALQUE.DOC file

WELCOME TO CALQUE

(To print these 17 pages, enter TYPE CALQUE.DOC > PRN from
DOS)

CALQUE is a calculator program for the IBM PC or
compatibles. For accounting it works well as a four function
calculator using the number keypad; a "paper tape" output is
your printer. For scientific applications it provides all
the trigonometric and exponential functions. For financial
analysis it provides a complete set of financial functions
including yield to maturity interest rate computation. For
computer work, hex to dec and dec to hex conversions are
provided.

CALQUE is programmable in the sense that macro-commands,
multiple keystrokes, can be defined, saved, called, and
executed with a single keystroke to implement sequences of
operations used, for example, to solve equations.

CALQUE uses decimal numbers with angles in radians. Note
that the conversion from degrees to radians (and vice versa)
is provided by F6.

CALQUE has a wide but limited number range. The maximum
magnitude is 10 to the 38 (1e38). This limits the maximum
factorial to 33, and it also limits the value of exponents
depending on the base. For numbers of magnitude less than
approximately 10 to the -38 (1e-38), zero is used.

CALQUE provides prompts at the bottom of the screen,
accompanied by a bell when a fault has occurred. For
example, try taking the reciprocal of 0. A bell and an
explanation, "NUMBER TOO LARGE TO COMPUTE", appears at the
bottom of the screen. Other prompts include the log of a
negative number, arcsin or arccos of a number greater than
one, etc.

CALQUE requires 41K of memory, one disk drive, and it runs
on any IBM PC or compatible including the PCAT, 386, etc. It
is not copy protected.

CALQUE requires that your display is in an 80 column mode.

- 1 -

CALQUE is polite, and it will not change any display
settings including colors and borders.

CALQUE, at \$10.00, is inexpensive; it should be since
hardware calculators with essentially the same capabilities
can be purchased for \$20.00 to \$50.00. We hope that the
program capabilities and the low price motivate you to buy
CALQUE and to recommend it to your associates.

STARTING OUT

To use this tutorial it is best to have CALQUE on the screen
in front of you. With the program diskette loaded, enter Q.
This will run the program (Q.EXE). The screen contains most
of the instructions needed, but the tutorial below will help
get you started.

FOUR FUNCTION OPERATIONS.

The cursor appears on the screen on a line called ENTRY.
This is the place you enter numbers to be operated on. To
enter a number use the number keys or the pad keys. If the
pad keys don't work, press NUMLOCK. (This is only necessary
on some "pseudo" IBM compatibles.) When the number on the
ENTRY line is correct press ENTER or SPACE. This will load
ENTRY to R1 the topmost number (REGISTER) under the function
table. Successive additional entries will push down on the
stack of REGISTERS. As an example, enter 6, and then enter
2. R2 contains 6, and R1 contains 2. Press "/" and note that
R1 now contains 3. This corresponds to the four-function
instructions shown near the center of the screen. You should
now be able to multiply, divide, add, and subtract.

If you make a mistake while composing an entry, press the
backspace key. This will erase the entry on the entry line
without entering it and allow you to start it over.

Numbers can be entered in either decimal or scientific
(exponent of 10) notation. For example entering .00123 is
the same as entering 1.23e-3 or 123e-5.

Numbers entered on the entry line are always entered as
positive; a minus sign will not be accepted except for the
exponent of exponential format entries (after an "e"). R1

- 2 -

can be made to change sign by pressing CNTRL F1. All results
are, of course, displayed with the correct sign. For example
subtract any positive number in R1 from 0 in R2.

A number of up to twelve digits may be entered which will be
rounded to eleven digits and an exponent. A bell will sound
when entry of a thirteenth digit is attempted. Internally
CALQUE uses a 6 byte (48 bits) representation for real
numbers. This is an 8 bit exponent, 40 bit mantissa format
corresponding to 10 to the plus or minus 38 with about 12
significant digits.

TAPE DISPLAY.

Note the instruction, located on the right middle of the
screen, to press T for a TAPE display. One of the nice
features of CALQUE is that for four function operations it
can simulate an office calculator including a "paper tape"
press T. A screen with one number shows with a line at the
top containing three items. The item on the left tells you
again. The item on the right tells you that your printer is
off (or on), indicating that calculations won't (or will)
print on your printer. The item in the middle tells you that
you can toggle your printer on and off by pressing P. The
number shown below this line is the number in the calculator
(in R1). Now press 0 (zero) and press * (times). This
multiples whatever is in the calculator by 0 and initializes
the calculator with a value, 0. Now press 3, +, and 2, /,
and note the successive answers 3 and 1.5.

The rule is to press a number and follow with an operation
(+,-,*,/); the number will be applied to the previous result
according to the operation selected. If you press a wrong
number, you can press the BACKSPACE key, prior to an
operation, and start that number over. If you wish to start
over at 0, multiply by 0. Note that if you press T, you lose
the screen; however the last result will be in R1 on the
main screen. Note also that you can start and stop printer
output any time by pressing P. Finally you can repeat any
operation on the last number used by pressing the operation
key (+,-,*,/) desired without re-writing the number itself.

FUNCTIONS.

- 3 -

All PC's have at least 10 function keys (F#), and these can
operate in conjunction the ALT, CTRL, and SHIFT keys using
any of these as shift keys. The functions available are
shown on the main screen in the table at the top. These
functions mostly (with exceptions discussed below) operate
on R1, or R1 and R2 where two operands are used. Results are
returned in R1 and on the ENTRY line. In the table R1 and R2
are referred to as X and Y respectively. Note that where
reasonable the ALT functions are the inverse of the
unshifted functions.

The trigonometric, exponential, logarithmic, square root,
factorial, and reciprocal functions all operate as expected.
For example to find log to the base 3 of 9, enter 3; enter
9; hold down alternate and press F10. The answer 2 will
appear in both R1 and on the entry line.

Note that there is no square function. This can be solved
with F10, where X=2 and Y equals the number to be squared.
However a more comvenient method is to enter the number
twice, into both R1 and R2, and multiply. Frequently this
requires only that the ENTER (or SPACE) key and * be pressed
since the number is usually in R1 and on the entry line. For
example to find (1/x) squared, enter a value for x; press
F4; press ENTER, and press *.

The POLAR function, CNTRL F9, converts X,Y (R1,R2) to polar
coordinates from rectangular coordinates. This of course
yields the square root of the sum of the squares of X and Y.
For example: enter 4; enter 3; press CNTRL F9. The answers 5
and 0.644 (radians) appear in R1 and R2 respectively. Now
press CNTRL F10 , RECT. The answers 3 and 4 reappear in R1
and R2. Jumping ahead for a point, you may wish to reverse
the positions of X and Y in R1 and R2; to do this press the
TAB key.

Note that the ALT F4 enters pi (3.1415...) into R1 and on
the entry line.

NOTE: We believe, along with Hewlett-Packard and others,
that the push-down stack (also known as "reverse Polish")
organization is more convenient than the use of parenthesise
and "=" signs, especially since the stack is displayed and
need not be remembered, when performing sequences of
operations. For example to perform

- 4 -

(((1-2+3)*4)/5)+6=7.6

Start at the inside of the parenthesise and work outwards by
pressing the following sequence of keys

1,ENTER,2,ENTER,-,3,ENTER,+,4,ENTER,*,5,ENTER,/,6,ENTER,+

As described above, when in the "TAPE DISPLAY" mode it is
not necessary use the "ENTER" after each number, but only
the four functions, +,-,*,/, can be performed in this mode.

Note also that a function of any partial result can be taken
in the sequence of operations. For example to perform

(((sin(1-2+3))*cos(4))/tan(5))^6=2.954e-5, press

1,<-,2,<-,-,3,<-,+,F1,4,<-,F2,*,5,<-,F3,/,6,<-,F10

Here we have used "<-" to mean "ENTER".

NUMBER CONVERSIONS.

There two types of number conversions in CALQUE. These are
F6, and (b) decimal to hexidecimal and hexidecimal to
decimal, CNTRL F8 and CNTRL F7. These functions operate on
numbers on the entry line and return answers on the entry
line but not in R1. This avoids using an erroneous number in
R1 for computation.

For example: press ALT F4, and then press ALT F6. The value
of pi first appears on the entry line (and in R1), and then
180, which is the value in degrees of pi, appears on the
entry but not R1. Note the prompt at the bottom of the
screen which explains the operation. Now press F6, and note
that the radian value of pi is on the entry line.

Decimal to hexidecimal, CNTRL F8, operates on the value on
the entry line at the time the key is pressed. The number is
converted to a decimal integer prior to dec to hex
conversion. Conversion of integers larger than about 4.29e9
is not possible. This corresponds to the number of digits
hex digits, 8, allowed.

- 5 -

Hex to dec conversion, CNTRL F7, clears the entry and waits
for you to enter a hex number after the \$ sign, which
signifies hexadecimal. The ENTER (or SPACE) key must be used
to activate the conversion on the entry, and the BACKSPACE
will clear the entry. Entry of an invalid hex digit results
in a bell and a warning message. Only integer hex numbers
of up to eight hex digits are accepted.

For example press CTRL F7; a \$ sign appears on the entry and
instructions at the bottom of the screen. Now press A,B,C,
ENTER. The answer in decimal appears on the entry line,
2748. Press CTRL F8 and \$ABC appears on the entry line. Note
that \$ABC is a valid number to CALQUE; press ENTER, and 2748
will appear in R1.

REGISTER MANIPULATION FROM THE KEYBOARD.

In the lower middle of the screen is a list of directions
for keypresses that move data from register to register on
the screen.

ENTRY TO R# = SHIFT F#. For example, pressing SHIFT F3 will
copy the contents of the entry line to R3. Pressing SHIFT F3
again will change the sign of R3. Note the warning at the
bottom of the screen which advises this. This is a more
convenient way to assign a set of numbers to the registers
than attempting to enter them in the correct order. It is
particularly useful for financial calculations as discussed
below. Anytime you enter the same number into a register it
will change the sign; it does not have to be re-entered on
successive keystrokes.

CLEAR REGISTERS = C. Pressing C clears all the R# registers
and the entry line to 0. It does not clear the STORE 1 and
STORE 2 registers.

CLEAR ENTRY = BACKSPACE. If you make a mistake on a digit
when entering a number on the control line, BACKSPACE starts
you over.

ROT UP/DOWN = U/D. Up (U) transfers data in registers R1 to
R6 as follows: R6 to R5 to R4 to R3 to R2 to R1 to R6. Down
(D) shifts in the opposite direction: R1 to R2 ..... R5 to
R6 to R1. This can be useful when you wish to recall a
number from the storage registers to a particular place in

- 6 -

the stack sequence; the desired location can be rotated to
R1 which will receive the recall (R) from the storage
register (see below).

SWAP X & Y = TAB. Interchanging R1 and R2 can be useful. For
example you might wish to store (see below) the angle from a
polar conversion where it is necessary to store from R1 and
the angle is returned in R2. Also use of keys F10 and ALT
F10 (exponents and logs) sometimes requires the use of SWAP.

R1 TO STORE = S. Two storage registers are provided to hold
constants which are re-used frequently in a calculation.
These are STORE 1 and STORE 2; they are not reset to 0 by a
C (clear). To move the contents of R1 to STORE 1, press S.
This also causes the contents of STORE 1 to move to STORE 2.
If only one instead of two constants are to be re-used,
press S again thereby loading both STORE 1 and STORE 2 with
the same number.

ST 1 TO R1 AND ENTRY = R. To recall a number from STORE 1 to
R1, press R. This also interchanges STORE 1 and STORE 2, so
that the next time R is pressed, the original contents of
STORE 2 are copied to R1. The numbers are also copied to the
entry line. This provides one way to move a number from R1
to the entry line: press S, and then press R. (Or add 0, or
multiply by 1, or press F4 twice.)

FINANCIAL AND INTEREST RATE CALCULATIONS.

CALQUE will find any of the five financial parameters,
listed on the bottom right of the screen as FINANCIALS:
PRESENT VALUE, FINAL VALUE, RATE, NUMBER OF PAYMENTS,
PAYMENT, as a function of the other four. For example it can
be used to find the interest rate of the combination of
future value and regular payments to give a bond's yield to
maturity (YTM).

To effectively use the financial functions provided by
CALQUE, it is necessary to have a clear logical
understanding of what is being calculated. We provide here a
brief explanation of how the financial functions work.

There are really two types of financial functions. The first
is explicit, where CALQUE finds the present value (PV),
final value (FV), or the payment value (PMT). CALQUE returns

- 7 -

a value in R1 which is the sum of the conversion of the
values in registers R2, R3, and R6 to the form commanded,
PV, FV, or PMT, for the rate and number of payments in R4
and R5. PV, FV, PMT entries can be either positive or
negative (more on this later); N must be an integer between
1 and 360; and R must be between -0.9 and 10.0 (-90% and
1000%) for N less than 31, or between 0.0 and 0.25 (25%) for
N greater than 30.

For example let

R2=100, R3=200, R4=0.06, R5=10, R6=15.

Pressing CNTRL F2 for PV gives the sum of the present values
of R2, R3, and R6 based on an interest rate of 6% per year
for 10 years (or 6% per month for 10 months). The only
confusing part is that the present value of the present
value in R2=100 is 100, which is obvious when you think

PV(R2)=100
PV(R3)=111.68
PV(R6)=110.40
SUM=R1=322.08

The other financial functions work the same way. With the
same values in R2..R6, the result of pressing CNTRL F3 (FV)
is 576.80 and the result of pressing CNTRL F6 (PMT) is
43.76; the PV, FV, PMT components of these solutions can be
found as for PV. Usually one or two of the PV, FV, PMT
components are zero. Be sure to set all the registers to the
desired values, including zero for those components intended
as zero.

The second type of financial function provides an implicit
answer. CALQUE solves for rate, R, or number of payments, N,
implicitly by iteratively trying different answers until it
finds one that fits. To find R it is necessary to give
CALQUE an N, and PV, FV, PMT, where at least one of the last
three must be negative. When solving for R CALQUE ignores
the value in R4, and similiarly for R5 when solving for N.

The way to keep the + or - signs of PV, FV, PMT straight is
to picture the calculation as a zero sum game where the
contributions of PV, FV, PMT total zero for the value of N

- 8 -

or R to be calculated. If you consider yourself as the
player, then for any transaction for which you wish to find
either the rate or number of payments, you will have some
income and some outgo; the rate or number of payments which
equates these will be solved and appear in R1 and on the
entry line.

With some thought it is clear that CALQUE must be told which
is income and which is outgo; otherwise it could equate the
wrong things. The program assumes the sum of the negative
entries in R2, R3, or R6 are to be equated to the sum of the
positive entries, after all entries are converted to the
same form. To do this CALQUE converts all entries to their
equivalent FV form, but this is only because it simplifies
the calculations; it could get the same answer by converting
the entries to present values or payments.

With two outgo components and one income component, the
income component could be negative. However, if you wish you
can consider income positive and outgo negative. Consider
the transaction as it appears to the opposite player. For
example you can compute the yield to maturity for a bond
either as a bond buyer or as a bond seller; the answer must
be the same. In setting up your financial problems, this is
a valuable point; there are two sides to any transaction,
and the rate of return and number of payments must be the
same for both, and the income for one side must equal the
outgo for the other side. You should check your problem
definition to see if it works both ways. Two boxes
representing the players interconnected with arrows
indicating the direction of PV, FV, PMT, quantities will
clarify the computations which can otherwise be confusing.

In complex situations it may be necessary to combine several
arrows into one; however it will not be possible to make any
conversions between PV, FV, PMT, if R or N are yet to be
solved. For example a down payment on a car loan and a
rebate on the car price can be combined (subtracted) to give
a single present value. However without knowing both R and
N, it will not be possible to convert a balloon payment at
the end of the loan to a present value. (The balloon payment
would entered as a final value.)

CALQUE financial functions are limited to interest rates in
the range from -90% to +1000% (-0.9 to +10), and N must be
between 1 and 360 (inclusive). Furthermore, to prevent

- 9 -

numeric overflow, if N is greater than 30, then R must be
between 0.0 and 0.25 (25%). Parameters which fail to satisfy
the conditions are indicated by a warning at the bottom of
the screen. For calculations of R or N this warning
indicates that CALQUE couldn't find a solution in the above
ranges.

Please note that CALQUE automatically converts any entry for
N (R5) to an integer. Also when solving for N, CALQUE gives
an integer answer and prompts with a bell and a message
indicating the remainder in the final value which should be
zero. This value is negative when the N payments exceed the
actual final value; an integer solution cannot exactly
satisfy the condition that the sum of PV, FV, PMT are zero.
It is correct to say that the last payment should be reduced
by the value given by the prompt when that value is
negative.

Since CALQUE converts the number of payments to an integer,
the computation of interest rate is only precisely accurate
if the present value is given for a date on which a payment
is made. CALQUE does not include calculations for pro-rating
partial bond interest, for example, due the seller when the
sale occurs between payment dates. CALQUE has no calendar
functions. This shortcoming is not significant if the number
of payments to maturity is large.

Negative interest sounds strange, but it happens. One
example is the combination of inflation rate and interest
rate in 1980, and another is the charges by Swiss banks for
deposits during turbulent economic times. (We suppose that
the Swiss argue that the negative interest they charge is
less than that of inflation of an unstable currency.)

To understand how to use the capability to calculate
interest rate, consider a bond with the data supplied by the
New York Bond Exchange. Note in this published listing the
current yield, not the yield to maturity, is given. Current
yield is simply the payment per year divided by the price;
yield to maturity (YTM) includes the final value at the time
the bond is due to be paid off; YTM is a valid parameter to
compare different bonds with differents terms. As shown
below CALQUE can find the yield to maturity. Of course
CALQUE can solve other interest rate problems, actual
payments would be given an interest rate, etc.

- 10 -

For example, suppose you find a bond listed with the
following parameters:

Price: 60
Rate: 5% (Not current yield but the bond yield.)
Due 10 yrs. (Given as a date.)

You know that the final value is 100 and that the payment is
\$5.00 or 5% of 100. To find the yield to maturity you
proceed as follows:

Enter -60 in R2 (PV);
Enter 100 in R3 (FV);
Enter 10 in R5 (N);
Enter 5 in R6 (PMT).

Note that 60, the outgo, or cost, is equated to the sum of
the PMT and FV, the incomes, which are positive. (To enter
-60, put 60 on the entry line and press SHIFT F2 twice.)

Press CNTRL F4, and the computed rate, .121118 (12.11%) will
appear in R1. For this computation the value in R4 (R)
doesn't matter. Note that the rate computed is the rate per
period, so it can be calculated as a monthly or semi-annual
rate. Note also that all rates are in decimal, not percent.

**** WARNING ****

Knowledge and experience beyond any information herein are
required.

*****************

As a second example let's compute the present value of the
bond at an assumed rate of 12%.

Enter 0 in R2 (PV);
Enter 100 in R3 (FV);
Enter .12 in R4 (R);
Enter 10 in R5 (N);
Enter 5 in R6 (PMT).

- 11 -

Press CNTRL F2. The answer 60.45 will show in R1. Note that
we set the present value in R2 to zero. Since we're
computing PV, it would make sense to add any present value
"on hand" to that computed. In this case there is none, but
suppose as an incentive to buy you were given \$10 (per
hundred dollars of bond) at the time of purchase; this would
add to the present value and should be entered in R2.

These calculations can be confusing, and the user should be
sure of his logic; CALQUE can only provide the computations
not the logic. For example consider the incentive \$10.00 in
both the cases above, the computation of rate and the
computation of present value. In the latter case the
rational for adding the \$10.00 to R2 was given, it is a part
of the present value. In the first case, where we calculate
R, the \$10.00 is also added to R2 prior to entry; -50 is
entered instead of -60, but in this case it appears as
reduction in cost (or outgo). The block diagram of the
transaction suggested above will clarify this.

For many users of the CALQUE financial functions, it will be
of interest to compute, or check the computation of loan
payment schedules. The schedule will generally look
something like this:

NUMBER PAYMENT PRINCIPAL INTEREST AMOUNT OWED
n PMT dV(n) I(n) V(n)

Here n is the payment number running from 1 to N; PMT is the
amount of the (monthly) payments, a constant; dV(n) is the
decrease in the amount owed (the principal payed) after this
payment; I(n) is the interest payed (useful for tax
purposes) with this payment; and V(n) is the amount owed,
including the then value of any balloon payment which is not
being paid down by the payments.

The table is computed based on an agreed "annual percentage
rate" (APR). Since this rate is an annual rate and the
payments are usually monthly, the rate to be used in the
computations below is R=1/12th the APR.

To fill out the table you proceed as follws using the
financial functions of CALQUE.

- 12 -

PMT: Enter R, as defined by APR/12, in R4; the amount of the
loan in R2; N, the number of monthly payments, in R5; and
minus (!!) the balloon payment due with the last payment in
R3; and zero in R6. Press CNTRL F6, and the value to be used
for PMT is returned in R1.

V(n): For n=0 use the amount of the loan. For any other
value of n enter n in R5, R in R4, the amount of the loan in
R2, zero in R3 and minus (!!) PMT in R6. Press CNTRL F3, and
V(n) is returned in R1.

dV(n): Using the procedure above find V(n-1), and subtract
V(n). dV(n)=V(n-1)-V(n).

I(n): I(n)=R*V(n-1).

If you did this right, then V(N), the amount owed at the end
of the loan period of N months, should equal the balloon
payment (which you still owe).

If you wish to calculate the complete loan table, start from
n=1, and use the following recursion:

V(n)=(1+R)*V(n-1)-PMT

The remaining table entries for each n are found as already
described. Note that to get started V(0) equals the amount
of the loan.

MACRO COMMANDS

Macro commands consisting of up to about 255 keystrokes can
be constructed and executed with just 1 keystroke. Also the
macro can be stored to disk and recalled from disk. The disk
file consists of ASCII characters, and it can be edited by
any editor or word processor. The current macro which the
program will use can be displayed. The five macro commands,
M,G,H,I,J are shown at the right of the screen.

M=MAKE MACRO. Press M. If there is no macro already
resident, the program instructs you to begin entering
keystrokes; entering Q will terminate the macro. If there is
already a macro in the program ready to be run (as a result
of a previous command) you are asked if you wish to erase
it. With Y the program will delete the existing macro and

- 13 -

act the same as though no macro is resident. N will display
the present macro for editing without a terminating Q, as
though it had just been entered. Pressing Q will end the
macro and offer the chance to store it to disk. It is then
resident and ready for use by pressing G.

For example, press M and Y (only if a macro already resident
causes a Y/N prompt). Now press

C,1,ENTER,S,S,F1,R,F2,/,R,F3,Q.

Now press G and the following actions will take place, but
too rapidly to observe step-by-step.

1. (C) All registers will be cleared to 0.
2. (1) 1 will be put on the entry line.
3. (ENTER) 1 will be entered into R1.
4. (S) 1 will be stored into ST1.
5. (S) 1 will be stored into ST2 (as well as ST1).
6. (F1) The 1 in R1 will be converted to SIN(1).
7. (R) R1 goes to R2 and 1 will be recalled from ST1
to R1.
8. (F2) The 1 in R1 will be converted to COS(1).
9. (/) R2 (SIN(1)) will be divided by R1 (COS(1)),
and the quotient will appear in R1.
10.(R) 1 will be recalled from ST1 and R1 shifted to
R2. R2 will now contain SIN(1)/COS(1), and R1=1.
11.(F3) The 1 in R1 will be converted to TAN(1).
12.(Q) This will cause an exit from MAKE MACRO, and
the program asks if the macro should be stored;

At the end of the execution of this macro (following the
keystroke G), R1 will contain TAN(1), and R2 will contain
SIN(1)/COS(1); the numbers should be the same. (This is a
well known trig identity.) In this example one could delete
the first five steps and enter and store the desired angle
argument manually each time before running the macro. This
would let the equation be solved for manually entered
different values of angles each time the macro is run. It is
also possible to set up increments of an angle in order to
process a range of angles in equal steps.

MAKE MACRO can also be used to crudely edit an existing
macro. If a macro already exists when M is pressed, the
program prompts this and asks if it should be erased. If you

- 14 -

answer N, then the existing macro is displayed (without the
ending Q) just as though you were at that point in
constructing the macro for the first time. The macro can be
modified by pressing backspace, which removes the last
function key entries are displayed as two ASCII character
mnemonics (e.g. SI=SIN), and the other keys are displayed as
shown on the keyboard. (In the make macro mode you can
observe the mnemonic code for each key by pressing it.) Note
that only the last keystrokes which can be displayed on one
line are shown; the earlier ones which "fall off" are stored
but cannot be displayed. As before, pressing Q causes an
exit from MAKE MACRO.

A second, more practical, example computes the formula for
the number of different combinations of "r" items out of a
total of "n" items:

C = n!/r!(n-r)!

The keystrokes to implement this, as shown by the MAKE MACRO
edit line or H=SHOW MACRO, are

R X! R X! R R - X! * / Q. (Where X! is ALT F5.)

Prior to running this macro, STORE 1 must contain "n", and
STORE 2 must contain "r". For example, key in this macro,
put 2 in STORE 2 and 4 in STORE 1. (Enter and store 2, and
then enter and store 4.) Press G, and observe the answer, 6
in R1 and on the ENTRY line. Work the same problem with
manual keystrokes, and you can see what's happening.

A macro can be defined which calls itself or another macro.
However, the requirement to use this capability probably
more sophisticated tool such as a general purpose compiler
(Basic, Fortran, Pascal), a spread sheet (Lotus 123,
Quattro), or an equation solver (Eureka, Mathcad, Tutsim).

Since the macros can be stored to disk in ASCII format, the
disk file can be edited by a word processor. Since CALQUE
only reads the stored macro up to the terminating Q (for
quit), you can add text which follows to explain the use of
the macro and its initial conditions. This practice is

- 15 -

highly recommended; experience has taught us that you will
never remember what these little programs are for or how to
use them.

Note that a macro execution does not stop with a warning of
an unallowed operation, such as dividing by 0. The bell
warning should alert you, but to be safe a macro should be
checked manually.

G=DO MACRO. Pressing G with the cursor on the entry line
will cause the macro present to run. If there is no macro
(as when CALQUE is first called) nothing happens.

H=SHOW MACRO. Pressing H displays the existing Macro at the
bottom of the screen. This is the only effect, and the
program is then ready to accept further commands. Only the
last 79 characters of the macro are displayed (since only
one line is available).

I=GET MACRO. Pressing I causes the program to prompt for a
file name for the macro to be loaded. A simple RETURN aborts
the command, a non-existent file name (or a disk access
failure) causes a prompt which repeats the file name
requested with the message that it couldn't be accessed.
Entry of a valid file name (followed by ENTER) will cause
the contents of that file to be loaded as a macro. If it is
a file that exists but is invalid as a macro (for example
some word processor document), the first characters up to
255, or a RETURN in the file, will be loaded. They will
execute whatever the erroneus data says. The file loaded can
be displayed by pressing H (SHOW MACRO). If the file data is
erroneus, pressing H may result in shifting the CALQUE
screen. This can be fixed without leaving the program by
pressing T twice.

J=STORE MACRO. Pressing J causes the program to prompt for
the file name to be used to store the existing macro. A
simple RETURN will abort the command. A file name which is
not allowed by DOS (or a disk access failure) causes a
prompt which says the file name requested couldn't be
accessed. If the file name is acceptable the existing macro
is stored in that file. If there is no existing macro, the
file will be written with nothing in it. It is suggested
that you use a distinctive suffix for your CALQUE files, for
example, .QQQ.

- 16 -

Note that GET, STORE, and MAKE all prompt for file names. To
abort this request without opening a file, press ENTER prior
to any other keystroke.

ORDERING INFORMATION

When the CALQUE screen first appears, the message at the
bottom welcomes you, gives you the serial number of your
copy of the program, and identifies you by name. This is
intended to motivate the user to purchase his own
personalized copy of CALQUE; the serial number will identify
the version in the unlikely event of problems. This
personalization of the program copy is the only form of
"copy protection" used.

RESTRICTIONS AND DISCLAIMERS. It should be understood that
the distribution of copies of CALQUE by anyone not
authorized by the author, free or for money, for any purpose
other than evaluation, is not allowed. The user of the
program implicitly agrees to this. CALQUE also denies any
liability for damages resulting from using the program. If
the program gives incorrect results, we will fix the problem
and provide an updated copy to all registered users who
request it within one year of purchase and send in their
program diskette. A user is automatically registered when he
orders the program according to the procedure below.

O=ORDER INFO. Pressing O causes the program to display
ordering information at the bottom of the screen. The name
CALQUE, the address, and the price are given. Send the
amount requested to the address given payable to CALQUE.
Personal check or cash is preferred. Don't worry about
postage, handling, or tax; they are included in the price.
copy can be sent to you.

If you already have CALQUE and have technical questions,
criticism you may have.

If you purchased CALQUE from any one other than CALQUE (and
if it is a registered copy), you can get your copy
personalized to you by sending it to the ordering address
with an addressed, stamped, return diskette mailer. We will
transfer the registration to the name requested by you.

THANK YOU from CALQUE.

- 17 -

December 15, 2017