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