Close
0%
0%

Z80-MBC2: 4ICs homemade Z80 computer

8MHz Z80, 128kB banked RAM, RTC, Disk on SD, Basic and Forth interpreters, CP/M 2.2 and 3, cross Assembler and C (SDCC) toolchains

Similar projects worth following
The Z80-MBC2 is an easy to build Z80 SBC (Single Board Computer).

It is the "evolution" of the Z80-MBC (https://hackaday.io/project/19000-a-4-4ics-z80-homemade-computer-on-breadboard), with a SD as "disk emulator" and with a 128KB banked RAM for CP/M 3 (but it can run CP/M 2.2 too).

It has an optional on board 16x GPIO expander, and uses common cheap add-on modules for the SD and the RTC options. It has an "Arduino heart" using an Atmega32A as EEPROM and "universal" I/O emulator (so a "legacy" EPROM programmer is not needed).

It is a complete development "ecosystem", and using the iLoad boot mode it is possible cross-compile, load and execute on the target an Assembler or C program (using the SDCC compiler) with a single command (like in the Arduino IDE).


* * HARDWARE OVERVIEW * *

The needed ICs for the "base system" are:

  • Z80 CPU CMOS (Z84C00) 8Mhz or greater
  • Atmega32A
  • TC551001-70 (128kB RAM)
  • 74HC00

If you want the 16x GPIO expansion (GPE option) add a MCP23017 too.

The schematic and the BOM are attached in the Files section. The MCU Atmega32A is used as universal I/O subsystem, as Eeprom, and as reset and 4/8MHz clock generator for the Z80 CPU.
Inside the Atmega32A it is flashed an Arduino bootloader taken from here, and it is possible to use the Board Manager of the Arduino IDE to "import" it.

Flash the Arduino bootloader at first (with the method you prefer), next you can upload the IOS "sketch" (the I/O Subsystem that interacts with the Z80 bus and "virtualizes" the EEPROM and all the peripherals seen by the Z80 CPU) using Arduino IDE.

You can use the on board ICSP port J3 (also called ISP port) to write the bootloader, but remember to disconnect any other connector when using it. Also both SD and RTC modules (if present) must be removed from the board when the ICSP port is in use.

As clock source for the Z80 CPU it is used the 16MHz Atmega32A oscillator, so the "external 16MHZ osc." bootloader variant must be chosen when flashing the bootloader from the Arduino IDE!.

The 74HC00 is used as RS flipflop to stop the Z80 CPU during I/O operation, giving the needed time to the Atmega32A to interact with the Z80 bus, and as part of the MMU.

Note that only the CMOS version of the Z80 CPU can be used here. This because only CMOS version, under given condition that are respected in this schematic, has logical levels compatibles with Atmega32A and 74HC00.


NOTES ABOUT THE COMPONENTS:

You should use a  Z80 CMOS speed grade of at least 8MHz for full speed, but setting the clock speed...

Read more »

STARTREKV2.BAS

The famous game Super Startrek kindly debugged by a RetroBrew Computer Forum user. Play with Caps-Lock activated! Now the animation works...

bas - 20.18 kB - 08/07/2018 at 16:32

Download

TREKINST.BAS

Instructions for STARTREK.BAS

bas - 6.80 kB - 08/04/2018 at 21:48

Download

Examples with Basic.txt

Some examples showing the new "Virtual I/O Engine" with the stand-alone 8K Basic interpreter.

plain - 4.07 kB - 07/31/2018 at 20:57

Download

S220618_IOS-LITE-Z80-MBC2.ino

The "sketch" for the IOS-LITE.

x-arduino - 153.28 kB - 07/25/2018 at 16:13

Download

A040618 Gerber.zip

Z80-MBC2 PCB Gerber files.

x-zip-compressed - 244.39 kB - 07/25/2018 at 16:06

Download

View all 8 files

  • 1 × See the file "A040618 BOM.ods" in the FILES section.

  • How use the ICSP port with the USBasp programmer under linux to burn the bootloader

    Just4Fun07/27/2018 at 15:57 0 comments

    A cheap and easy way to burn the Arduino bootloader is to use an USBasp programmer that is commonly available:

    The USBasp is also capable to give the power to the "target" using the VCC pin, but remember to check that the JP1 jumper is set to provide 5V to the target (as shown in the photo).

    Please note that the pinout of the USBasp is a little different from the "standard" ICSP (os ISP) pinout:


    In the previous picture it is possible see that pins 4 (TXD) and 6 (RXD) are not at GND as expected  by the standard ICSP port, and pin 3 is not NC.

    See the following picture showing the standard 10 pin ICSP pinout:


    So you must consider this when connecting the USBasp to the 6 pins ICSP port (J3) on the Z80-MBC2 (see the schematic):

    To avoid problems I suggest to use as GND pin 10 of the USBasp connector, and connect the other pins (VCC, MISO, MOSI,SCK, RST) accordingly.

    An handy way to connect the USBasp to the 6 pin ICSP port (J3) of the Z80-MBC2 could be to use a commonly available "10pin to 6pin" adapter like this:


    but you cannot use it "as is" because its internal connections are done for a "standard" ICSP port, and we have seen that the USBasp connector differs from the standard one.
    The schematic of the adapter shows that isn't compatible "as is" with the UABasp connector:


    To use it is a good idea isolate the pins 4, 5 and 6 cutting the trace on the PCB of the adapter that connects those pins together, and then check with a tester.
    In the following photo are shown the three cuts (thin red lines inside the green "circle") to do:


    BURNING THE BOOTLOADER FROM ARDUINO IDE:

    To easily burn the bootloader follow these "quick and dirty" steps (tested on a linux Mint OS with Arduino IDE 1.8.5):

    STEP 1: Connect the 10 pins connector of the USBasp programmer to the 6 pins ICSP port (J3) of the Z80-MBC2 (using wires or a modified adapter as discussed before);

    STEP 2: Verify carefully that any other connector of the Z80-MBC2 is not used, and verify that both the SD and RTC modules (if present) are removed from the board;.

    STEP 3: Only at this point connect the USB side of the USBasp programmer to an USB port of your workstation;

    STEP 4: Open a "terminal" window on your workstation and go to the directory where there are the Arduino IDE executables, and get the root privileges with the command:

    sudo su

    then run the Arduino IDE with the command:

    ./arduino

    STEP 5: Because Arduino IDE is running as the root user it is necessary re-install the "core" for the Atmega32. Open the Board Manager as you already did (anyway  the guide is here). Note that you must do this step only the first time you execute the Arduino IDE as root;

    STEP 6: Now from the Tools menu of Arduino IDE select "Atmega32" as "Board", "16 MHz external" as "Clock", and "USBasp" as "Programmer". Then you can burn the right bootloader (without playing with the FUSE setting) selecting "Burn Bootloader" from the same "Tools" menu.

    All done!

View project log

Enjoy this project?

Share

Discussions

villaromba wrote 08/11/2018 at 07:51 point

Built up my board yesterday - no output!! until I realised I had clock fusebits inverted!! Reprogrammed AVR (TL866) and then it worked immediately, pleased all hardware/soldering was 100%!!. Put my AVR on a ZIF, just fits nicely. RTC should be here over weekend. I already have a Pololu SD so hoping that will be ok when ready to fit. Thanks again J4F for another excellent design and look forward to where it might develop.

  Are you sure? yes | no

Just4Fun wrote 08/11/2018 at 08:02 point

Thanks!

I think this may interest you... :) : https://twitter.com/Just4Fun_J4Fun/status/1027158962242772992.

