Rev 675 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
648 | andrew_pro | 1 | |
2 | nm_redraw_all = 10000000b |
||
3 | nm_redraw_off = 01111111b |
||
4 | ;nm_special_redraw_on = 00000100b |
||
675 | andrew_pro | 5 | ;nm_special_redraw_off = 11111011b |
6 | nm_integer_type = 00000010b |
||
7 | nm_no_show_number = 00000001b |
||
8 | |||
648 | andrew_pro | 9 | |
10 | ;********************craete Number********************** |
||
11 | ;**************************************************** |
||
12 | ;IN |
||
13 | ;pointer to parend |
||
14 | ;pointer to Number's structure |
||
15 | ;OUT |
||
16 | ;pointer to initialized Number's structure |
||
17 | align 4 |
||
18 | |||
19 | |||
20 | |||
21 | |||
706 | andrew_pro | 22 | push ecx |
23 | push edx |
||
24 | push esi |
||
25 | push edi |
||
26 | push ebp |
||
27 | |||
648 | andrew_pro | 28 | |
706 | andrew_pro | 29 | mov eax,[esp+24+8] |
30 | |||
31 | |||
648 | andrew_pro | 32 | |
33 | |||
34 | call craete_control |
||
35 | |||
36 | |||
37 | mov [eax],dword number |
||
38 | |||
39 | |||
40 | mov esi,[PointerToStructureForNumber] |
||
41 | mov edi,eax |
||
42 | add edi,control_header_size |
||
43 | rep movsb |
||
44 | |||
45 | |||
46 | |||
47 | |||
48 | mov ecx,[ebx+6] ;x |
||
49 | mov edx,[ebx+10] ;y |
||
50 | add ecx,border_width |
||
51 | add edx,[skin_height] |
||
52 | ;copy information to control |
||
53 | mov [eax+24],ecx |
||
54 | mov [eax+28],edx |
||
55 | |||
56 | |||
706 | andrew_pro | 57 | pop edi |
58 | pop esi |
||
59 | pop edx |
||
60 | pop ecx |
||
61 | pop ebx |
||
62 | |||
63 | |||
648 | andrew_pro | 64 | |
65 | |||
66 | ;********************Draw Number********************* |
||
67 | ;**************************************************** |
||
68 | ;IN |
||
69 | ;pointer to control of number |
||
70 | ;message |
||
71 | ;OUT |
||
72 | ;not returned value |
||
73 | align 4 |
||
74 | |||
75 | |||
76 | |||
77 | |||
78 | mov eax,[esp+8] |
||
79 | |||
80 | |||
81 | mov esi,[esp+4] |
||
82 | mov [PointerForNumber],esi |
||
83 | ;copy control to local control |
||
84 | add esi,control_header_size |
||
85 | mov edi,dword Number |
||
86 | mov ecx,nm_control_data_size |
||
87 | rep movsb |
||
88 | |||
89 | |||
90 | |||
91 | jne no_redraw_all_number |
||
92 | |||
93 | |||
94 | mov bl,[Number.type] |
||
95 | and bl,nm_no_show_number |
||
96 | test bl,bl |
||
97 | jnz no_redraw_all_number |
||
98 | |||
99 | |||
100 | |||
101 | |||
102 | |||
103 | |||
104 | jne no_special_message_for_number |
||
105 | |||
106 | |||
107 | mov bl,[Number.type] |
||
108 | and bl,activate_trap |
||
675 | andrew_pro | 109 | test bl,bl |
648 | andrew_pro | 110 | jz no_special_message_for_number |
111 | |||
112 | |||
113 | and [Number.type],deactivate_trap |
||
675 | andrew_pro | 114 | |
648 | andrew_pro | 115 | |
116 | |||
117 | |||
118 | jne no_destroy_control_of_number |
||
119 | |||
120 | |||
121 | no_destroy_control_of_number: |
||
122 | |||
123 | |||
124 | mov eax,[PointerForNumber] |
||
125 | mov ebx,[eax+24] ;x |
||
126 | mov ecx,[eax+28] ;y |
||
127 | ;set current coordinats and sizes in zakladka |
||
128 | mov [Number.x],ebx |
||
129 | mov [Number.y],ecx |
||
130 | |||
131 | |||
132 | mov al,[Number.type] |
||
133 | and al,nm_redraw_all |
||
134 | test al,al |
||
135 | jz no_redraw_number_ |
||
136 | |||
137 | |||
138 | |||
139 | |||
140 | mov edi,[PointerForNumber] |
||
141 | add edi,control_header_size |
||
142 | mov ecx,2 |
||
143 | rep movsb |
||
144 | |||
145 | |||
146 | mov eax,48 |
||
147 | mov ebx,3 |
||
148 | mov ecx,dword pointer2 |
||
149 | mov edx,40 |
||
150 | mcall |
||
151 | |||
152 | |||
153 | mov al,[Number.type] |
||
154 | and al,nm_integer_type |
||
155 | test al,al |
||
156 | jnz no_integer_number |
||
157 | |||
158 | |||
159 | mov ebx,[Number.parameters] |
||
160 | mov ecx,[Number.number] |
||
161 | mov edx,[Number.x] |
||
162 | shl edx,16 |
||
163 | add edx,[Number.y] |
||
164 | mov esi,[Number.color] |
||
165 | mov edi,[pointer2+8] |
||
166 | mcall |
||
167 | |||
168 | |||
169 | no_integer_number: |
||
170 | ;--------------------------------------- |
||
171 | |||
172 | |||
173 | mov ecx,ebx |
||
174 | shr ebx,16 ;format for integer |
||
175 | and ecx,0xffff ;format for float |
||
176 | |||
177 | |||
178 | mov eax,1 |
||
179 | mov edi,ecx |
||
180 | pow_10__: |
||
181 | |||
182 | |||
183 | lea eax,[eax+eax*4] |
||
184 | shl eax,1 |
||
185 | |||
186 | |||
187 | jnz pow_10__ |
||
188 | mov edx,eax |
||
189 | |||
190 | |||
191 | mov [v2],0 |
||
192 | fld [Number.number] |
||
193 | fcom [v2] |
||
194 | fstsw ax |
||
195 | sahf |
||
196 | jae no_signum_float_number |
||
197 | |||
198 | |||
199 | mov [signum_float_number],byte 1 |
||
200 | |||
201 | |||
202 | fstp [Number.number] |
||
203 | |||
204 | |||
205 | fild [v2] |
||
206 | fld [Number.number] |
||
207 | fmul st0,st1 |
||
208 | fistp [v] |
||
209 | fstp st0 |
||
210 | |||
211 | |||
212 | mov eax,[v] |
||
213 | cdq |
||
214 | idiv esi |
||
215 | mov [v],eax |
||
216 | |||
217 | |||
218 | and [tochnost1],0 |
||
219 | |||
220 | |||
221 | mov eax,[v] |
||
222 | mov [v2],eax |
||
223 | |||
224 | |||
225 | mov esi,ebx |
||
226 | get_next_razryd_of_number_integer: |
||
227 | |||
228 | |||
229 | |||
230 | |||
231 | pow_10_integer: |
||
232 | |||
233 | |||
234 | lea eax,[eax+eax*4] |
||
235 | shl eax,1 |
||
236 | |||
237 | |||
238 | jnz pow_10_integer |
||
239 | |||
240 | |||
241 | mov eax,[v] |
||
242 | cdq |
||
243 | idiv edi |
||
244 | and eax,0xf |
||
245 | |||
246 | |||
247 | jz no_save_pos_for_integer |
||
248 | |||
249 | |||
250 | jne no_save_pos_for_integer |
||
251 | |||
252 | |||
253 | mov [tochnost1],esi |
||
254 | add [tochnost1],1 |
||
255 | |||
256 | |||
257 | |||
258 | |||
259 | sub [v],eax |
||
260 | add [integer_part],eax |
||
261 | |||
262 | |||
263 | jnz get_next_razryd_of_number_integer |
||
264 | mov eax,[v] |
||
265 | add [integer_part],eax |
||
266 | |||
267 | |||
268 | jnz all_ok_with_tochnost |
||
269 | |||
270 | |||
271 | all_ok_with_tochnost: |
||
272 | |||
273 | |||
274 | mov eax,[v2] |
||
275 | mov [v],eax |
||
276 | |||
277 | |||
278 | mov edi,ecx |
||
279 | pow_10_float__: |
||
280 | |||
281 | |||
282 | lea eax,[eax+eax*4] |
||
283 | shl eax,1 |
||
284 | |||
285 | |||
286 | jnz pow_10_float__ |
||
287 | |||
288 | |||
289 | |||
290 | |||
291 | fild [v] |
||
292 | fld [Number.number] |
||
293 | fsub st0,st1 |
||
294 | fmul st0,st2 |
||
295 | fistp [v] |
||
296 | fstp st0 |
||
297 | fstp st0 |
||
298 | |||
299 | |||
300 | |||
301 | |||
302 | get_next_razryd_of_number_float: |
||
303 | |||
304 | |||
305 | |||
306 | |||
307 | pow_10_float: |
||
308 | |||
309 | |||
310 | lea eax,[eax+eax*4] |
||
311 | shl eax,1 |
||
312 | |||
313 | |||
314 | jnz pow_10_float |
||
315 | |||
316 | |||
317 | mov eax,[v] |
||
318 | cdq |
||
319 | idiv edi |
||
320 | and eax,0xf |
||
321 | imul eax,edi |
||
322 | sub [v],eax |
||
323 | add [float_part],eax |
||
324 | |||
325 | |||
326 | jnz get_next_razryd_of_number_float |
||
327 | mov eax,[v] |
||
328 | add [float_part],eax |
||
329 | |||
330 | |||
331 | cmp [signum_float_number],byte 1 |
||
332 | jne no_draw_signum_for_float_number |
||
333 | |||
334 | |||
335 | mov eax,4 |
||
336 | mov ebx,[Number.x] |
||
337 | mov ecx,[Number.color] |
||
338 | mov edx,dword signum |
||
339 | mov esi,1 |
||
340 | mov edi,[pointer2+8] |
||
341 | shl ebx,16 |
||
342 | add ebx,[Number.y] |
||
343 | mcall |
||
344 | |||
345 | |||
346 | mov [signum_float_number],0 |
||
347 | no_draw_signum_for_float_number: |
||
348 | |||
349 | |||
350 | mov eax,47 |
||
351 | mov ebx,[tochnost1] |
||
352 | mov ecx,[integer_part] |
||
353 | mov edx,[Number.x] |
||
354 | mov esi,[Number.color] |
||
355 | mov edi,[pointer2+8] |
||
356 | shl edx,16 |
||
357 | shl ebx,16 |
||
358 | add edx,[Number.y] |
||
359 | mcall |
||
360 | |||
361 | |||
362 | add edx,1 |
||
363 | lea edx,[edx+edx*2] |
||
364 | shl edx,1 ;edx=edx*6 |
||
365 | add edx,[Number.x] |
||
366 | mov [x],edx |
||
367 | |||
368 | |||
369 | mov eax,47 |
||
370 | mov ebx,[tochnost2] |
||
371 | mov ecx,[float_part] |
||
372 | mov esi,[Number.color] |
||
373 | mov edi,[pointer2+8] |
||
374 | shl edx,16 |
||
375 | shl ebx,16 |
||
376 | add edx,[Number.y] |
||
377 | mcall |
||
378 | |||
379 | |||
380 | mov eax,4 |
||
381 | mov ebx,[x] |
||
382 | mov ecx,[Number.color] |
||
383 | mov edx,dword point |
||
384 | mov esi,1 |
||
385 | mov edi,[pointer2+8] |
||
386 | sub ebx,6 |
||
387 | shl ebx,16 |
||
388 | add ebx,[Number.y] |
||
389 | mcall |
||
390 | |||
391 | |||
392 | ;----------------------------------------- |
||
393 | |||
394 | |||
395 | |||
396 | |||
397 |