Rev 153 | Rev 195 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 153 | Rev 175 | ||
---|---|---|---|
1 | ;; Calculator for MenuetOS (original version) |
1 | ;; Calculator for MenuetOS (original version) |
2 | ;; (c)Ville Turjanmaa |
2 | ;; (c)Ville Turjanmaa |
3 | ;; Compile with FASM for Menuet |
3 | ;; Compile with FASM for Menuet |
4 | ;; |
4 | ;; |
5 | ;;What's new: |
5 | ;;What's new: |
6 | ;; Calc 1.1 |
6 | ;; Calc 1.1 |
7 | ;; 1)changed design |
7 | ;; 1)changed design |
8 | ;; 2)new procedure of draw window (10 decimal digits, 23 binary, "+" not displayed now) |
8 | ;; 2)new procedure of draw window (10 decimal digits, 23 binary, "+" not displayed now) |
9 | ;; 3)window with skin |
9 | ;; 3)window with skin |
10 | ;; 4)I had used macroses |
10 | ;; 4)I had used macroses |
11 | ;; Calc 1.2 |
11 | ;; Calc 1.2 |
12 | ;; 1)added some useful functions, such as arcsin, arccos, arctg, 1/x, x^2 |
12 | ;; 1)added some useful functions, such as arcsin, arccos, arctg, 1/x, x^2 |
13 | ;; Calc 1.31 |
13 | ;; Calc 1.31 |
14 | ;; 1)optimised program |
14 | ;; 1)optimised program |
15 | ;; 2)new type of window (you need kernel 114 revision or higher) |
15 | ;; 2)new type of window (you need kernel 114 revision or higher) |
16 | ;; Pavel Rymovski (Heavyiron) |
16 | ;; Pavel Rymovski (Heavyiron) |
17 | 17 | ||
18 | appname equ 'Calc ' |
18 | appname equ 'Calc ' |
19 | version equ '1.31' |
19 | version equ '1.31' |
20 | 20 | ||
21 | use32 |
21 | use32 |
22 | org 0x0 |
22 | org 0x0 |
23 | db 'MENUET01' ; 8 byte id |
23 | db 'MENUET01' ; 8 byte id |
24 | dd 0x01 ; header version |
24 | dd 0x01 ; header version |
25 | dd START ; start of code |
25 | dd START ; start of code |
26 | dd I_END ; size of image |
26 | dd I_END ; size of image |
27 | dd 0x1000 ; memory for app |
27 | dd 0x1000 ; memory for app |
28 | dd 0x1000 ; esp |
28 | dd 0x1000 ; esp |
29 | dd 0x0,0x0 ; I_Param , I_Icon |
29 | dd 0x0,0x0 ; I_Param , I_Icon |
30 | 30 | ||
31 | include 'macros.inc' |
31 | include 'macros.inc' |
32 | 32 | ||
33 | START: |
33 | START: |
34 | 34 | ||
35 | red: |
35 | red: |
36 | call draw_window |
36 | call draw_window |
37 | 37 | ||
38 | still: |
38 | still: |
39 | push 10 |
39 | push 10 |
40 | pop eax |
40 | pop eax |
41 | int 40h |
41 | int 40h |
42 | dec eax |
42 | dec eax |
43 | jz red |
43 | jz red |
44 | dec eax |
44 | dec eax |
45 | jz key |
45 | jz key |
46 | 46 | ||
47 | button: |
47 | button: |
48 | mov al,17 ; ¯®«ãç¨âì ¨¤¥â¨ä¨ª â®à ¦ ⮩ ª®¯ª¨ |
48 | mov al,17 ; ¯®«ãç¨âì ¨¤¥â¨ä¨ª â®à ¦ ⮩ ª®¯ª¨ |
49 | int 0x40 |
49 | int 0x40 |
50 | shr eax,8 |
50 | shr eax,8 |
51 | jmp testbut |
51 | jmp testbut |
52 | 52 | ||
53 | key: |
53 | key: |
54 | mov al,2 ; ¯®«ãç¨âì ASCII-ª®¤ ¦ ⮩ ª« ¢¨è¨ |
54 | mov al,2 ; ¯®«ãç¨âì ASCII-ª®¤ ¦ ⮩ ª« ¢¨è¨ |
55 | int 0x40 |
55 | int 0x40 |
56 | shr eax,8 |
56 | shr eax,8 |
57 | mov edi,asci ; ¯¥à¥¢®¤ ASCII ¢ ¨¤¥â¨ä¨ª â®à ª®¯ª¨ |
57 | mov edi,asci ; ¯¥à¥¢®¤ ASCII ¢ ¨¤¥â¨ä¨ª â®à ª®¯ª¨ |
58 | mov ecx,18 |
58 | mov ecx,18 |
59 | cld |
59 | cld |
60 | repne scasb |
60 | repne scasb |
61 | jne still |
61 | jne still |
62 | sub edi,asci |
62 | sub edi,asci |
63 | dec edi |
63 | dec edi |
64 | mov esi,butid |
64 | mov esi,butid |
65 | add esi,edi |
65 | add esi,edi |
66 | lodsb |
66 | lodsb |
67 | 67 | ||
68 | testbut: |
68 | testbut: |
69 | cmp eax,1 ; ª®¯ª 1 - § ªàë⨥ ¯à®£à ¬¬ë |
69 | cmp eax,1 ; ª®¯ª 1 - § ªàë⨥ ¯à®£à ¬¬ë |
70 | jne noclose |
70 | jne noclose |
71 | or eax,-1 |
71 | or eax,-1 |
72 | int 0x40 |
72 | int 0x40 |
73 | 73 | ||
74 | noclose: |
74 | noclose: |
75 | cmp eax,2 |
75 | cmp eax,2 |
76 | jne no_reset |
76 | jne no_reset |
77 | call clear_all |
77 | call clear_all |
78 | jmp still |
78 | jmp still |
79 | 79 | ||
80 | no_reset: |
80 | no_reset: |
81 | finit |
81 | finit |
82 | mov ebx,muuta1 ; ¥à¥¢®¤ ¢ ä®à¬ â FPU |
82 | mov ebx,muuta1 ; ¥à¥¢®¤ ¢ ä®à¬ â FPU |
83 | mov esi,18 |
83 | mov esi,18 |
84 | call atof |
84 | call atof |
85 | fstp [trans1] |
85 | fstp [trans1] |
86 | mov ebx,muuta2 |
86 | mov ebx,muuta2 |
87 | mov esi,18 |
87 | mov esi,18 |
88 | call atof |
88 | call atof |
89 | fst [trans2] |
89 | fst [trans2] |
90 | cmp eax,33 |
90 | cmp eax,33 |
91 | jne no_sign |
91 | jne no_sign |
92 | cmp [dsign],byte '-' |
92 | cmp [dsign],byte '-' |
93 | jne no_m |
93 | jne no_m |
94 | mov [dsign],byte '+' |
94 | mov [dsign],byte '+' |
95 | call print_display |
95 | call print_display |
96 | jmp still |
96 | jmp still |
97 | 97 | ||
98 | no_m: |
98 | no_m: |
99 | mov [dsign],byte '-' |
99 | mov [dsign],byte '-' |
100 | call print_display |
100 | call print_display |
101 | jmp still |
101 | jmp still |
102 | 102 | ||
103 | no_sign: |
103 | no_sign: |
104 | cmp eax,3 |
104 | cmp eax,3 |
105 | jne no_display_change |
105 | jne no_display_change |
106 | inc [display_type] |
106 | inc [display_type] |
107 | cmp [display_type],2 |
107 | cmp [display_type],2 |
108 | jbe display_continue |
108 | jbe display_continue |
109 | mov [display_type],0 |
109 | mov [display_type],0 |
110 | 110 | ||
111 | display_continue: |
111 | display_continue: |
112 | mov eax,[display_type] |
112 | mov eax,[display_type] |
113 | mov eax,[multipl+eax*4] |
113 | mov eax,[multipl+eax*4] |
114 | mov [entry_multiplier],eax |
114 | mov [entry_multiplier],eax |
115 | call print_display |
115 | call print_display |
116 | jmp still |
116 | jmp still |
117 | multipl: dd 10,16,2 |
117 | multipl: dd 10,16,2 |
118 | 118 | ||
119 | no_display_change: |
119 | no_display_change: |
120 | cmp eax,6 |
120 | cmp eax,6 |
121 | jb no_a_f |
121 | jb no_a_f |
122 | cmp eax,11 |
122 | cmp eax,11 |
123 | jg no_a_f |
123 | jg no_a_f |
124 | add eax,4 |
124 | add eax,4 |
125 | call number_entry |
125 | call number_entry |
126 | jmp still |
126 | jmp still |
127 | 127 | ||
128 | no_a_f: |
128 | no_a_f: |
129 | cmp eax,12 |
129 | cmp eax,12 |
130 | jb no_13 |
130 | jb no_13 |
131 | cmp eax,14 |
131 | cmp eax,14 |
132 | jg no_13 |
132 | jg no_13 |
133 | sub eax,11 |
133 | sub eax,11 |
134 | call number_entry |
134 | call number_entry |
135 | jmp still |
135 | jmp still |
136 | 136 | ||
137 | no_13: |
137 | no_13: |
138 | cmp eax,19 |
138 | cmp eax,19 |
139 | jb no_46 |
139 | jb no_46 |
140 | cmp eax,21 |
140 | cmp eax,21 |
141 | jg no_46 |
141 | jg no_46 |
142 | sub eax,15 |
142 | sub eax,15 |
143 | call number_entry |
143 | call number_entry |
144 | jmp still |
144 | jmp still |
145 | 145 | ||
146 | no_46: |
146 | no_46: |
147 | cmp eax,26 |
147 | cmp eax,26 |
148 | jb no_79 |
148 | jb no_79 |
149 | cmp eax,28 |
149 | cmp eax,28 |
150 | jg no_79 |
150 | jg no_79 |
151 | sub eax,19 |
151 | sub eax,19 |
152 | call number_entry |
152 | call number_entry |
153 | jmp still |
153 | jmp still |
154 | 154 | ||
155 | no_79: |
155 | no_79: |
156 | cmp eax,34 |
156 | cmp eax,34 |
157 | jne no_0 |
157 | jne no_0 |
158 | xor eax,eax |
158 | xor eax,eax |
159 | call number_entry |
159 | call number_entry |
160 | jmp still |
160 | jmp still |
161 | 161 | ||
162 | no_0: |
162 | no_0: |
163 | cmp eax,35 |
163 | cmp eax,35 |
164 | jne no_id |
164 | jne no_id |
165 | inc [id] |
165 | inc [id] |
166 | and [id],1 |
166 | and [id],1 |
167 | mov [new_dec],100000 |
167 | mov [new_dec],100000 |
168 | jmp still |
168 | jmp still |
169 | 169 | ||
170 | no_id: |
170 | no_id: |
171 | cmp eax,17 |
171 | cmp eax,17 |
172 | jne no_sin |
172 | jne no_sin |
173 | fld [trans1] |
173 | fld [trans1] |
174 | fsin |
174 | fsin |
175 | jmp show_result |
175 | jmp show_result |
176 | 176 | ||
177 | no_sin: |
177 | no_sin: |
178 | cmp eax,18 |
178 | cmp eax,18 |
179 | jne no_asin |
179 | jne no_asin |
180 | fld [trans1] |
180 | fld [trans1] |
181 | fld st0 |
181 | fld st0 |
182 | fmul st,st1 |
182 | fmul st,st1 |
183 | fld1 |
183 | fld1 |
184 | fsubrp st1,st0 |
184 | fsubrp st1,st0 |
185 | fsqrt |
185 | fsqrt |
186 | fpatan |
186 | fpatan |
187 | jmp show_result |
187 | jmp show_result |
188 | 188 | ||
189 | no_asin: |
189 | no_asin: |
190 | cmp eax,16 |
190 | cmp eax,16 |
191 | jne no_int |
191 | jne no_int |
192 | fld [trans1] |
192 | fld [trans1] |
193 | frndint |
193 | frndint |
194 | jmp show_result |
194 | jmp show_result |
195 | 195 | ||
196 | no_int: |
196 | no_int: |
197 | cmp eax,23 |
197 | cmp eax,23 |
198 | jne no_1x |
198 | jne no_1x |
199 | fld [trans1] |
- | |
200 | fld1 |
199 | fld1 |
201 | fdiv st,st1 |
200 | fdiv [trans1] |
202 | jmp show_result |
201 | jmp show_result |
203 | 202 | ||
204 | no_1x: |
203 | no_1x: |
205 | cmp eax,24 |
204 | cmp eax,24 |
206 | jne no_cos |
205 | jne no_cos |
207 | fld [trans1] |
206 | fld [trans1] |
208 | fcos |
207 | fcos |
209 | jmp show_result |
208 | jmp show_result |
210 | 209 | ||
211 | no_cos: |
210 | no_cos: |
212 | cmp eax,25 |
211 | cmp eax,25 |
213 | jne no_acos |
212 | jne no_acos |
214 | fld [trans1] |
213 | fld [trans1] |
215 | fld1 |
214 | fld1 |
216 | fsub st,st1 |
215 | fsub st,st1 |
217 | fsqrt |
216 | fsqrt |
218 | fld1 |
217 | fld1 |
219 | fadd st,st2 |
218 | fadd st,st2 |
220 | fsqrt |
219 | fsqrt |
221 | fpatan |
220 | fpatan |
222 | fadd st,st0 |
221 | fadd st,st0 |
223 | jmp show_result |
222 | jmp show_result |
224 | 223 | ||
225 | no_acos: |
224 | no_acos: |
226 | cmp eax,30 |
225 | cmp eax,30 |
227 | jne no_x2 |
226 | jne no_x2 |
228 | fld [trans1] |
227 | fld [trans1] |
229 | fmul st,st0 |
228 | fmul st,st0 |
230 | jmp show_result |
229 | jmp show_result |
231 | 230 | ||
232 | no_x2: |
231 | no_x2: |
233 | cmp eax,31 |
232 | cmp eax,31 |
234 | jne no_tan |
233 | jne no_tan |
235 | fld [trans1] |
234 | fld [trans1] |
236 | fptan |
235 | fptan |
237 | fstp st2 |
236 | fstp st2 |
238 | jmp show_result |
237 | jmp show_result |
239 | 238 | ||
240 | no_tan: |
239 | no_tan: |
241 | cmp eax,32 |
240 | cmp eax,32 |
242 | jne no_atan |
241 | jne no_atan |
243 | fld [trans1] |
242 | fld [trans1] |
244 | fld1 |
243 | fld1 |
245 | fpatan |
244 | fpatan |
246 | jmp show_result |
245 | jmp show_result |
247 | 246 | ||
248 | no_atan: |
247 | no_atan: |
249 | cmp eax,38 |
248 | cmp eax,38 |
250 | jne no_pi |
249 | jne no_pi |
251 | fldpi |
250 | fldpi |
252 | jmp show_result |
251 | jmp show_result |
253 | 252 | ||
254 | no_pi: |
253 | no_pi: |
255 | cmp eax,37 |
254 | cmp eax,37 |
256 | jne no_sqrt |
255 | jne no_sqrt |
257 | fld [trans1] |
256 | fld [trans1] |
258 | fsqrt |
257 | fsqrt |
259 | jmp show_result |
258 | jmp show_result |
260 | 259 | ||
261 | no_sqrt: |
260 | no_sqrt: |
262 | cmp eax,15 |
261 | cmp eax,15 |
263 | jne no_add |
262 | jne no_add |
264 | call calculate |
263 | call calculate |
265 | call new_entry |
264 | call new_entry |
266 | mov [calc],'+' |
265 | mov [calc],'+' |
267 | jmp still |
266 | jmp still |
268 | 267 | ||
269 | no_add: |
268 | no_add: |
270 | cmp eax,22 |
269 | cmp eax,22 |
271 | jne no_sub |
270 | jne no_sub |
272 | call calculate |
271 | call calculate |
273 | call new_entry |
272 | call new_entry |
274 | mov [calc],'-' |
273 | mov [calc],'-' |
275 | jmp still |
274 | jmp still |
276 | 275 | ||
277 | no_sub: |
276 | no_sub: |
278 | cmp eax,29 |
277 | cmp eax,29 |
279 | jne no_div |
278 | jne no_div |
280 | call calculate |
279 | call calculate |
281 | call new_entry |
280 | call new_entry |
282 | mov [calc],'/' |
281 | mov [calc],'/' |
283 | jmp still |
282 | jmp still |
284 | 283 | ||
285 | no_div: |
284 | no_div: |
286 | cmp eax,36 |
285 | cmp eax,36 |
287 | jne no_mul |
286 | jne no_mul |
288 | call calculate |
287 | call calculate |
289 | mov [calc],'*' |
288 | mov [calc],'*' |
290 | call new_entry |
289 | call new_entry |
291 | jmp still |
290 | jmp still |
292 | 291 | ||
293 | no_mul: |
292 | no_mul: |
294 | cmp eax,39 |
293 | cmp eax,39 |
295 | jne no_calc |
294 | jne no_calc |
296 | call calculate |
295 | call calculate |
297 | jmp still |
296 | jmp still |
298 | 297 | ||
299 | no_calc: |
298 | no_calc: |
300 | jmp still |
299 | jmp still |
301 | 300 | ||
302 | show_result: |
301 | show_result: |
303 | call ftoa |
302 | call ftoa |
304 | call print_display |
303 | call print_display |
305 | jmp still |
304 | jmp still |
306 | 305 | ||
307 | error: |
306 | error: |
308 | jmp still |
307 | jmp still |
309 | 308 | ||
310 | calculate: |
309 | calculate: |
311 | pusha |
310 | pusha |
312 | cmp [calc],' ' |
311 | cmp [calc],' ' |
313 | je no_calculation |
312 | je no_calculation |
314 | cmp [calc],'/' |
313 | cmp [calc],'/' |
315 | jne no_cdiv |
314 | jne no_cdiv |
316 | fdiv [trans1] |
315 | fdiv [trans1] |
317 | 316 | ||
318 | no_cdiv: |
317 | no_cdiv: |
319 | cmp [calc],'*' |
318 | cmp [calc],'*' |
320 | jne no_cmul |
319 | jne no_cmul |
321 | fmul [trans1] |
320 | fmul [trans1] |
322 | 321 | ||
323 | no_cmul: |
322 | no_cmul: |
324 | cmp [calc],'+' |
323 | cmp [calc],'+' |
325 | jne no_cadd |
324 | jne no_cadd |
326 | fadd [trans1] |
325 | fadd [trans1] |
327 | 326 | ||
328 | no_cadd: |
327 | no_cadd: |
329 | cmp [calc],'-' |
328 | cmp [calc],'-' |
330 | jne no_cdec |
329 | jne no_cdec |
331 | fsub [trans1] |
330 | fsub [trans1] |
332 | 331 | ||
333 | no_cdec: |
332 | no_cdec: |
334 | call ftoa |
333 | call ftoa |
335 | 334 | ||
336 | no_calculation: |
335 | no_calculation: |
337 | call print_display |
336 | call print_display |
338 | popa |
337 | popa |
339 | ret |
338 | ret |
340 | 339 | ||
341 | number_entry: |
340 | number_entry: |
342 | 341 | ||
343 | pusha |
342 | pusha |
344 | 343 | ||
345 | cmp eax,[entry_multiplier] |
344 | cmp eax,[entry_multiplier] |
346 | jge no_entry |
345 | jge no_entry |
347 | cmp [id],1 |
346 | cmp [id],1 |
348 | je decimal_entry |
347 | je decimal_entry |
349 | mov ebx,[integer] |
348 | mov ebx,[integer] |
350 | test ebx,0xc0000000 |
349 | test ebx,0xF0000000 |
351 | jnz no_entry |
350 | jnz no_entry |
352 | mov ebx,eax |
351 | mov ebx,eax |
353 | mov eax,[integer] |
352 | mov eax,[integer] |
354 | mov ecx,[entry_multiplier] |
353 | mov ecx,[entry_multiplier] |
355 | mul ecx |
354 | mul ecx |
356 | add eax,ebx |
355 | add eax,ebx |
357 | mov [integer],eax |
356 | mov [integer],eax |
358 | call print_display |
357 | call print_display |
359 | call to_muuta |
358 | call to_muuta |
360 | popa |
359 | popa |
361 | ret |
360 | ret |
362 | 361 | ||
363 | decimal_entry: |
362 | decimal_entry: |
364 | 363 | ||
365 | imul eax,[new_dec] |
364 | imul eax,[new_dec] |
366 | add [decimal],eax |
365 | add [decimal],eax |
367 | mov eax,[new_dec] |
366 | mov eax,[new_dec] |
368 | xor edx,edx |
367 | xor edx,edx |
369 | mov ebx,[entry_multiplier] |
368 | mov ebx,[entry_multiplier] |
370 | div ebx |
369 | div ebx |
371 | mov [new_dec],eax |
370 | mov [new_dec],eax |
372 | call print_display |
371 | call print_display |
373 | call to_muuta |
372 | call to_muuta |
374 | popa |
373 | popa |
375 | ret |
374 | ret |
376 | 375 | ||
377 | no_entry: |
376 | no_entry: |
378 | 377 | ||
379 | call print_display |
378 | call print_display |
380 | call to_muuta |
379 | call to_muuta |
381 | popa |
380 | popa |
382 | ret |
381 | ret |
383 | 382 | ||
384 | to_muuta: |
383 | to_muuta: |
385 | 384 | ||
386 | pusha |
385 | pusha |
387 | mov al,[dsign] |
386 | mov al,[dsign] |
388 | mov esi,muuta0 |
387 | mov esi,muuta0 |
389 | mov edi,muuta1 |
388 | mov edi,muuta1 |
390 | mov ecx,18 |
389 | mov ecx,18 |
391 | cld |
390 | cld |
392 | rep movsb |
391 | rep movsb |
393 | mov [muuta1],al |
392 | mov [muuta1],al |
394 | mov edi,muuta1+10 ; 楫®¥ |
393 | mov edi,muuta1+10 ; 楫®¥ |
395 | mov eax,[integer] |
394 | mov eax,[integer] |
396 | 395 | ||
397 | new_to_muuta1: |
396 | new_to_muuta1: |
398 | 397 | ||
399 | mov ebx,10 |
398 | mov ebx,10 |
400 | xor edx,edx |
399 | xor edx,edx |
401 | div ebx |
400 | div ebx |
402 | mov [edi],dl |
401 | mov [edi],dl |
403 | add [edi],byte 48 |
402 | add [edi],byte 48 |
404 | dec edi |
403 | dec edi |
405 | cmp edi,muuta1+1 |
404 | cmp edi,muuta1+1 |
406 | jge new_to_muuta1 |
405 | jge new_to_muuta1 |
407 | mov edi,muuta1+17 ; ¤à®¡®¥ |
406 | mov edi,muuta1+17 ; ¤à®¡®¥ |
408 | mov eax,[decimal] |
407 | mov eax,[decimal] |
409 | 408 | ||
410 | new_to_muuta2: |
409 | new_to_muuta2: |
411 | 410 | ||
412 | mov ebx,10 |
411 | mov ebx,10 |
413 | xor edx,edx |
412 | xor edx,edx |
414 | div ebx |
413 | div ebx |
415 | mov [edi],dl |
414 | mov [edi],dl |
416 | add [edi],byte 48 |
415 | add [edi],byte 48 |
417 | dec edi |
416 | dec edi |
418 | cmp edi,muuta1+12 |
417 | cmp edi,muuta1+12 |
419 | jge new_to_muuta2 |
418 | jge new_to_muuta2 |
420 | popa |
419 | popa |
421 | ret |
420 | ret |
422 | 421 | ||
423 | new_entry: |
422 | new_entry: |
424 | 423 | ||
425 | pusha |
424 | pusha |
426 | mov esi,muuta1 |
425 | mov esi,muuta1 |
427 | mov edi,muuta2 |
426 | mov edi,muuta2 |
428 | mov ecx,18 |
427 | mov ecx,18 |
429 | cld |
428 | cld |
430 | rep movsb |
429 | rep movsb |
431 | mov esi,muuta0 |
430 | mov esi,muuta0 |
432 | mov edi,muuta1 |
431 | mov edi,muuta1 |
433 | mov ecx,18 |
432 | mov ecx,18 |
434 | cld |
433 | cld |
435 | rep movsb |
434 | rep movsb |
436 | mov [integer],0 |
435 | mov [integer],0 |
437 | mov [decimal],0 |
436 | mov [decimal],0 |
438 | mov [id],0 |
437 | mov [id],0 |
439 | mov [new_dec],100000 |
438 | mov [new_dec],100000 |
440 | mov [sign],byte '+' |
439 | mov [sign],byte '+' |
441 | popa |
440 | popa |
442 | ret |
441 | ret |
443 | 442 | ||
444 | ten dd 10.0,0 |
443 | ten dd 10.0,0 |
445 | tmp dw 1,0 |
444 | tmp dw 1,0 |
446 | sign db 1,0 |
445 | sign db 1,0 |
447 | tmp2 dq 0x0,0 |
446 | tmp2 dq 0x0,0 |
448 | exp dd 0x0,0 |
447 | exp dd 0x0,0 |
449 | new_dec dd 100000,0 |
448 | new_dec dd 100000,0 |
450 | id db 0x0,0 |
449 | id db 0x0,0 |
451 | res dd 0 |
450 | res dd 0 |
452 | trans1 dq 0 |
451 | trans1 dq 0 |
453 | trans2 dq 0 |
452 | trans2 dq 0 |
454 | controlWord dw 1 |
453 | controlWord dw 1 |
455 | 454 | ||
456 | ftoa: ; fpu st0 -> [integer],[decimal] |
455 | ftoa: ; fpu st0 -> [integer],[decimal] |
457 | pusha |
456 | pusha |
458 | fst [tmp2] |
457 | fst [tmp2] |
459 | fstcw [controlWord] ; set truncate integer mode |
458 | fstcw [controlWord] ; set truncate integer mode |
460 | mov ax,[controlWord] |
459 | mov ax,[controlWord] |
461 | mov [tmp], ax |
460 | mov [tmp], ax |
462 | or [tmp], word 0x0c00 |
461 | or [tmp], word 0x0c00 |
463 | fldcw [tmp] |
462 | fldcw [tmp] |
464 | ftst ; test if st0 is negative |
463 | ftst ; test if st0 is negative |
465 | fstsw ax |
464 | fstsw ax |
466 | and ax, 0x4500 |
465 | and ax, 0x4500 |
467 | mov [sign], 0 |
466 | mov [sign], 0 |
468 | cmp ax, 0x0100 |
467 | cmp ax, 0x0100 |
469 | jne no_neg |
468 | jne no_neg |
470 | mov [sign],1 |
469 | mov [sign],1 |
471 | 470 | ||
472 | no_neg: |
471 | no_neg: |
- | 472 | fld [tmp2] |
|
473 | fistp [integer] |
473 | fistp [integer] |
474 | fld [tmp2] |
474 | fld [tmp2] |
475 | fisub [integer] |
475 | fisub [integer] |
476 | fldcw [controlWord] |
476 | fldcw [controlWord] |
477 | cmp byte [sign], 0 ; change fraction to positive |
477 | cmp byte [sign], 0 ; change fraction to positive |
478 | je no_neg2 |
478 | je no_neg2 |
479 | fchs |
479 | fchs |
480 | 480 | ||
481 | no_neg2: |
481 | no_neg2: |
482 | mov [res],0 ; convert 6 decimal numbers |
482 | mov [res],0 ; convert 6 decimal numbers |
483 | mov edi,6 |
483 | mov edi,6 |
484 | 484 | ||
485 | newd: |
485 | newd: |
486 | fimul [kymppi] |
486 | fimul [kymppi] |
487 | fist [decimal] |
487 | fist [decimal] |
488 | mov ebx,[res] |
488 | mov ebx,[res] |
489 | imul ebx,10 |
489 | imul ebx,10 |
490 | mov [res],ebx |
490 | mov [res],ebx |
491 | mov eax,[decimal] |
491 | mov eax,[decimal] |
492 | add [res],eax |
492 | add [res],eax |
493 | fisub [decimal] |
493 | fisub [decimal] |
- | 494 | fst [tmp2] |
|
494 | ftst |
495 | ftst |
495 | fstsw ax |
496 | fstsw ax |
496 | 497 | test ax,1 |
|
- | 498 | jnz real_done |
|
- | 499 | fld [tmp2] |
|
497 | dec edi |
500 | dec edi |
498 | jz real_done |
501 | jz real_done |
499 | jmp newd |
502 | jmp newd |
500 | 503 | ||
501 | real_done: |
504 | real_done: |
502 | mov eax,[res] |
505 | mov eax,[res] |
503 | mov [decimal],eax |
506 | mov [decimal],eax |
504 | cmp [integer],0x80000000 |
507 | cmp [integer],0x80000000 |
505 | jne no_error |
508 | jne no_error |
506 | call clear_all |
509 | call clear_all |
507 | mov [calc],'E' |
510 | mov [calc],'E' |
508 | 511 | ||
509 | no_error: |
512 | no_error: |
510 | mov [dsign],byte '+' |
513 | mov [dsign],byte '+' |
511 | cmp [sign],byte 0 ; convert negative result |
514 | cmp [sign],byte 0 ; convert negative result |
512 | je no_negative |
515 | je no_negative |
513 | mov eax,[integer] |
516 | mov eax,[integer] |
514 | not eax |
517 | not eax |
515 | inc eax |
518 | inc eax |
516 | mov [integer],eax |
519 | mov [integer],eax |
517 | mov [dsign],byte '-' |
520 | mov [dsign],byte '-' |
518 | 521 | ||
519 | no_negative: |
522 | no_negative: |
520 | call to_muuta |
523 | call to_muuta |
521 | popa |
524 | popa |
522 | ret |
525 | ret |
523 | 526 | ||
524 | 527 | ||
525 | atof: |
528 | atof: |
526 | push ax |
529 | push ax |
527 | push di |
530 | push di |
528 | fldz |
531 | fldz |
529 | mov di, 0 |
532 | mov di, 0 |
530 | cmp si, 0 |
533 | cmp si, 0 |
531 | je .error ; Jump if string has 0 length. |
534 | je .error ; Jump if string has 0 length. |
532 | mov byte [sign], 0 |
535 | mov byte [sign], 0 |
533 | cmp byte [bx], '+' ; Take care of leading '+' or '-'. |
536 | cmp byte [bx], '+' ; Take care of leading '+' or '-'. |
534 | jne .noPlus |
537 | jne .noPlus |
535 | inc di |
538 | inc di |
536 | jmp .noMinus |
539 | jmp .noMinus |
537 | 540 | ||
538 | .noPlus: |
541 | .noPlus: |
539 | cmp byte [bx], '-' |
542 | cmp byte [bx], '-' |
540 | jne .noMinus |
543 | jne .noMinus |
541 | mov byte [sign], 1 ; Number is negative. |
544 | mov byte [sign], 1 ; Number is negative. |
542 | inc di |
545 | inc di |
543 | 546 | ||
544 | .noMinus: |
547 | .noMinus: |
545 | cmp si, di |
548 | cmp si, di |
546 | je .error |
549 | je .error |
547 | call atof_convertWholePart |
550 | call atof_convertWholePart |
548 | jc .error |
551 | jc .error |
549 | call atof_convertFractionalPart |
552 | call atof_convertFractionalPart |
550 | jc .error |
553 | jc .error |
551 | cmp byte [sign], 0 |
554 | cmp byte [sign], 0 |
552 | je .dontNegate |
555 | je .dontNegate |
553 | fchs ; Negate value |
556 | fchs ; Negate value |
554 | 557 | ||
555 | .dontNegate: |
558 | .dontNegate: |
556 | mov bh, 0 ; Set bh to indicate the string is a valid number. |
559 | mov bh, 0 ; Set bh to indicate the string is a valid number. |
557 | jmp .exit |
560 | jmp .exit |
558 | 561 | ||
559 | .error: |
562 | .error: |
560 | mov bh, 1 ; Set error code. |
563 | mov bh, 1 ; Set error code. |
561 | fstp st0 ; Pop top of fpu stack. |
564 | fstp st0 ; Pop top of fpu stack. |
562 | 565 | ||
563 | .exit: |
566 | .exit: |
564 | pop di |
567 | pop di |
565 | pop ax |
568 | pop ax |
566 | ret |
569 | ret |
567 | 570 | ||
568 | atof_convertWholePart: |
571 | atof_convertWholePart: |
569 | 572 | ||
570 | ; Convert the whole number part (the part preceding the decimal |
573 | ; Convert the whole number part (the part preceding the decimal |
571 | ; point) by reading a digit at a time, multiplying the current |
574 | ; point) by reading a digit at a time, multiplying the current |
572 | ; value by 10, and adding the digit. |
575 | ; value by 10, and adding the digit. |
573 | 576 | ||
574 | .mainLoop: |
577 | .mainLoop: |
575 | mov al, [bx + di] |
578 | mov al, [bx + di] |
576 | cmp al, '.' |
579 | cmp al, '.' |
577 | je .exit |
580 | je .exit |
578 | cmp al, '0' ; Make sure character is a digit. |
581 | cmp al, '0' ; Make sure character is a digit. |
579 | jb .error |
582 | jb .error |
580 | cmp al, '9' |
583 | cmp al, '9' |
581 | ja .error |
584 | ja .error |
582 | 585 | ||
583 | ; Convert single character to digit and save to memory for |
586 | ; Convert single character to digit and save to memory for |
584 | ; transfer to the FPU. |
587 | ; transfer to the FPU. |
585 | 588 | ||
586 | sub al, '0' |
589 | sub al, '0' |
587 | mov ah, 0 |
590 | mov ah, 0 |
588 | mov [tmp], ax |
591 | mov [tmp], ax |
589 | 592 | ||
590 | ; Multiply current value by 10 and add in digit. |
593 | ; Multiply current value by 10 and add in digit. |
591 | 594 | ||
592 | fmul dword [ten] |
595 | fmul dword [ten] |
593 | fiadd word [tmp] |
596 | fiadd word [tmp] |
594 | inc di |
597 | inc di |
595 | cmp si, di ; Jump if end of string has been reached. |
598 | cmp si, di ; Jump if end of string has been reached. |
596 | je .exit |
599 | je .exit |
597 | jmp .mainLoop |
600 | jmp .mainLoop |
598 | 601 | ||
599 | .error: |
602 | .error: |
600 | stc ; Set error (carry) flag. |
603 | stc ; Set error (carry) flag. |
601 | ret |
604 | ret |
602 | 605 | ||
603 | .exit: |
606 | .exit: |
604 | clc ; Clear error (carry) flag. |
607 | clc ; Clear error (carry) flag. |
605 | ret |
608 | ret |
606 | 609 | ||
607 | 610 | ||
608 | atof_convertFractionalPart: |
611 | atof_convertFractionalPart: |
609 | fld1 ; Load 1 to TOS. This will be the value of the decimal place. |
612 | fld1 ; Load 1 to TOS. This will be the value of the decimal place. |
610 | 613 | ||
611 | .mainLoop: |
614 | .mainLoop: |
612 | cmp si, di ; Jump if end of string has been reached. |
615 | cmp si, di ; Jump if end of string has been reached. |
613 | je .exit |
616 | je .exit |
614 | inc di ; Move past the decimal point. |
617 | inc di ; Move past the decimal point. |
615 | cmp si, di ; Jump if end of string has been reached. |
618 | cmp si, di ; Jump if end of string has been reached. |
616 | je .exit |
619 | je .exit |
617 | mov al, [bx + di] |
620 | mov al, [bx + di] |
618 | cmp al, '0' ; Make sure character is a digit. |
621 | cmp al, '0' ; Make sure character is a digit. |
619 | jb .error |
622 | jb .error |
620 | cmp al, '9' |
623 | cmp al, '9' |
621 | ja .error |
624 | ja .error |
622 | fdiv dword [ten] ; Next decimal place |
625 | fdiv dword [ten] ; Next decimal place |
623 | sub al, '0' |
626 | sub al, '0' |
624 | mov ah, 0 |
627 | mov ah, 0 |
625 | mov [tmp], ax |
628 | mov [tmp], ax |
626 | 629 | ||
627 | ; Load digit, multiply by value for appropriate decimal place, |
630 | ; Load digit, multiply by value for appropriate decimal place, |
628 | ; and add to current total. |
631 | ; and add to current total. |
629 | 632 | ||
630 | fild word [tmp] |
633 | fild word [tmp] |
631 | fmul st0, st1 |
634 | fmul st0, st1 |
632 | faddp st2, st0 |
635 | faddp st2, st0 |
633 | jmp .mainLoop |
636 | jmp .mainLoop |
634 | 637 | ||
635 | .error: |
638 | .error: |
636 | stc ; Set error (carry) flag. |
639 | stc ; Set error (carry) flag. |
637 | fstp st0 ; Pop top of fpu stack. |
640 | fstp st0 ; Pop top of fpu stack. |
638 | ret |
641 | ret |
639 | 642 | ||
640 | .exit: |
643 | .exit: |
641 | clc ; Clear error (carry) flag. |
644 | clc ; Clear error (carry) flag. |
642 | fstp st0 ; Pop top of fpu stack. |
645 | fstp st0 ; Pop top of fpu stack. |
643 | ret |
646 | ret |
644 | 647 | ||
645 | ; ********************************************* |
648 | ; ********************************************* |
646 | ; ******* WINDOW DEFINITIONS AND DRAW ********* |
649 | ; ******* WINDOW DEFINITIONS AND DRAW ********* |
647 | ; ********************************************* |
650 | ; ********************************************* |
648 | 651 | ||
649 | draw_window: |
652 | draw_window: |
650 | 653 | ||
651 | mov eax,48 |
654 | mov eax,48 |
652 | mov ebx,3 |
655 | mov ebx,3 |
653 | mov ecx,sc |
656 | mov ecx,sc |
654 | mov edx,sizeof.system_colors |
657 | mov edx,sizeof.system_colors |
655 | int 0x40 |
658 | int 0x40 |
656 | 659 | ||
657 | mov eax,12 |
660 | mov eax,12 |
658 | mov ebx,1 |
661 | mov ebx,1 |
659 | int 0x40 |
662 | int 0x40 |
660 | 663 | ||
661 | mov eax,0 |
664 | xor eax,eax |
662 | mov ebx,200*65536+255 |
665 | mov ebx,200*65536+255 |
663 | mov ecx,200*65536+180 |
666 | mov ecx,200*65536+180 |
664 | mov edx,[sc.work] |
667 | mov edx,[sc.work] |
665 | or edx,0x33000000 |
668 | or edx,0x33000000 |
666 | mov edi,header |
669 | mov edi,header |
667 | int 0x40 |
670 | int 0x40 |
668 | 671 | ||
669 | mov eax,8 |
672 | mov eax,8 |
670 | mov ebx,19*65536+28 |
673 | mov ebx,19*65536+28 |
671 | mov ecx,49*65536+18 |
674 | mov ecx,49*65536+18 |
672 | mov edx,6 |
675 | mov edx,6 |
673 | mov esi,[sc.work_button] |
676 | mov esi,[sc.work_button] |
674 | mov edi,7 |
677 | mov edi,7 |
675 | newbutton: |
678 | newbutton: |
676 | dec edi |
679 | dec edi |
677 | jnz no_new_row |
680 | jnz no_new_row |
678 | mov edi,7 |
681 | mov edi,7 |
679 | mov ebx,19*65536+28 |
682 | mov ebx,19*65536+28 |
680 | add ecx,20*65536 |
683 | add ecx,20*65536 |
681 | no_new_row: |
684 | no_new_row: |
682 | int 0x40 |
685 | int 0x40 |
683 | add ebx,30*65536 |
686 | add ebx,30*65536 |
684 | inc edx |
687 | inc edx |
685 | cmp edx,39 |
688 | cmp edx,39 |
686 | jbe newbutton |
689 | jbe newbutton |
687 | 690 | ||
688 | mcall ,199*65536+28,49*65536+18,2 ; 'C' |
691 | mcall ,199*65536+28,49*65536+18,2 ; 'C' |
689 | mcall ,220*65536+8,7*65536+8,3 ; 'dec-bin-hex' |
692 | mcall ,220*65536+8,7*65536+8,3 ; 'dec-bin-hex' |
690 | 693 | ||
691 | mov eax,4 |
694 | mov eax,4 |
692 | mov ebx,27*65536+54 |
695 | mov ebx,27*65536+54 |
693 | mov ecx,[sc.work_button_text] |
696 | mov ecx,[sc.work_button_text] |
694 | mov edx,text |
697 | mov edx,text |
695 | mov esi,33 |
698 | mov esi,33 |
696 | newline: |
699 | newline: |
697 | int 0x40 |
700 | int 0x40 |
698 | add ebx,20 |
701 | add ebx,20 |
699 | add edx,33 |
702 | add edx,33 |
700 | cmp [edx],byte 'x' |
703 | cmp [edx],byte 'x' |
701 | jne newline |
704 | jne newline |
702 | 705 | ||
703 | call print_display |
706 | call print_display |
704 | 707 | ||
705 | mov eax,12 |
708 | mov eax,12 |
706 | mov ebx,2 |
709 | mov ebx,2 |
707 | int 0x40 |
710 | int 0x40 |
708 | 711 | ||
709 | ret |
712 | ret |
710 | 713 | ||
711 | print_display: |
714 | print_display: |
712 | pusha |
715 | pusha |
713 | mcall 13,18*65536+210,19*65536+13,0xffffff |
716 | mcall 13,18*65536+210,19*65536+13,0xffffff |
714 | 717 | ||
715 | mov eax,4 |
718 | mov eax,4 |
716 | mov ebx,135*65536+7 |
719 | mov ebx,135*65536+7 |
717 | mov ecx,[sc.work_text] |
720 | mov ecx,[sc.work_text] |
718 | or ecx,0x40000000 |
721 | or ecx,0x40000000 |
719 | mov edx,calc |
722 | mov edx,calc |
720 | mov esi,1 |
723 | mov esi,1 |
721 | mov edi,[sc.work] |
724 | mov edi,[sc.work] |
722 | int 0x40 |
725 | int 0x40 |
723 | 726 | ||
724 | mov ebx,198*65536+8 |
727 | mov ebx,198*65536+8 |
725 | mov edx,[display_type] |
728 | mov edx,[display_type] |
726 | shl edx,2 |
729 | shl edx,2 |
727 | add edx,display_type_text |
730 | add edx,display_type_text |
728 | mov esi,3 |
731 | mov esi,3 |
729 | mov edi,[sc.work] |
732 | mov edi,[sc.work] |
730 | int 0x40 |
733 | int 0x40 |
731 | 734 | ||
732 | cmp [dsign],byte '+' |
735 | cmp [dsign],byte '+' |
733 | je positive |
736 | je positive |
734 | mov ebx,23*65536+22 |
737 | mov ebx,23*65536+22 |
735 | mov ecx,0x0 |
738 | mov ecx,0x0 |
736 | mov edx,dsign |
739 | mov edx,dsign |
737 | mov esi,1 |
740 | mov esi,1 |
738 | int 0x40 |
741 | int 0x40 |
739 | 742 | ||
740 | positive: |
743 | positive: |
741 | cmp [display_type],0 |
744 | cmp [display_type],0 |
742 | jne no_display_decimal |
745 | jne no_display_decimal |
743 | cmp [decimal],0 |
746 | cmp [decimal],0 |
744 | je whole |
747 | je whole |
745 | 748 | ||
746 | mov ebx,180*65536+22 |
749 | mov ebx,180*65536+22 |
747 | mov ecx,0x0 |
750 | mov ecx,0x0 |
748 | mov edx,dot |
751 | mov edx,dot |
749 | mov esi,1 |
752 | mov esi,1 |
750 | int 0x40 |
753 | int 0x40 |
751 | 754 | ||
752 | mov eax,47 |
755 | mov eax,47 |
753 | mov ebx,10*65536 |
756 | mov ebx,10*65536 |
754 | mov ecx,[integer] |
757 | mov ecx,[integer] |
755 | mov edx,120*65536+22 |
758 | mov edx,120*65536+22 |
756 | mov esi,0x0 |
759 | mov esi,0x0 |
757 | int 0x40 |
760 | int 0x40 |
758 | 761 | ||
759 | mov ebx,6*65536 |
762 | mov ebx,6*65536 |
760 | mov ecx,[decimal] |
763 | mov ecx,[decimal] |
761 | mov edx,187*65536+22 |
764 | mov edx,187*65536+22 |
762 | mov esi,0x0 |
765 | mov esi,0x0 |
763 | int 0x40 |
766 | int 0x40 |
764 | 767 | ||
765 | popa |
768 | popa |
766 | ret |
769 | ret |
767 | 770 | ||
768 | whole: |
771 | whole: |
769 | mov ebx,220*65536+22 |
772 | mov ebx,220*65536+22 |
770 | mov ecx,0x0 |
773 | mov ecx,0x0 |
771 | mov edx,dot |
774 | mov edx,dot |
772 | mov esi,1 |
775 | mov esi,1 |
773 | int 0x40 |
776 | int 0x40 |
774 | 777 | ||
775 | cmp [integer],0 |
778 | cmp [integer],0 |
776 | je null |
779 | je null |
777 | 780 | ||
778 | mov eax,47 |
781 | mov eax,47 |
779 | mov ebx,10*65536 |
782 | mov ebx,10*65536 |
780 | mov ecx,[integer] |
783 | mov ecx,[integer] |
781 | mov edx,160*65536+22 |
784 | mov edx,160*65536+22 |
782 | mov esi,0x0 |
785 | mov esi,0x0 |
783 | int 0x40 |
786 | int 0x40 |
784 | 787 | ||
785 | popa |
788 | popa |
786 | ret |
789 | ret |
787 | 790 | ||
788 | no_display_decimal: |
791 | no_display_decimal: |
789 | cmp [display_type],1 |
792 | cmp [display_type],1 |
790 | jne no_display_hexadecimal |
793 | jne no_display_hexadecimal |
791 | cmp [integer],0 |
794 | cmp [integer],0 |
792 | je null |
795 | je null |
793 | 796 | ||
794 | mov eax,47 |
797 | mov eax,47 |
795 | mov ebx,256+8*65536 |
798 | mov ebx,256+8*65536 |
796 | mov ecx,[integer] |
799 | mov ecx,[integer] |
797 | mov edx,173*65536+22 |
800 | mov edx,173*65536+22 |
798 | mov esi,0x0 |
801 | mov esi,0x0 |
799 | int 0x40 |
802 | int 0x40 |
800 | 803 | ||
801 | popa |
804 | popa |
802 | ret |
805 | ret |
803 | 806 | ||
804 | no_display_hexadecimal: |
807 | no_display_hexadecimal: |
805 | cmp [integer],0 |
808 | cmp [integer],0 |
806 | je null |
809 | je null |
807 | 810 | ||
808 | mov eax,47 |
811 | mov eax,47 |
809 | mov ebx,2*256+32*65536 |
812 | mov ebx,2*256+32*65536 |
810 | mov ecx,[integer] |
813 | mov ecx,[integer] |
811 | mov edx,32*65536+22 |
814 | mov edx,32*65536+22 |
812 | mov esi,0x0 |
815 | mov esi,0x0 |
813 | int 0x40 |
816 | int 0x40 |
814 | 817 | ||
815 | popa |
818 | popa |
816 | ret |
819 | ret |
817 | 820 | ||
818 | null: |
821 | null: |
819 | mov eax,47 |
822 | mov eax,47 |
820 | mov ebx,1*65536 |
823 | mov ebx,1*65536 |
821 | mov ecx,0 |
824 | mov ecx,0 |
822 | mov edx,214*65536+22 |
825 | mov edx,214*65536+22 |
823 | mov esi,0x0 |
826 | mov esi,0x0 |
824 | int 0x40 |
827 | int 0x40 |
825 | 828 | ||
826 | popa |
829 | popa |
827 | ret |
830 | ret |
828 | 831 | ||
829 | clear_all: |
832 | clear_all: |
830 | pusha |
833 | pusha |
831 | mov [calc],' ' |
834 | mov [calc],' ' |
832 | mov [integer],0 |
835 | mov [integer],0 |
833 | mov [decimal],0 |
836 | mov [decimal],0 |
834 | mov [id],0 |
837 | mov [id],0 |
835 | mov [dsign],byte '+' |
838 | mov [dsign],byte '+' |
836 | mov esi,muuta0 |
839 | mov esi,muuta0 |
837 | mov edi,muuta1 |
840 | mov edi,muuta1 |
838 | mov ecx,18 |
841 | mov ecx,18 |
839 | cld |
842 | cld |
840 | rep movsb |
843 | rep movsb |
841 | mov esi,muuta0 |
844 | mov esi,muuta0 |
842 | mov edi,muuta2 |
845 | mov edi,muuta2 |
843 | mov ecx,18 |
846 | mov ecx,18 |
844 | cld |
847 | cld |
845 | rep movsb |
848 | rep movsb |
846 | call print_display |
849 | call print_display |
847 | popa |
850 | popa |
848 | ret |
851 | ret |
849 | 852 | ||
850 | 853 | ||
851 | ;data |
854 | ;data |
852 | 855 | ||
853 | header db appname,version,0 |
856 | header db appname,version,0 |
854 | 857 | ||
855 | display_type dd 0 ; 0 = decimal, 1 = hexadecimal, 2= binary |
858 | display_type dd 0 ; 0 = decimal, 1 = hexadecimal, 2= binary |
856 | entry_multiplier dd 10 |
859 | entry_multiplier dd 10 |
857 | display_type_text db 'dec hex bin' |
860 | display_type_text db 'dec hex bin' |
858 | 861 | ||
859 | dot db '.' |
862 | dot db '.' |
860 | calc db ' ' |
863 | calc db ' ' |
861 | integer dd 0 |
864 | integer dd 0 |
862 | decimal dd 0 |
865 | decimal dd 0 |
863 | kymppi dd 10 |
866 | kymppi dd 10 |
864 | 867 | ||
865 | dsign: |
868 | dsign: |
866 | muuta1 db '+0000000000.000000' |
869 | muuta1 db '+0000000000.000000' |
867 | muuta2 db '+0000000000.000000' |
870 | muuta2 db '+0000000000.000000' |
868 | muuta0 db '+0000000000.000000' |
871 | muuta0 db '+0000000000.000000' |
869 | 872 | ||
870 | text: |
873 | text: |
871 | db ' A B C D E F C ' |
874 | db ' A B C D E F C ' |
872 | db ' 1 2 3 + Int Sin Asin' |
875 | db ' 1 2 3 + Int Sin Asin' |
873 | db ' 4 5 6 - 1/x Cos Acos' |
876 | db ' 4 5 6 - 1/x Cos Acos' |
874 | db ' 7 8 9 / x^2 Tan Atan' |
877 | db ' 7 8 9 / x^2 Tan Atan' |
875 | db '+/- 0 . * Sqr Pi = ' |
878 | db '+/- 0 . * Sqr Pi = ' |
876 | db 'x' |
879 | db 'x' |
877 | 880 | ||
878 | asci: db 49,50,51,52,53,54,55,56,57,48,43,61,45,42,47,44,46,27 |
881 | asci: db 49,50,51,52,53,54,55,56,57,48,43,61,45,42,47,44,46,27 |
879 | butid: db 12,13,14,19,20,21,26,27,28,34,15,39,22,36,29,35,35,1 |
882 | butid: db 12,13,14,19,20,21,26,27,28,34,15,39,22,36,29,35,35,1 |
880 | 883 | ||
881 | I_END: |
884 | I_END: |
882 | 885 | ||
883 | sc system_colors |
886 | sc system_colors |