EasyManuals Logo

Intel 80287 User Manual

Intel 80287
515 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #435 background imageLoading...
Page #435 background image
PROGRAMMING NUMERIC APPLICATIONS
Table 2-17. Addressing Mode Examples
Coding
Interpretation
FIAOO
ALPHA ALPHA is a simple scalar (mode is direct).
FOIVR ALPHA.BETA
BETA
is a
field
in a
structure
that
is
"overlaid"
on ALPHA (mode is direct).
FMUL aWORO PTR [BX] BX contains the address
of
a long real
variable (mode is register indirect).
FSUB ALPHA [SI] ALPHA is an array and
SI
contains the
offset
of
an
array element from the start
of
the array (mode is indexed).
FILO [BP].BETA BP contains the address
of
a structure on
the CPU stack and BETA is a field
in
the
structure (mode is based).
FBLO TBYTE PTR [BX] [01] BX
contains
the
address
of
a
packed
decimal array and
01
contains the offset
of
an
array element (mode is based indexed).
Comparative Programming Example
Figures
2-6
and
2-7
show
the PLjM-286 and ASM286 code for a simple 80287 program, called
ARRSUM. The program references
an
array (X$ARRA Y), which contains 0-100 short real values;
the integer variable N$OF$X indicates the number of array elements the program
is
to
consider.
ARRSUM steps through X$ARRA Y accumulating three sums:
• SUM$X, the sum of the array values
• SUM$INDEXES, the sum of each array value times its index, where the index of the first element
is
1,
the second
is
2,
etc.
• SUM$SQUARES, the sum of each array element squared
(A true program, of course, would
go
beyond these steps
to
store and use the results of these calcula-
tions.) The control
word
is
set with the recommended values: projective closure, round
to
nearest,
64-bit precision, interrupts enabled, and all exceptions masked invalid operation.
It
is
assumed that an
exception handler has been written
to
field the invalid operation, if
it
occurs, and that it
is
invoked
by
interrupt pointer
16.
Either version of the program
will
run
on
an
actual or
an
emulated
80287
without
altering the code shown.
The PLjM-286 version of ARRSUM (figure
2-6)
is
very straightforward and illustrates
how
easily the
80287 can
be
used
in
this language. After declaring variables the program calls built-in procedures
to
initialize the processor (or its emulator) and
to
load
to
the control word. The program clears the sum
variables and then steps through X$ARRAY with a DO-loop. The loop control takes into account
PLjM-286's practice of considering the index of the first element of an array
to
be
o.
In the compu-
tation of SUM$INDEXES, the built-in procedure FLOAT converts
1+1
from integer
to
real because
the language
does
not support "mixed mode" arithmetic. One of the strengths of the NPX, of course,
is
that it does support arithmetic
on
mixed data types (because all values are converted internally
to
the 80-bit temporary real format).
2-43
pcjs.org

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Intel 80287 and is the answer not in the manual?

Intel 80287 Specifications

General IconGeneral
BrandIntel
Model80287
CategoryComputer Hardware
LanguageEnglish

Related product manuals