hello friends,

I have looked deeper into the intel docs: 24319102.pdf
see page 158 the cpuid section.

eax[3:0] = stepping id
eax[7:4] = model
eax[11:8] = familly

Ok, lets try to learn something here!

eax= 32 bits register so 32 values of 1 bit can be
placed in it.
Acording to the intel docs they use heximal to indicate
a feature.

edx[012345678901234567890123456789012] ; 32 values

Lets assume we have used cpuid and eax=1
To do something with the data we need to read EXACTLY x
BYTES from eax or EDX!

Damm we have a reall challange here! read x bytes from 3 to 7
and place them in a db,dw so we can
pressent the user with some info.

How do i read a RANGE from a register like this?????
(please answer this)

result db ?

; lets asume the data we need to read is
;bytes : 4-8

; into = where to place result
; startoffset =
; endoffset =

proc ReadBytes , INTO:byte

mov eax,byte ptr ; pos 4

mov result,byte ptr eax
inc ecx
cmp ecx,end_byte_offset
mov byte ptr ; set next pos to read
jne read


end ReadBytes

Thanx if u can help me.

If it works, i can write some system Info tool.
Posted on 2005-03-08 03:12:23 by marco1974
I'm really not sure what you are trying to do, but the intel document is treating the 32 bit register as a structure of bit fields.

eax[3:0] means bits 0, 1, 2, and 3 of eax. You want them, "AND eax, 0Fh".

You want bits 4 to 7?
SHR eax, 4
AND eax, 0Fh

I don't get what the exact problem is here...

Posted on 2005-03-08 05:58:50 by Mirno

I meant that i want to read edx after cpuid BUT only
bit-range 4-7 for example.

Its not about cpuid but about Reading Bits from a REGISTER into a
Dw or Db value.

I also meanth that i need to read a specific range like
readBitsFrom_reg32 proc,startpos:dw ,endPos:dword,register:dword

for example if edx contains a bitfield and i ONLY want to read 3 BITS from EDX into a db or dw structure.

I am stuck in there!

reading specific ranges from a 32bits register is TOUCH!
Posted on 2005-03-08 07:25:48 by marco1974
Mirno just gave you the answer...

PS: A 32bit register can only hold 4 bytes.. There is a difference between bits and bytes.
Posted on 2005-03-08 07:53:34 by roticv
marco1974 i suggest reading
Art of Assembly Language
Chapter One Data Representation

the expert's way :P

push ebx
mov eax,1
CPUVERINFO record cviReserved:18,cviType:2,cviFamily:4,\
mov ecx,eax
mov ebx,eax
and eax,mask cviSteppingID
and ebx,mask cviModel
and ecx,mask cviFamily
shr eax,cviSteppingID
shr ebx,cviModel
shr ecx,cviFamily
;- store eax,ebx,ecx
pop ebx
Posted on 2005-03-08 13:39:10 by drizz