• Please review our updated Terms and Rules here

Unix on a Z80 machine

ziloo

Veteran Member
Joined
Feb 7, 2006
Messages
990
Location
in the basement
I know this might be a wild question, but has there been any attempt or
is it possible to port Unix (or one of its derivatives) to a Z80 environment?
Yes or No...please explain...

ziloo

p.s. I know nothing about Unix!
 
Trite answer: The Z80, AFAIK, is a Turing-complete. So, given a suitable amount of storage (e.g., a hard disk), it's possible to emulate any other processor, albeit very slowly. So, you could theoretically run any version of Unix (or Windows 7) on a Z80.
 
...Z80, AFAIK, is a Turing-complete...

Do I understand correctly that: Because Z80 is a Turing-complete, it can emulate
any other CPU. Since Unix is running on many other CPUs, then there is no reason
it won't run on a Z80 machine.

Yes...No...?

ziloo
 
Exactly. Basic computability theory. Given enough storage and a Turing-complete instruction set, any CPU can emulate any other CPU.

Sometimes this can be very useful--you can, for example, design a fictional CPU that has capabilities that your CPU doesn't natively have. UCSD Pascal is a good example of this--the language compiles to P-code and any system that hosts it interprets the P-code instruction set.
 
For practical reasons though, it is nice if your computer is able to execute at least one command per day.

MikeS' reference to Cromix probably is a good start. I'd also look into recent homebrewn operating systems for Z80 home computers (perhaps mainly the European ones) which often borrow parts of the Unix concept, although perhaps being far from fully Unix compliant.

I've once tried something called UNIX V3 on a Commodore 128, although running in 6502 mode. It was rather slow, but a reasonable attempt at mimicing a single user Unix-like system.
 
Z80 computers like the trs 80 model II ran XENIX but only after a 68000 kit upgrade..There would have been others who did the same, relegating the z80 to the role of support chip. I'd search around for a "tiny unix" or "z80 unix" something like that. The orig UNIX ran on primitive DEC systems but even they were not 8 bit.

I wonder what you could do on the 128k trs 80 model 4 with Aztec or whatever C to write a tiny UNIX. You'd not get too far making a full UNIX file system but you could build an unix like interface friendly to connecting with other UNIX systems?
 
Last edited:
I'm going to go out on a limb here and give the common sense answer. No.

When most people talk about Unix they talk about an operating system with many of these design features:

  • At least two levels of protection enforced by the CPU: user and privileged
  • Multiple concurrent processes (fork, exec, wait, etc.)
  • A filesystem using inodes accessed accessed using file descriptions (open, read, write, etc.)
  • Inter process communication via pipes and signals
  • A reasonable/sane user environment with a shell and C runtime


You can overlook things like the lack of user and privilege mode in the CPU and no-memory management. You can limit the processes to one or two at a time, and write them all in assembler. But even with those concessions it is pretty much impossible to get Unix onto something as small as a Z80. It would be just too stripped to be anything other than a demo.
 
I suspect that any PDP-11 variant of Unix could be made to work on a bank switching Z-80 system. The result would be quite slow though. Far beyond my skill to implement.
 
I'm going to go out on a limb here and give the common sense answer. No.

Give me a hard disk and a 64K Z80 and I'll produce an emulator for a PDP-11, privilege levels, I/O and all. It'll run PDP-11 version of Unix just fine---albeit very slowly.

I've been there myself, running on an emulator of a supercomputer because of limited access to the real thing--at less than 1/100th the speed of the real thing. Instead of a few seconds to do a compilation, it took all night. But useful work was still done on it.

So no, it's not impossible. On a 50MHz eZ80, the speed might even be quite tolerable.
 
Well, you've a very nice UNIX derivative for MSX machines called UZIX. Written in C it can be ported to every other Z80 based computer out there...
 
Give me a hard disk and a 64K Z80 and I'll produce an emulator for a PDP-11, privilege levels, I/O and all. It'll run PDP-11 version of Unix just fine---albeit very slowly.

I've been there myself, running on an emulator of a supercomputer because of limited access to the real thing--at less than 1/100th the speed of the real thing. Instead of a few seconds to do a compilation, it took all night. But useful work was still done on it.

So no, it's not impossible. On a 50MHz eZ80, the speed might even be quite tolerable.


