Код:
.8086
.model small
.586
.data
i8086mes db "i8086",13,10,'$'
i286mes db "i286",13,10,'$'
i386mes db "i386",13,10,'$'
i486mes db "i486",13,10,'$'
cpu db "CPU: ",0,0,0,0,0,0,0,0,0,0,0,0,10,13,'$'
stepping db "stepping: ",0,0,10,13,'$'
model_ db "Model: ",0,0,10,13,'$'
family db "Family: ",0,0,10,13,'$'
type00 db "Type: standart",10,13,'$'
type01 db "Type: overdrive",10,13,'$'
type10 db "Type: dual",10,13,'$'
ten db 10
.stack 100h
.code
print macro mess
mov dx,offset mess
mov ah,09h
int 21h
endm print
main proc near
;-------------------------------
mov ax,@data
mov ds,ax
;-------------------------------
pushf
pop ax
and ax,0F000h
cmp ax,0
je i286
cmp ax,0F000h
je i8086
;------i386---------------------
pushfd
pop eax
mov ec
x,eax
xor eax,00040000h
push eax
popfd
pushfd
pop eax
cmp eax,ecx
je i386
;------i486---------------------
pushfd
pop eax
mov ecx,eax
xor eax,00200000h
push eax
popfd
pushfd
pop eax
cmp eax,ecx
je i486
;======cpuid====================
mov eax,0
cpuid
mov dword ptr cpu+5,ebx
mov dword ptr cpu+9,edx
mov dword ptr cpu+13,ecx
print cpu
;-----stepping------------------
mov eax,1
cpuid
mov ecx,eax
and eax,0000000Fh
lea bx,stepping
mov di,11
call numtostr
print stepping
;-----model---------------------
mov eax,ecx
and eax,000000F0h
shr eax,4
lea bx,model_
mov di,8
call numtostr
print model_
;----family---------------------
mov eax,ecx
and eax,00000F00h
shr eax,8
lea bx,family
mov di,9
call numtostr
print family
;-------------------------------
mov eax,ecx
and eax,00003000h
shr eax,12
cmp eax,0
je type_std
cmp eax,1
je type_od
cmp eax,2
je type_dual
jmp exit
;===============================
i8086:
print i8086mes
jmp exit
i286:
print i286mes
jmp exit
i386:
print i386mes
jmp exit
i486:
print i486mes
jmp exit
type_
std:
print type00
jmp exit
type_od:
print type01
jmp exit
type_dual:
print type10
jmp exit
;-------------------------------
exit:
mov ax,4C00h
int 21h
main endp
;===============================
numtostr proc near
; eax - number
; bx - offset of string
; di - position in string
mov byte ptr [bx+di],'0'
output:
div ten
cmp ax,0
je out
add ah,30h
mov [bx+di],ah
xor ah,ah
dec di
jmp output
out:
retn
numtostr endp
;===============================
end main
///////еще один вариант(тоже выдает ошибку)//////
Код:
;----------checkCPU.asm----------------------------------
;прога, которая определяет тип процессора.
;---------------------------------------------------------
.8086
.model small
.586
.data
clrscr db 0dh,0ah,'$'
i8086mes db "It is i8086",13,10,'$'
i286mes db "It is i286",13,10,'$'
i386mes db "It is i386",13,10,'$'
i486mes db "It is i486",13,10,'$'
cpu db "CPU: ",0,0,0,0,0,0,0,0,0,0,0,0,10,13,'$'
.stack 100h
.code
print macro str
mov dx, offset str
mov ah, 09h
int 21h
endm print
;--------i8086,i286------------
pushf
pop ax
and ax,0F000h
cmp ax,0
je i286
cmp ax,0F000h
je i8086
;------i386---------------------
pushfd
pop eax
mov ecx,eax
xor eax,00040000h
push eax
popfd
pushfd
pop eax
cmp eax,ecx
je i386
;------i486---------------------
pushfd
pop eax
mov ecx,eax
xor eax,00200000h
push
eax
popfd
pushfd
pop eax
cmp eax,ecx
je i486
;======cpuid====================
mov eax,0
cpuid
mov dword ptr cpu+5,ebx
mov dword ptr cpu+9,edx
mov dword ptr cpu+13,ecx
print cpu
i8086:
print i8086mes
jmp exit
i286:
print i286mes
jmp exit
i386:
print i386mes
jmp exit
i486:
print i486mes
jmp exit
type_std:
print type00
jmp exit
type_od:
print type01
jmp exit
type_dual:
print type10
jmp exit
;-------------------------------
exit:
mov ax,4C00h
int 21h
main endp