Rev 799 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
576 | serge | 1 | format MS COFF |
2 | |||
3 | include "proc32.inc" |
||
4 | |||
701 | serge | 5 | section '.text' align 16 code readable executable |
576 | serge | 6 | |
7 | public _InitHeap@4 |
||
8 | public _UserAlloc@4 |
||
701 | serge | 9 | public _UserFree@4 |
10 | |||
11 | public _GetNotify@4 |
||
576 | serge | 12 | public _CreateThread@8 |
13 | public _GetMousePos@4 |
||
701 | serge | 14 | |
576 | serge | 15 | public _get_fileinfo@8 |
701 | serge | 16 | public _create_file@4 |
576 | serge | 17 | public _read_file@20 |
701 | serge | 18 | public _write_file@20 |
19 | |||
576 | serge | 20 | public _get_key@4 |
701 | serge | 21 | public _remap_key@4 |
576 | serge | 22 | public _get_button_id |
701 | serge | 23 | |
24 | public _GetScreenSize@8 |
||
25 | |||
576 | serge | 26 | public _DrawWindow@36 |
27 | public _make_button@24 |
||
28 | public _draw_bar@20 |
||
701 | serge | 29 | |
576 | serge | 30 | public _write_text@20 |
31 | public _debug_out@4 |
||
32 | public _debug_out_hex@4 |
||
33 | public _create_thread@12 |
||
34 | |||
35 | |||
799 | serge | 36 | public _memset |
701 | serge | 37 | |
576 | serge | 38 | struc FILEIO |
39 | { .cmd dd ? |
||
40 | .offset dd ? |
||
41 | dd ? |
||
42 | .count dd ? |
||
43 | .buff dd ? |
||
44 | db ? |
||
45 | .name dd ? |
||
46 | }; |
||
47 | |||
701 | serge | 48 | struc CTRL_INFO |
49 | { .pci_cmd dd ? |
||
50 | .irq dd ? |
||
51 | .glob_cntrl dd ? |
||
52 | .glob_sta dd ? |
||
53 | .codec_io_base dd ? |
||
54 | .ctrl_io_base dd ? |
||
55 | .codec_mem_base dd ? |
||
56 | .ctrl_mem_base dd ? |
||
57 | .codec_id dd ? |
||
58 | } |
||
59 | CTRL_INFO_SIZE equ 9*4 |
||
60 | |||
576 | serge | 61 | align 4 |
701 | serge | 62 | _GetScreenSize@8: |
63 | .x equ esp+12 |
||
64 | .y equ esp+16 |
||
65 | |||
66 | push ebx |
||
67 | push ecx |
||
68 | mov eax, 14 |
||
69 | int 0x40 |
||
70 | mov ebx, [.y] |
||
71 | movzx ecx, ax |
||
72 | inc ecx |
||
73 | mov [ebx], ecx |
||
74 | mov ebx, [.x] |
||
75 | shr eax, 16 |
||
76 | inc eax |
||
77 | mov [ebx], eax |
||
78 | pop ecx |
||
79 | pop ebx |
||
80 | ret 8 |
||
81 | |||
82 | align 4 |
||
576 | serge | 83 | _create_thread@12: |
799 | serge | 84 | .thr_proc equ esp+8 |
85 | .param equ esp+12 |
||
86 | .stack_size equ esp+16 |
||
576 | serge | 87 | |
799 | serge | 88 | push ebx |
89 | |||
576 | serge | 90 | mov eax, 68 |
91 | mov ebx, 12 |
||
92 | mov ecx, [.stack_size] |
||
93 | add ecx, 4095 |
||
94 | and ecx, -4096 |
||
95 | int 0x40 |
||
96 | test eax, eax |
||
97 | jz .fail |
||
98 | |||
99 | lea edx, [eax+ecx-12] |
||
100 | mov [edx], dword .exit_point |
||
101 | mov ebx, [.param] |
||
102 | mov [edx+4], ebx |
||
103 | mov [edx+8], ecx |
||
104 | |||
105 | mov eax, 51 |
||
106 | mov ebx, 1 |
||
107 | mov ecx, [.thr_proc] |
||
108 | int 0x40 |
||
799 | serge | 109 | pop ebx |
576 | serge | 110 | ret 12 |
111 | .fail: |
||
112 | not eax |
||
799 | serge | 113 | pop ebx |
576 | serge | 114 | ret 12 |
115 | align 4 |
||
116 | .exit_point: |
||
117 | pop ecx |
||
118 | mov eax, 68 |
||
119 | mov ebx, 13 |
||
120 | int 0x40 |
||
121 | mov eax, -1 |
||
122 | int 0x40 |
||
123 | |||
124 | restore .thr_proc |
||
125 | restore .param |
||
126 | restore .stack_size |
||
127 | |||
128 | align 4 |
||
129 | proc _get_button_id |
||
130 | mov eax,17 |
||
131 | int 0x40 |
||
132 | test al,al |
||
133 | jnz @F |
||
134 | shr eax,8 |
||
135 | ret |
||
136 | @@: |
||
137 | xor eax,eax |
||
138 | dec eax |
||
139 | ret |
||
140 | endp |
||
141 | |||
142 | align 4 |
||
143 | proc _get_fileinfo@8 stdcall, name:dword, info:dword |
||
144 | push ebx |
||
701 | serge | 145 | push ecx |
576 | serge | 146 | push esi |
147 | push edi |
||
148 | xor eax, eax |
||
149 | mov ebx, [name] |
||
150 | mov ecx, [info] |
||
151 | |||
152 | mov [fileio.cmd], 5 |
||
153 | mov [fileio.offset], eax |
||
154 | mov [fileio.offset+4], eax |
||
155 | mov [fileio.count], eax |
||
156 | mov [fileio.buff], ecx |
||
157 | mov byte [fileio.buff+4], al |
||
158 | mov [fileio.name], ebx |
||
159 | |||
160 | mov eax, 70 |
||
161 | lea ebx, [fileio] |
||
162 | int 0x40 |
||
163 | pop edi |
||
164 | pop esi |
||
701 | serge | 165 | pop ecx |
576 | serge | 166 | pop ebx |
167 | ret |
||
168 | endp |
||
169 | |||
170 | align 4 |
||
701 | serge | 171 | proc _create_file@4 stdcall, name:dword |
172 | push ebx |
||
173 | xor eax, eax |
||
174 | mov ebx, [name] |
||
175 | |||
176 | mov [fileio.cmd], 2 |
||
177 | mov [fileio.offset], eax |
||
178 | mov [fileio.offset+4], eax |
||
179 | mov [fileio.count], eax |
||
180 | mov [fileio.buff], eax |
||
181 | mov byte [fileio.buff+4], al |
||
182 | mov [fileio.name], ebx |
||
183 | |||
184 | mov eax, 70 |
||
185 | lea ebx, [fileio] |
||
186 | int 0x40 |
||
187 | pop ebx |
||
188 | ret |
||
189 | endp |
||
190 | |||
191 | align 4 |
||
576 | serge | 192 | proc _read_file@20 stdcall,name:dword, buff:dword, offset:dword,\ |
193 | count:dword,reads:dword |
||
194 | push ebx |
||
195 | push esi |
||
196 | push edi |
||
701 | serge | 197 | push edx |
576 | serge | 198 | xor eax, eax |
199 | mov ebx, [name] |
||
200 | mov edx, [offset] |
||
201 | mov esi, [buff] |
||
202 | mov edi, [count] |
||
203 | |||
204 | mov [fileio.cmd], eax |
||
205 | mov [fileio.offset], edx |
||
206 | mov [fileio.offset+4], eax |
||
207 | mov [fileio.count], edi |
||
208 | mov [fileio.buff], esi |
||
209 | mov byte [fileio.buff+4], al |
||
210 | mov [fileio.name], ebx |
||
211 | |||
212 | mov eax, 70 |
||
213 | lea ebx, [fileio] |
||
214 | int 0x40 |
||
215 | mov esi, [reads] |
||
216 | test esi, esi |
||
217 | jz @f |
||
218 | mov [esi], ebx |
||
219 | @@: |
||
701 | serge | 220 | pop edx |
576 | serge | 221 | pop edi |
222 | pop esi |
||
223 | pop ebx |
||
224 | ret |
||
225 | endp |
||
226 | |||
701 | serge | 227 | |
576 | serge | 228 | align 4 |
701 | serge | 229 | proc _write_file@20 stdcall,name:dword, buff:dword, offset:dword,\ |
230 | count:dword,writes:dword |
||
231 | push ebx |
||
232 | push esi |
||
233 | push edi |
||
234 | push edx |
||
235 | xor eax, eax |
||
236 | mov ebx, [name] |
||
237 | mov edx, [offset] |
||
238 | mov esi, [buff] |
||
239 | mov edi, [count] |
||
240 | |||
241 | mov [fileio.cmd], 3 |
||
242 | mov [fileio.offset], edx |
||
243 | mov [fileio.offset+4], eax |
||
244 | mov [fileio.count], edi |
||
245 | mov [fileio.buff], esi |
||
246 | mov byte [fileio.buff+4], al |
||
247 | mov [fileio.name], ebx |
||
248 | |||
249 | mov eax, 70 |
||
250 | lea ebx, [fileio] |
||
251 | int 0x40 |
||
252 | mov esi, [writes] |
||
253 | test esi, esi |
||
254 | jz @f |
||
255 | mov [esi], ebx |
||
256 | @@: |
||
257 | pop edx |
||
258 | pop edi |
||
259 | pop esi |
||
260 | pop ebx |
||
261 | ret |
||
262 | endp |
||
263 | |||
264 | align 4 |
||
576 | serge | 265 | proc _get_key@4 stdcall, key:dword |
266 | push ebx |
||
267 | push ecx |
||
268 | mov eax, 2 |
||
269 | int 0x40 |
||
270 | mov ebx, [key] |
||
271 | mov ecx, eax |
||
272 | shr ecx, 8 |
||
273 | mov [ebx], ecx |
||
274 | movzx eax, al |
||
275 | pop ecx |
||
276 | pop ebx |
||
277 | ret |
||
278 | endp |
||
279 | |||
280 | align 4 |
||
281 | proc _InitHeap@4 stdcall, heap_size:dword |
||
701 | serge | 282 | push ebx |
283 | push ecx |
||
284 | mov eax, 68 |
||
285 | mov ebx, 11 |
||
286 | mov ecx, [heap_size] |
||
287 | int 0x40 |
||
288 | pop ecx |
||
289 | pop ebx |
||
290 | ret |
||
576 | serge | 291 | endp |
292 | |||
293 | align 4 |
||
294 | proc _UserAlloc@4 stdcall, alloc_size:dword |
||
701 | serge | 295 | push ebx |
296 | push ecx |
||
297 | mov eax, 68 |
||
298 | mov ebx, 12 |
||
299 | mov ecx, [alloc_size] |
||
300 | int 0x40 |
||
301 | pop ecx |
||
302 | pop ebx |
||
303 | ret |
||
576 | serge | 304 | endp |
305 | |||
306 | align 4 |
||
701 | serge | 307 | proc _UserFree@4 stdcall, pmem:dword |
308 | push ebx |
||
309 | push ecx |
||
310 | mov eax, 68 |
||
311 | mov ebx, 13 |
||
312 | mov ecx, [pmem] |
||
313 | int 0x40 |
||
314 | pop ecx |
||
315 | pop ebx |
||
316 | ret |
||
317 | endp |
||
318 | |||
319 | align 4 |
||
320 | proc _GetNotify@4 stdcall, p_ev:dword |
||
321 | push ebx |
||
322 | push ecx |
||
323 | mov eax, 68 |
||
324 | mov ebx, 14 |
||
325 | mov ecx, [p_ev] |
||
326 | int 0x40 |
||
327 | pop ecx |
||
328 | pop ebx |
||
329 | ret |
||
330 | endp |
||
331 | |||
332 | align 4 |
||
576 | serge | 333 | proc _CreateThread@8 stdcall, fn:dword, p_stack:dword |
334 | push ebx |
||
701 | serge | 335 | push ecx |
336 | push edx |
||
576 | serge | 337 | mov eax, 51 |
338 | mov ebx, 1 |
||
339 | mov ecx, [fn] |
||
340 | mov edx,[p_stack] |
||
701 | serge | 341 | int 0x40 |
342 | pop edx |
||
343 | pop ecx |
||
344 | pop ebx |
||
345 | ret |
||
576 | serge | 346 | endp |
347 | |||
348 | align 4 |
||
349 | proc _GetMousePos@4 stdcall,rel_type:dword |
||
350 | push ebx |
||
351 | mov eax, 37 |
||
352 | mov ebx, [rel_type] |
||
353 | int 0x40 |
||
354 | pop ebx |
||
355 | ret |
||
356 | endp |
||
357 | |||
358 | align 4 |
||
359 | proc _DrawWindow@36 stdcall, x:dword, y:dword, sx:dword, sy:dword,\ |
||
360 | workcolor:dword, style:dword, captioncolor:dword,\ |
||
361 | windowtype:dword, bordercolor:dword |
||
701 | serge | 362 | push ebx |
363 | push ecx |
||
364 | push edx |
||
365 | push edi |
||
366 | push esi |
||
367 | |||
576 | serge | 368 | mov ebx, [x] |
369 | mov ecx, [y] |
||
370 | shl ebx, 16 |
||
371 | shl ecx, 16 |
||
372 | mov bx, word [sx] |
||
373 | mov cx, word [sy] |
||
374 | mov edx,[style] |
||
375 | shl edx,24 |
||
376 | add edx,[workcolor] |
||
377 | mov esi,[windowtype] |
||
378 | shl esi,24 |
||
379 | add esi,[captioncolor] |
||
380 | mov edi,[bordercolor] |
||
381 | xor eax,eax |
||
382 | int 0x40 |
||
701 | serge | 383 | pop esi |
384 | pop edi |
||
385 | pop edx |
||
386 | pop ecx |
||
387 | pop ebx |
||
576 | serge | 388 | ret |
389 | endp |
||
390 | |||
391 | align 4 |
||
801 | serge | 392 | proc _make_button@24 stdcall,x:dword, y:dword, \ |
393 | xsize:dword, ysize:dword, \ |
||
394 | id:dword, color:dword |
||
576 | serge | 395 | |
801 | serge | 396 | push ebx |
397 | push esi |
||
398 | |||
399 | mov ebx,[x] |
||
400 | mov ecx,[y] |
||
401 | shl ebx,16 |
||
402 | shl ecx,16 |
||
403 | mov bx, word [xsize] |
||
404 | mov cx, word [ysize] |
||
576 | serge | 405 | |
801 | serge | 406 | mov edx,[id] |
407 | mov esi,[color] |
||
408 | |||
409 | mov eax,8 |
||
410 | int 0x40 |
||
411 | pop esi |
||
412 | pop ebx |
||
413 | ret |
||
414 | endp |
||
415 | |||
576 | serge | 416 | align 4 |
417 | _draw_bar@20: |
||
418 | ;arg1 - x |
||
419 | ;arg2 - y |
||
420 | ;arg3 - xsize |
||
421 | ;arg4 - ysize |
||
422 | ;arg5 - color |
||
701 | serge | 423 | push ebx ecx |
576 | serge | 424 | mov eax,13 |
799 | serge | 425 | mov ebx,[esp+12] |
576 | serge | 426 | shl ebx,16 |
799 | serge | 427 | mov bx,[esp+20] |
428 | mov ecx,[esp+16] |
||
576 | serge | 429 | shl ecx,16 |
799 | serge | 430 | mov cx,[esp+24] |
431 | mov edx,[esp+28] |
||
576 | serge | 432 | int 0x40 |
701 | serge | 433 | pop ecx ebx |
576 | serge | 434 | ret 20 |
435 | |||
436 | _write_text@20: |
||
437 | ;arg1 - x |
||
438 | ;arg2 - y |
||
439 | ;arg3 - color |
||
440 | ;arg4 - text |
||
441 | ;arg5 - len |
||
701 | serge | 442 | push ebx ecx esi |
576 | serge | 443 | mov eax,4 |
799 | serge | 444 | mov ebx,[esp+16] |
576 | serge | 445 | shl ebx,16 |
799 | serge | 446 | mov bx,[esp+20] |
447 | mov ecx,[esp+24] |
||
448 | mov edx,[esp+28] |
||
449 | mov esi,[esp+32] |
||
576 | serge | 450 | int 0x40 |
701 | serge | 451 | pop esi ecx ebx |
576 | serge | 452 | ret 20 |
453 | |||
454 | align 4 |
||
455 | proc _debug_out@4 stdcall, val:dword |
||
456 | push ebx |
||
701 | serge | 457 | push ecx |
576 | serge | 458 | mov ecx,[val] |
459 | mov ebx,1 |
||
460 | mov eax,63 |
||
461 | int 0x40 |
||
701 | serge | 462 | pop ecx |
576 | serge | 463 | pop ebx |
464 | ret |
||
465 | endp |
||
466 | |||
467 | align 4 |
||
468 | proc _debug_out_hex@4 stdcall val:dword |
||
469 | locals |
||
470 | count dd ? |
||
471 | endl |
||
472 | |||
473 | mov [count], 8 |
||
474 | .new_char: |
||
475 | rol [val], 4 |
||
476 | mov ecx, [val] |
||
477 | and ecx, 0x0f |
||
478 | mov cl,byte [__hexdigits+ecx] |
||
479 | mov eax, 63 |
||
480 | mov ebx, 1 |
||
481 | int 0x40 |
||
482 | dec [count] |
||
483 | jnz .new_char |
||
484 | ret |
||
485 | endp |
||
486 | |||
487 | align 4 |
||
701 | serge | 488 | proc _remap_key@4 stdcall, key:dword |
489 | |||
490 | mov eax, [key] |
||
491 | and eax, 0x7F |
||
492 | movzx eax, byte [keymap+eax] |
||
493 | ret |
||
494 | endp |
||
495 | |||
496 | align 4 |
||
576 | serge | 497 | _memset: |
498 | mov edx,[esp + 0ch] |
||
499 | mov ecx,[esp + 4] |
||
500 | |||
501 | test edx,edx |
||
502 | jz short toend |
||
503 | |||
504 | xor eax,eax |
||
505 | mov al,[esp + 8] |
||
506 | |||
507 | push edi |
||
508 | mov edi,ecx |
||
509 | |||
510 | cmp edx,4 |
||
511 | jb tail |
||
512 | |||
513 | neg ecx |
||
514 | and ecx,3 |
||
515 | jz short dwords |
||
516 | |||
517 | sub edx,ecx |
||
518 | adjust_loop: |
||
519 | mov [edi],al |
||
520 | add edi,1 |
||
521 | sub ecx,1 |
||
522 | jnz adjust_loop |
||
523 | |||
524 | dwords: |
||
525 | mov ecx,eax |
||
526 | shl eax,8 |
||
527 | add eax,ecx |
||
528 | mov ecx,eax |
||
529 | shl eax,10h |
||
530 | add eax,ecx |
||
531 | |||
532 | mov ecx,edx |
||
533 | and edx,3 |
||
534 | shr ecx,2 |
||
535 | jz tail |
||
536 | |||
537 | cld |
||
538 | rep stosd |
||
539 | main_loop_tail: |
||
540 | test edx,edx |
||
541 | jz finish |
||
542 | |||
543 | |||
544 | tail: |
||
545 | mov [edi],al |
||
546 | add edi,1 |
||
547 | |||
548 | sub edx,1 |
||
549 | jnz tail |
||
550 | |||
551 | finish: |
||
552 | mov eax,[esp + 8] |
||
553 | pop edi |
||
554 | |||
555 | ret |
||
556 | |||
557 | toend: |
||
558 | mov eax,[esp + 4] |
||
559 | |||
560 | ret |
||
561 | |||
701 | serge | 562 | ;public __allmul |
576 | serge | 563 | |
701 | serge | 564 | __allmul: |
565 | mov eax, [esp+8] |
||
566 | mov ecx, [esp+16] |
||
567 | or ecx,eax |
||
568 | mov ecx, [esp+12] |
||
569 | jnz .hard |
||
570 | mov eax, [esp+4] |
||
571 | mul ecx |
||
572 | ret 16 |
||
573 | .hard: |
||
574 | push ebx |
||
575 | mul ecx |
||
576 | mov ebx,eax |
||
577 | mov eax, [esp+8] |
||
578 | mul dword [esp+20] |
||
579 | add ebx,eax |
||
580 | mov eax,[esp+8] |
||
581 | mul ecx |
||
582 | add edx,ebx |
||
583 | pop ebx |
||
584 | ret 16 |
||
576 | serge | 585 | |
701 | serge | 586 | ;public __allshr |
587 | |||
576 | serge | 588 | align 4 |
701 | serge | 589 | __allshr: |
590 | cmp cl,64 |
||
591 | jae .sign |
||
576 | serge | 592 | |
701 | serge | 593 | cmp cl, 32 |
594 | jae .MORE32 |
||
595 | shrd eax,edx,cl |
||
596 | sar edx,cl |
||
597 | ret |
||
598 | .MORE32: |
||
599 | mov eax,edx |
||
600 | sar edx,31 |
||
601 | and cl,31 |
||
602 | sar eax,cl |
||
603 | ret |
||
604 | .sign: |
||
605 | sar edx,31 |
||
606 | mov eax,edx |
||
607 | ret |
||
608 | |||
609 | |||
610 | ;public _scalbn |
||
611 | |||
576 | serge | 612 | align 4 |
701 | serge | 613 | proc _scalbn |
614 | fild dword [esp+12] |
||
615 | fld qword [esp+4] |
||
616 | fscale |
||
617 | fstp st1 |
||
618 | ret |
||
619 | endp |
||
576 | serge | 620 | |
621 | |||
701 | serge | 622 | ;public __alloca_probe_8 |
623 | ;public __alloca_probe_16 |
||
576 | serge | 624 | |
701 | serge | 625 | __alloca_probe_16: ; 16 byte aligned alloca |
576 | serge | 626 | |
701 | serge | 627 | push ecx |
628 | lea ecx, [esp + 8] ; TOS before entering this function |
||
629 | sub ecx, eax ; New TOS |
||
630 | and ecx, (16 - 1) ; Distance from 16 bit align (align down) |
||
631 | add eax, ecx ; Increase allocation size |
||
632 | sbb ecx, ecx ; ecx = 0xFFFFFFFF if size wrapped around |
||
633 | or eax, ecx ; cap allocation size on wraparound |
||
634 | pop ecx ; Restore ecx |
||
635 | jmp __chkstk |
||
636 | |||
637 | alloca_8: ; 8 byte aligned alloca |
||
638 | __alloca_probe_8: |
||
639 | |||
640 | push ecx |
||
641 | lea ecx, [esp+8] ; TOS before entering this function |
||
642 | sub ecx, eax ; New TOS |
||
643 | and ecx, (8 - 1) ; Distance from 8 bit align (align down) |
||
644 | add eax, ecx ; Increase allocation Size |
||
645 | sbb ecx, ecx ; ecx = 0xFFFFFFFF if size wrapped around |
||
646 | or eax, ecx ; cap allocation size on wraparound |
||
647 | pop ecx ; Restore ecx |
||
648 | jmp __chkstk |
||
649 | |||
650 | ;public __chkstk |
||
651 | ;public _alloca_probe |
||
652 | |||
653 | align 4 |
||
654 | ;_alloca_probe: |
||
655 | __chkstk: |
||
656 | push ecx |
||
657 | lea ecx, [esp+8-4] ; TOS before entering function + size for ret value |
||
658 | sub ecx, eax ; new TOS |
||
659 | |||
660 | ; Handle allocation size that results in wraparound. |
||
661 | ; Wraparound will result in StackOverflow exception. |
||
662 | |||
663 | sbb eax, eax ; 0 if CF==0, ~0 if CF==1 |
||
664 | not eax ; ~0 if TOS did not wrapped around, 0 otherwise |
||
665 | and ecx, eax ; set to 0 if wraparound |
||
666 | |||
667 | mov eax, esp ; current TOS |
||
668 | and eax, -4096 ; Round down to current page boundary |
||
669 | |||
670 | cs10: |
||
671 | cmp ecx, eax ; Is new TOS |
||
672 | jb short cs20 ; in probed page? |
||
673 | mov eax, ecx ; yes. |
||
674 | pop ecx |
||
675 | xchg esp, eax ; update esp |
||
676 | mov eax, [eax] ; get return address |
||
677 | mov [esp], eax ; and put it at new TOS |
||
678 | ret |
||
679 | |||
680 | ; Find next lower page and probe |
||
681 | cs20: |
||
682 | sub eax, 4096 ; decrease by PAGESIZE |
||
683 | test [eax],eax ; probe page. |
||
684 | jmp short cs10 |
||
685 | |||
686 | public __ftol2_sse |
||
687 | |||
688 | align 4 |
||
689 | __ftol2_sse: |
||
690 | push ebp |
||
691 | mov ebp, esp |
||
692 | sub esp, 20 |
||
693 | and esp, 0xFFFFFFF0 |
||
694 | fld st0 |
||
695 | fst dword [esp+18] |
||
696 | fistp qword [esp+10] |
||
697 | fild qword [esp+10] |
||
698 | mov edx, [esp+18] |
||
699 | mov eax, [esp+10] |
||
700 | test eax, eax |
||
701 | jz .QnaNZ |
||
702 | |||
703 | .not_QnaNZ: |
||
704 | fsubp st1, st0 |
||
705 | test edx, edx |
||
706 | jns .pos |
||
707 | fstp dword [esp] |
||
708 | mov ecx, [esp] |
||
709 | xor ecx, 0x80000000 |
||
710 | add ecx, 0x7FFFFFFF |
||
711 | adc eax, 0 |
||
712 | mov edx, [esp+14] |
||
713 | adc edx, 0 |
||
714 | jmp .exit |
||
715 | .pos: |
||
716 | fstp dword [esp] |
||
717 | mov ecx, [esp] |
||
718 | add ecx, 0x7FFFFFFF |
||
719 | sbb eax, 0 |
||
720 | jmp .exit |
||
721 | .QnaNZ: |
||
722 | mov edx, [esp+14] |
||
723 | test edx, 0x7FFFFFFF |
||
724 | jne .not_QnaNZ |
||
725 | fstp dword [esp+18] |
||
726 | fstp dword [esp+18] |
||
727 | .exit: |
||
728 | leave |
||
729 | ret |
||
730 | |||
731 | section '.data' align 16 data readable writable |
||
732 | |||
733 | align 16 |
||
734 | __hexdigits db '0123456789ABCDEF' |
||
735 | |||
736 | ; 0 1 2 3 4 5 6 7 |
||
737 | ; 8 9 a b c d e f |
||
738 | |||
739 | keymap: |
||
740 | db 0, 27, '1', '2', '3', '4', '5', '6' ;00 |
||
741 | db '7', '8', '9', '0', '-', '=',0x7F, 0x9 ;08 |
||
742 | db 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i' ;10 |
||
743 | db 'o', 'p', '[', ']', 13,0x9D, 'a', 's' ;18 |
||
744 | db 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';' ;20 |
||
745 | db 0, '~',0xB6, '|',0x7A,0x87, 'c', 'v' ;28 |
||
746 | db 'b', 'n', 'm', ',', '.', '/',0xB6, '*' ;30 |
||
747 | db 0xB8, ' ', 0,0xBB,0xBC,0xBD,0xBE,0xBF ;38 |
||
748 | db 0xC0,0xC1,0xC2,0xC3,0xC4, 0, 0, 0 ;40 |
||
749 | db 0xAD, 0, 0,0xAC, 0,0xAE, 0, 0 ;48 |
||
750 | db 0xAF, 0, 0, 0, 0, 0, 0, 0 ;50 |
||
751 | db 0, 0, 0, 0, 0, 0, 0, 0 ;58 |
||
752 | db 0, 0, 0, 0, 0, 0, 0, 0 ;60 |
||
753 | db 0, 0, 0, 0, 0, 0, 0, 0 ;68 |
||
754 | db 0, 0, 0, 0, 0, 0, 0, 0 ;70 |
||
755 | db 0, 0, 0, 0, 0, 0, 0, 0 ;78 |
||
756 | |||
757 | public ___sse2_available |
||
758 | ___sse2_available dd 0 |
||
759 | |||
760 | public __fltused |
||
761 | __fltused dd 0 |
||
762 | |||
763 | align 4 |
||
764 | fileio FILEIO |