12

TL;DR:

The Z80 was introduced not long after the 8080 and replaced it quickly and almost entirely for personal computing. Still, a large chunk of new software written stayed with 8080 code, making no or only very limited use of Z80 instructions.

Are there any reliable numbers of the amount of Z80-only software for OS that supported both CPUs? For the fine print see below.


Story Behind

While the 8080 started its CPU lineage in 1975, it was dethroned two years later by the less expensive and (hardware wise) more versatile Z80. Right in time for the home computer era starting ca. 1977. Except for some very early systems (Altair/SOL), late (DAI) or undead (Interact) designs and regional circumstances (COMECON countries *1) the Z80 ruled the market for 8080-compatible CPUs (*2).

Still, even throughout all of the 1980s many software packages did not use Z80 instructions - or in case of compilers, did not generate Z80 Code (*3). There were programs explicitly Z80-based, like ZCPR replacing CP/M's shell CCP with a Z80 optimized version, but it felt like a minority (*4).

This is even more astonishing as not only new computers were designed around the Z80, but also a good part of all S100 systems were upgraded (*5) with new, more powerful (and less power consuming) Z80. After all, early Z80 cards doubled the speed to 4 MHz (*5). Later Cards not only cranked that up to 6 or 8 MHz but offered addressing past 64 KiB, interfaces and even full 64 KiB on board.

Fine Print

What I'm looking for are (somewhat) reliable numbers to get a picture how true my impression is - or not. Of course a relevant result can only be found for operating systems that supported 8080 as well - at least at some point. Main candidate might be CP/M and its derivatives. It does not make any sense to look at OS that were only used with/made for Z80-only-systems, like Tandy TRS-80, CPC or MSX (*7).

A good answer might include some quantification, like how much of a certain software archive is 8080 code vs. Z80 (or later) code. Might be interesting to see what metrics can be used.

Since more software was produced later (i.e. Software production increases a lot during the 1980s), a result might be biased toward Z80, but that's fine as it simply shows at the end of the Z80 era.


*1 - And even here the Z80 was a strong opponent, as Eastern Germany did, unlike most COMECON countries not clone the 8080, but went right away (and 4 years late) for the Z80

*2 - Intel's 8085 did find some usage in portable devices like the Kyotronic series due its low power CMOS version.

*3 - Including Turbo-Pascal. While it and its products needed a Z80 to run, the compiler itself produced clean 8080 code. Only its runtime/libraries contained Z80 code - most likely as they were written in Assembly.

*4 - IIRC, later ZCPR came as well in a 8080 code only version. But my memory might be false.

*5 - All the Altairs and IMSAIs I have came with Z80 cards instead of the original 8080 board. Quite often the Godbout/CopmuPro Z-CPU or the Ithaca Z-80.

*6 - Especially Godbout's Z-CPU was famous for being stable at 6 MHz and above.

*7 - Thinking of it, it might be even more interesting if similar patterns would show up at such systems, as they provide no inzentive to avoid Z80 code. Lets make it an addition for bonus points :))

15
  • 3
    If you write an application for an operating system that supports both the Z80 and the 8080, you are pretty much forced to use 8080 compatible code. It's either that or shut out a segment of your potential market.
    – JeremyP
    Feb 20 at 8:59
  • 1
    @tofro True, the 8080 was extreme successful in embedded applications. Much like all early ones. Otherwise we wouldn't have the 8086.
    – Raffzahn
    Feb 20 at 10:25
  • 1
    @JeremyP Are you? Glad this didn't stop 286/386 software for the 8086 MS-DOS. Would have crippled much loved software. Likewise, as noted, Z80 software does existed for CP/M, thus the question is about 'how much', not 'did it exist or why not'.
    – Raffzahn
    Feb 20 at 10:31
  • 1
    The earliest software for 286/386 based machines ran on MS-DOS/PC-DOS and was 8086 software. But that didn't last too long because the 286 protected mode allowed significant advantages once operating systems caught up. The Z80 extended instructions did not offer such an advantage and there was little incentive for most companies to offer Z80 only software.
    – jwh20
    Feb 20 at 23:18
  • 3
    I know anecdotes are not data, but my personal experience was that I wrote for the 8080 despite always having a Z80. The differences didn't seem significant enough to spend the effort to optimize; the 8080 was already very capable. Feb 25 at 4:53

1 Answer 1

8

Summary:

Are there any reliable numbers of the amount of Z80-only software for OS that supported both CPUs?

No, not previously, and not from third parties. I've had to rely on my own research here. For the 3487 unique CP/M-80 COM files in the Oakland archive, 55% likely contain only 8080 code, while 45% would appear to include some Z80-only opcodes

