Live data from Hacker News

The Zilog Z80 has turned 50

goliath32.com

101–110 of 131 posts

Re: The Zilog Z80 has turned 50

#101
post #96

Earlier quoted context omitted.

Making the parity flag not perfectly compatible was a wise choice. In legacy programs the parity flag was seldom tested and practically never after the instructions where in Z80 it behaved differently. This allowed the repurposing of the parity flag as an overflow flag, which was an extremely useful extension of Z80. The instruction sets of Datapoint 2200, Intel 8008 and Intel 8080 share with that of RISC-V the disti…

It's obviously done like that in RISC-V to simplify it.

Zilog Z80 was orders of magnitude simpler, but its designers never did something so foolish.

At that time, many people still used assembly language and they would have never accepted to write arithmetic expressions in the contorted way forced by RISC-V.

Now compilers hide this aspect of RISC-V so most are not aware of this. Moreover, most people are still using programs compiled from C/C++ with unsafe compilation options, or even from Rust, where by default integer overflow is not checked in programs compiled for "release", so they do not see how much performance RISC-V loses when executing programs that are designed to produce correct results.

Re: The Zilog Z80 has turned 50

#102
post #95

Earlier quoted context omitted.

risc-v has no flags period modern out-of-order execution gets hindered by such non-parallel cpu state, so it wasn't included

IMO, the "out-of-order performance/complexity" excuse is complete bullshit. Out-of-order pipelines actually have a really elegant way of handling flags, they just store a copy of the flags register on every ROB entry. During renaming, instructions that consume flags just gain an extra implicit input pointing to the ROB that will contain the correct flags. Such pipelines already need deal with so much serialised state…

> Out-of-order pipelines actually have a really elegant way of handling flags, they just store a copy of the flags register on every ROB entry.

And yet, flag writing instructions are usually half the throughput on regular ALU instructions, on modern wide ooo designs. [1, 2]

But I generally agree, there is a good way of handling them, it's hust unclear to me how expensive it is. It can't be that expensive, but apparently it is expensive enough, to not put a mask register write port on all integer execution units.

[1] https://dougallj.github.io/applecpu/firestorm-int.html (see how ADD is 6-issue and ADDS 3-issue)

[2] https://developer.arm.com/documentation/111027/4-0/ (again 8-issue ADD, but 4-issue ADDS)

Re: The Zilog Z80 has turned 50

#103

Z-80 was the processor for my introduction to programming in assembly language on a TRS-80 model I in early 1983. Bill Barden's assembly language books and Hardin Brothers' "The Next Step" column in 80 Micro magazine paved the way. I wrote a quick post a while back about my Z-80 experiences here: https://jimlawless.net/blog/posts/z-80/

When I was a teenager ca. 1980, my local Radio Shack had a shelf of books, and I worked my way through them as my funds allowed. Since the TRS-80 used a Z80, they had Barden's book on the Z80, published by Howard Sams. I already understood programming a bit thanks to learning BASIC, and my curiosity about micro's was piqued by my mom's subscription to Byte Magazine. Maybe it's because it was so clearly written that a…

Agreed. I only recently found out about a book that Barden wrote (also a Sams book) that was published in 1977 called "How to Program Microcomputers". It explains the common workings of microprocessors and then goes over the makeup and instruction sets of the Z-80, 6502, and 6800. I wish I'd had that as a primer on assembly language and programming for microprocessors.

Re: The Zilog Z80 has turned 50

#104
Does anyone know what (if any) open source assemblers exist, that are written in Z80 assembly themselves?

I'm aware of: proprietary ones like GEN80 (my fav way back), M80/L80, at least one open source assembler written in plain C, and probably some table-driven assemblers targeting multiple architectures.

Re: The Zilog Z80 has turned 50

#105

Does anyone know what (if any) open source assemblers exist, that are written in Z80 assembly themselves? I'm aware of: proprietary ones like GEN80 (my fav way back), M80/L80, at least one open source assembler written in plain C, and probably some table-driven assemblers targeting multiple architectures.

Z80 assembler in _machine code_ could be really fun.

Re: The Zilog Z80 has turned 50

#106

