Intel 80286 Computer Accessories User Manual


 
intel"
PROGRAMMING NUMERIC APPLICATIONS
"iAPX286
MACRO
ASSEMBLER EXAMPLE_ASM286_PROGRAM
SERIES-I
I I
iAPX286
MACRO ASSEMBLER
X10B
ASSEMBLY
OF MODULE
EXAMPLE_ASM286_PROGRAM
OBJECT
MODULE
PLACED
IN
:
F6:
287EXP,
OBJ
ASSEMBLER
INVOKED
BY:
ASM286.86:
F6:
287EXP.
SRC
XREF
LOC
OBJ
0000
3E03
0002
????
0004
(
100
????????
)
0194
????????
0198
????????
019C
????????
0000
0000
B8----
0003
8ED8
0005
B8----
0008
8EDO
OOOA
BCFEFF
OOOD
9AOOOO----
0012
D92EOOOO
0016
D9EE
0018
D9EE
001A
D9EE
001C
8BOE0200
0020
F7E9
0022
8BFO'
0024
0024
83EE04
0027
D9840400
002B
DCC3
002D
D9CO
002F
DCC8
0031
DEC2
0033
FFOE0200
0037
E2EB
0039
0039
D91E9401
003D
D91E9801
0041
D91E9COl
0045
9B
R
R
E
R
R
R
R
R
LINE
SOURCE
1
name
example_ASM28b_pT'ogram
2
Define
initialization
routine
3
extl'n
init287:
faT'
4
S
Allocate
'space
foT'
data
6
data
se!Jment
T'W
public
7
control_287
dw
033eh
8
9
10
11
12
13
14
n
of
,
- -
,
_array
sum_squaT'es
sum_indexes
sum
,
data
ends
dU/
?
dd
100
d d ?
dd
?
dd
?
15
;
Allocate
CPU
stack
spaclt
16
stack
stackseg
400
17
Ie ;
Begi"n
code
19
code
segment
eT'
public
dup
(1)
20
assume
ds:
data.
55:
stack.
es:
nothing
21
22
23
24
25
26
'Z7
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
start:
mov
ax.
data
mov
ds.
ax
mov
ax.
stack
ss.
ax
sp.
sta.ckstsrt
stack
Assume
x_array
and
"_of_x
are
initialized
this
pprogram
zeroes
n_of_lC
Prepare
the
80287
or
its
emulator.
call
init287
fldclll
control_287
j
Clear
three
reg
isters
to
hold
running
sums
fldz
fld
z
fld
z
Setup
CX
as
loop
counter
imd
SI
as
index
to
x_array
mov c
lC.
n
of
,
- -
imul
mov
si.
ax
;
Sl
now
contains
index
of
last
element
+ 1
;
Loop
thru
lC_array.
accumulat.ing
~ums
sum_next:
sub
fld
fadd
fld
fmul
faddp
dec
loop
si.
type
x_array
x_array[siJ
st(3)'
st
st
st.st
st(2).
st
backup
one
element
push
it
on
the
stac
k
add
into
sum
of
x
duplicate
x
on
top
square
it
add
into
sum
of
(index+x)
and
discard
reduce
index
for
next
iteration
;
continue
59
;
Pop
running
sums
into
memory
60
pop_results:
61
fstp
sum_squares
Qc.
.tc.t.!"I
sum
indexes
63
64
65
66
67
68
69
70
Etc.
fstp
fwai
t
code
ends
end
start
Figure
2·7.
Sample ASM286
Program
2-46