274 points · by based2 · 6y ago · 116 comments
To reduce the chip count, the Datapoint 2200 used a serial processor, which processed one bit at a time, so you had a 1-bit ALU among other things. One consequence is that you have to start with the low-order bit when doing addition, so you can handle carries. And for 16-bit values, you also have to start with the low-order byte. This forces you into a little-endian architecture.
Thus, to be compatible with the Datapoint 2200, the 8008 was also made little-endian. Unfortunately, Intel was very slow creating the 8008, so Datapoint had moved on to a parallel 74181-based architecture and didn't want the 8008. Intel decided to sell the 8008 as a stand-alone product, essentially creating the microprocessor industry. As the article explains, the x86 grew out of the 8008, so x86 also inherited the little-endian architecture
Endianness is only really a thing if there's addressable memory, which is not the case for a bit stream. Whether a system is big/little/mixed-endian was only a question of how the address lines are set for multi-byte accesses.
> Shustek: So, for example, storing numbers least significant byte first, came from the fact that this was _serial_ and you needed to process the low bits first.
> Poor: You had to do it that way. You had no choice.
I'm wondering if it was the bit order that mattered for compatibility with the 1-bit serial processor of the Datapoint 2200, and if that determined byte ordering of it's 16bit successor?... I don't know much about 1-bit computing, but if you think about it - to be useful, it must be capable of doing operations on arbitrary length words (within some reasonable limitation), i.e not limited to 8 bits like the 8008. So maybe this put it in a funny position: while byte endianess makes no sense and bit endianness seem to make no difference for the 8008 since it was 8bit; it did make a difference to the datapoint which was serial 1-bit and could operate through the 8bit word boundaries.
To be clear what i mean, imagine how a 1-bit ALU would process 16 bits, it would want them in order like this (the bits are in logical order, not numerical order):
(8bit) Little Endian:
byte 0000000011111111
bit 0123456789abcdef
But not like this: (8bit) Big Endian:
byte 0000000011111111
bit 76543210fedcba98
I don't know if this is correct, and i'm assuming here that bit endianness must determine byte endianness in the 16bit 8086. Clarification/correction is most welcome.Really, it wasn't until the mid-80's and the RISC revolution, where all of a sudden people found themselves designing systems that would be 32 bits wide from the very first silicon that the community "decided" that the only true byte order should be BE.
And of course, the reason they made that decision was simply that the order of bytes in memory happened to match the way readers of the latin alphabet write arabic numbers on paper. Had the arabs invented computing, there would never even have been a debate.
For variable-length integers, using a UTF-8-like big-endian encoding allows you to keep the relationship between lexographic and numeric sorting.
This is also a huge advantage of ISO 8601 over other date formats.
IBM 360-series mainframes were 32-bit and big-endian in the 1960s. (Their earlier computers may have been big-endian too, I'm not sure.)
Yes, their choice of big endian probably came from their earlier unit record equipment, which used punched cards as input, storage, and output. Since punched cards were (sort of) directly human readable, it was natural to use big endian.
Practically all multi-precision arithemtic libraries store the segments of a bignum in LE order too, despite the fact that the individual segments may be BE on a BE machine. That is even more confusing.
And while I consider the PDP-6 to be the first RISC architecture, really that title goes to 1970s machines like the 801.
The advantage works both ways: it's also nice if your normal integer vector instructions can be used to accelerate memcmp, without needing an extra opcode or instruction flag to specifically support parallel lexographical comparison. Note that if the vector units only support signed integers, then you only need an exclusive-or to flip all of the sign bits in order to get lexographical sorting, and that vector exclusive-or has important real-word use cases for hash functions and so-called add-shift-xor encryption algorithms like ChaCha20.
Alternatively, if you're going to include a dedicated lexographical comparison instruction for strcmp/memcmp (like x86 REP CMPS), a fast implementation will need less dedicated circuitry if your processor natively supports big-endian operations for other instructions.
Big-endian use in mainframes likely evolved from big-endian BCD numeric fields on punch card sorting/tabulating machines, where big-endianness was an advantage in that the normal lexographic sorting would put constant-width numeric fields in numerical order.
Hah, so it's literally because we write numbers with most significant digit on the left, which is the opposite to logical ordering?
I presume the only advantage to BE today is compatibility then...
As you have to read an entire positional number to be able to get even its magnitude; the only “advantage” I can see of LE over BE in natural languages is that at least rtl can get odd/even immediately. Then again in ltr you can get sign immediately. In real life human use neither “advantage” is compelling.
“This is basically the report_final_FINAL2.docx of register names.”
Also anyone not using proper version control (business folks, designers, scientists, students) usually has a bunch of files all over the place with every kind of inconsistent names for a bunch of versions.
Also if you could explain A-R15 that’d be super. Apparently they have learned absolutely nothing.
For the high 8 registers it isn’t like that. There is no way to get to the “high” byte.
8 bits == byte == B
16 bits == word == W
32 bits == doubleword == DWhen it comes to the assembler syntax 32bit word, my guess would be, that 32bit words (e.g AT&T x86 syntax, m68 assemblers) are mostly indicated as l (for long).
movl (at&t's x86) or mov.l (m68k).
Edit: Ah.. yeah, also intel x86 asm syntax uses it, so I guess that's where the idea of using D for 32bit values originates.
If you ever find yourself writing an AMD-64 assembler, it really feels like you're digging through archaeology with all of the weird quirks you need to implement. The SSE, AVX, and AVX-512 encodings add even more levels of, "why did they do that?!?" which don't make much sense except in the context of history.
I've never seen an authoritative answer for that but I believe it comes from the fact that in the 16-bit addressing modes, BX is the only one of the 4 ABCD registers that can be used to address memory, and the circuitry for decoding is very slightly simpler to detect two 1 bits than one 1 and one 0 bit. The 4 other registers are, in order, SP BP SI DI.
which don't make much sense except in the context of history
That can be said for a lot of things...
I was under the impression that it went
Accumulator
Base
Counter
Data
I'm not sure about the D or E registers, but I am sure I remember using B as the base address register for arrays, and using C as the counter register for loops and such because the others couldn't be used that way.
It's been a while. Am I misremembering?
The interesting part is that BX maps to HL, which explains the weird order AX/CX/DX/BX in the encoding of 8086 instructions.
A - accumulator
X - wildcard for both upper and lower 8-bit parts, this becomes redundant b/c of E prefix
No we don't ... the E stands for "extended".
You can look here at the original 8080 reference manual:
https://altairclone.com/downloads/manuals/8080%20Programmers...
For example page 4 lists the name of instructions, INR is "increment register" while INX is "increment register pair", similar notation is used for several other instructions where the X is the register paired version of an instruction.
In the case of the AX register, it likely just refers to the pair of AH and AL registers.
At any rate, it's really interesting glancing over the various 8086 reference manuals. Gives me a deep sense of appreciation for how far things have come and how things have managed to build upon what are otherwise some very simple and fundamental building blocks.
I do somewhat wish AMD managed to get R0-R7 as the standard, though :p oh well.
On the one hand, it’s gross that x86 still has this legacy.
On the other hand, it’s a good thing that it’s possible to maintain compatibility so far back while still having such good perf. I find that aspect of modern x86 to be super impressive.
Intel hires the best of the best, the true cream of the crop to design them an ISA that is meant to crystallize everything that is known about ISA design into a single completely new design that discards all the broken crap of yesterday and will be futureproof for decades if not forever, and a chip to implement it.
Everything is going to be great forever, but it turns out it's a bit hard to get done, so they just have the B-team whip up something quick to sell in the meantime. This something was the 8086, which gets adopted into increasingly successful products, but no matter, the new shiny thing is going to displace all of that when it finally ships.
Then it does, and it actually has a hard time competing in performance with the much older stopgap product. It turns out that the team of superstars they hired was very theoretical, and built an ISA that was a dream to program against, but did not really understand what it took to build something that was going to be fast when implemented in hardware. (Also, the system was meant to be used mainly with high-level languages, and the compilers really were not there yet.) Being more expensive, much slower than the competition and with 0 market penetration, the iAPX 432 was dead on arrival in the market.
Luckily, the B-team had been busy working up on another extension of the stop-gap product, the 80286, which is again a runaway success, and only partially because of backwards compatibility with the existing x86 ecosystem. It was also quite fast for it's time.
Last one was dropping MPX, while everyone else is making memory tagging compulsory as means to tame C and C++ code.
Under 16 bits, it has a high and low part, AL and AH. The 16 bit whole got called AX, because X gets used a lot as a wild card.
EAX is extended (to 32 bits) AX.
"The 6502 CPU's overflow flag explained at the silicon level" by Ken Shirriff,
http://www.righto.com/2013/01/a-small-part-of-6502-chip-expl...
Re: books, I liked Robert X. Cringley's Accidental Empires, but it covers only until 91 (or 93 if IIRC for the 2nd edition) of the PC industry and not really technical.
edit: also, of course: https://devblogs.microsoft.com/oldnewthing/
"You might think—gee, seven is a very odd number of registers—and would be right! The registers were encoded as three bits of the instruction, so it allowed for eight combinations. The last one was for a pseudo-register called M. It stood for memory. M referred to the memory location pointed by the combination of registers H and L. H stood for high byte, while L stood for low byte of the memory address. That was the only available way to reference memory in [an] 8008."
Also what if I want to deal with something like screen pixels that packs nicely in 8 bit boundaries, but maybe I don't want the first 8 bits?
I've always liked how 6502 neatly has everything in 3 letter opcodes. But that's not scalable given modern CPU capabilities.
Some companies experimented with "symbolic Asm" which was even terser, and made it look more like an HLL.
And the 80286 predated the 80386 as a 32-bit processor, so the 80286 was Intel's first 32-bit offering. It was still segmented, missing the paging hardware. I helped write an operating system for it. Short-lived.
The 80286 by most definitions was a 16-bit CPU, having a 16-bit data bus, 16-bit general purpose registers and 16-bit segments. It did have a 24-bit address space though, up from the 20 bits of the 8086.
EDIT: Even Intel called the 286 a 16-bit CPU, see the Preface of http://bitsavers.trailing-edge.com/components/intel/80286/21...
It had 'real mode' which was the ordinary 8086 addressing mode (capable of 20-bit addressing to 1MB) and 'protected mode' which we called 'imaginary mode' since nobody used it.
That's why the article said their flagship processor iAPX 432 is delayed. The 432 started development in 1975 (!) but wasn't shipped until 1981.