Close
0%
0%

Evolving Z80

Because I'm too poor for a full computer

Similar projects worth following
End goal: To merge this project with my other one, Fun With CRTs, and make a fully functional, customizeable Z80 machine similar to the early Macs from back then.

I'm starting off with a basic test circuit, and then i'll slowly add things to it when i can afford to.

The final goals for this project are:

  • Multitasking OS
  • Ability to load ROMs from SPI cartridge
  • Ability to self-flash BIOS
  • MMU mapping 2MB of DRAM to a 16KB space (along with 32KB of built in SRAM)
  • 16KB BIOS
  • ATA port for hard drives
  • Floppy drive port
  • 2...nah let's make it 3 expansion ports starting with VGA and sound cards
  • serial port
  • 2 PS/2 ports for mouse and keyboard
  • Built in CRT display that can be detached
  • overclocking capability
  • RTC

  • Tested some overclocking

    FloppidyDingo07/15/2017 at 17:52 0 comments

    I have put together a minimal system to test everything would work the way i designed it, and I had a school project that involved doing an experiment. So i decided to test how well the Z80 overclocked against my home PC. I found the results surprising since the Z80 maxed out its clock multiplier chip at 32 MHz, and my PC crashed at 4.3 GHz. This may not seem surprising until I worked out the percentages. The Z80 overcooked 320% faster than it was designed to go and my PC only hit up to like 122%. If the clock multiplier wasn't limited to x8 on a 4MHz base clock, I'm sure the Z80 could go faster.

    Below is the Z80 test board I made:

  • Starting a compiler and some design updates

    FloppidyDingo10/20/2016 at 04:49 1 comment

    So I have quickly found out how tedious it is to write programs entirely in assembly, and I can't seem to find a way to get C to target this system, so I'm creating my own small program language that's C based, it's going to be called D. This language is system agnostic, you can target any system you like with it, with little to no modification. And you can get it to target different CPUs by telling it to translate with a different definition file, which is a file that tells the compiler what to translate the D instructions into.

    What the compiler will do is translate the D code into assembly code, then pass the asm file to this assembler: https://sourceforge.net/projects/sjasmplus/ . Then a binary file is generated and you can upload it to whatever you want.

    I'm also starting the design of the OS, called Walls (i am so going to be sued), which will be a multitasking OS with some form of GUI. The way it works is that a timer will supply an interrupt at a set interval, and that interrupt triggers the task scheduler to save the CPU state for that task, then move on to the next task, loading its CPU state. When Walls first starts up, it scans all the entire IO space and determines the available hardware. It then loads resources called System Artifacts, which are packets of data that describe certain things such as configurations, drivers for the scanned hardware, startup applications, and other things. The Artifacts reside in reserved drive sectors so they can be read without a file system. This is pretty much like the Registry in Windows. After it loads everything it needs, Walls then initializes the hardware and sets the graphics mode to Graphic, since it starts off in Text mode, and then loads the UI and then the user can do what they like. The OS can also go into ROM mode, where it loads a ROM file into the RAM and then tells the CPU to jump to that data, while disabling the timer interrupt. So pretty much the OS goes to sleep and the ROM file takes over. To go back to normal operation, the ROM has to jump to an address that contains code to resume normal OS function.

    I also have a pinout made for the expansion ports:

    I'm also going to add an interrupt controller to the chipset so that way the system can handle more than two interrupts. And I might add a DMA engine. Maybe.

  • Got some Memory

    FloppidyDingo06/15/2016 at 02:58 0 comments

    I got some RAM and ROM for the CPU to work with, now this machine can stop wasting away its life endlessly executing NOPs. For the RAM I got an AS7C256B 32KB SRAM chip. For ROM I got a flash chip (ST39SF010A 128KB) instead of EEPROM, since it's much much cheaper. Since I'm using flash and not EEPROM, writing is a bit different. That's why I made a flash programmer with my Arduino MEGA. It works, just not the way I want it too, so no source code yet. That will be posted when I clean it up and write a client app to easily upload ROM images to the programmer. Then when I start working on the BIOS file, i'll be sure to include built in ROM imaging, so that way I can update the BIOS in the computer itself through the serial port, and not have to move the flash chip to the programmer every time

  • And we're off!

    FloppidyDingo06/11/2016 at 01:22 0 comments

    I have the test circuit up and running, and I've done what I can to record the behavior of the CPU.

    The clock IC is there, it's just very small and doesn't show well on my low res phone camera.

    There were some issues with this circuit though. I have to let it sit for several seconds after powering it off before powering it back up, or else the CPU will stall. This was fixed by adding in a POR chip (shown below) so the CPU resets every power up. The CPU also seems to work on 3.3 volts too.