Chuck,

If you start as you did with the argument that the device is Turing complete, then you can run pretty much any code ever written or will be written on that Z80 to, assuming you have the mass storage and a few lifetimes. Which makes the question meaningless because the answer is always "yes". Bringing up the Turing complete argument might be fun at a cocktail party and it shows how smart we are, but it really doesn't answer the question.

The original question is "I know this might be a wild question, but has there been any attempt or is it possible to port Unix (or one of its derivatives) to a Z80 environment? Yes or No...please explain..." To my knowledge a reasonable Unix has not been ported to run natively on the Z80, and it is not feasible. You can have some Unix-like features, but getting something that operates like Unix at the kernel level is going to be impossible.

That was the spirit and intent of the original question.
 
I'm going to go out on a limb here and give the common sense answer. No.
Another sweeping (and misleading IMO) generalization by Mr. B. ...

When most people talk about Unix they talk about an operating system with many of these design features:

  • At least two levels of protection enforced by the CPU: user and privileged
  • Multiple concurrent processes (fork, exec, wait, etc.)
  • A filesystem using inodes accessed accessed using file descriptions (open, read, write, etc.)
  • Inter process communication via pipes and signals
  • A reasonable/sane user environment with a shell and C runtime

Exactly which of your arbitrary criteria does Cromemco's Cromix (for example) fail to meet in order to qualify as a "UNIX derivative"? (Note the '..IX' in CROMIX)

Multiple levels of protection - Y
Multiple tasks and multiple users - Y
Inodes and configurable I/O - Y
Pipes and signals - Y
Shell (Configurable, scripting, etc.) - Y

Whether it's "sane" or "reasonable" in your opinion, especially in the context of the early 80's, is irrelevant to the OP's question.
 
Last edited:
I wonder about the memory mapper in MSX2 computers. I found one reference that in the old days it would consist of a dozen 74 series chips and DRAM. In order to successfully port something like UZIX to another Z80 machine, you might need a machine with similar banking capacities to overcome the 64K addressing space. Off-hand, I don't know which Z80 systems can do that, but looking at the screenshots and technical specs it looks quite promising although development might have halted since six years ago.
 
I wonder about the memory mapper in MSX2 computers. I found one reference that in the old days it would consist of a dozen 74 series chips and DRAM. In order to successfully port something like UZIX to another Z80 machine, you might need a machine with similar banking capacities to overcome the 64K addressing space. Off-hand, I don't know which Z80 systems can do that, but looking at the screenshots and technical specs it looks quite promising although development might have halted since six years ago.

Memory banking on Z-80 was quite common; CP/M 3 was largely built to implement that. Amstrad's later CPC models were likely the most widespread Z-80 systems with more than 64K of RAM.

But those shipped in the late 80's and the Unix variants most easily ported to the this hardware would have been from before 1980 so that would prove a lot of work for very little gain.

Cromix was probably as close as any completed software got to being a Unix running on a Z-80.
 
Last edited:
...Cromix was probably as close as any completed software got to being a Unix running on a Z-80.
Z80 Cromix used from two to seven banked 64KB memory blocks, one for the kernel & shell and one each for up to 6 users; as a matter of fact, the same memory and I/O could later be upgraded to a 68000 by just replacing the CPU card.

There were also optional I/O cards with Z80s and firmware on board to offload and handle serial I/O; as an interesting side note, these Z80s could be reassigned to run Z80-specific application software when the main CPU was a 680x0.
 
Last edited:
The original question is "I know this might be a wild question, but has there been any attempt or is it possible to port Unix (or one of its derivatives) to a Z80 environment? Yes or No...please explain..." To my knowledge a reasonable Unix has not been ported to run natively on the Z80, and it is not feasible. You can have some Unix-like features, but getting something that operates like Unix at the kernel level is going to be impossible.

It's a much tougher question in my mind. Exactly what constitutes Unix--is it the OS kernel or the utilities that accompany it? If it's the kernel, then what features (keeping in mind the historical evolution of Unix) are essential to the character of Unix? If it's the utilities, which ones? If it's both, what's the minimum to be called Unix?

