-
Notifications
You must be signed in to change notification settings - Fork 84
/
code21.src
207 lines (185 loc) · 1.95 KB
/
code21.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
.page
.subttl 'code21'
romram
lda (index1),y
bcs qintrt
jmp indin1
;*********************************
; quick greatest integer function
;*********************************
qint
lda facexp
beq clrfac
sec
sbc #addpr8+@230
bit facsgn
bpl qishft
tax
lda #@377
sta bits
jsr negfch
txa
qishft
ldx #fac
cmp #$f9
bpl qint1
jsr shiftr
sty bits
qintrt rts
qint1
tay
lda facsgn
and #@200
lsr facho
ora facho
sta facho
jsr rolshf
sty bits
rts
;***************************
; greatest integer function
;***************************
int
lda facexp
cmp #addpr8+@230
bcs intrts
jsr qint
sty facov
lda facsgn
sty facsgn
eor #@200
rol a
lda #@230+8
sta facexp
lda faclo
sta integr
jmp fadflt
clrfac
sta facho
sta facmoh
sta facmo
sta faclo
tay
intrts rts
fin
ldy #0
ldx #@11+addprc
finzlp
sty deccnt,x
dex
bpl finzlp
bcc findgq
cmp #'-'
bne qplus
stx sgnflg
beq finc
qplus
cmp #'+'
bne fin1
finc
jsr chrget
findgq
bcc findig
fin1
cmp #'.'
beq findp
cmp #'E'
bne fine
jsr chrget
bcc fnedg1
cmp #minutk
beq finec1
cmp #'-'
beq finec1
cmp #plustk
beq finec
cmp #'+'
beq finec
bne finec2
finec1
ror expsgn
finec
jsr chrget
fnedg1
bcc finedg
finec2
bit expsgn
bpl fine
lda #0
sec
sbc tenexp
jmp fine1
findp
ror dptflg
bit dptflg
bvc finc
fine
lda tenexp
fine1
sec
sbc deccnt
sta tenexp
beq finqng
bpl finmul
findiv
jsr div10
inc tenexp
bne findiv
beq finqng
finmul
jsr mul10
dec tenexp
bne finmul
finqng
lda sgnflg
bmi negxqs
rts
negxqs
jmp negop
findig
pha
bit dptflg
bpl findg1
inc deccnt
findg1
jsr mul10
pla
sec
sbc #'0'
jsr finlog
jmp finc
finlog
pha
jsr movaf
pla
jsr float
lda argsgn
eor facsgn
sta arisgn
ldx facexp
jmp faddt
finedg
lda tenexp
cmp #@12
bcc mlex10
lda #@144
bit expsgn
bmi mlexmi
jmp overr
mlex10
asl a
asl a
clc
adc tenexp
asl a
clc
ldy #0
sta syntmp
jsr indtxt
adc syntmp
sec
sbc #'0'
mlexmi
sta tenexp
jmp finec
;.end