9 ;============================================================================
\r
15 ;============================================================================
\r
19 ; Hacked up Juan Jimenez's code a bit to just return 386/not 386
\r
23 pushf ; Save flag registers, we use them here
\r
24 xor ax,ax ; Clear AX and...
\r
25 push ax ; ...push it onto the stack
\r
26 popf ; Pop 0 into flag registers (all bits to 0),
\r
27 pushf ; attempting to set bits 12-15 of flags to 0's
\r
28 pop ax ; Recover the save flags
\r
29 and ax,08000h ; If bits 12-15 of flags are set to
\r
30 cmp ax,08000h ; zero then it's 8088/86 or 80188/186
\r
33 mov ax,07000h ; Try to set flag bits 12-14 to 1's
\r
34 push ax ; Push the test value onto the stack
\r
35 popf ; Pop it into the flag register
\r
36 pushf ; Push it back onto the stack
\r
37 pop ax ; Pop it into AX for check
\r
38 and ax,07000h ; if bits 12-14 are cleared then
\r
39 jz not386 ; the chip is an 80286
\r
41 mov ax,1 ; We now assume it's a 80386 or better
\r
67 mov ax,[WORD PTR @@where]
\r
68 mov [WORD FAR es:LDIV@],ax
\r
69 mov ax,[WORD PTR @@where+2]
\r
70 mov [WORD FAR es:LDIV@+2],ax
\r
72 mov ax,offset @@jabdiv
\r
81 add sp,4 ;Nuke IRET address, but leave flags
\r
83 mov bp,sp ;Save BP, and set it equal to stack
\r
88 idiv [DWORD PTR bp+12]
\r
98 popf ;Restore flags (from INT)
\r
99 retf 8 ;Return to original caller
\r