Annoying part of 8080 was that the command set had holes in it and mystery restrictions. Which were hard to remember. And 12 undefined opcodes. Z80 solved all that. However, you had to be a programmer Anno Dominii 1975 to fully understand what heavenly Joy and Jubilation Z80 was.

8080 assembly language makes it easy to understand what the restrictions are. Z80 much less so.

Much of the instruction set was carried over from the 8008, that's where you get MOV & ALU operations, the pseudo-register M standing for memory at address HL, etc. The 8080 then added to that some extensions that weren't as orthogonal, but greatly improved the usability.

That memory copy example, rewritten for the 8008, would take more than 30 instructions, constantly juggling pointers in and out of HL, because there was absolutely no other way to access memory. For that you needed an extra free register as well (no XCHG instruction!), so only a single 8 bit register would be available to use as a counter. Or you could store the counter in memory, but in that case there would be even more instructions to first load the address of that variable into HL!

In 8080 assembly as defined by Intel, each of these extended instructions has a unique mnemonic. LDAX = load A extended, etc. There's a one-to-one correspondence with the opcodes, so it's easy to memorize the encoding (best in octal), and what register can be used for what purpose.

Zilog added even more unorthogonal extensions to this set, but "simplified" the assembly so that one mnemonic could produce many different opcodes, some with an additional prefix. Most of these don't provide any benefit over using the existing 8080 opcodes, and you have to memorize lots of seemingly arbitrary restrictions. If you first learn Z80, those make no sense at all.

Re: The Zilog Z80 has turned 50

#107
post #7

I started programming in 1978 (In Assembler) and wanted to know not only how the software worked but how the hardware worked. Found a great kit using the Z80 and built it and spent many nights with a logic probe and oscilloscope learning digital eletronics. Also devoured the Z80 manual learning the instruction set. I'm nearly 70 now but remember those days like they were yesterday. Truly a magnificent CPU

I started 3 years later than you on a 4K Radio Shack computer running a 6809 8-bit CPU. I can still remember quite a few opcodes and a few months ago helped some on retrocomputing.stackexchange.com find a rather tricky 6809 assembly language bug without looking anything up. It's weird how stuff sticks around in our heads, since I haven't written any 6809 code in more than 40 years. Despite being entirely self-taught…

"I still think there's something invaluable about learning computers from first principles down to the metal"

Totally agree!

I never went to Uni either (at least not until I retired) yet have had a very succesful career in IT and still love tinkering like it sounds you do.

Those were heady days :-)

Re: The Zilog Z80 has turned 50

#108
post #73

Earlier quoted context omitted.

I started 3 years later than you on a 4K Radio Shack computer running a 6809 8-bit CPU. I can still remember quite a few opcodes and a few months ago helped some on retrocomputing.stackexchange.com find a rather tricky 6809 assembly language bug without looking anything up. It's weird how stuff sticks around in our heads, since I haven't written any 6809 code in more than 40 years. Despite being entirely self-taught…

It feels a bit like a first language. That's the one that really sticks with you.

Or a first love (of the human kind) :-)

Re: The Zilog Z80 has turned 50

#109
post #7

I started programming in 1978 (In Assembler) and wanted to know not only how the software worked but how the hardware worked. Found a great kit using the Z80 and built it and spent many nights with a logic probe and oscilloscope learning digital eletronics. Also devoured the Z80 manual learning the instruction set. I'm nearly 70 now but remember those days like they were yesterday. Truly a magnificent CPU

May I suggest you check out the game "Turing Complete" https://turingcomplete.game/ It sounds like it may be right up your alley. Its a simplified digital logic simulator, you make basic circuits from NAND gates, and then build these into functional units in later levels, then further on you build an instruction decoder, and combine it with these functional units and before long you have a Turing complete architectur…

Thanks for posting this.

Re: The Zilog Z80 has turned 50

#110

Annoying part of 8080 was that the command set had holes in it and mystery restrictions. Which were hard to remember. And 12 undefined opcodes. Z80 solved all that. However, you had to be a programmer Anno Dominii 1975 to fully understand what heavenly Joy and Jubilation Z80 was.

And yes. There was 8080-assembler in PDP-11, but it was just regular PDP assembler with extra macroes. It did not know those forbidden commands and thus produced undefined opcodes with random and entertaining results.

[deleted]
Post reply on HN