RE: A86: Byte order
[Prev][Next][Index][Thread]
RE: A86: Byte order
At 11:30 PM 9/28/97 +0200, you wrote:
>Copied from Cyber Optics TI-86 ASM Tutorial, part 3:
>"When storing 16-bit values (words), the Least Significant Byte (LSB)
> is stored first and the Most Significant Byte (MSB) is stored last.
> This appears to make 16-bit LD's look backwards. For example,
>
> LD BC, $569A ; puts $56 into C and $9A into B."
>
>This is the opposite of what you just told me, isn't it?
>
>Who is right?, you or Cyber Optic?
>
>Stud. tech. Martin Blix Grydeland, Computer Science NTNU
>E-mail: grydelan@stud.ntnu.no
>Web: http://www.stud.ntnu.no/~grydelan
>
here's some examples:
ld bc,$4567 ;would put $45 into b and $67 into c
however,
ld (hl),$1234 ;would put $34 into (hl) and $12 into (hl+1)
also
ld (hl),bc ;would put c, or $67 into (hl) and b, $45 into (hl+1)
;by the way, that last command doens't actually exist, just used as exmaple
16-bit registers, (hl,bc,de,af) aalways act like the top example, in fact
every microprocessor works like that. However, the memory of different
processors is sometimes different. The z80 is a Big-Endian, which means
the most-significant byte is stored first. some processors are
Small-Endian, or little-endian, which means the opposite.
I'm pretty sure about that last bit of information
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Alan Bailey mailto:bailela@charlie.cns.iit.edu
IRC:Abalone Web:http://www.iit.edu/~bailela/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Follow-Ups:
References: