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