PS: Check carefully that the Pololu SD has the 3.3V regulator and level shifters on board, and how to connect it as it is different from that one I've used here.

  Are you sure? yes | no

villaromba wrote 08/11/2018 at 10:39 point

Great!!! - it works with the Pololu SD card, with level shifters (all I had) just needed to make small adapter to ensure pin compatibility. 

  Are you sure? yes | no

villaromba wrote 6 days ago point

What will be the longer term plan for CP/M files on the SD Card e.g will it be able to read files from Peter Schorns Z80 simulaior (https://schorn.ch/)  or Z80 pack (https://www.autometer.de/unix4fun/z80pack/)?  OR ???

  Are you sure? yes | no

Just4Fun wrote 6 days ago point

The first link is interesting as i didn't know anything about it. (the second is well known).

About the SD,  I'll use "disk files" each equivalent to a disk of 512 tracks of 32 sectors. A sector is 512 bytes large, as the SD physical sector. So any SW that can "understand" this can read/write files on it.

E. G. using cpmtools with the correct parameters will work (I hope...) :)

I've to manage a "deblocking" algorithm for CP/M2.2, because it can use natively only 128 bytes sectors (CP/M 3 can use 512 bytes sectors natively, as far I know...), and this will take "some" time...

  Are you sure? yes | no

