Z80 – The 1970s Microprocessor Still Alive (2021)(computer.org) |
Z80 – The 1970s Microprocessor Still Alive (2021)(computer.org) |
Why I have not picked one up yet… I think I just have a sweet spot for the 6502 and keep putting together KIM-1 kits.
(EDIT: Finally after years, I just pulled the trigger on their Classic II kit.)
The ISA is quite messy because of the backward compatibility requirement with the Intel 8080 (e.g. the Z80 had to fill undocumented gaps in the 8080 opcode encoding map with new instructions, four of which were prefix instructions to unlock additional instruction 'subsets' (DD/FD for replacing instructions involving the HL register pair with indexed addressing modes via the IX/IY registers, and ED/CB prefixes for adding two entirely new opcode blocks).
If the Zilog engineers would have been free to design their own ISA I'm sure they would have been able to come up with a much more elegant design.
Also the Z80 had more than twice as many transistors as the 6502 (8500 for the Z80 vs 3500 for 6502).
I still prefer programming the Z80 over the 6502 though :)
I really don't.
There are some few things you can fit into and get working fast in the Z80's A + 6 registers (IX and IY are not useful if speed is the aim), but for anything complicated the 6502's 256 Zero page locations — any pair of which can hold a pointer you can index off — is far superior.
The Z80 is awful at accessing memory for anything other than a simple absolute address or sequential access or push/pop of a register pair. It's better for manipulating 16 bit values, but not as much as you'd think especially once you run out of three register pairs plus ToS.
My 5090 has 92 billion transistors (I dont say they dont bring fun)
That's an interesting idea. They were previously part of the team that designed the 8080 so they must have been very familiar with the ISA and the design philosophy.
I'm sure they'd be able to come up with improvements but how much more elegant it would have been is hard to say.
Since Zilog was founded by former Intel engineers, they were probably the ones who helped design the 8080 in the first place?
Over the past couple of years I've gone back to the Z80, working on CP/M emulation, testing, and similar things. It's fun to play the old infocom games, and mess around with BIOSes when all you have is 64k.
There's a lot of good CP/M reference material out there, and numerous emulators to run it on modern systems
This sentence threw me a little bit. Which mainframes were based on the Z80? I'd love to know more about that.
https://ia902902.us.archive.org/20/items/mame0.211manualsful...
There are also FPGA emulated versions.
[1] https://spritesmods.com/?art=tamasingularity&page=2
[2] https://archive.org/details/furby-source
[3] https://dmitry.gr/?r=05.Projects&proj=37.%20Pixter#_TOC_a6fe...
It was the early 80s, and my mom was getting Byte Magazine, which I devoured. I had taken a high school programming class in BASIC, and was interested in electronics. Radio Shack had a shelf of books, and I was going through them one by one as I could afford them. They had William Barden's book on the Z80, published by Howard Sams, because the TRS-80 used it.
That book was so clearly and methodically written, that a high school kid could understand it. Later on I added some scraps of inline assembler here and there in programs, but eventually got into microcontrollers, which I continue to play with.
I admit that my mental model of microcontrollers is still based on those 8 bit machines, and I owe a debt to the Z80.
an Apple M5 Max is 100,000,000,000 transistors (ok it’s 18 CPU + 40 GPU cores) by comparison so 17 million 8080 equivalents
At, ballpark, 1000 times the clock frequency. It’s a pity we do not how to connect such a large number of tiny cores in a way so that it can perform meaningful work. One hurdle is that, even ignoring the insane amount of connections needed, it would not be possible to connect each of those cores to each other one because their address spaces are so tiny.
Every so often someone reinvents the transputer, and it turns out not to be quite as good as mainstream multi-core CPUs, but the wheel must turn.
Z80 was the choice of a microprocessor for then home computers such as Radio Shack TRS-80, SORD M23P, M5, Sinclair ZX81, ZX Spectrum, KayPro II, and many other manufacturers.3 It was capable of running the CP/M operating system in most Z80-based PCs. Z80 had a reasonable share in the PC market until Intel revealed its 16-bit microprocessor in the mid-1980s. Z80 was very popular as a microprocessor not only in PC applications, but also in industrial embedded applications, and some of the big manufacturers have Z80 core inside their ASIC chips still today or use enhanced versions of Z80 in consumer electronic devices.4–7 Zilog still manufactures ez80, an enhanced version of the original Z80, which is still being used by Texas Instruments in its TI-84 and TI-84 Plus calculators.7 It is among the few silicon chips that made a remarkable impact on the electronic device industry.8 To this day, Zilog produces a range of Z80-based microprocessors and intelligent peripheral controllers, and they are available from reputed electronics component suppliers.2,9,10 This microprocessor is one of the longest living microprocessors of all time.
anyway - say you want 50% of the transistors for on chip RAM these days, then thats
100 billion / 50 thousand = 2 million ARM 1s
clocking at say 3GHz
6e15 MIPS = 6 peta MIPS
so if you could run code on it, you would get a 10,000x speed up ;-)
¹ USS Enterprise, that is.
Foreseen it was.
And in a way, those old 8-bit home computers also worked like a single integrated 'super-chip', because the whole system was driven by a single clock and entirely 'hard realtime', while modern computers are much more asynchronous (and I guess this asynchronous design is what enabled most performance improvements that go beyond pure transistor count scaling).
The Z80 could even refresh the RAM by itself. It was not like the 8080 which required two support chips only to function.
Of course, the 8008's origins (along with the completely unrelated 4004) were outside of Intel. They were hired to design custom ICs. The 8008's architecture was dictated by a CTC terminal. While Intel designed the 4004, it was only intended to be used in calculators. Intel, and its engineers, probably put relatively little thought into microprocessor architecture until the 8080.
You can create as many other stacks as you want using pairs of Zero Page locations as stack pointers.
Best practice for recursive/reentrant code (e.g. compiling C) is to follow modern RISC/x86_64 practice and reserve a few (16 maybe) Zero Page locations as argument/working registers, a few (16 maybe) as callee-save registers, and have prolog and epilog utility functions that create/destroy a stack frame and save/restore N bytes of callee-save ZP locations.
You can unroll those into a sequence of elements like...
lda $1F
dey
sta (SP),y
lda $1E
dey
sta (SP),y
:
lda $10
dey
sta (SP),y
... at 5 bytes and 11 cycles per byte saved. And of course jump into the appropriate part of the sequence.In general, the reason why modern CPUs are so complex is because the gap in performance between CPU and memory has grown massively over time.
In the old days, something like a 6502 was running nearly synchronously with RAM.
That gap has grown massively over time; a modern CPU is orders of magnitude faster than RAM. So they have to jump through a lot of loops to avoid simply idling 99.99% of the time while they wait for some new data or instructions from RAM. On-CPU cache memory is one answer. Branch prediction and speculative execution are others. As you may imagine, speculatively executing code based on branch prediction is very complex because you must roll back any side effects from that execution if your prediction turns out wrong.
Example:
# assume `i` is a value stored in main memory
if i == 42
j += 1
k -= 1
l = 666
else
z = 123
q = 5879873
Waiting for `i` to arrive from main memory might take thousands of CPU cycles. So instead we will execute one, and possibly both of those branches. But we'll need to undo those side effects if turns out we executed something with an invalid prediction. It's complex, and messy, but still better than sitting around doing nothing for thousands of cycles.That's why we can't just take an R2000 and scale it up to 3ghz. I mean, we could, but it wouldn't work very well unless we also had low-latency 3ghz main memory to pair with it.
Acorn co-founder Hermann Hauser famously joked that he gave the original ARM microchip design team two distinct advantages: no time and no resources. With no money for a large crew or complex hardware, the tiny core team had to keep the processor design exceptionally simple, which ultimately birthed the revolutionary RISC architecture.
It also had to run in simulation on a BBC micro… Probably with a second processor via the Tube interface, but still.
https://www.righto.com/2015/12/reverse-engineering-arm1-ance...