home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Education Master 1994 (4th Edition)
/
EDUCATIONS_MASTER_4TH_EDITION.bin
/
files
/
calctors
/
eval
/
manual.doc
< prev
next >
Wrap
Text File
|
1992-08-31
|
25KB
|
595 lines
EVAL Version 1.0
+++++++++
by McAdams Associates
*****************************************************************
**IMPORTANT**
To register Eval, see "Registering Eval" on page 9 of
this manual.
Contents Page
-------- ----
Description................................ 2
Running Eval............................... 2
Removing Eval From Memory.................. 2
Control Keys............................... 3
Using Eval................................. 4
Evaluation Order........................... 4
Inputting Different Number Bases........... 4
Getting Answers in Different Number Bases.. 5
Eval's Limits.............................. 6
Disclaimer & Agreement..................... 8
Registering Eval........................... 9
Index......................................10
(C)Copyright 1992 by T.C. McAdams. All Rights Reserved.
DESCRIPTION
-----------
EVAL.EXE is a pop-up TSR expression evaluator and number base
conversion program. EVAL can act as both a four-function
floating point calculator and as a programmer's number base
converter, translating numbers to and from binary, octal, decimal
and hexadecimal number bases. EVAL is completely modeless in its
operation and dispenses entirely with the conventional
"pushbutton" calculator paradigm. Because of this you are
encouraged to read this manual to get the most out of EVAL. EVAL
should work in any 80- or 40-column text mode on any DOS computer
running DOS 2.1 or above.
RUNNING EVAL
------------
EVAL can be run as a standalone program by typing
EVAL [ENTER]
at the DOS command line. All of the program's abilities, except
for the ability to output a result to the running application,
are available in this mode.
EVAL can be made memory resident by typing
EVAL /r [ENTER]
at the command line. Equally valid would be /R, -r or -R. The
"R" stands for "resident".
When the program has been successfully loaded into memory and
made resident, it will beep once. This is EVAL's way of saying
everything is fine. If you hear TWO beeps, it means that EVAL is
unable to make itself resident in memory. The main reason for
this to occur is that a copy of EVAL is already resident. EVAL
is programmed to "check for itself" before loading to keep from
using more memory than necessary.
REMOVING EVAL FROM MEMORY
-------------------------
When it is memory resident, EVAL can be removed from memory by
typing
EVAL /k [ENTER]
where /K, -k and -K are all acceptable. The "K" means "kill from
memory". If EVAL successfully removes itself from memory you'll
hear one beep. If the program is unable to remove itself you
will hear TWO beeps. Possible reasons for this are 1) the
program was not resident to begin with, 2) a program was loaded
after EVAL that altered one or more of the interrupts EVAL uses,
making it impossible to safely change them back to their original
2
values. If this happens, the only way to remove EVAL from memory
is to reboot.
CONTROL KEYS
------------
If EVAL is memory-resident, the program is invoked by pressing
[CTRL + SPACE]. This means hold down the [CTRL] key while
pressing [SPACE]. The basic control keys will be seen displayed
on the bottom line of the program box: [ESC]Quit [-><-]
[Backspace] [Delete] [Insert]. These keys (except [ESC]) control
the movement of the block cursor visible on the input/answer line
in the middle of the program box. Here's what the keys do:
[ESC] leaves EVAL.
[-><-] The arrow keys move the cursor to the left and right
within an expression, without erasing any character
it moves over.
[Backspace] erases the character to the cursor's immediate left
and moves the remainder of the expression (anything
to the right of the cursor) left.
[Delete] erases the character under the cursor.
[Insert] controls the input mode. Insert mode is the default,
and is shown by the short block cursor. If the
cursor is moved inside an expression and a key
is struck in insert mode, that character is inserted into the
string and all characters to the right are moved one space right.
Pressing the insert key shifts the mode to overstrike and causes
the cursor to change appearance (a large block cursor). Typing
inside an expression in overstrike mode causes the newly typed
characters to replace whatever was there previously. The Insert
key in EVAL operates identically to most text editors.
[ENTER] to obtain an answer.
[CTRL + SPACE] From inside EVAL, when memory resident, "pops
down" the program box and feeds the latest result
into the running application.
Not shown on-screen, but always available during input, are the
[Home] and [End] keys. Pressing [Home] moves the cursor to the
beginning of an expression. [End] moves the cursor to the end of
an expression.
After [ENTER] has been pressed, a new set of control keys appears
in the rectangle: [F1]Expression [F2]Accum. [F3]Clear.
[F1] redisplays the original expression.
3
[F2] uses the answer to the last expression as the first
number of the new.
[F3] clears everything.
USING EVAL
----------
EVAL is a four-function expression evaluator. What this means is
that instead of merely pushing buttons, you can instead type
things like
-(32.5+19.5)/16*9.7 [ENTER]
and get as a result -0.335051546391753.
EVALUATION ORDER
----------------
To get the results you expect from a calculation, you should know
how EVAL evaluates an expression string. EVAL evaluates from
left to right, within parentheses, in operator order. Operators
are always evaluated as follows:
Precedence Operator Action
-------------------------------------
1 * multiplication
2 / division
3 + addition
4 - subtraction
In the above example, for instance, the sub-expression
-(32.5+19.5)
is first to be evaluated, since it is inside parentheses. When
this is done, the overall expression then looks like
-52/16*9.7
Next, the 16*9.7 is evaluated (multiplication is done first),
leaving us with
-52/155.2
which is then evaluated to give the result -0.335051546391753.
INPUTTING DIFFERENT NUMBER BASES
--------------------------------
The previous example was entirely decimal, or base ten. What
would happen if we typed
0xfe57 * 0b110 + 098 * .36 [ENTER] ?
4
We would get 390666, of course! To explain, the following number
prefixes are what are used to denote different number bases in
EVAL:
Prefix Number base
------------------------------------------------------
0b (zero-"b") binary (base 2)
0 (zero) octal (base 8)
d decimal (base 10)
<nothing> decimal (base 10, default, same as "d")
0x (zero-"x") hexadecimal (base 16)
Upper- or lower-case doesn't matter: "0B" is the same as "0b" and
"0X" is equivalent to "0x". Note that where zeros are used in a
prefix they must ALWAYS be zeros; letter O's won't work.
The programmers among you will already have noticed that all of
the prefixes except that for binary are standard C-language
syntax. That's no accident, since EVAL was written in C. Since
C doesn't support binary numbers, however, a prefix had to be
invented, which I did with the "0b".
Note: When a result is output to the running application by
pressing [CTRL + SPACE] all number prefixes are stripped off.
GETTING ANSWERS IN DIFFERENT NUMBER BASES
-----------------------------------------
The number prefixes explained above are for individual numbers.
So as not to confuse EVAL, a different method has to be used to
indicate the output, or overall expression, number base. Instead
of number prefixes, then, we use expression prefixes, which are
letters at the beginning of an expression.
The following expression prefixes are used:
Prefix Output
---------------------------
b binary
o octal
d decimal (default)
h hexadecimal
As before, upper- or lower-case doesn't matter.
The expression prefix "d" (for decimal) is provided for
consistency, but isn't really necessary since decimal output is
EVAL's default mode.
Time for some examples. Typing
B255 [ENTER]
5
produces 0b11111111, which is 255 in binary (base 2). Typing
h255 [ENTER]
produces 0xff, which is 255 in hexadecimal. And so on, with any
of the expression prefixes shown above. To get fancier, we can
combine number and expression prefixes in lots of different ways:
b0x214*03777+0b11110000 [ENTER]
which gives us an answer of 0b100001001111011011100. See how it
works: The first character of the expression, "b", is the
overall expression prefix, specifying binary output. The first
number of the expression has the hexadecimal number prefix "0x",
the second number the octal "0" prefix and the third number the
binary "0b" prefix.
To see how easy things are to change, type the previous example
into EVAL and press [ENTER]. Then press [F1] (to bring back the
original expression), [Home] (to move the cursor to the beginning
of the expression), and [Delete] (to delete the binary expression
prefix, placing us back into default decimal output mode).
Hitting [ENTER] again gives us the decimal result 1089244.
Repeating the process, but this time putting an "O" (letter "O",
for octal, this time, not zero) expression prefix at the start of
the expression, gives us the base 8 answer of 04117334.
The main thing to remember, when using EVAL to convert numbers to
and from various number bases, is the idea of NUMBER PREFIXES and
EXPRESSION PREFIXES. Number prefixes govern how a number is
interpreted. Expression prefixes determine how an answer is
output.
EVAL'S LIMITS
-------------
The following is a table of the maximum and minimum values EVAL
will handle:
Mode Maximum Minimum
--------------------------------------------------------------
Binary 8589934591 -4294967295
Octal 5.070602400912918e+030 -6.338253001141147e+029
Decimal 1.7e+308 -1.7e+308
<fractions> 1.7e-307 -1.7e-307
Hex 5.444517870735015e+039 -3.402823669209385e+038
When these limits are exceeded an overflow or underflow error
occurs. When this happens, press [F1] to edit the original
expression, or [F3] to clear the program box. When decimal
numbers become greater than 999999999999999, or smaller than
-999999999999999, EVAL switches automatically to exponential
format where, for example, 1.7e+308 means the decimal point
should be moved 308 places to the right, and 1.7e-30 means the
decimal point should be moved 30 places left.
6
Decimal (base 10) is the only number base in which fractional
numbers are handled. Inputting something like 0xff.f3 would
result in an answer of 255; everything after the decimal point
will be ignored.
EVAL's error checking is minimal, so care should be taken not to
input a number too large for the number base specified by the
expression prefix. To show what this means, if you input 01238
[ENTER], the answer would be 83. Silly number! To see why,
input 08 [ENTER]. The answer is zero, since the octal number
base is comprised only of numerals from 0 through 7, and EVAL
quits parsing (breaking down) a number when the numeral it's
looking at exceeds a number's base.
To make things clearer, here are all possible numerals in each
number base:
Base Possible numbers
-------------------------------------------------------------
2 0, 1
8 0, 1, 2, 3, 4, 5, 6, 7
10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
In base 16, "number" A is the same as 10 decimal, B represents
11, and so on through F = 15.
Inputting e5 [ENTER] (without a hex number prefix) would come out
as 5, since the "e" is skipped when EVAL is "building" a number.
Remember that all nondecimal number bases have a "0" as the first
character of their number prefixes. Since EVAL takes "e5" to be
decimal, the "e" is simply passed over, much as a space would be.
Generally speaking, assume that if you input nonexistent numbers,
or nondecimal numbers without the necessary number prefix, you
will get silly answers in return.
Note for programmers: Since EVAL uses the Microsoft floating
point math library, bitwise operations aren't possible. Bitwise
shifting can be simulated, however, by multiplying and dividing
by powers of two:
Places shifted Number to multiply/divide by
-----------------------------------------------------
1 2
2 4
3 8
4 16
5 32
6 64
7 128
8 256
7
DISCLAIMER & AGREEMENT
----------------------
Users of EVAL must accept this disclaimer of warranty:
"EVAL is supplied as is. The author disclaims all warranties,
expressed or implied, including, without limitation, the
warranties of merchantability and of fitness for any purpose.
The author assumes no liability for damages, direct or conse-
quential, which may result from the use of EVAL."
EVAL is a "shareware program" and is provided at no charge
to the user for evaluation. Feel free to share it with your
friends, but please do not give it away altered or as part of
another system. The essence of "user-supported" software is to
provide personal computer users with quality software without
high prices, and yet to provide incentive for programmers to
continue to develop new products. If you find this program
useful and find that you are using EVAL and continue to use
EVAL after a reasonable trial period, you must make a reg-
istration payment of $15 to McAdams Associates. The $15
registration fee will license one copy for use on any one
computer at any one time. You must treat this software just like
a book. An example is that this software may be used by any
number of people and may be freely moved from one computer
location to another, so long as there is no possibility of it
being used at one location while it's being used at another.
Just as a book cannot be read by two different persons at the
same time.
Commercial users of EVAL must register and pay for their
copies of EVAL within 30 days of first use or their license
is withdrawn. Site-License arrangements may be made by con-
tacting McAdams Associates.
Anyone distributing EVAL for any kind of remuneration must
first contact McAdams Associates at the address below for
authorization. This authorization will be automatically granted
to distributors recognized by the ASP as adhering to its
guidelines for shareware distributors, and such distributors may
begin offering EVAL immediately (However McAdams Associates must
still be advised so that the distributor can be kept up-to-date
with the latest version of EVAL.).
You are encouraged to pass a copy of EVAL along to your
friends for evaluation. Please encourage them to register their
copy if they find that they can use it.
Since this is shareware and I am a member of the Association of
Shareware Professionals, please read the following:
"This program is produced by a member of the
Association of Shareware Professionals (ASP). ASP
wants to make sure that the shareware principle works
for you. If you are unable to resolve a shareware-
8
related problem with an ASP member by contacting the
member directly, ASP may be able to help. The ASP
Ombudsman can help you resolve a dispute or problem
with an ASP member, but does not provide technical
support for members' products. Please write to the ASP
Ombudsman at 545 Grover Road, Muskegon, MI 49442
or send a CompuServe message via CompuServe Mail to ASP
Ombudsman 70007,3536."
REGISTERING EVAL
----------------
Registering EVAL costs $15 and includes one year's free support
by phone, mail and CompuServe e-mail, free bug fixes, the latest
version of EVAL, plus a handy disk utility program: TO/RET, a
"two-in-one" combo that work together, enabling you to change to
any disk/directory and return instantly to your starting point.
To register EVAL, simply print and fill out the file REGISTER.DOC
and send it, along with $15 (checks or M.O.s drawn on a U.S. bank
only, please) to:
McAdams Associates
P.O. Box 835505
Richardson, TX 75083-5505
CIS PPN 70353,1644
-----------------------------------------------------------------
EVAL was created using QuickC and MASM, which are trademarks of
Microsoft Corporation.
9
INDEX
-----
[-><-] arrow keys, 3
Accumulator, see [F2]
Answers in different bases, 5
Beeps
one, signifying success, 2
two, signifying failure, 2
Bit-shifting (simulating), 7
Clearing the program box, see [F3]
Control keys, 3
[CTRL + SPACE] key
from inside EVAL, 3
initial hotkey, 3
[DELETE] key, 3
Description, 2
Editing an expression, see Control keys
[END] key, 3
[ENTER] key, 3
Errors
number base, 7
overflow, 6
underflow, 6
[ESC] key, 3
EVAL compatibility, 2
EVAL's limits, 6-7
Evaluation order, 4
Expression prefixes, 5-6
[F1] key, 3
[F2] key, 4
[F3] key, 4
Getting an answer, see [ENTER]
[HOME] key, 3
Hotkey (for popping up), see [CTRL + SPACE]
Inputting a number/expression, 4
[INSERT] key, 3
Legal stuff, 8
Number prefixes, 5
Numerals (all possible), 7
Operator precedence, 4
Recalling original expression, see [F1]
Registering EVAL, 9
Running EVAL
from the command line, 2
when memory resident, 2
Using EVAL, 4
10