Just4Fun wrote 08/05/2018 at 11:57 point

For those interested I've set up a twitter account to follow the "day by day" developments (and others things too)...: https://twitter.com/Just4Fun_J4Fun

  Are you sure? yes | no

Norihiro Kumagai wrote 08/05/2018 at 07:23 point

I have one comment, some N-MOS CPU also work well, at least, NEC upd780-1 works well on both Z80-MBC, and Z80-MBC2.  If someone have one or more N-MOS Z80, It might work on these boards.

  Are you sure? yes | no

Norihiro Kumagai wrote 08/05/2018 at 07:19 point

I built a PCB and see the BASIC prompt and run a Blink BASIC program.  Quite good.  Thank you very much. If you are interested in it, please refer my blog https://dip40.wordpress.com/  or my tweet (@tendai22plus).

  Are you sure? yes | no

Just4Fun wrote 08/05/2018 at 09:27 point

You have a very good blog. It's really a pleasure read it!

  Are you sure? yes | no

Just4Fun wrote 08/02/2018 at 17:02 point

HI all, and thanks for your comments!

Here IOS booting from SD: https://farm2.staticflickr.com/1793/43090760674_723f2eb475_o.png

Now starting to play with CP/M 2.2...

  Are you sure? yes | no

Mark Jungwirth wrote 07/31/2018 at 17:05 point

I just ordered 5 PCBs from https://www.pcbway.com/project/shareproject/Z80_MBC2__4ICs_homemade_Z80_computer.html

Is anyone planning a component order that others could tag along on?

Awesome work, J4F!!!

  Are you sure? yes | no

john wrote 07/31/2018 at 19:28 point

Hey Mark - I've got the parts from the original board that I'm planning to reuse, but  if you've got an extra board you'd be willing to part with, I'd be willing to buy one from you.

  Are you sure? yes | no

Mark Jungwirth wrote 07/31/2018 at 20:01 point

John, not a problem.  I only paid for ePacket delivery so it might be a couple of weeks.  My cost is $3 and I should be able to send USPS first class for less than $1.

  Are you sure? yes | no

john wrote 07/28/2018 at 20:52 point

Great job!!! Again!

  Are you sure? yes | no

villaromba wrote 07/28/2018 at 19:51 point

Ordered pcb from EasyEDA. Looking forward to start building in a few weeks. It will be good to have the SD Card this time. Be so much easier to load up!!!

  Are you sure? yes | no

Peabody1929 wrote 07/29/2018 at 04:01 point

Could you share how you uploaded the gerbers to EasyEDA?  I get "Bad File Format".

  Are you sure? yes | no

villaromba wrote 07/29/2018 at 08:28 point

When I ordered (got transferred to JLCPCB) it asks for Gerber files - so I just uploaded the zip file from this site, kindly provided by Just4Fun. All went through ok without any problems. So maybe you should download zip file again and try a new upload to EasyEDA in case one or the other corrupted.

  Are you sure? yes | no

nemfield wrote 07/28/2018 at 12:16 point

Excellent work. There is elegance in simplicity , and you nailed it. I'll be ordering boards asap. 

  Are you sure? yes | no

Norihiro Kumagai wrote 07/28/2018 at 02:37 point

I ordered 10 PCBs with your garber data to fusionPCB.  I am quite looking forward to receiving them to start soldering.  Thank you for your kindly preparing.

  Are you sure? yes | no

Just4Fun wrote 07/28/2018 at 06:26 point

Thanks! Happy soldering... :-)

  Are you sure? yes | no

Jose Manuel Arenas wrote 07/27/2018 at 18:44 point

Very nice project. I love it.

  Are you sure? yes | no

Just4Fun wrote 07/27/2018 at 19:22 point

Thanks!

  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