2 ms·
Others have mentioned various reasons. Here's yet another reason: Shorter instructions. Let's say you have an 8-bit machine, like a 6502 or an 8080 (the archi
by PhantomGremlin 9y ago
Others have mentioned various reasons. Here's yet another reason:
Shorter instructions.
Let's say you have an 8-bit machine, like a 6502 or an 8080 (the architectural predecessor to the x86). Let's say everything goes thru the ACCumulator.
Then you can have 1 byte opcodes to do things such as:
clear accumulator
shift left everything in ACC by 1 bit
rotate left everything in ACC by 1 bit
etc.
You can also have 2 byte opcodes to do things such as:
add an 8 bit immediate to the ACC
8 bit opcode plus 8 bit data
exclusive or an 8 bit immediate to the ACC
8 bit opcode plus 8 bit data
etc.
Those early microprocessors used a lot of 8 bit and 16 bit instructions. Why? Cost and chip count.
Early EPROMs (equivalent of today's flash but could only be erased by shining UV light on them), like the Intel 1702A, were 256 bytes. That's it. 2048 bits of memory in a chip. It was great when the Intel 2708 became reasonably priced. That got you an entire 1024 bytes of ROM in a single chip.
Early RAMs, like the 2102, were 1024 words by 1 bit. Put 8 chips together and you got 1024 bytes of memory.
So, yeah, shorter instructions were a big big deal in "the old days", i.e. the mid 1970s.
- bogomipz 9y agoThanks for the examples. I guess I'm missing what the connection between 1 byte opcodes and the presence of a dedicated accumulator register. Sorry if I'm missing something obvious. Can you elaborate?
- PhantomGremlin 9y agoYou have many things a microprocessor needs to do, even an 8-bit one from 45 or so years ago. You need opcodes to shift left and right, rotate left and right (possibly with and without carry), add, subtract, and, or, exclusive or. Perhaps other arithmetic and logical operations. You need opcodes to move values to/from memory, to/from other registers such as index registers. You don't just have opcodes that specify absolute memory locations, you need more opcodes to specify that you want to use an index register instead. You need opcodes to jump conditionally. You need opcodes to call and return from subroutines. You need opcodes to enable and disable interrupts. You need opcodes to push and pop registers from the stack. Etc etc etc. You can't easily encode all those opcodes into a single byte and still set aside bits from that one byte to specify one of a number of accumulators. Hence why the Intel 8080 had a single accumulator. Because all math happened with the accumulator, you didn't need any bits in the opcode to specify that. It was implied. Having said that, there was one commercially available microprocessor, the Motorola 6800, that had two general purpose accumulators.[1] It still had many single-byte opcodes. But it also gave some stuff up. It only had a single index register. The competitor MOS Technology 6502 had a single accumulator[2], but that left opcode room and die area for two index registers. The Woz chose the more flexible (and far cheaper) 6502 for the Apple I and Apple II. And the rest, as they say, is history. [1] https://en.wikipedia.org/wiki/Motorola_6800 https://en.wikipedia.org/wiki/Motorola_6800 [2] https://en.wikipedia.org/wiki/MOS_Technology_6502 https://en.wikipedia.org/wiki/MOS_Technology_6502
- bogomipz 9y ago>"Because all math happened with the accumulator, you didn't need any bits in the opcode to specify that. It was implied." Ah OK. This is the bit I was missing. This makes perfect sense. Thanks you for the detailed response!