home *** CD-ROM | disk | FTP | other *** search
-
- ;*----------------------------------------------------------------
- ;* from larry caldwell
- ;*----------------------------------------------------------------
- ; This is the code for CPU autodetection.
- ; I picked it off of the Power
- ; Programming conference on PC-MAGNET.
- ; The guy who posted it didn't write it,
- ; and didn't know where it came from.
- ; Probably INTEL, because it doesn't deal with NEC processors.
-
- CLI ; runs in real mode only!
- PUSHF ; save machine flags
- MOV AX,0 ; set all flag bits to zero
- PUSH AX
- POPF
- PUSHF ; retrieve flag bits
- POP AX
- TEST AH,080H
- JNZ xxxx ; bit set if CPU 8088
- ;
- ; determine if CPU 286 or 386
- MOV AX,07000H ; set bits 14, 13, 12 - nested task/iopl bits
- PUSH AX ; put bits into flag register
- POPF ; via stack
- PUSHF ; get bits back
- POP AX
- TEST AX,07000H ; are any bits still set?
- JZ yyyy ; no bits set CPU 80286
- JNZ zzzz ; bits set CPU 80386
- xxxx:
- yyyy:
- zzzz:
- POPF
- STI
-
-