1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
push bp
mov bp, sp
; push zero onto the stack and pop it into flags.
; some bits won't change
xor ax,ax
push ax
popf
pushf
pop ax
and ax, 0xf000 ;0f000h
cmp ax, 0xf000 ;0f000h
je lessthantwoeightsix
; marked as 286 (2)
mov dl, 2
mov ax, 0x7000 ;7000h
push ax
popf
pushf
pop ax
and ax, 0x7000 ;7000h
jz alldone
; mark as 386 (3)
inc dl
jmp alldone
lessthantwoeightsix:
mov dl, 1
mov al, 0xff ;0ffh
mov cl, 0x21 ;21h
shr al, cl
; if the shift leaves zero, it's a 8088 class cpu, else 80186/88
jnz alldone
; Lets see if we have a V20/V30 (V)
mov dl, 0x56 ;056h
sti
push si
mov si, 0
mov cx, 0xffff ;0ffffh
;rep lods [BYTE PTR es:si]
rep lodsb
pop si
or cx, cx
jz alldone
; mark as a 8088/8086 (0)
mov dl, 0
alldone:
; store in ax
xor dh, dh
mov di, [bp]+6
mov [di], dx
pop bp
retf 2
|