forked from mist64/cbmsrc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trig.src
126 lines (114 loc) · 1.56 KB
/
trig.src
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
.page
.subttl 'trig'
cos
lda #<pi2
ldy #>pi2
jsr romadd
sin
jsr movaf
lda #<twopi
ldy #>twopi
ldx argsgn
jsr fdivf
jsr movaf
jsr int
lda #0
sta arisgn
jsr fsubt
lda #<fr4
ldy #>fr4
jsr romsub
lda facsgn
pha
bpl sin1
jsr faddh
lda facsgn
bmi sin2
lda tansgn
eor #$ff
sta tansgn
sin1
jsr negop
sin2
lda #<fr4
ldy #>fr4
jsr romadd
pla
bpl sin3
jsr negop
sin3
lda #<sincon
ldy #>sincon
jmp polyx
tan
jsr mov1f
lda #0
sta tansgn
jsr sin
ldx #<tempf3
ldy #>tempf3
jsr gmovmf
lda #<tempf1
ldy #>tempf1
jsr movfm
lda #0
sta facsgn
lda tansgn
jsr cosc
lda #<tempf3
ldy #>tempf3
jmp fdiv
cosc
pha
jmp sin1
pi2 .byte @201,@111,@17,@332,@242
twopi .byte @203,@111,@17,@332,@242
fr4 .byte @177,0,0,0,0
sincon .byte 5,@204,@346,@32,@55
.byte @33,@206,@50,@7,@373
.byte @370,@207,@231,@150,@211
.byte 1,@207,@43,@65,@337,@341
.byte @206,@245,@135,@347,@50,@203
.byte @111,@17,@332,@242
atn
lda facsgn
pha
bpl atn1
jsr negop
atn1
lda facexp
pha
cmp #@201
bcc atn2
lda #<fone
ldy #>fone
jsr romdiv
atn2
lda #<atncon
ldy #>atncon
jsr polyx
pla
cmp #@201
bcc atn3
lda #<pi2
ldy #>pi2
jsr romsub
atn3
pla
bpl atn4
jmp negop
atn4 rts
atncon .byte @13,@166,@263,@203
.byte @275,@323,@171,@36,@364
.byte @246,@365,@173,@203,@374
.byte @260,@20
.byte @174,@14,@37,@147,@312
.byte @174,@336,@123,@313,@301
.byte @175,@24,@144,@160,@114
.byte @175,@267,@352,@121,@172
.byte @175,@143,@60,@210,@176
.byte @176,@222,@104,@231,@72
.byte @176,@114,@314,@221,@307
.byte @177,@252,@252,@252,@23
.byte @201,0,0,0,0
;.end