View all 4 project logs

Enjoy this project?

Share

Discussions

Dr. Cockroach wrote 04/02/2018 at 00:21 point

I just had to follow and like this project just because of the TRS-80 image. That was my own first computer but helped build a Imsai8080 before that :-)

  Are you sure? yes | no

ziggurat29 wrote 07/15/2017 at 20:28 point

Kewl (and bold) project; good luck with it!

Sound, serial, RTC, PS/2, keyboard, should be straightforward.

It will be interesting to see what you have planned for floppy/hard drive.  I myself chose to emulate and use SD storage, but that was a very different project.

You might consider adding ethernet.  The enc28j60 is a very inexpensive device.  It's SPI, but somehow I think you could even bit-bang it with the Z80.  Maybe.

I'll be interested to hear your plans for VGA.  I did a colour VGA with SPI -- it's not great resolution/colour depth, but it was uber cheap using only on-chip resources.  If you're going totally retro, then you might consider the CRT chips of the time...  Try to support 80 columns so you can support running then-cool OS's like CP/M.  Also, that will be useful if you want to port a really old BSD (pre-MMU) to your platform for a real multitasking OS.

Speaking of MMU, I'll be interested to hear how you are planning to do the bank-switching of the DRAM into the 16K space and also keep the DRAM refreshed.  Truthfully, aside from that challenge, I would suggest that ROM only be used for system bring-up, and that the core all be loaded in from flash/SD card, but that might violate some of the retro aesthetics you are going for (and which I totally appreciate).

I don't understand your recent overclocking post, though. What Z80 chip are you using?  Which manufacturer/date code? I imagine new ones might be capable of extreme overclocking simply because modern manufacturing processes are such that the older 4MHz limitation is farcical in the modern age. But what is a 'clock multiplier' in the Z80 context?  We didn't have that sort of stuff until the early 90's.

Anyway, again, best of wishes on the platform -- it will be exciting (and a little perverse) seeing an ancient processor doing modern things.  But wasn't that the whole point of something being Turing complete?

  Are you sure? yes | no

FloppidyDingo wrote 07/15/2017 at 21:20 point

Thank you for showing interest in my project!

First off, for the hard drive I'm using the standard PATA interface using 8 bit latches to hold onto the upper and lower halves of the 16 bit data bus needed. For floppy drives I'll have to find a floppy disk controller off of eBay or something since i can't seem to find one anywhere else.

I'm also planning on adding an SPI port for serial based memory such as SD cards, usinf shift registers and other logic gates.

I have recently heard of the enc28j60 and was actually planning on putting it in the list of features, I'd love this machine to have some sort of networking. I can also use the above mentioned SPI port to interface with this chip.

For VGA i was planning on making a 2d graphics card with it's own vram and the core running on a CPLD or FPGA. Having hardware accelerated graphics would take a ton of the load off of the CPU making it able to do other things. The card will have support for any column count up to 256, although having it up that high might lower performance to a crawl depending on how well I make the core.

For the DRAM, the MMU will have a base address, and it will map 16KB of the DRAM starting at that base address into the last 16K of the Z80's address space. For refresh, the MMU will use CAS before RAS refresh on each DRAM module when the ram is idle and after every memory access. The ROM is only going to be used to start the system up and load the OS from disk, along with some motherboard specific BIOS calls and utilities such as a memory checker and BIOS flasher.

In regards to my overclocking post, in the clock system is a neat little PLL 5 called the 501MLF. It takes a clock signal, and based on a combination of selector lines which i attached to jumpers on the board, multiplies that clock from 2 to 8 times. I wanted to put a little bit of a modern touch to this machine and decided overclocking would be a nice thing to have. The Z80 is brand new from Zilog, which is probably why it overcooked so much.

I look forward to seeing this old CPU do modern things too. I find the Z80 a really fun chip to work with being that it's simple and easy to get running.

  Are you sure? yes | no

ziggurat29 wrote 07/16/2017 at 00:39 point

