Z80 Gets New OS

If you have a soft spot for a Z80 computer but want a new operating system experience, try Zeal. You can watch a demo of the open-source OS in the video below.

As you might expect, the whole system is written in Z80 assembly language. The features you expect are there: files, directories, device drivers, a clock, and even memory banking to support up to 16M of memory. The work isn’t totally done, nor is the initial target computer — Zeal — but it looks like a great piece of work so far and will be of interest to anyone who has a Z80.

You can also try it in emulation mode in your browser if you don’t have a Z80 CPU handy. The author wanted a simple OS that wasn’t multithreaded and could live in ROM. The kernel takes about 6K of ROM and 1K of RAM, depending on the configuration. The system calls and general operation will remind you of Linux.

There is a large list of things to do, so if you have a mind to pitch in, there’s no shortage of ideas to work on. Does the world need another Z80 OS? For that matter, does the world need any more Z80 systems? We don’t know about the world, but we can always use them. They don’t even have to cost very much.

17 thoughts on “Z80 Gets New OS

  1. Very interesting and ambitious. Not only it has the Zeal 8-bit OS, but also the creator is making Z80 computer. I think the world still needs the Z80, especially in IT education. Why not teaching computer science begins with the Z80?

    1. MP/M II is also an awesome OS. And it has an actual software library (can run multiple CP/M programs, has Turbo Pascal 3 etc).

      And then there’s SymbOS, another lively OS with applications. It even has a RAD IDE, akin to Delphi or Visual Basic.

    2. There was a time not so long ago when a student could get sued by Microsoft as he could not possibly write operating system by himself. Today people write operating systems for computers they design. Impressive work.

  2. the first chip I started to learn assembly programming with on Texas Instruments calculator (TI-82)
    and the chip used in the original gameboy.
    Nice to see this chip stills getting interest after so many years. I guess it is part of the emblematic devices in the history of computers such as as commodore, amiga, motorola 68k…

    1. The chip used in the original Game Boy is a fun offshoot of computing history in and of itself.

      The CPU used in the Game Boy is a Sharp LR35902, which has a number of features in common with the Zilog Z80, but lacks much of what people associate with the Z80 over the Intel 8080.

      The opcodes prefixed with a ‘CB’ byte are present, but the remaining prefix instructions (DD, ED, FD) are not. The ‘shadow’ register file is not present. On-board support for DRAM refresh (the ‘R’ register) is not.

      The fact that Sharp were tapped for the Game Boy’s CPU isn’t a coincidence, either, as by the time the Game Boy was in development, Nintendo had a 7-year history of working with Sharp, as the company’s 4-bit microcontroller line (the Sharp SM5x and SM51x) were the basis of all of Nintendo’s “Game & Watch” line of handhelds dating back to 1981. Offshoots of Sharp’s 4-bit SM5-series microcontrollers were also the dedicated key/lock chips known as “CIC” which were present on the NES, SNES, and N64 for the ostensible purposes of copy protection (though which were more realistically for vendor lock-in).

      1. Also, the gameboy CPU lacks the index registers, which makes it very much NOT a Z80. Any Z80 code will very likely not work on the gameboy due to it.

        Everything points at that the gameboy CPU has a SM83 core, as documentation that was found on that core matches 1:1 with the gameboy CPU.

        Both the Z80 and SM83 are 8080 based, and that’s where they share a lot of things from. And the assembly syntax is Z80 style, as the 8080 style is pretty confusing.

        On a related note, those 4bit CPUs (SM51x for example) are really odd, if you want to be confused, lookup the instruction set of those, and how the program counter isn’t just counting upwards.

        1. In truth, I find the 8080 mnemonics more intuitive than the Z80 ones; they don’t seduce you into thinking things that are impossible might not be. Things that look like special cases really are.

        2. And let’s don’t forget the sound chip inside the DMG-01’s CPU core.. The GB is capable of stereo sound, has two pulse channels (square), a noisy channel, a square wave channel, 3-bit volume control..

          The reason why most people think that the Gameboy has a Z80 is because of the history of emulation, I suppose. The Z80 was well documented, not only by official sources. So if you’re working on a Gameboy project, you’ll likely start with an existing Z80 emulation core and begin to build upon of that rather than implementing the strange SM83 architecture from scratch.

        3. The Z80 actually matches 8085 machine code, i remember programming for the 8085 in Uni and then bringing the binary code home to run/test my code on weekends, using my old ZX Spectrum.

  3. Missed this detail: “Make sure you have an MMU first which divides the Z80’s 64KB address space into 4 pages of 16KB. That’s the main requirement.” So while it may have only a few K resident at any one time, it still requires more memory, just shoved off elsewhere.

    DARN. There are those of us who like to play with vintage machines that don’t have the full 64K space available–like TRS-80s that start with 16K lost to ROM, and certainly no banked memory. The TRS-80 DOSes had a less than 3K resident kernel “nucleus”, with a 1K region for disk overlay “/SYS” files. (NewDOS got up to 21 SYS files.)

    C’mon guys, even (very) early UNIX could run in small K. Can’t we squeeze an OS without needing 100+K memory on hand?

    1. “Make sure you have an MMU first which divides the Z80’s 64KB address space into 4 pages of 16KB. That’s the main requirement.”

      That’s the classic bank-switching model, as used by Expanded Memory Specification (EMS) in the mid-late 1980s. I had no idea this qualifies as a full-fledged MMU already.

      On 16-Bit x86, 64KB is the size of a single segment (on Z80 its the complete address space).

      A Small Page Frame of EMS has a size of 64KB, too. Inside this window, which usually is located between 640KB-1MB, four pages a 16KB reside.

      Applications can use these four pages to store/read information. A memory manager is used for communication between bank-switching hardware and the EMS application. Simply said.

      1. Quite a few of the early MMUs were nothing more than this, just done in silicon.

        For example, the Motorola 68451 was often used more as a simple hardware segmentation system than anything more MMU-like (in the modern definition). It could be used for segment-style *or* page-style usage, but could only support 32 simultaneous segments/pages at a time; if you needed more simultaneous segments, you were expected to use multiple physical 68451s.

        The 68000 had an error in its memory-access trapping that often prevented full restoration of state after the trap had been handled, but the 68010 had the fix, and thus could use a 68451 to do true virtual memory. With only 32 segments in the table, a 68010+68451 system often felt like an exercise in patience, since modifying the segment table wasn’t exactly instantaneous.

        I once got to see a specialty system that used 12 or 16 68451s, back when it cost more than a small bizjet. It was great for problems that couldn’t fit into a smaller system, but if your problem would fit into a smaller system, *any* other system would have been faster :)

        I think it ran on a UNOS variant, but they didn’t actually let us touch it. It was nearly obsolete, but the owners still had a couple of in-progress projects that depended on it. It was used for some kind of typesetting, and they were MUCH more careful of letting outsiders touch it than they were of the just-delivered fifteen million dollar process press.

    1. The Z8000 was quite convoluted. The Z800 was much nicer, but I don’t know if it ever materialized, there were also some other Z800-like designs in the making. I found some Olivetti Z8000 motherboards for minicomputers on a PC-fair, but never powered them up. Later Zilog also designed a Z80,000 I think.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.