home *** CD-ROM | disk | FTP | other *** search
/ 100 af Verdens Bedste Spil / 100Spil.iso / dos / wolf3d / source / wolfsrc.1 / WL_ASM.ASM < prev    next >
Assembly Source File  |  1993-02-04  |  1KB  |  68 lines

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