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