flat assembler
Message board for the users of flat assembler.

Index > Windows > CPUID problems

Author
Thread Post new topic Reply to topic
DX_



Joined: 10 Apr 2004
Posts: 1
DX_
Hey.. I'm just now getting into ASM.. I'm trying to figure out what's wrong with this code...

Code:
include '%fasminc%\win32a.inc'
include '%fasminc%\win32ax.inc'

pushfd
pop eax
mov ebx, eax
xor eax, 00200000h
push eax
popfd
pushfd
pop eax
cmp eax, ebx
jz nocpuid

mov eax, 1
cpuid
test ebx, 68747541h
jnz amd
jmp intel

amd:
invoke  MessageBox,HWND_DESKTOP,"You have an AMD processor!","AMD!",MB_OK
invoke  ExitProcess,0
.end amd

intel:
invoke  MessageBox,HWND_DESKTOP,"You have an AMD processor!","Intel!",MB_OK
invoke  ExitProcess,0
.end intel

nocpuid:
invoke  MessageBox,HWND_DESKTOP,"Your processor type cannot be detected!","Error!",MB_OK
invoke  ExitProcess,0
.end nocpuid
    


Anyone? Razz Thanks.
Post 10 Apr 2004, 02:34
View user's profile Send private message Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: usa
coconut
edit


Last edited by coconut on 18 Apr 2004, 01:57; edited 1 time in total
Post 10 Apr 2004, 05:49
View user's profile Send private message Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: usa
coconut
edit


Last edited by coconut on 18 Apr 2004, 01:58; edited 2 times in total
Post 10 Apr 2004, 13:14
View user's profile Send private message Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: usa
coconut
heres the program - unsure about the accuracy since i have an amd cpu, and it reports an intel

Code:
format PE GUI 4.0
entry start

include '%fasminc%\win32a.inc'

_szintel db 'intel cpu',0
_szamd   db 'amd cpu',0
_szerror db 'cpuid not supported',0
_sztitle db 'cpuid app',0

start:
        pushfd
        pop     eax
        mov     ebx,eax
        xor     eax,00200000h
        push    eax
        popfd
        pushfd
        pop     eax
        cmp     eax,ebx
        jz      nocpuid
        mov     eax, 1
        cpuid
        test    ebx,68747541h
        jnz     amd_cpu
        invoke  MessageBox,0,_szintel,_sztitle,0 
        jmp     finish
  amd_cpu:
        invoke  MessageBox,_szamd,_sztitle,0
        jmp     finish
  nocpuid:
        invoke  MessageBox,0,_szerror,_sztitle,0
  finish:
        invoke ExitProcess,0

section '.idata' import data readable writeable

  library kernel,'KERNEL32.DLL',\
          user,'USER32.DLL'

  import kernel,\
         ExitProcess,'ExitProcess'

  import user,\
         MessageBox,'MessageBoxA'
    
Post 11 Apr 2004, 16:40
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.