News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Exagone-Tuts need some help

Started by kromag, February 02, 2009, 07:19:20 PM

Previous topic - Next topic

kromag

I am reading Exagone-Tuts in chm format and I have come to a section that says the following:

Quote
There are a few sizes of registers: 8 bit, 16 bit, 32 bit (and some more on a MMX processor). In 16-bit programs, you can only use 16-bit registers and 8 bit registers. In 32-bit programs you can also use 32-bit registers.
Some registers are part of other registers; for example, if EAX holds the value EA7823BBh, here's what the other registers contain.

It then shows a map of what's going on like so:

Quote
eax = EA7823BB (32-bit)
ax = 23BB (16-bit)
ah = 23 (8-bit)
al = BB (8-bit)

And here it says:

Quote
Example of the use of registers (don't care about the opcodes, just look at the registers and description):

mov eax, 12345678h mov loads a value into a register (note: 12345678h is a hex value because of the 'h' suffix)
mov cl, ah move the high byte of ax (67h) into cl
sub cl, 10 substract 10 (dec.) from the value in cl
mov al, cl and store it in the lowest byte of eax.

My question is this:

Would not ah the high byte of ax contain 56?
---
William

kromag


Tedd

Yeah, it'll just be a typo..

eax = 12345678h

al = 78h
ah = 56h
ax = 5678h
No snowflake in an avalanche feels responsible.

donkey

As Ted said that is just a typo in this case, however the x86 family of processors use little endian format, the bytes are stored in reverse order. This allows you to access data in BYTE/WORD/DWORD order with a single address, whereas Big Endian would require offsets from that address (+4/+8/+16), very helpful if you only need to check the low order byte of a memory address.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

kromag

Thank you Tedd and Donkey :bg

And thanks for the Tip Donkey ;-]
---
William