Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Byte order in memory after storing a 16-bit number on 8086?

I'm studying 8086 assembly language at high school and I have this question:

For example I have this number ABCD (hex). How is it stored on the memory?

Does the AB go for example to memory address 01 and the CD goes to address 02?

like image 777
Tal Avatar asked Apr 21 '10 12:04

Tal


2 Answers

8086 stores the values in little endian format. So the lower order byte (i.e. CD) is stored first and then the higher order byte is stored. So in your case it will be address 01 will have CD and 02 will have AB.

like image 142
Naveen Avatar answered Nov 15 '22 11:11

Naveen


Depends on the Endianness of the system you're working on.

x86 systems use little endian, so the value ABCD would appear in memory as CD followed by AB

like image 27
PaulG Avatar answered Nov 15 '22 12:11

PaulG