This is the code I used back in the day,
const
cpu8086 = 1;
cpu80286 = 2;
cpu80386 = 3;
cpu80486 = 4;
function WhatCPU : Byte; Assembler;
asm
mov DX, Cpu8086
push SP
pop AX
cmp SP, AX
jne @OUT
mov DX, Cpu80286
pushf
pop AX
or AX, 4000h
push AX
popf
pushf
pop AX
test AX, 4000h
je @OUT
mov DX, Cpu80386 {"DB 66h" converts instructions to '386}
db 66h; mov BX, SP {mov EBX, ESP}
db 66h, 83h, 0e4h, 0fch {and ESP, FFFC}
db 66h; pushf
db 66h; pop AX
db 66h; mov CX, AX
db 66h, 35h, 00h
db 00h, 04h, 00h {xor EAX, 00040000}
db 66h; push AX
db 66h; popf
db 66h; pushf
db 66h; pop AX
db 66h, 25h, 00h
db 00h, 04h, 00h {and EAX, 00040000}
db 66h, 81h, 0e1h, 00h
db 00h, 04h, 00h {and ECX, 00040000}
db 66h; cmp AX, CX
je @Not486
mov DX, Cpu80486
@Not486:
db 66h; push CX
db 66h; popf
db 66h; mov SP, BX
@OUT:
mov AX, DX
end;{function WhatCpu}
So yet another option there.
Cheers!