Author Topic: 8086 registers - NOOB question  (Read 1718 times)

hornet07

  • Regular Member
  • *
  • Posts: 3
8086 registers - NOOB question
« on: April 12, 2015, 01:33:14 AM »
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

  • Member
  • *****
  • Posts: 8752
  • Still using Abacus 2.0
    • DednDave
Re: 8086 registers - NOOB question
« Reply #1 on: April 12, 2015, 01:37:39 AM »
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
Code: [Select]
34h, 12h
it's called "little endian"

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

Gunther

  • Member
  • *****
  • Posts: 3518
  • Forgive your enemies, but never forget their names
Re: 8086 registers - NOOB question
« Reply #2 on: April 12, 2015, 01:44:43 AM »
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
Get your facts first, and then you can distort them.

hornet07

  • Regular Member
  • *
  • Posts: 3
Re: 8086 registers - NOOB question
« Reply #3 on: April 12, 2015, 02:10:57 AM »
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

  • Member
  • ****
  • Posts: 946
Re: 8086 registers - NOOB question
« Reply #4 on: April 12, 2015, 05:37:42 AM »
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

  • Member
  • *****
  • Posts: 1383
Re: 8086 registers - NOOB question
« Reply #5 on: April 12, 2015, 10:53:04 AM »
@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

  • Regular Member
  • *
  • Posts: 3
Re: 8086 registers - NOOB question
« Reply #6 on: April 13, 2015, 12:57:45 AM »
Thank you all for your help.