Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bits & Bytes Help (beginner)

Status
Not open for further replies.

tntcoder

Programmer
Dec 10, 2005
6
GB
Hey guys,

Can someone explain this to me:

10000h in bytes is 4+4+4+4+4 = 20bytes yes? and because thers no 20bit reigster it goes in a 32bit dword. I think i understand that.

But then with this code as an example:

arrayD DWORD 10000h, 20000h
mov eax, arrayD ; eax = 10000h
mov eax, [arrayD+4] ; eax = 20000h

Right now i get that its +4 because 20000h is 4 bytes beyond the 1st element. What i dont understand is how is it 4 bytes beyond, why not 20 bytes as i said earlier?

Really having a problem getting my head around this?

Thanks for any help
 
Each hex number is equal to 4 bits (half a byte), not 4 bytes.
For example, 0x01 is 8 bits, 0x0123 is 16 bits, and 0x01234567 is 32 bits (4 bytes).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top