flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Windows > test CPUID code

Author
Thread Post new topic Reply to topic
catafest



Joined: 05 Aug 2010
Posts: 85
test CPUID code
I make a test CPUID , any idea to solve this issue ?


Code:
format PE GUI 4.0
entry start 

include 'win32ax.inc' 

section '.code' code readable executable 

    start

        ; INVOKE CPUID FUNCTION 0x00000000 

        xor     eax,eax 
        cpuid 

        ; EXTRACT VENDOR STRING FROM

        mov     [out_buffer.vendor_ebx],ebx
        mov     [out_buffer.vendor_edx],edx
        mov     [out_buffer.vendor_ecx],ecx

        ; CHECK FOR FUNCTION 0x00000001 

        cmp     eax,0x00000001 
        jl      .NoCPUID_FN1 

        ; INVOKE CPUID FUNCTION 0x00000001 

        mov     eax,0x00000001 
        cpuid 
        ; TEST FOR HTT  Hyper-Threading Technology

        test    edx,00010000000000000000000000000000b
        jz      .NoHTT
        mov     [out_buffer.htt_arch4],'YES '
    .NoHTT:

        ; TEST FOR MMX

        test    edx,00000000100000000000000000000000b 
        jz      .NoMMX 
        mov     [out_buffer.mmx_ach4],'YES '
    .NoMMX

        ; TEST FOR SSE 

        test    edx,00000010000000000000000000000000b 
        jz      .NoSSE 
        mov     [out_buffer.sse_ach4],'YES '
    .NoSSE

        ; TEST FOR SSE2 

        test    edx,00000100000000000000000000000000b 
        jz      .NoSSE2 
        mov     [out_buffer.sse2_ach4],'YES '
    .NoSSE2

        ; TEST FOR SSE3 

        test    ecx,00000000000000000000000000000001b 
        jz      .NoSSE3 
        mov     [out_buffer.sse3_ach4],'YES '
    .NoSSE3

    .NoCPUID_FN1

        ; DISPLAY RESULTS AND QUIT 

        invoke  MessageBox,NULL,out_buffer,'CPUID',MB_OK+MB_ICONINFORMATION
        invoke  ExitProcess,0 
        jmp     $ 

;---  SECTION DATA STRUCTURE FOR MESSAGE BOX

section '.data' data readable writeable 

    out_buffer:
                        db 'VENDOR',2,9,'- '
      .vendor_ebx       dd 0 
      .vendor_edx       dd 0 
      .vendor_ecx       dd 0 
                        db 9,13,10

                        db 'NoHTT',2,9,'- '
      .htt_arch4        dd 'NO  '
                        db 9,10

                        db 'MMX',2,9,'- '
      .mmx_ach4         dd 'NO  ' 
                        db 9,10

                        db 'SSE',2,9,'- '
      .sse_ach4         dd 'NO  ' 
                        db 9,10

                        db 'SSE2',2,9,'- '
      .sse2_ach4        dd 'NO  ' 
                        db 9,10

                        db 'SSE3',2,9,'- '
      .sse3_ach4        dd 'NO  ' 
                        db 9,10

                        db 0 ; end out_buffer

;---  DEFAULT DATA INCLUDES

section '.idata' import data readable 

    library kernel32,'kernel32.dll',\ 
            user32,'user32.dll' 

    include 'api\kernel32.inc' 
    include 'api\user32.inc' 

Post 07 Dec 2017, 15:54
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15303
Location: Bigweld Industries
Re: test CPUID code

catafest wrote:
... any idea to solve this issue ?

What is the issue?
Post 07 Dec 2017, 16:03
View user's profile Send private message Visit poster's website Reply with quote
catafest



Joined: 05 Aug 2010
Posts: 85
so show infos about CPUID ( or CPU) .
Post 07 Dec 2017, 16:08
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15303
Location: Bigweld Industries
What does it display now?
Post 07 Dec 2017, 16:10
View user's profile Send private message Visit poster's website Reply with quote
catafest



Joined: 05 Aug 2010
Posts: 85
Just testing with fasm . Why ?
Post 07 Dec 2017, 18:16
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15303
Location: Bigweld Industries
I can't run your code right now from where I am, so you will need to explain more about what you see. Does it display anything? Does it only display a partial message? Does it crash? Something else?
Post 08 Dec 2017, 00:11
View user's profile Send private message Visit poster's website 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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.