Radio Shack TRS-80 User Manual page 220

Micro computer system
Hide thumbs Also See for TRS-80:
Table of Contents

Advertisement

Tangent
Computes:
TAN(X)
Input:
Xin
degrees
;
Output:
Y
Also
Uses:
A,C,W
and
Z
internally.
Value
of
X
is
changed.
Other
subroutines required: Cosine, Sine
How
to
call:
GOSUB
3032(8
30000 END
30300 REM *TANGENT* INPUT
X
IN
DEGREES, OUTPUT
Y
30310 REM ALSO USES A,C,W,Z INTERNALLY
30320
A
= X
i
GOS.
30360
32330
IF
AGS
(YX1E-5
T.
P.
"TANGENT
UNDEFINED"
i
STOP
303*0 C=Y
:
X
=
A
t
GOS.
30376
t
Y
=
Y/C
:
RET.
Cosine
Computes:
COS(X)
Input:
X
in
degrees
Output:
Y
Also
uses:
W
and
Z
internally.
Value of
X
is
changed.
Other
subroutines required: Sine
How
to
call:
GOSUB
3036(3
30000 END
30350 REM *COSINE* INPUT
X
IN
DEGREES, OUTPUT
Y
30351 REM
ALSO USES
W,Z
INTERNALLY
30360
W=ABS(X)/X:X=X+90
i
GOS.
321376
*
J
F{
Z=-l
)
*
(
W=
1
>T
.
Y=
30365 RET.
Sine
Computes: SIN(X)
;]lnp«t:
X
degrees
Output:
Y
Also
uses:
Z
internally.
Value of
X
is
changed.
Other
subroutines required
:
None
How
to
Call:
GOSUB
30376
30000 END
38370 REM *SIN* INPUT
X
IN
DEGREES, OUTPUT
Y
33371 REM ALSO USES
Z
INTERNALLY
30376 2=ABS< X)/XiX=Z'x
303BB
IF
X>360
T.
x=x/360
i
X={X-INT(X)
1*360
303
9
IFX>9
0T.X=X/90>
Y=INT<
X)
:
X=
(
X-
Y
)
*
90
:
ONYG
.
30
410.30420, 3043B
30402 X=X/57. 29578
i
IF
A6
S{ X
)<2
.
486
1
6E-
4
Y=QtRET.
3040S
G.
33*40
30410 X=90-X
:
G.
30400
30420
X =
-X
i
G.
30400
30430 X=X-90
i
G.
30400
30440 Y=X-X
,
X"
,
X/6
+
X*X
,
X*X+X/120-X*x*X*X*X*X
,,
X/S040
30450 Y=Y+X
,
X*X*X*X
,
X*X*X*X/362880
:
IF
Z=-1T,Y=-Y
30455 RET.
218

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents