close-circle
Close
0%
0%

Z80 overpowered computer

I am building a computer with a 4MHz Z80, 32KiB EEPROM, 32KiB RAM, IDE interface and UART.

Similar projects worth following
close
Super awesome z80 computer, fully upgradable and limitless. Also open source.

OK, so here are the system specs I will at least have in the end, and may get better over time.

RAM in minimal system32 KiB
maximum RAMTechnically unlimited....
video resolutionDepends on graphics hardware
Disk space in minimal system16 KiB EEPROM, Also IDE interface
expansion slots0-8
Extra featuresRTC, 
main system clock speed4 MHz (Or dynamic/auto adjust speed)
OSNTIOS (My own OS, see github repo)

This is the third attempt at getting this thing working, and it seems to be getting easier and cheaper over time. I think this time I'll get it right. Things on the board do quite a bit already, because there aren't really any errors in the PCB (for now). How nice!

CPU clock speed auto adjust

The RAM I am using is BLAZING fast. Not very retro, but whatever. The EEPROM, however is very slow. 150ns. If the EEPROM is deselected, why not go at a faster speed? The CPU I have can handle 20Mhz. New logic in my motherboard (see logs) allows faster speeds, but the other devices can only handle a small boost.  I am going to cap the speed at 8MHz for now, assuming EEPROM is unused.

Motherboard

I like the concept of motherboards.  I'm just used to it from building computers.   I have ordered 5 motherboards from easyEDA.  RTC is supported, but I when I ordered the RTC chips they sent me the wrong chips!  I will work on other stuff for now.

mobo_0.1.sch

Newer motherboard, actually ordered

sch - 58.63 kB - 09/12/2017 at 04:33

blank
See BOM
download-circle
Download

mobo_0.1.kicad_pcb

Newer motherboard, actually ordered

kicad_pcb - 917.19 kB - 09/12/2017 at 04:33

download-circle
Download

mobo.kicad_pcb

first version of my flexATX motherboard featuring a Z80 processor as a PCB

kicad_pcb - 641.09 kB - 06/17/2017 at 21:08

download-circle
Download

mobo.sch

first version of my flexATX motherboard featuring a Z80 processor schematic

sch - 54.35 kB - 06/17/2017 at 21:08

blank
See BOM
download-circle
Download

mobo.pro

the KiCad Project

pro - 2.46 kB - 06/17/2017 at 21:08

download-circle
Download

View all 6 files

  • 1 × Z80 CPU, min 4 MHz, preferably CMOS processor for the system made by zilog
  • 1 × 74HC42 Selects chips & boards, could be replaced by similar chips.
  • 1 × System Board Solder together on a protoboard
  • 5 × 1k resistor used for pull up and pull downs
  • 3 × 330 ohm resistor allows LEDs to run at 5 volts

View all 10 components

  • Reading sectors, FAT fs driver: error traceback

    Dylan Brophy10/08/2017 at 19:40 0 comments

    The CF card I had been using was 512MiB, which I have learned is incompatible with my hardware setup... thus the errors.  After getting a 128 MiB CF card, I tried an IDE/CF driver for Z80 I had downloaded a while back.  I read the first sector and got the os name at offset 3, then sent it via serial:

    I used the 'dir' command because there is no fs yet, so we can't list files.  But as you can see, it clearly responds with 'MSDOS5.0', meaning reading sector zero actually worked.  Yay!  now lets make a FAT driver...

    First tests of this FAT driver made the computer simply stop, endlessly waiting for the drive to be ready.  I knew the drive had errored, but why?  What piece of code caused the error?  Time to make a stack tracer.

    I put strings before each function call which could lead to an error, then made a program trace any drive error. We can see that the problematic code is at 0x489, where the filesystem is loaded. More specifically, where the root directory is loaded into memory.

    I got the drive error code: 0x10, like last time, that the sector wasn't found.  So I guess I tried to access a sector that isn't on the card...

    That is the next thing to fix.

  • Making friends with some compact flash (almost)

    Dylan Brophy10/06/2017 at 04:35 0 comments

    Many of my tests yesterday gave me zeros on the status register.  I played with it for a while with no avail, but I decided to treat the motherboard as if the expansion ports support hot plugging (they shouldn't).  To my surprise not only did the computer not crash, but the CF card actually started working!  Almost.

        The card gave me an error code: 0x10, aka Sector ID not found.  As of yet I haven't found out exactly where this error comes from, but I think it means that the sector doesn't exist.  I set the sector to zero, but I am currently using a crappy test driver that is probably the issue.  But, I'm talking to it!

    You will notice that usually the number (the status, in hex) is 51, bit one being set meaning an error occurred.  when I remove the CF card it becomes 50 once, indicating no error.  This means my driver code is broken.

    I am going to play with someone else's driver, will post another log.

  • Late Log, but motherboards received!

    Dylan Brophy10/01/2017 at 00:30 0 comments

    The new mobos somewhat work!  I am still compiling a list of things to fix, as the first boards always have problems (at least for me so far).

    Here are some pics:

    The board supports UART, 32KiB of RAM and 32KiB of ROM, a bq4845 RTC, ATX power, 4 expansion slots, and two different clocks for the CPU (switchable).  With an ATtiny a USB keyboard can be added.  There are more bells and whistles, but most of the features I listed aren't tested.  I don't have a bq4845 (I ordered 4, but they sent me 4 bq3285s instead).

    There are a lot of awesome things, but the board isn't perfect.  There are a few pullup resistors I forgot, and it doesn't have any LEDs ;(.  I am making a to do list for my next boards, don't worry.

    I also need to make that uPD7220 graphics card... I may need to actually order a board for that.  I would be worried about that however, because if a make a little mistake... there goes some money for nothing.  The embarrassing fact is that I don't have enough patience to solder the wires for a complex TTL circuit.  When I build that this machine will be incredible, especially considering that it should be possible to boost this thing up to 20Mhz: the graphics and CPU would be crazy powerful; really exciting.

    Unfortunately CF cards and IDE drives don't like any of my z80 computers, so I cant really do anything with files yet.  Without a file system an OS isn't super useful, so a CF card reader is the next step.

    The reason that I am building this computer to be so nice and powerful, even though it uses (largely) 80s tech, is that I want a platform to build an OS on.  And of course because building a computer completely from scratch.  The problem with modern computers is that they are too complex to fully understand from books, difficult to program on without an OS, and pretty much are impossible to completely build from scratch at this point.  A mixture of simpler, older tech with modern technology that works well with it is the perfect solution.  The computer can be fairly powerful, yet easier to program and construct.

    With that, here is a video of it working, plus a few more tidbits:

  • ORDER​ED THE MOTHERBOARDS.

    Dylan Brophy09/12/2017 at 04:29 0 comments

    My old boards were an incredible step forward, but they had limited functionality, were not built with power/input/simplicity in mind, sometimes were unreliable, and were starting to die.

    The new boards have proper ground planes plus some cool new features I have been planning for longer than I can remember, including:  Changing clock speeds, an RTC, and slots for IO and memory cards.  Also it adds support for USB keyboards and an ATX power supply.  I can't wait, execpt I dont have all the connectors I need to make it do everything, but it will still be awesome when I get it.

    Here is a pic from KiCad:

    You can take a peek for yourself, I will upload the files.

    Good day Hackers!

  • everything but keyboard and CF working

    Dylan Brophy07/13/2017 at 07:12 0 comments

    CF card is untested, but there is something really wrong with the keyboard. Certain keys, mainly ones far from the control circuit, don't work. I think I also found a firmware glitch. So there seems to be a matrix problem, right? but all keys work on my test area. Hmm. That's why I am 3d printing a keyboard back, maybe if there is interference or something causing the keyboard not to work in some places, it would be blocked. At least the video is working great!

    No pic today ;( oh well

  • Graphics and a keyboard in the works

    Dylan Brophy07/07/2017 at 07:48 0 comments

    Got basic graphics working; I essentially took one of the NGT20's predecessors and updated the firmware for better graphics.

    More exciting : the UART keyboard!

    I typed that on a home made mechanical keyboard! Nice and clicky... still am building the card that connects to the Z80 computer. I cant use the other UART as input because the graphics card uses the port. I mean, I could hack it, but... Actually I think I'm going to do that. Lol. Time to hack a graphics card and keyboard port!

  • ITS ALIVE!

    Dylan Brophy06/28/2017 at 23:33 0 comments

    UART FIXED! I hadn't soldered the oscillators ground line, so the UART chip had no clock signal. Duh. Anyways, I had written an OS with the help of an emulator I think starting about a year ago. Here is a branch of it running on my Z80 computer:

    Still a long ways to go. Next step: graphics!

    You see, the NGT20 is one of a line of video-card-like devices I made. My Z80 computer has been designed for a long time to be compatible with one of its unnamed relatives. I just got a CF card to IDE adapter and a CF card for files. Also, I have an RTC chip on the way so I can multitask. Lots of things happening moving forward!

  • Big ole update

    Dylan Brophy06/21/2017 at 14:48 0 comments

    OK, so for now I ditched the motherboard idea. I am not willing to buy a motherboard from a fab, so later I may make a homemade board with vias, as seen here. That blog is really awesome btw, consider reading it sometime.

    Well anyways I have been trying to get a 16550 UART working, so far with no luck. I have pretty much reduced the problem down to the UART or the data bus's connection to the 'expansion board' I made because I ran out of room on my first board.

    I also added a nice ATX power supply controller circuit, which allows power to go to the (currently useless) IDE hard drive. It's still pretty cool though.

    Well, here is the system so far:

    You can see why I need to make my own smaller and more clean PSU. This 'wires going crazy shorting everywhere' business with a WAY oversized powe is beyond terrible. OK, now the computer itself:

  • Designed a motherboard!

    Dylan Brophy06/17/2017 at 21:35 0 comments

    I spent many hours designing a motherboard in KiCad. It looks like it would work! No, this isn't retro anymore, but I think what I really liked about the Z80 was that it is simple, unlike modern processors, and powerful, unlike most arduinos. It has a DIP pinout, and it is simply the perfect combination of features for me to make a computer with. Since more powerful things are more complicated, and complicated projects can be fun, I realized what I was really aiming for was the most powerful Z80 computer I could build from scratch, then the best OS I could make for it. So it's new features are SUPER COOL (in my opinion).

    New Design Features

    • 2 Clocks for CPU, one for accessing slow devices and one for faster devices
    • RTC with interrupts to allow better multitasking and device polling, and of course timekeeping
    • Compatible with ATX power supply
    • Standard front panel connector
    • UART
    • built-in USB to PS2 keyboard converter
    • 32KB EEPROM
    • 32KB RAM
    • IDE connector

    I understand that many people who build computers with the Z80 are looking for a retro computer experience, to run old programs OSes or games they remember from the 80's. I didn't ever have that, so I don't really resonate with it. I found out about the Z80 by looking for something more powerful than an Atmel chip, because the computers I was trying to make were too big for it. That was 4 years ago, before I knew what an address bus was. So that is why I think in terms of motherboards, and video cards, and that every computer must have keyboard input and video output.

    I also may add more things, like a floppy disk controller. Or any other ideas anyone else has.

    Also, its about 335$ for 3 boards from OSH park, so I am going to see if I can do it a bit cheaper: decrease board size - or make a 2-layer PCB with vias underneath chips at home (Yieks!)

    Here are some pics of the new board to add to my file uploads:


  • Z80 Motherboard preliminary designs underway

    Dylan Brophy05/27/2017 at 23:43 0 comments

    Preliminary designs

    I basically took my old schematics and made some modifications. NGT20 graphics on the motherboard, EEPROM/RAM switch, support for modern computer power supplies. I guess this isn't 1980s, but rather a 1980s/present hybrid. I will update the project accordingly. I still am adding more things to the design, and I want to add support for RC2014 computer parts (see here). Here is the preliminary schematic:

    Expenses

    A smaller-than-ATX design I put on OSH Park to see the cost for 3 boards costs about $250.

    Cool 3D Printing Idea

    I want to make some more money before I do that, plus I just bought a 3d printer and 2kg of filament... Which brings me to an idea I have. What if I could 3d print a pcb? Not like make it in one of the specialized machines, but literally make the board from PLA or ABS filament? And have an alloy that melts at the same temp. as the filament? That will be a project I post in the future. So I might make the motherboard of my Z80 computer in the 3D Printer.

View all 13 project logs

Enjoy this project?

Share

Discussions

Hacker404 wrote 09/12/2017 at 02:16 point

If you want more speed then FLASH is much faster than EEPROM and easier to program - even the CPU can write to FLASH.

I normal FLASH chip is about 70nS and there are faster chips but they are more specialized. You can still get 1 Mib (128 kiB) FLASH chips in DIL / DIP format.

This project is coming together well !!!

  Are you sure? yes | no

Dylan Brophy wrote 09/12/2017 at 04:17 point

Thank you!  Yes I have tried to use FLASH in the past but write protection has caused problems...  I want the EEPROM/BIOS to be modifiable via the CPU.  I think flash is best for high density,  I'm thinking about using it for a special SSD drive that connects directly to the Z80's IO. I guess I could create some really cool software abstraction to make modifying the FLASH chip unnecessary and thus give faster speeds with the same functionality.

Actually, I used EEPROM originally because I couldn't program FLASH, but that has changed.... I've just stuck with the "32KiB EEPROM model."

I have something new to think about :D

  Are you sure? yes | no

Hacker404 wrote 09/12/2017 at 09:54 point

By SSD, I assume you mean IDE.

I tried IDE and it was a nightmare as I was using Compact Flash (CF) that has an IDE mode but it turned out that CF needs CMOS voltage levels and I was using a LVTTL CPLD. I plugged in a HDD instead of the CF and it finally worked.

If you are going to use IDE then here are the traps -

IDE stands for Embedded  Drive Electronics and IDE came out with the 8-bit XT. It was also used for the 16-bit AT.

There are 8-bit and 16-bit versions of IDE so people assume that the 8-bit relates to the XT and the 16-bit relates to the AT and that is not true at all.

The 8-bit IDE version was an 8-bit mode that was used on the 16-bit AT. The XT was completely different.

Apart from that if you get the voltages right and set the mode registers right and use LBA instead of CHS then all is good and it works well with a 8-bit Z80 bus.

The best place for IDE specs is the CF specification of version 3 or less that has the IDE mode included.

The FLASH chips aren't hard to use from memory you just need to do some prewrites to AA00 or something like that.

Here's some Arduino code for FLASH

It's was used with a CPLD as a shift register so it has serial_out but you can do the same with a parallel address / data bus of the Z80 -

void signal_delay()
  {
  //  This may be needed for long wire connections
  //delayMicroseconds(10);
  }

void sector_erase_delay()
  {
  delay(20); // 10mS
  }

void chip_erase_delay()
  {
  delay(40); // 20mS
  }

void write_delay()
  {
  delayMicroseconds(60);
  }


int read_address(long add)
  {
  int one_byte;
  //      data, WE, OE, CE, address
  //serial_out(0, 1, 1, 1, 0);
  //serial_out(0, 1, 0, 0, add);
  //serial_out(0, 1, 0, 0, add);
  serial_out(0, 1, 0, 0, add);
  toggle_S_LOAD();
  one_byte = serial_in_byte();
  return one_byte;
  }

void write_address(long add, int data)
  {
  //      data, WE, OE, CE, address
  serial_out(0xAA, 1, 1, 0, 0x5555);
  serial_out(0xAA, 0, 1, 0, 0x5555);
    serial_out(0x55, 1, 1, 0, 0x2AAA);
  serial_out(0x55, 0, 1, 0, 0x2AAA);
    serial_out(0xA0, 1, 1, 0, 0x5555);
  serial_out(0xA0, 0, 1, 0, 0x5555);
    serial_out(data, 1, 1, 0, add);
  serial_out(data, 0, 1, 0, add);
    serial_out(data, 1, 1, 0, add);
    write_delay();
  }

void sector_erase(int sector)
  {
  sector = sector & (total_sectors - 1);
  sector = (sector << 12);
  //      data, WE, OE, CE, address
  serial_out(0xAA, 1, 1, 0, 0x5555);
  serial_out(0xAA, 0, 1, 0, 0x5555);
    serial_out(0x55, 1, 1, 0, 0x2AAA);
  serial_out(0x55, 0, 1, 0, 0x2AAA);
    serial_out(0x80, 1, 1, 0, 0x5555);
  serial_out(0x80, 0, 1, 0, 0x5555);
    serial_out(0xAA, 1, 1, 0, 0x5555);
  serial_out(0xAA, 0, 1, 0, 0x5555);
    serial_out(0x55, 1, 1, 0, 0x2AAA);
  serial_out(0x55, 0, 1, 0, 0x2AAA);
    serial_out(0x30, 1, 1, 0, sector);
  serial_out(0x30, 0, 1, 0, sector);
    serial_out(0x30, 1, 1, 0, sector);
    sector_erase_delay();
  }

void chip_erase()
  {
  serial_out(0xAA, 1, 1, 0, 0x5555);
  serial_out(0xAA, 0, 1, 0, 0x5555);
    serial_out(0x55, 1, 1, 0, 0x2AAA);
  serial_out(0x55, 0, 1, 0, 0x2AAA);
    serial_out(0x80, 1, 1, 0, 0x5555);
  serial_out(0x80, 0, 1, 0, 0x5555);
    serial_out(0xAA, 1, 1, 0, 0x5555);
  serial_out(0xAA, 0, 1, 0, 0x5555);
    serial_out(0x55, 1, 1, 0, 0x2AAA);
  serial_out(0x55, 0, 1, 0, 0x2AAA);
    serial_out(0x10, 1, 1, 0, 0x5555);
  serial_out(0x10, 0, 1, 0, 0x5555);
    serial_out(0x10, 1, 1, 0, 0x5555);
    chip_erase_delay();
  }



  Are you sure? yes | no

Dylan Brophy wrote 09/12/2017 at 13:12 point

@Hacker404 

I have actually been trying to get a CF card to work, but the status register seems to return weird values.  Could be that the CF card uses CMOS...  Maybe then my old hard drive will work.  I designed the new board to support the ATX power connector so getting power would be that much easier.

But, actually, by SSD I meant another custom board full of FLASH chips or something that works as an SSD.  I'm still looking into it, I have some designs in my notebook.

About flash... Yea.  I have some flash chips and I programmed them with an arduino, but I guess I don't like all that 0x5555 and 0xAAAA stuff.  The ones I have worked like your code; they're the SST39SF040 and some variants.

My designs make use of 8-bit IDE, but I didn't know all those traps existed.  It seems that CF cards would be designed to be completely backwards compatible since the protocol is IDE.  I guess if I want to use CF card I have to use level shifter.

Thank you for your information, I value it.  When I ask for help in a project log no one helps.  If you have anything more to say, any ideas, I am all ears.

  Are you sure? yes | no

oshpark wrote 06/29/2017 at 19:34 point

Great project!

  Are you sure? yes | no

Dylan Brophy wrote 06/29/2017 at 20:20 point

Thankyou!

  Are you sure? yes | no

Mustafa Kemal Peker wrote 04/08/2017 at 16:31 point

Hi Dylan,

At last my monitor type OS (with inline assembler and disassembler )is ready
Please setup and try this v1.0b 
you can find all necessary information in my Efex pages;



http://peker.000webhostapp.com/Efex-V4/



please send me your comments than I can improve software



Thank you

  Are you sure? yes | no

Hacker404 wrote 03/27/2017 at 10:03 point

I'd love to see more details about this project. I have some similar projects as well. 

  Are you sure? yes | no

Dylan Brophy wrote 03/27/2017 at 14:31 point

Yes! I saw the #Z80 Retro Computer (With Graphics).  I think I can learn a lot from you.  You have excellent documentation and your projects seem to be made very cleanly.  Its really nice.  I havent looked much into that project in the past but looking more into it now I think I should study it!

I haven't worked on the project in a while because I need to figure some problems out and get some more extra cash. I have the money, I just want to grow it before I spend any.  Watch for a next update though - the project is not dead and I intend on completing it.

  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