OSDN Git Service

going on vacation >.<
[proj16/16.git] / src / core / wl_asm.asm
1 ; JABHACK.ASM\r
2 \r
3 .386C\r
4 IDEAL\r
5 MODEL   MEDIUM\r
6 \r
7 EXTRN   LDIV@:far\r
8 \r
9 ;============================================================================\r
10 \r
11 DATASEG\r
12 \r
13 ;============================================================================\r
14 \r
15 CODESEG\r
16 \r
17 ;       Hacked up Juan Jimenez's code a bit to just return 386/not 386\r
18 PROC    _CheckIs386\r
19 PUBLIC  _CheckIs386\r
20 \r
21 ;hack to never look for a 386, for benchmark comparisons of same code on all CPUs\r
22 ;       pushf                   ; Save flag registers, we use them here\r
23 ;       xor     ax,ax           ; Clear AX and...\r
24 ;       push ax                 ; ...push it onto the stack\r
25 ;       popf                    ; Pop 0 into flag registers (all bits to 0),\r
26 ;       pushf                   ; attempting to set bits 12-15 of flags to 0's\r
27 ;       pop     ax                      ; Recover the save flags\r
28 ;       and     ax,08000h       ; If bits 12-15 of flags are set to\r
29 ;       cmp     ax,08000h       ; zero then it's 8088/86 or 80188/186\r
30 ;       jz      not386\r
31 ;\r
32 ;       mov     ax,07000h       ; Try to set flag bits 12-14 to 1's\r
33 ;       push ax                 ; Push the test value onto the stack\r
34 ;       popf                    ; Pop it into the flag register\r
35 ;       pushf                   ; Push it back onto the stack\r
36 ;       pop     ax                      ; Pop it into AX for check\r
37 ;       and     ax,07000h       ; if bits 12-14 are cleared then\r
38 ;       jz      not386          ; the chip is an 80286\r
39 ;\r
40 ;       mov     ax,1            ; We now assume it's a 80386 or better\r
41 ;       popf\r
42 ;       retf\r
43 ;end benchmark hack\r
44 \r
45 not386:\r
46         xor     ax,ax\r
47         popf\r
48         retf\r
49 \r
50         ENDP\r
51 \r
52 \r
53 PROC    _jabhack2\r
54 PUBLIC  _jabhack2\r
55 \r
56         push    es\r
57 \r
58         mov     ax,seg LDIV@\r
59         mov     es,ax\r
60         mov     ax,9090h                                        ;Two NOP's\r
61         mov     [WORD FAR es:LDIV@],ax          ;Patch over XOR AX,AX\r
62         mov     [WORD FAR es:LDIV@+2],ax        ;and over JMP SHORT COMMON\r
63 \r
64         pop     es\r
65         retf\r
66 \r
67         ENDP\r
68 \r
69         END\r