There are probably several Unix utility-work-alikes around. If protection is important, there are certainly multi-CPU Z80 systems with each CPU having its own memory space monitored by a supervisor CPU (the logical equivalent of a protected-mode CPU). Similarly, a bankswitched Z80 CPU with the proper hardware can be said to be protected, as long as any part of memory can be mapped out and privileged memory be mapped in only only with an accompanying trap to a predetermined location within it. There are lots of ways to skin a cat.

Is Cromix Unix? Cromemco certainly didn't call it that. Have there been any ports of Unix to Z80 hardware, no matter how heavily augmented? Probably not--but it's hard to say. We've lost so much of the early startup attempts that I wouldn't venture to guarantee an answer. About the only assurance is that Unix porting to microcomputer architectures didn't really gather steam until the late 70s. To be sure, there were other multi-user alternatives that consumed fewer resources.

Given that the Z80 community mostly used the CP/M application base, the big question is why anyone would want to bring in Unix. Cromemco is an exception, essentially keeping its user community locked in.

With a speed-challenged CPU like a Z80, another consideration was "Can one get reasonable efficiency from a real Unix port on a CPU as badly suited to C as a Z80?" When we did one of the early ports of Xenix to the 80286 and translated our applications base from x80 assembly to C, we watched the speed of the system drop substantially. It took a lot of work to get things back to something approximating the speed of the original 3.5MHz 8085 that could service 5 users without breaking a sweat.
 
Another sweeping (and misleading IMO) generalization by Mr. B. ...

Try not to take such delight in turning things personal.



Exactly which of your arbitrary criteria does Cromemco's Cromix (for example) fail to meet in order to qualify as a "UNIX derivative"? (Note the '..IX' in CROMIX)

Multiple levels of protection - Y
Multiple tasks and multiple users - Y
Inodes and configurable I/O - Y
Pipes and signals - Y
Shell (Configurable, scripting, etc.) - Y

Whether it's "sane" or "reasonable" in your opinion, especially in the context of the early 80's, is irrelevant to the OP's question.

My "arbitrary" criteria came from the chapter headlines from the book "The Design of the Unix Operating System" by Maurice Bach. Is that too arbitrary for you?

I understand the memory is bank switched. How is kernel mode vs. user mode enforced?


Mike
 
Is Cromix Unix? Cromemco certainly didn't call it that.
I wouldn't call it that either, but I think it does qualify as the OP's "Unix derivative".

Given that the Z80 community mostly used the CP/M application base, the big question is why anyone would want to bring in Unix. Cromemco is an exception, essentially keeping its user community locked in.
I'm not sure what you mean by "locked in"?

As long as there was a Z80 somewhere, whether on a dual-processor board or an I/O board, every version of Cromix could run native CP/M applications, admittedly with a few gotchas but third party add-ons took care of that; in fact most Cromix installations were really just multi-user CP/M systems with some of the added security and flexibility usually only found in UNIX. I haven't tried it recently, but I'm pretty sure I could still run dBaseII, SuperCalc and Wordstar on one of my 68020 systems...

Towards the end of the 80s they did offer 'real' Unix as an option, either by itself or in a dual-boot Cromix/UNIX configuration with a shared partition

With a speed-challenged CPU like a Z80, another consideration was "Can one get reasonable efficiency from a real Unix port on a CPU as badly suited to C as a Z80?" When we did one of the early ports of Xenix to the 80286 and translated our applications base from x80 assembly to C, we watched the speed of the system drop substantially. It took a lot of work to get things back to something approximating the speed of the original 3.5MHz 8085 that could service 5 users without breaking a sweat.
Granted, the speed of even a three or four user Z80 Cromix system was nothing to brag about, even in 1981...
 
I should add that there was a massive rush toward Unix ports when the 68000 came out, particularly after SysV came out, although there were plenty of BSD-based ventures as well.

Over my objections, the firm I was with then bought a Plexus 68K box over leasing a VAX 11/730 (we already had a 750) to temporarily augment our capabilities. Big mistake--the Plexus came nowhere near the manufacturer's stated performance and the programmers made up rude acronyms that described what they thought of the Plexus.

In that context, "real" Unix, say, SysV, on a Z80 would have been at best a curiosity.

And MikeS has a point--why would anyone want to do this, given that the product base for the Z80 was pretty much exclusively CP/M?
 
Back
Top