Intel 80286 Computer Accessories User Manual


 
NUMERIC PROGRAMMING EXAMPLES
iAPX286
MACRO
ASSEMBLER
80287
rrignometric
Functions
10: 13:
51
09/25/83
PAGE
lOC
ODJ
00E9
E83300
OOEe
EDEO
OOEE
OOEE
C3
COEF
DOEF
D9E4
OOF!
91
OOF2 '9BDFEO
OOF5
91
OOF6
DDD9
OOFS
F6C'40
OOFS
7515
caFD
OOFD
D9F2
DOFF
OOFF
BAC?
0101
254002
0104
F6C742
0107
7BOD
0109
OAC4
0108
7A02
0100
D9EO
OIOF
OIOF DEF9
0111
C3
0112
0112
D9EB
0114
EBE9
0116
0116
OAC4
011B
7A02
011A
D9EO
oue
OllC
DEF1
ailE
C3
a11F
011F
D9El
0121
D9F4
0123
D9EB
0125
DeCl
0127
DEE9
0129
D9FD
0128
DDD9
0120
2EDB2£0000
0132
09C9
0134
C3
ASSEMBLY COMPLETE.
LINE
39.
3.7
3.8
3
••
400
401
402
403
404
40S
40.
407
408
40.
410
411
412
413
414
415
41.
417
"B
41.
420
.21
.22
23
42'
.OS
42.
.27
42B
42.
430
.31
432
'33
43'
.35
43.
.37
.3B
43.
440
441
442
443
44'
44'
446
447
44B
•••
4.0
451
452
453
454
••
5
456
457
45B
4
••
460
'61
462
463
464
465
4.6
467
46B
.6.
470
471
472
.73
474
475
476-
477
47B
.7.
.BO
4Bl
482
4B3
4B4
4B5
NO
W"'RNINQS.
SOURCE
call
normalize_valu.
Jmp
tan_normal
rot
Angle
fell
in
octants
0.2.4.6.
Test
for
5t(O)
-
0,
flpti!ln
won't
work.
flht
xchg
fstsw
xchg
htp
test
J"'
fptan
.u:.cx
.,
ex,
Cl
ste
1)
ch,
high(mask
cond3)
tan_zero
Test
for
zero
engle
I
C3
= 1 H
st(O)
..
0
I Removtt
PI/4
J
ttm
sno)
..
ST(!)/ST(O)
aft.r
_tangent:
Decide
on
the
o"der
of
the
op.rands
and
their
sign
for
the
divide
operation
while
the
fptan
instruction
is
working
.
mov
d.
btl I
Qet
a
cop",
of
'prem
C3
P1oI9
and
a
••
mask
cond1
+
high(mask
cond3),
Elamine
fprem
C3
flag
and
j
FXAH
CI
flag
test
bh.
high(mask
condl
+
mask
cond3)l
Use
rttverse
divide
if
in
,
octants
1.2,
S.
D
Jpo
reverse_divid..
Nate!
parit",
wo"ks
low
B
bits
onllJ!
Angle
was
in
octant.
0.3.4.7.
Test
fo"
the
sign
of
the
r.sult.
Tlilo
negatives
cancel.
or
al,ah
Jpe
positive_divide
IIdiv
rot
J
Form
r.sult
I Ok
to
leave
fdiv
running
IIdl
J
Force
1/0
-
tanCP1I2)
Jmp
aftttr
_tangent
Angle
lIIas
in
octant.
1.2.5.0.
Set
the
correct
sign
of
the
result.
,
reverse_divide:
or
ai,
ah
Jpe
positive_r_divide
fdivr
ret
tangent
endp
J
Form
reciprocal
oil
result
Ok
to
leave
fdiv
running
This
function
111111
normalize
the
vilh.l.
in
steOL
The"
PII4
i.
placed
into
.telL
,
normal
i
ze_value:
fabs
fxtract
fldl
f.dd
ste!),
st
flub
fscale
flstp
stCI)
fld
pi_lI.uart."
fxch
ret
code
end.
.n.
NO
ERRORS
I
Force
value
positive
o <-
steO)
< I
I
get
normalize
bit
I
Normali
Ztt
fraction
Restor.
original
value
I
Form
ori91nal
normali
zed
value
I
Remove
scala
.pactor
Get
PII4
Figure 4-7. Calculating Trigonometric Functions (Cont'd.)
4-23