Programming with FASM – test with CPUID.

First, you need to take a look at this website.
The CPUID returns processor identification and feature information in the EAX, EBX, ECX, and EDX registers.
What the source code from my example do?
First I start with the default assembly program.
The next step is to start with resetting with xor eax,eax use cpuid.
The result of CPUID will be put into EBX.
Into section ‘.data’ data readable writeable make a structure named out_buffer.
The structure will be filled so you need to EBX, see the example:
mov [out_buffer.vendor_ebx],ebx will give us “Genu”.
The next step for test EBX is this example:
test edx,00010000000000000000000000000000b
jz .NoHTT
mov [out_buffer.htt_arch4],’YES ‘
.NoHTT:

The structure of out_buffer is :
db ‘NoHTT’,2,9,’- ‘
.htt_arch4 dd ‘NO ‘
db 9,10

Because I used MessageBox to show us the out_buffer.
The result will be No or Yes with the size of dd.
The DB can define byte variables, as well as arrays of bytes.
Fasm documentation tells us: For example db 1,2,3 will define the three bytes of values 1, 2 and 3 respectively.
The dd has 4 bytes.
The result will be this text (the result is true to the text will be YES): “NoHTT – YES”.
Let’s see one screenshot:

This is the source code:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.