News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

8086 registers - NOOB question

Started by hornet07, April 12, 2015, 01:33:14 AM

Previous topic - Next topic

hornet07

Okay, so I was going through some tutorials on 8086 Assembly, and I hit some information that seems contradicting, to me at least.

AX, the 16-bit register is made up of:
    - high-byte AH (8-15 bits)
    - low-byte AL (0-7 bits)

So AX is AH|AL.

If you assign  1234h to AX, 12h goes to AH and 34h goes to AL. So far so good. BUT, the next part just confuses me.
The tutorial went on to convert the hex into binary and represented the value like so: 0011 0100 0001 0010, which is 3412h. This shows me that 34h is in AH and 12h is in AL, which is completely opposite of what it mentions previously. Also, the least significant byte, which for some reason is 8-15 and not 0-7 (why is this?), corresponds to the highest address (1000h), while the low byte has address 1001h.

This is quite a mess in my head. Is there something I'm missing? Or maybe the tutorial really is that dumb and misleading...

In any case, can someone please provide some in-depth explanation on this issue of addresses and low/high bytes?

dedndave

not sure how the book explained it, but....

intel stores information, low-order byte first
so, if i stored AX (1234h) in memory, and examined the bytes, i'd see
34h, 12h

it's called "little endian"

http://en.wikipedia.org/wiki/Endianness

Gunther

Hi hornet07,

I think that Dave gave the right answer. Your question has to do with the Endianness. You can find some examples about it in this tutorial. And welcome to the forum.

Gunther
You have to know the facts before you can distort them.

hornet07

Thanks for the explanation and ebook. Can you recommend one just for 16-bit? I can work with this one as well, but I'm writing programs in 8086 for homework back in college.

FORTRANS

Hi,

       Randy Hyde's "The Art of Assembly Language Programming"
(AoA), is in its second edition, which is 32-bit.  The first edition
was 16-bit and looks to be available as a download.

http://www.plantation-productions.com/Webster/www.artofasm.com/DOS/index.html

   It is not standard in its assembly language syntax.  But the
basics of registers and math ought to be covered.

HTH,

Steve N.

rrr314159

@FORTRANS, I was going to recommend that myself. Here's another web site which seems to have a better format for reading it: The Art of Assembly Language Programming by Randall Hyde.

However, note some of the chapters can be skipped: anything about the UCR  "Standard Library" is obsolete. When he starts talking about "finite state automata" and "iterators" you should probably turn the page.

Some people think the DOS info is obsolete, I don't agree, it's still a good book / tutorial.
I am NaN ;)

hornet07