re: the enc28J60, I think it's a good choice because it will offload the byte-by-byte ethernet work, and the z80 will just have to work at the packet level.  Please do read the errata on that chip -- it's been out forever, so clearly they will never fix the silicon problems (especially regarding fifo buffer allocation). Trivial to work around (and the workarounds are in errata sheet).  For prototyping, you can get little boards from China for USD$5 or so that have the jacks, transformers, and chip in place.  I usually keep 5 or so of these on hand at any given time to internetify whatever with a spi port.  (second only to a boatload of ftdi boards).

re: floppies, firmies, and hardies:  again, if you can get a SPI port up, you'll be able to usefully emulate block storage with ease, and partition that software development task off from the hardware support.  I suspect that when you go for real hardware interfacing, that it will be nice to have a known-good upper level driver in your pocket.

re: using an FPGA for VGA and DRAM, it could be viewed as a compromise of the retrocomputing aesthetics to use that more modern technology, but I agree with your choice, and 'hey' you're doing this all for fun, right?  Get a honker of an FPGA, and eventually, you might even be able to suck the Z80 itself into it....

Cheers!

  Are you sure? yes | no

FloppidyDingo wrote 07/16/2017 at 02:47 point

Yeah when I make my projects, I try to refrain from reprogrammable logic to cut down on costs and time, but my only other option is with a microcontroller, or design an ASIC. Using a microcontroller wouldn't be hardware acceleration but rather a software emulated GPU, and I can't afford to have an ASIC fabricated. So my only other option is FPGA.

As for the last idea, i actually thought of doing that and making a Z80 based SOC. But that's another project I'm saving for later

  Are you sure? yes | no

apocsantos wrote 10/16/2016 at 20:18 point

Interesting! Will it be able to run any version of DOS, or any small version of unix ? If you are considering using the Z80, it would be nice if there was a cartrige port that could load custom software and/or roms.

  Are you sure? yes | no

FloppidyDingo wrote 10/16/2016 at 20:55 point

The final goal of this project is to have it running some form of multitasking OS, and yes with the ability to load ROMs. I guess i should put in the final goals of this project in the description.

  Are you sure? yes | no

apocsantos wrote 10/18/2016 at 10:52 point

Cool! Thanks!
I've been thinking about this kind of machine for quite a while.
Also it's not clear for me if you are considering the same type of machine as the Apple II, with a main-board, with expansion ports for other cards, like a soundcard, VGA, and so on... It would be incredible to have such machine with 8bit expansion ports, so one could design and build expansion cards for it, like perhaps an ethernet card, or wifi, or whatever! The "sky" is the limit, I guess.


Also if power was provided to the main system board, by a common ATX power supply, it would be cheeper to get a power supply and easy to get. And that would make it more acessible for most enthusiasts, cause the lack of AT power supply's is groing every day.


Anywho, if you need any help, specialy with software, let me know.

  Are you sure? yes | no

FloppidyDingo wrote 10/19/2016 at 02:36 point

Yes, i was thinking of something Apple II ish, but with my own design. The entire thing will be customizeable, and the CRT display can come off too so you can make a video card that can connect to a color monitor. And about the power supply, I am making the power ATX standard so yes exactly so other people can power it easier. I have a 500 Watt power supply in my closet, even though it's a overkill for a small Z80 computer (but only a little ;) ). I am making my own PSU that's ATX compliant so i have something small to use. It's only going to be about 50 watts.

And if you'd like to program this machine, by all means go ahead! I'm going to write an emulator of the machine so you can program on that then make the ROMs when you're ready. You can request to join the project if you like since you're technically contributing to it.

  Are you sure? yes | no

JL9791 wrote 06/11/2016 at 17:50 point

Ah, I see.  Well, have fun with that and good luck! :)

  Are you sure? yes | no

JL9791 wrote 06/11/2016 at 15:17 point

Why the z80?  Zilog also makes eZ80 CPUs which are a little different, have some other features (such as 24 bit addressing mode), up to 50MHz clock, etc.

  Are you sure? yes | no

FloppidyDingo wrote 06/11/2016 at 17:09 point

I've heard of those before, but I have an interest in vintage tech. I like the Z80, IMO it's such a nice CPU. And i don't like how the eZ80 has a bunch of peripherals built in, it takes away from the fun of building them yourself.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates