
Chip Hall of Fame: Zilog Z80 Microprocessor (2017) - tosh
https://spectrum.ieee.org/tech-history/silicon-revolution/chip-hall-of-fame-zilog-z80-microprocessor
======
tasty_freeze
Trivia: the article says the Z80 had "full compatibility" with the 8080, but
that isn't true. Here and there programs failed because of it.

In the 8080, most ALU operations set the "P" (parity) flag to indicate if the
result had an even or odd number of 1 bits. On the Z80, that flag would be set
the same way for logical operations (AND, OR, XOR), but for ADD/SUB operations
it was used as an overflow flag -- not carry out, but it indicated that the
2s-complement result wasn't able to accurately represent the result.

There were also some changes in the way the half-carry (nibble carry out) flag
was handled in some instructions too.

~~~
slededit
Most notably Microsoft Basic was not compatible initially. The CP/M version is
but that came much later.

------
vanderZwan
> _Zilog still makes the Z80, which is used in some embedded systems._

Still used in the TI range of graphing calculators. Specifically, the TI-84 CE
range[0]. I can't speak for other countries, but graphing calculators are
mandatory in Dutch high schools, and the TI series is the default choice for
many (I got a TI 83+ Silver Edition when I was 14, which was "new" at the time
- guess my age). I suspect because it's low-powered enough to still require
that students Learn The Material too (instead of doing the symbolic calculus
through the calculator). Texas Instruments must be having quite a large mark-
up on such a dirt-cheap piece of electronic hardware though.

Anyway, because of that, Z80 assembly was my second programming language TI
Basic being the first[1]. It really is quite accessible - I mean you basically
memorise the entire instruction set after a while because it's so small and
simple[2].

Funny enough, I remember when moving to higher level languages that almost
every tutorial that I read on warned me that pointers were really, _really_
hard, and I couldn't see why at that point. I guess that if you start from the
ground up instead from the top down, some things get easier.

[0]
[https://en.wikipedia.org/wiki/TI-84_Plus_series](https://en.wikipedia.org/wiki/TI-84_Plus_series)

[1]
[https://www.ticalc.org/archives/files/fileinfo/328/32816.htm...](https://www.ticalc.org/archives/files/fileinfo/328/32816.html)

[2]
[http://wikiti.brandonw.net/index.php?title=Z80_Instruction_S...](http://wikiti.brandonw.net/index.php?title=Z80_Instruction_Set)

~~~
cottsak
I had a similar high school experience. Not as much asm but spent way too many
hours writing basic programs on that thing. prob should have spent more time
listening in class.... nar! :-D

~~~
setquk
Same. I wrote a horse racing program on the 82 that I sold to students so they
could use it for betting. It was my first profitable software product :)

It was lame as crap. Just used the PRNG to multiply one of 5 variables by 10
and then draw them on the screen. Longest number won the race.

If you were clever enough you could reseed the RNG and pick a winner every
time.

~~~
Bromskloss
I wrote a solver of quadratic equations that occasionally adjusted the answer
to be wrong by a few percent. The plan was to disseminate it to the class. I
don't remember to what extent I managed or dared. I have now put my black hat
days behind me.

~~~
setquk
That’s so incredibly evil that I love it :)

------
dwarman
I spent many happy years making the Z80 dance, from Summer 1976 through Spring
1989, architecting and writing statistical multiplexors at MICOM
Communications in LA. Micro 800 line. That is a Hard Real Time application,
and the hardware for the first model was only 4KROM and 4KRAM. I made one Z80
do what the competition (CISCO) swore required 5, and laughed discreetly at
us, but it worked, sold out the bottom end market from under them, and
suddenly we had a runaway and I got an excellent team to buttress and
ultimately take over the baton from me. I would dream in Z80 ASM in those
days.

The Z80 had two hardware features that made it possible, and that nobody here
has mentioned yet:

1: two sets of working registers, with a one byte instruction to toggle
between them. I instruction cyclke to context switch between application and
interrupt handlers. Only the TI 9900 came close with its in-RAM working
register sets.

2: hardware vectored interrupt dispatch, fully suppported by theor
accompanying peripheral line. Just a few clocks from raising an interrupt to
executing the first line of code (typically switch context then ...) of not
only the device but it's reason for interrupt code. No code wasted
interrogating bitfields and scanning registers. 2 usecs interrupt response
time. Faster than an Intel i960 with its 50MHz clock, that came along later.

------
loser777
Surprised that the TI-8X series and TRS-80 got mentioned as popular
applications, but not the Gameboy! (well, it's not _exactly_ a Z80, but it's
close enough that reasonable Gameboy emulators are feasible on a TI-83+SE:
[https://www.ticalc.org/archives/files/fileinfo/419/41990.htm...](https://www.ticalc.org/archives/files/fileinfo/419/41990.html))

The ironic bit is that the emulation experience is fundamentally flawed
because the TI-83+SE has a _lower_ resolution display than an original
Gameboy. The original TI-83 launched in 1996, the Gameboy in _1989_.

------
sehugg
One nifty thing the Z80 did was built-in DRAM refresh:
[http://www.piclist.com/techref/mem/dram/slide4.html](http://www.piclist.com/techref/mem/dram/slide4.html)

"Access cheap DRAM just like you do SRAM" must have been an effective sales
pitch at the time.

~~~
raverbashing
> Access cheap DRAM just like you do SRAM" must have been an effective sales
> pitch at the time.

Yes, yes it was

------
digi_owl
From back when 3 guys could make a CPU in a year.

The Z80 was also a big deal in Europe, where it powered two (major) brands of
micros in UK alone, and was cloned extensively in the USSR.

~~~
dcminter
Sinclair's machines were Z80 based - was there another major brand using it?
All the ones in the UK I can think of were 6502 based...?

~~~
digi_owl
Amstrad. Their CPC range sold well enough that they ended up buying most of
Sinclair Research and releasing a few models of Spectrum variants based on
Amstrad industrial design.

One model post-purchase Spectrum even included the same kind of oddball 3 inch
floppy drive that Amstrad had been using (another had a built in cassette
player, similar to what the first Amstrad CPC had).

~~~
Zardoz84
The Spectrum +3 . Also, was my first computer. Andreas bought Sinclair,
because Sinclair lost a lot of money, trying to get his "electric car"

~~~
rahimnathwani
I had the +2, the one with the cassette player.

------
thanatropism
I remember sort of learning (just superficially) Z80 and 6502 assembly at the
time (mid to late 80s) and thinking Z80 assembler was much simpler.

~~~
znpy
I can testimony for Z80 assembly (tough I cannot say anything about 6502).

In high school one of our teachers made us program a Z80 board by hand.

And when I say "by hand" I mean it quite literally: first a flow-chart, then a
conversion to z80 assembly (two passes: pencil first, pen later), then
datasheet at hand a conversion into z80 opcodes (this time it was three
passes, the third one was to recalculate all jumps, absolute and relative
ones).

Last step was to input each opcode into memory by hand using an hexadecimal
keypad. Then go to address 1800h, hold breath and press RUN.

In retrospect, it was a very enlightening experience considering I and my
school mates were like 16-17.

But keep in mind, if a 17 years old can do this with relative ease (it was a
technical high school, after all) that should tell you something about the
simplicity and effectiveness of the Z80 instruction set.

Z80 <3

~~~
jacquesm
I bootstrapped a 6809 assembler by hand. That took a while :)

------
tomxor
I like reading history about old chips like this, i've read about the z80
before... but where is the rest of the article? so short, the z80's story is
far longer than this.

~~~
bookofjoe
Me too, love this stuff. For those of us who haven't a clue about coding or
software (I'm a retired neurosurgical anesthesiologist), reading this comments
section and its ilk is like visiting the Egyptian Museum in Cairo and gazing
at the hieroglyphics. My understanding of what I'm reading/seeing is nil but
the wonder titer is high.

------
MarcPereira
And, then, they thought: "hum... let's do our 16 bits microprocessor... and
forgot the retro compatibility with our own 8bit chip!". What could go wrong?

~~~
spc476
The 8086 wasn't binary compatible, but it was (more or less) software
compatible---you could mechanically translate 8080 assembly to 8086 assembly
and get about 95% converted without issue.

Motorola broke compatibility completely when they transitioned from 8-bits
(6800, 6809) to 16/32 bits (68000) [1].

[1] From a hardware perspective, the 68000 is a 16-bit system; from a software
perspective, it's a 32-bit system.

~~~
billforsternz
I think he's talking about Zilog's 16 bit processor, which was completely
incompatible with everything and is more or less forgotten now. (Literally in
my case, I can't even recall its name).

~~~
klft
Z8000
[https://en.wikipedia.org/wiki/Zilog_Z8000](https://en.wikipedia.org/wiki/Zilog_Z8000)

~~~
billforsternz
Yes, of course, that's the one. In the embedded shop I worked it I'm sure we
looked at it briefly - it was overkill for our applications and also didn't
have the natural advantage of being in any way compatible with the desktop
computers we used for embedded software development.

------
js2
Microsoft's first hardware product was a Z-80 card for the Apple II:

[https://en.wikipedia.org/wiki/Z-80_SoftCard](https://en.wikipedia.org/wiki/Z-80_SoftCard)

My Apple II had one for basically the sole purpose of running Wordstar under
CP/M (I don't recall why we didn't just use Apple Writer).

------
chadcmulligan
Had this book on my shelves for many years
[https://archive.org/details/Programming_the_Z-80_2nd_Edition...](https://archive.org/details/Programming_the_Z-80_2nd_Edition_1980_Rodnay_Zaks)

------
Sir_Cmpwn
z80 is a lovely instruction set, and a delight to work with. These days CPUs
are incredibly complicated, with massive instruction sets, pipelining and
caches, microcode and SMP, lots of crazy nonsense going on. Anyone who has
ever worked with the x86 family at a low enough level knows just how insane it
is. z80, on the other hand, is just a reasonably fast CPU with predictable
timings and an instruction set which can fit on an index card (well, if you
use both sides). It still has plenty of secrets to discover, though - easily
half of the instruction set is undocumented and full of useful tricks. I have
spent a lot of time with this CPU, none of it wasted :)

------
timonoko
After suffering the gaps in 8080 command set for years, this was the greatest
joy ever. Also the new assembler was such a pleasure, you could just LD
everything to everywhere.

------
glhaynes
_The Z80 was a contemporary of MOS Technology’s 6502, and like that chip, it
stood out not only for its elegant design but also for being dirt cheap (about
US $25)._

Anybody got a graph of historical 6502 vs Z80 prices?

EDIT: Some previous HN discussion "On choosing the Z80 over the 6502 (2014)"
[https://news.ycombinator.com/item?id=10763274](https://news.ycombinator.com/item?id=10763274)

~~~
TheOtherHobbes
I designed a few Z80 projects in the early 80s, and they were a few pounds
then.

------
toomanybeersies
My father's first computer was a Sinclair ZX81, powered by a Z80. He still has
it at home.

I tried getting it working a few years ago, but it wouldn't work with the TV.
I wasn't really interested enough to get an old TV to use with it. Pretty
amazing though, not many people are able to say they still have their first
computer.

~~~
adamkruszewski
I still have a Timex 2048 (a clone of Sinclair ZX Spectrum). It is not the
first Spectrum I used, but first I owned. It works still and I have a family
tradition of plugging it into our TV set each Christmas and playing the games
we have grown up with. Years ago I could use my PC workstation to "play" tape
recordings into it but nowadays you have to use an Android phone [1] as I
think there is too much of sound filtering built in and the tapes just don't
load.

[1]
[https://play.google.com/store/apps/details?id=dk.rift.tzxdro...](https://play.google.com/store/apps/details?id=dk.rift.tzxdroid)

------
swiley
They still manufacture z80 DIPs and it’s crazy easy to build homebrew
computers with them (you really only need a few chips total to have something
that works.) it’s something I think anyone that uses computers heavily should
try.