Since more software was produced later (i.e. Software production increases a lot during the 1980s), a result might be biased toward Z80, …

From the software archives I've been able to look at (including the Oakland CPM Archive CD-ROM plus some archives of miscellaneous commercial CP/M-80 software), I don't get a clear picture of more people contributing code that would only run on Z80s as time went by. Here's a graph of the guessed 8080 vs Z80 code in the SIG/M library by slightly uneven time:

graph of guessed "z80ness" of contributions to the Sim/M library throughout the early 1980s. There is no clear pattern to the data. There is, however, a tiny Captain Zilog at the top right of the graph

The terminology used in the graph will be explained later.

Background

CP/M-80 COM files are simple containers of bytes with no headers and no segmentation into code and data. Thus it's hard to say what's actual code, and what might be data. To further confound the issue, the Z80 can run 8080 code perfectly.

One way to guess if a CP/M executable contains Z80 code is to count the number of two-byte sequences in the file that correspond to Z80-only opcodes. These opcodes (detailed here: Z80 Instruction Set) start with one of four byte values: 0xCB, 0xDD, 0xED or 0xFD. The second byte of the Z80-only instruction can take a variety of defined values: they are fairly easy to count.

It is assumed that code written for the Z80 will have more of these specific two byte sequences than code written for the 8080. The Z80 instructions are be completely valid data to an 8080, so they will still be seen occasionally in pure 8080 COM files.

From counting the number of Z80-only byte sequences in files (using is_z80.sh, a Linux tool I wrote), I came up with a heuristic: the Z80ness of a binary is the number of Z80-only byte sequences per 10,000 bytes. The odd scale is to ensure that the value is a useful integer range from 0–~900.

Reviewing known 8080 binaries (all of DR's system disks, for example) and comparing them against binaries for Z80 home computers, it became clear that 8080 code typically had fewer than 40× Z80 byte sequences per 10,000 bytes. Any “Z80ness” over about 40 appeared to be written specifically for the Z80 and wouldn't run on an 8080/8085 at all.

To track the change of code target with time, I looked at the SIG/M Amateur Computer Group of New Jersey disks. This group released over 300 volumes of “PD” software from 1981–1987. If the Z80 opcodes gained mindshare with time, surely this would have been reflected in a clear trend in the SIG/M disks? The graph shows otherwise: there's no real trend at all. People were programming Z80s as if they were 8080s, pretty much all the way through SIG/M's life span.

There are, of course, exceptions:

  1. WordStar, the classic word processor for CP/M, stayed solidly 8080 compatible throughout its life. But a v4.x release for the MicroBee computer appears to be almost pure Z80 code.

  2. Code written for the Apple II Z80 CP/M cards appears to be solidly 8080, unless it's a hardware specific driver, then it has Z80 opcodes.

  3. A few games for the Z80-based Sinclair ZX Spectrum use suspiciously few Z80 opcodes. One example appears to be Hudson Soft's Stop the Express, originally written as 暴走特急SOS, "Runaway Express SOS", for the Sharp X1.

14
  • As awesome as expected! Tiny question: what is each dot representing? One Program or One Disk or ? Also, you mention ZX games - do you have a sizeable archive to check against? might be interesting to see if the phenomena is there as well - without and need of restriction that is.
    – Raffzahn
    Feb 25 at 14:23
  • One dot is, effectively, one disk volume. When I plotted it per COM file per volume, it was pure noise. I do (well, TOSEC has ...) giant archive of ZX Spectrum and other Z80 machine binaries. With graphics and game data, though, we risk false-positive identification of Z80 opcodes in program data, and this would mask any 8080 code
    – scruss
    Feb 25 at 19:06
  • Really pure noise, or would it need maybe a different form of graph? The scatter plot against time makes a point about next to no change but doesn't really show about distribution. Since time seems of less of an influence, number of programs vs number of (assumed) Z80 might go more toward differentiation. Maybe a heat map or box-and-whisker plot might show distribution clearer? Regarding game data, I would not think that there is much masking. At least no systematic, so it may over emphase on Z80, but not make it impossible to see if pure 8080 is a noticeable amount or not.
    – Raffzahn
    Feb 25 at 19:45
  • I think I'm hitting my interest/expertise ceiling on this one. Regarding systems, maybe something like ZX81 code might show 8080 influences more, since it's almost graphics-free?
    – scruss
    Feb 26 at 1:45
  • If a CP/M program required a z80 it would be documented as such, right? So you could just search for text in the documentation stating that a Z80 was required? Feb 26 at 15:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .