User's Manual

i
AP
X:286 MACRO ASSEMBLER
LOC
08,)
007F
007F
D9F2
OOBI
0081
F6C742
0094
?BIA
0096
D9Cl
OOBS
EllA
OOSA
DOBA DDDS
OOSC
7404
OOBE
7002
0090
D9FB
0092
0092
0092
C3
0o,3
0093
D9ES
009'
EBEA
0097
0097
OED.
0099
2ED9060AOO
009E
99
009F
C3
OOAO
OOAO
D9CO
00A2
D9CA
00A4
00A4
Dcea
OOA6
D9C9
00A8
DCCB
OOAA
DEC!
OOAC
D9FA
OOAE
80E701
0001
80E402-
0094
DAFe
0006
7A02
OODB
09EO
OOBA
OOBA
DEF'
DOBC
C3
NUMERIC PROGRAMMING EXAMPLES
B0287
T1'ignometl'ic
Functioni;
10: 13:
51
09/25/83
PAGE
LINE
207
20B
20.
210
211
212
213
.14
210
21.
.17
21B
.1.
220
221
2
••
22'
224
22'
22.
27
22B
229
230
231
=
233
.34
235
23.
237
2.B
23.
240
.41
.42
243
244
245
2
••
.47
.4B
•••
2.0
201
2.2
253
2
••
••
5
2
••
257
25B
•••
2.0
••
1
2
••
2.3
2.'
••
5
2
••
2.7
2.B
2
••
270
271
272
27.
274
27S
.7.
277
278
27.
2BO
2Bl
28.
28.
2B4
.B5
.8.
2B7
.88
2B.
2'0
2.1
2.2
2.3
2.4
2.'
296
+1
2.7
2.B
2.'
300
SOURCE
Assert::
0 (
steOl
<-
PII4
,
dD_sine_fphn:
flpten
, TAN
9nO)
STeu/snol
...
V/X
IIfte"
_sine_flpten:
te.t
bh.highCmilsk
c:and3
+
m.sk
cond!).
L.ao.
at
octant
angle
fell
into
JPo
X_numeT'atoT' I
C.lcul.te
cosine
'aT'
Dctenh
I
1,2.9.6
Calculate
the
sine
of
the
aT'~ument.
sinCA)
...
tanCA)/sq,T't<1+tanCA)**2)
if
tenCA)
...
V/X
then
sinCA)
...
V/sqrt(X_X
+ V-V)
'Id
Jmp
stCl)
shoT't
finhh_sine
I Cop V V
value
I
Put
V
value
in
numeT'atoT'
The
top
0'
the
stack
is
eUheT'
NAN.
infinitv.
OT'
emptv
.
,
funnv"paT'ameteT':
fstp
J'
JPO
steO)
retuT'n_empt"
T'.tuT'n..NAN
, Remove
PII4
I
Return
empt\l
if
no
paT'm
I Jump
if
st(OI
is
NAN
st(O)
is
infinit".
R.tuT'n·
an
indefinite
value.
'pT'em I
STell
can
be
·.n\lthing
T'etuT'n..NAN:
T'etuT'n_emp tV:
••
t
I
Ok
to
hillve
fpT'em
T'unning
I
Simuleh
'ptan
lIIith
~tCO)
...
0
,
Il.ne_aT'gument_zeT'o:
I
Simulate
tanCO)
I
RetuT'n
the
zeT'O
value
The
anllh
ilia.
tao
laT'lIe. Remove
the
modulull
and
divl.dend
fT'om
the
stack
and
retuT'n
an
indefinite
T'e~ult.
fcompp
Hd
indefinite
flllOl1t
rot
Calculate
the
cosine
of
the
aT'gument.
I
Pop
tlllO
valulls
for'om
the
stack
I
RetuT'n
indefinite
I
Wait
foT'
load
to
finish
cosCA)
-
1/sqrtC1+tanCA)**2)
if
tenIA)
III
V/X
then
cas
(A) =
X/sq,rtex*x
+
V*V)
,
X_numeT'atoT':
finish
fld
st(O)
,
COP\!
X
value
fxch
~t(2)
Put
X
in
numeT'atoT'
_sine:
fmul
st.
st(O)
,
FOT'm
x*x
+ V.V
Fxch
fmul
st,st(O)
hdd
st<O)
=
X'X
+ V*V
hq,rt
steOI
.
sqrteX*X
+
V*V)
FOT'm
the
sign
of
the
T'esult.
The
hID
conditions
are
the
Cl
flag
'T'tlm
FXAM
in
bh
and
the
CO
flag
fT'om IpT'em
in
ah.
and
.nd
D.
JPe
fchs
fdiv
rot
bh,
high
(mask
condO)
ah,
highemask
condl)
bh,
ah
positive_sine
Look
at
the
fprem
CO
flag
Look
at
the
ham
Cl
flag
Even
numbeT'
of
flags
cancel
TIllO
negatives
m.ake a
positive
FOT'ce
T'esult
negative
Form
final
result
Ok
to
leave
fdiv
running
casine
endp
'eJect
This
function
!IIill
calculate
the
tangent
of
an
angle.
The
angle,
in
T'adians
is
pa.sed
in
ST(O),
the
tangent
is
T'eturned
in
ST(OL
The
tangent
is
calculated
to
OIn
aCCUT'aCU
of
4
units
in
the
Figure 4-7. Calculating Trigonometric Functions (Cont'd.)
4-21