32 bit
Posted: Sat Jan 20, 2007 7:47 am
heres just a quick question. If i want to use the 32 bit registers do i have to be in protected mode?
or register an invalid opcode handler (which then errs out) or just expect a crash.bubach wrote:No, but you better check so that it's a 386 or higher first.
Code: Select all
MOV AX, 0xF000 ; set all the high bits to 1
PUSHF ; save state of flags register before modifying
PUSH AX
POPF ; move AX into FLAGS
PUSHF
POP AX ; move it back -- anything in flags forced to a specific value is changed
POPF ; restore previous flags
AND AH,0xF0 ; mask out the bottom part, and move it into flags for checking
JS no386 ; the sign bit is only set on 8086/8
JZ no386 ; bits 12:15 0 on start, and cannot be changed in RMode on 286,
; but can on 386
:386code ; if you get here you have a 386