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 strat with reset 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 fill so you need to EBX, see 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 tell 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 so the text will be YES): “NoHTT – YES”.
Let’s see one screenshot:

This is the source code:

admin

born 1976

Posted in All, Assembler, Windows 10, Windows 7, Windows 8. Tagged with , , , , , .