Protected Mode On A Z80! (Almost)

The microprocessor feature which probably most enables the computing experience we take for granted today is protected mode. A chip with the required hardware can run individual software processes in their own environments, enabling multitasking and isolation between processes. Older CPUs lacked this feature, meaning that all the resources were available to all software. [Andy Hu] has done the seemingly impossible with a Zilog Z80, enabling a protected mode on the chip for the first time in over four decades. Has he found an elusive undocumented piece of silicon missed by every other researcher? Not quite, but it is a clever hack.

The Z80 has two address spaces, one for memory and the other for I/O. He’s taken the I/O request line and fed it through a flip-flop and some logic to call a hardware interrupt the first time an I/O call is made or when a RST instruction is executed. Coupled with a small piece of memory for register contents, and he’s made a Z80 with a fully-functional protected mode, for the cost of a few logic chips. It’s explained in the video below the break, and we hope you agree that it’s rather elegant given the resources in hand. It’s too late for the commercial 8-bit machines of the past, but it would be interesting to see what today’s retrocomputer designers make of it.

Continue reading “Protected Mode On A Z80! (Almost)”

Build An 8-bit CPU To Know “But How Do It Know?”

Sometime around 2009, [J. Clark Scott] published a book aimed to demystify computers for everyone by walking through construction of an 8-bit CPU from scratch. The book had a catchy, but somewhat confusing title But How Do It Know?. The back story on the title goes something like this: Joe is a very nice fellow, but has always been a little slow. He goes into a store where a salesman is standing on a soapbox in front of a group of people. The salesman is pitching the miracle new invention, the Thermos bottle. He is saying, “It keeps hot food hot, and cold food cold….” Joe thinks about this a minute, amazed by this new invention that is able to make a decision about which of two different things it is supposed to do depending on what kind of food you put in it. He can’t contain his curiosity, he is jumping up and down, waving his arm in the air, saying “but, but, but, but…” Finally he blurts out his burning question “But how do it know?” Joe looked at what this Thermos bottle could do, and decided that it must be capable of sensing something about its contents, and then performing a heating or cooling operation accordingly. Joe’s concept of how the bottle worked was far more complicated than the truth. With that introductory opening, [J. Clark Scott] goes on to cover basic number theory, leading on to logic gates, and finally the 8-bit CPU.

[Patrick LeBoutillier] decided to build a hardware version of the CPU/computer as described in [John Clark Scott]’s book. In order to keep size and cost within reasonable bounds, he choose a hybrid construction using a combination of micro-controllers and SN74HC logic IC’s. When used as a companion project alongside reading the book, he hopes people can get their hands dirty and try it out for themselves. He has published a series of 14 videos covering construction of the CPU and the first Introductory video is embedded after the break below. For the micro-controller part of the project, he is using four Arduino Nanos, the code and install instructions for which are available at his Git repo. The Fritzing schematic, also available at the repo, might look a bit daunting at first look, but when you follow along his video series, it becomes easier. You can preview the first three chapters of the book at the “But How Do It Know?” website.

If FPGA’s are more of a thing for you, or you’d like to dip your feet learning FPGA, then [Patrick] has another series of 17 videos (embedded below) where he goes through the same process using a Digilent BASYS3 FPGA development board. These aren’t your only options — if you just want to understand how it works, without having to build the hardware, then check out the online, browser based implementation of the [Clark Scott] CPU.

If it seems the breadboard build of this 8-bit CPU looks complex, then this
Home Made 8-bit CPU Is A Wiry Blinky Build and a veritable rats nest of jumper wires.

Continue reading “Build An 8-bit CPU To Know “But How Do It Know?””