LWN.net Logo

How an Accident of Hardware Design Encouraged Open Source (O'ReillyNet)

How an Accident of Hardware Design Encouraged Open Source (O'ReillyNet)

Posted Mar 1, 2007 16:47 UTC (Thu) by brouhaha (guest, #1698)
In reply to: How an Accident of Hardware Design Encouraged Open Source (O'ReillyNet) by jzbiciak
Parent article: How an Accident of Hardware Design Encouraged Open Source (O'ReillyNet)

The 6800, 6809, and other 8-bit Motorola microprocessors were big-endian. As you say, the 6502 is little-endian.

The 68000 was interesting in that it was mostly big-endian, but the bit ordering used by the bit instructions was little-endian. When they added bitfield instructions to the 68020, with bitfields that could span words, they had to adopt big-endian bit numbering for those instructions to make it work well.

IBM, on the other hand, uses consistenly big-endian numbering for both bits and bytes. I've always thought it aggravating to deal with bytes and words that have bit zero as the most significant bit, but at least it is consistent.


(Log in to post comments)

How an Accident of Hardware Design Encouraged Open Source (O'ReillyNet)

Posted Mar 1, 2007 17:26 UTC (Thu) by jzbiciak (✭ supporter ✭, #5246) [Link]

Ok, I misremembered then. I didn't have much opportunity to program the 6800 series back in the day--just a few brushes with a 6875 and a 68HC11.

Big endian bit numbering is supremely annoying to me. The TI Home Computer numbered its busses in big-endian. A0 was the MSB of the address bus. Depending on whether you were looking at the 16-bit or 8-bit portion of the bus, the LSB was A14 or A15. (Yes, I did program 9900 assembly. It was my first assembly language.)

It works, but it only works well if you left-justify addresses as opposed to right-justifying them. And that only works if you know what your longest address is. What happens if the machine goes to 32 bits? :-)

(I'll stop now. I had written more, but thought better of it.)

Endian consistency

Posted Mar 3, 2007 5:41 UTC (Sat) by ldo (subscriber, #40946) [Link]

IBM, on the other hand, uses consisten[t]ly big-endian numbering for both bits and bytes.

Actually, there is no completely consistent big-endian system. There are three different decisions to be made as far as endianness goes:

  • The ordering of bits in a byte.
  • The ordering of bytes in a multi-byte object.
  • The place value of binary digits making up an integer.

The IBM convention gets consistency among the first two, but not the third. The only way to get consistency among all three is to go little-endian.

Another point is that, even on big-endian architectures, registers tend to effectively be treated as little-endian--when you load/store quantities less than the full register size, you get the least-significant end of the register, not the most-significant end. Again, the only way to be completely consistent is to go little-endian.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds