Z80-MBC2: a 4 ICs homebrew Z80 computer

Homemade 8MHz Z80 SBC, 128kB banked RAM, RTC, SD (HD emulation), Basic and Forth interpreter, CP/M 2.2 and 3, UCSD Pascal, Fuzix and more...

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 (, with a SD as "disk emulator" and with a 128KB banked RAM for CP/M 3 (but it can run CP/M 2.2, QP/M 2.71, UCSD Pascal, Collapse OS and Fuzix 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).

* NOTE TO THE READER *: Due to a text size limitation of the Hackaday. io site a few chapters have been moved to "Log files". In this case you have just to click on the link of the chapter's title to open a new tab and read it.


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.


You should use a  Z80 CMOS speed grade of at least 8MHz for full speed, but setting the clock speed at 4MHz you can use a 4MHz Z80 CMOS version too (or you can try to overclock it at 8MHz...). The 74HC00 can be substituted with a 74HCT00 if you already have one. The RAM chip TC551001-70 can be substituted with any suitable 128kB SRAM).

Please note that the USER led  * must * be blue or white (or pink... I've some pink leds that seems to have a Vf like blue one. May be I'll do a board with them...) just to be sure that V(forward) is >= 2.7V (otherwise the USER key may not work as expected).

The J4 connector (AUX_P) is used as auxiliary power connector when an add-on board (uCom or uTerm) is connected.

The three solder jumpers (SJ1-3) on the bottom side are not currently supported and must  be left opened (as stated in the schematic).


It is possible to choose to populate on the PCB a GPIO port expander (U5) to add 16 bidirectional GPIO pins. The GPE option (see the schematic) can be used with the SPP Adapter board (see the paragraph: SPP (STANDARD PARALLEL PORT) ADAPTER BOARD).

The pinout of the GPIO (J7) connector is:


The  SERIAL port (J2, see schematic) can be connected with a TTL-RS232 adapter, or with a serial-USB adapter.
I've used a serial-USB adapter that acts also as power source for the Z80-MBC, and has the DTR signal for the "autoreset" driven from the Arduino IDE. For a terminal that has a serial TTL port no adapter is needed.

Of course to upload a "sketch" from Arduino IDE you need to use a serial-USB adapter connected to the SERIAL port.

Note that the RTS and CTS pins of the SERIAL port are not currently supported and must be left not connected (as the NC pin!).

The 3V3 pin of the serial-USB adapter must be left disconnected  (if present).

You should use those Serial-USB adapters that have the DTR pin on the connector. It is suggested to have also the CTS/RTS signals available for future upgrades.

Please note that all the pin...

Read more »

Z80-MBC2 User Manual - D081023-R280424.pdf

Z80-MBC2 User Manual

Adobe Portable Document Format - 11.66 MB - 04/28/2024 at 15:52


The content of the microSD needed to run CP/M 2.2, CP/M 3.0, QP/M 2.71, UCSD Pascal, Collapse OS and Fuzix with IOS S220718-R290823 (More info in the Changelog.txt file inside)

Zip Archive - 5.81 MB - 10/06/2023 at 10:40


The sketch for the IOS (with the needed libraries). Unzip into a folder and open the .ino file (with Arduino IDE). IOS must be uploaded into the Atmega32A flash. Adds support for Fuzix OS and the SPP Adapter board (more info in the changelog inside the .ino file).

Zip Archive - 43.75 kB - 09/24/2023 at 11:59



The sketch for the IOS in executable format (.HEX) with the bootloader. This executable file is intended for use with a programmer as the Atmel Ice or AVRISPmkII or others (Fuse bits: High Byte 0xD6, Low Byte 0xAF, Lock Byte 0xCF)

x-hex - 59.90 kB - 09/24/2023 at 12:04


SPP Adapter board -

All the documentation needed to build the SSP (Standard Parallel Port) Adapter board (A240721-R270921) including schematic, PCB assembling guide, Gerber files for PCB production. PCB is 55mm x 60mm 2-layers.

Zip Archive - 747.10 kB - 09/24/2023 at 15:10


View all 13 files

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


    Just4Fun10/09/2023 at 14:07 0 comments


    The TASM cross assembler (Windows CLI application) can be used for various CPU. It can be downloaded from here. The on-line manual is here.

    Using the TASM cross assembler it is possible setup a toolchain to program the Z80-MBC2, doing all the development on a PC and uploading the code with the serial port and then executing it on the target Z80-MBC2 with iLoad.

    After the download of the TASM zip file, unzip it into your working directory (it is the folder where your assembler source files are stored) and to assemble an user source give the command:

    tasm -s -h -c -g0 -80  <Your_source.asm> out.hex

    It will be created the out.hex file (Intel-hex formatted executable file).

    Now you can upload and execute out.hex using the iLoad boot mode of the Z80-MBC2.

    Remember that iLoad will take the first address of the Intel-Hex stream as the starting address of the program, and after the loading will jump to it.

    At this point you can follow the same steps to create an automated toolchain described in the paragraph "SDCC: SETTING UP AN AUTOMATED TOOLCHAIN (WINDOWS)".


    If you want create a binary file to use with the Autoboot boot mode you can generate it with the command:

    tasm -s -h -c -g3 -80   <Your_source.asm> out.bin

    It will be created a flat binary file out.bin. Then rename out.bin as autoboot.bin and copy it into the root of the SD used by the Z80-MBC2.


    Just4Fun10/05/2023 at 13:27 0 comments


    Using the SDCC (Small Device C Compiler) cross-compiler it is possible setup a toolchain to program the Z80-MBC2 with the C language, doing all the development on a PC and uploading the code with the serial port and then executing it on the target Z80-MBC2 with iLoad

    SDCC can be found here:

    After installing it, SDCC needs to be in some way instructed about how to deal with the specific HW of the Z80-MBC2.

    For this reason in the SD image, inside the \SDCC folder, there are two support files: S190818-R011023_crt0.s and S290923_Z80-MBC2.c.

    All the steps needed to configure the toolchain are explained below (we will assume a Windows operating system here, but the steps are similar for Linux):

    STEP 1:

    Copy the two support files S190818-R011023_crt0.s and S290923_Z80-MBC2.c from the SD image (\SDCC folder) to your working directory (it is the folder where your C source files are stored) and compile the first file with the command (from your working directory):

    sdasz80 -plosgff -o S190818-R011023_crt0.s

    It will be created the S190818-R011023_crt0.rel file.

    STEP 2:

    Now it's time to compile the second support file (S290923_Z80-MBC2.c). Here things are a little more complex because this file can be compiled in two different ways which differ depending on whether interrupts are enabled or not.

    The  need to have interrupts enabled or not depends on whether your user program uses them or not.

    To enable the interrupts support compile with the command (from your working directory):

    sdcc -c -mz80 -DZ80MBC2IRQ S290923_Z80-MBC2.c

    Instead to disable the interrupts support compile with (from your working directory):

    sdcc -c -mz80 S290923_Z80-MBC2.c

    It will be created the S290923_Z80-MBC2.rel file.

    STEP 3:

    iLoad uses the first address as starting address for the execution, so the executable file (Intel-Hex formatted) must be in ascending address order. This is not guaranteed by SDCC, so you need to use the srec_cat utility to sort the file. You can download this utility from here:  and then you have to copy the srec_cat.exe file into your working directory.

    All done!

    To compile your source file the command is (from your working directory):

    sdcc -mz80 --no-std-crt0 S190818-R011023_crt0.rel <your_source.c> S290923_Z80-MBC2.rel -o temp.hex

    It will be created the temp.hex file (Intel-hex formatted executable file).

    Now to sort the file give the command (from your working directory):

    srec_cat -disable-sequence-warnings temp.hex -Intel -o out.hex -Intel

    This will create the sorted file ready to be loaded with iLoad: out.hex.

    Now you can upload and execute out.hex using the iLoad boot mode of the Z80-MBC2.


    To create an automated toolchain you need another "ingredient", a terminal emulator supporting scripts. Here we will use Tera Term. You can download Tera Term from here:

    After installing Tera Term, from the SD image inside the \SDCC folder, copy into the working directory the following batch files: SDC.BAT and L.BAT.

    Before using the L.BAT batch file you have to adapt two parameters according with the configuration of your PC. 

    Go at line 18 and verify the path where Tera Term (ttermpro.exe) is installed, and at line 19 the number of the COM port used to connect the Z80-MBC2 to your PC.

    You need also to copy the Tera Term script LoadZ80.ttl from the /SDCC folder (inside the SD image) to the directory where Tera Term (ttermpro.exe) is installed, and adapt the parameter at line 15 with the complete path of your working directory in your system.

    Now to compile your_source.c file give the command (from your working directory):

    SDC your_source.c

    and to upload and execute it on the Z80-MBC2 (from your working directory):


    Remember to close the Tera Term window...

    Read more »

View all 2 project logs

Enjoy this project?



Florian wrote 05/15/2024 at 04:22 point

Am I missing anything or is it not possible to access the i2c port by software?

  Are you sure? yes | no

Just4Fun wrote 05/16/2024 at 15:47 point

I2C is used for the optional GPIO expander (and for the RTC too). If you want use it for something different and access it from SW you have to modify the IOS FW accordingly.

  Are you sure? yes | no

Florian wrote 05/16/2024 at 15:50 point

Ok. Then I will do that. Will post it here if I have something :)

Thanks for the great project 

  Are you sure? yes | no

Massimo wrote 03/10/2024 at 07:38 point

I see on facebook that one user add LCD display to the board where can I find some information and code ?

  Are you sure? yes | no

Just4Fun wrote 05/16/2024 at 15:51 point

Try to ask on FB.

  Are you sure? yes | no

JoeH wrote 08/18/2023 at 19:48 point

Does anyone know if the ATMega32 can be reprogrammed (sketch not bootloader) while still in circuit using the Z80-MBC2 serial port? I want to update my firmware to the latest version. Thanks.

  Are you sure? yes | no

Just4Fun wrote 09/13/2023 at 08:26 point

In your case you have to use the ICSP connector with an external programmer as the USBasp (as if you had a brand new Atmega32), and you can do it leaving the Atmega32 and the other chips on the board (be sure that the SD module is taken out from the board). There is no chance to program the Atmega with the serial port without  a bootloader.

  Are you sure? yes | no

StevenValentine-Page wrote 07/24/2023 at 00:10 point

OK am is there any BOM with all of the components like the resistor values and their number on the board? I can't find it anywhere.

Edit: I must not have looked very hard! 

  Are you sure? yes | no

TRStrider wrote 09/21/2022 at 18:04 point

I just wanted to take a moment to say that the Z80-MBC2 is an amazing project! It allowed me to explore an era of home computing I had missed out on since my first was the TI-99/4A in 1981. It reminds me of a modern incarnation of vintage machines like the SWTPC 6800 and others.

It was a pure joy to build and get up and running. Now it's time to build the uTerm and design a case for everything to go into!

So this classic geek says THANK YOU, Just4Fun!

Here is my full build log, perhaps it will help someone. :)

  Are you sure? yes | no

gtanasescu8 wrote 09/08/2022 at 06:17 point

Hi this is a verry nice project. Good work. I have an error when trying to compile the arduino sketch. 

Arduino : 1.8.19 (Windows 10), Carte : "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

D:\Users\g4b3\Downloads\F11RKKSJNEVGGU4\S220718-R190918_IOS-Z80-MBC2\S220718-R190918_IOS-Z80-MBC2.ino: In function 'void setup()':

S220718-R190918_IOS-Z80-MBC2:690:3: error: 'TCCR2' was not declared in this scope

   TCCR2 |= (1 << CS20);                           // Set Timer2 clock to "no prescaling"


D:\Users\g4b3\Downloads\F11RKKSJNEVGGU4\S220718-R190918_IOS-Z80-MBC2\S220718-R190918_IOS-Z80-MBC2.ino:690:3: note: suggested alternative: 'TCCR2A'

   TCCR2 |= (1 << CS20);                           // Set Timer2 clock to "no prescaling"



S220718-R190918_IOS-Z80-MBC2:694:19: error: 'COM20' was not declared in this scope

   TCCR2 |= (1 <<  COM20);                         // Set "toggle OC2 on compare match"


D:\Users\g4b3\Downloads\F11RKKSJNEVGGU4\S220718-R190918_IOS-Z80-MBC2\S220718-R190918_IOS-Z80-MBC2.ino:694:19: note: suggested alternative: 'COM2A0'

   TCCR2 |= (1 <<  COM20);                         // Set "toggle OC2 on compare match"



S220718-R190918_IOS-Z80-MBC2:695:19: error: 'COM21' was not declared in this scope

   TCCR2 &= ~(1 << COM21);


D:\Users\g4b3\Downloads\F11RKKSJNEVGGU4\S220718-R190918_IOS-Z80-MBC2\S220718-R190918_IOS-Z80-MBC2.ino:695:19: note: suggested alternative: 'COM2A1'

   TCCR2 &= ~(1 << COM21);



S220718-R190918_IOS-Z80-MBC2:696:3: error: 'OCR2' was not declared in this scope

   OCR2 = clockMode;                               // Set the compare value to toggle OC2 (0 = low or 1 = high)


D:\Users\g4b3\Downloads\F11RKKSJNEVGGU4\S220718-R190918_IOS-Z80-MBC2\S220718-R190918_IOS-Z80-MBC2.ino:696:3: note: suggested alternative: 'OCR2A'

   OCR2 = clockMode;                               // Set the compare value to toggle OC2 (0 = low or 1 = high)



exit status 1

'TCCR2' was not declared in this scope

Ce rapport pourrait être plus détaillé avec
l'option "Afficher les résultats détaillés de la compilation"
activée dans Fichier -> Préférences.

I am not an arduino  user. So if somebody can help please. My goal is to try using the board with a french Minitel and try to do a sort of BBS on it.

Thank you.

  Are you sure? yes | no

Robin Hourahane wrote 12/30/2022 at 19:42 point

Hi, In order to compile the source in Arduino you need to install the correct core using the board manager. The core required is the page has details on how to install the core. Once installed you need to select ATmega32 with an external 16MHz crystal. You need to select the same port as you connect on your terminal so you can't do both.

  Are you sure? yes | no

coopzone-dc wrote 02/16/2023 at 11:24 point

It looks like you have the wrong MCU set. It should be Atemga32A not Mega2560. It's good to use the facebook page, probably a faster responce.

  Are you sure? yes | no

Randall.Routh wrote 07/18/2022 at 16:54 point

I am impressed by your SBC.  I have seen some of your YouTube videos demonstrating the construction and operation of the MBC2 and MBC3.

I would like to see some videos about the evolution of the designed.  For example, why did you chose the static ram that you did?  What compromises went into the choice?  Why did you choose this particular AVR?  Are there things that you put in the Flash memory of the chip that you could have put on the SD card or vise versa?

I noticed that in the Rev3 board you connected A8 of the Z80 to A12 of the RAM.  I assume that this was done to simplify PCB layout.  When did you make this decision, and where there any other considerations?  You bank the memory. How did you decide on the bank size (64k, 32k, 16k, etc)?  Z80 address A15 goes to the AVR. What advantages and difficulties does that cause?

All communications between the Z80 and AVR appears to be via I/O ports 0 and 1. What went into that design decision? What have been the advantages and disadvantages to that choice?

You went from an SR flip flop and a WAIT to driving an interrupt on the AVR. How has this been better?

I would love to see a multipart series of videos with schematics and code segments to explain everything that went in the design and its evolution.

Thank you for sharing your design with the rest of the world.

  Are you sure? yes | no

Paolo Amoroso wrote 07/25/2022 at 16:21 point

Is there a Z80-MBC3?

  Are you sure? yes | no

Randall.Routh wrote 07/25/2022 at 19:22 point

  Are you sure? yes | no

Paolo Amoroso wrote 06/19/2022 at 11:52 point

Do you have a Chromebook? The Z80-MBC2 will most likely work with it. If the Chromebook doesn't immediately detect the board, try re-plugging it a few more times.

The Z80-MBC2 is working fine with my i7 ASUS Chromebox 3 under chromeOS 103. It's worth noting the board is detected only under Crostini Linux, not from the Android container or chromeOS itself.

  Are you sure? yes | no

Bob wrote 01/07/2022 at 13:36 point

Greetings all

I recently finished building a Z80-MBC2 and am having trouble with it.  When I apply power and it reset the IOS light blinks at about a 3Hz rate but there's no other sign of activity on the system except a short pulse when I press the reset button.  The ATmega32 seems to have been flashed successfully via an avrtiny.  Fuse bits are set properly.  Swapped out the atmega32 and Z80 chips, no joy.  Any pointers to what to check,or pointer to a discussion group or some such where I can discuss this more fully?

Thanks in advance


  Are you sure? yes | no

leo wrote 04/25/2022 at 11:22 point

I just finished building one yesterday and have exactly this issue.  I have double checked solder joints and begun looking for troubleshooting tips.  I also carefully compared my build with the detailed pictures in this project.  I am most suspicious of my serial connection since the board looks alive, like Bob's, and I successfully flashed the 32A with this a USBTinyISP programmer.  I have tried 1152008n1, 96008n1 with both IOS and IOS-lite.  Even tried multiple flashes of the 32A.  Next up for me is re-reading the info on this page and other's replies below and making time to investigate clocks and the like with an oscilloscope.  I'll update when I learn more about what I might have done wrong.

  Are you sure? yes | no

coopzone-dc wrote 02/16/2023 at 11:32 point

What os, if windows 11 then you need serial port drivers for the 2102 chip. You can see if the serial program is working ok by unplugging the mbc2 from the adapter put a dupont connector from RX to TX. Run your terminal software, make sure the keys you press are echoed back to the screen. You should see TX/RX led flash. If nothing then 99% driver problem. 

  Are you sure? yes | no

Edgar Salgado wrote 11/22/2021 at 20:17 point

Hello guys! 

A year ago I managed to get this up and runing. 

Now I want to update the IOS, but I am unable to find a way to flash the ATMEGA32 from the included ISP header using Arduino as ISP. I am connecting both ISP headers from the arduino to the Z80-MBC2, and when I try to flash, it resets the MBC2, then waits, and throws: avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xe0

I know I could probably take out the ATMEGA and put it in a breadboard, throw in a crystal, and flash it, but I think there must be a combination of keypresses to put it into "bootloader" mode?

Thanks for any hint :)

  Are you sure? yes | no

Edgar Salgado wrote 11/22/2021 at 22:14 point

Solved: I used a BusPirate to program with avrdude with no problem... it looks like Arduino as ISP does not quite work! THanks :)

  Are you sure? yes | no

ben wrote 08/04/2021 at 03:32 point

Hi all.  I've succesfully built the MBC2 on breadboard and can get the OS Lite (no SD Card) working!  When I add the SD Card, and flash the full OS, the system starts, but hangs on the boot menu and reports SD Error 2 NOT_READY on MOUNT operation.  
I've doubled checked the wiring.  I can successfully use the SD Card module with PetitFS running on an Arduino Uno.  I can even flash PetitFS and run the test on to a brand new ATMega128.  So I know the SD Card reader is working.  It just won't work with the MBC2.
I have also checked the SCK, CS output on a logic analyser and from what I can see the clock is cycling and there are pulse on the CS, but no data on MISO or MOSI.  I'm stuck!    I'm using a 16GB micro SD card so not sure if that is too big??   Any help appreciated. Cheers

  Are you sure? yes | no

ben wrote 08/08/2021 at 09:10 point

After lots of testing and cursing, I determined that the USB breadboard power supply unit (YuRobot) was only supply 3.3V even though it was jumped for five.  Turns out this unit needs to be feed 6.5-12V in order to output 5V!  I had powered directly from USB 5V which for some reason it steps down to 3.3V - not enough to power the SD Card, but apparently enough to power the Z80, RAM, and ATMega128.   I attached 5V and everything worked immediately!  Great project!

  Are you sure? yes | no

alexjhardy wrote 07/14/2021 at 20:23 point

Hi all. I've successfully completed the Z8-MBC2 and it works fine. I've just completed the uTerm board and programmed the STM32 successfully following the instructions on the site. I have a problem now in the monitor says "no input detected".  I tried the test points TP1 - TP4. TP1 (RGB) I get 2.6v and nothing on TP3/4. Not sure what values I should have, can't find any info for these. Using a new VGA cable and a monitor that was working fine.  Not sure what to do next.  Any help would be appreciated. Thanks.

  Are you sure? yes | no

Just4Fun wrote 07/17/2021 at 09:39 point

Check if the keyboard's led work (NUM LOCK, CAPS LOCK...). If not there is a problem with yours STM32.

  Are you sure? yes | no

alexjhardy wrote 07/17/2021 at 13:49 point

J4F, many thanks for your prompt reply. Tried the keyboard, no lights! Resoldered the SMT32, doesn't look pretty but  SUCCESS!!!  Once again many thanks, regards Alex.

  Are you sure? yes | no

John wrote 07/14/2021 at 16:34 point

I have trouble in communicating with the board! Using putty (9600 bauds, 8 data bits, 1 stop bit, no parity, no flow control) I receive (after pressing the reset button) a flow of about 550 chars, but they are gibberish! LEDs are blinking "normally"' and the behavior is repeatable, so I presume the program is correctly loaded - how could I go further?

  Are you sure? yes | no

Just4Fun wrote 07/17/2021 at 09:36 point

IOS serial wants 115200bps 8N1, IOS LITE 9600bps 8N1.

  Are you sure? yes | no

Dario Lampa wrote 06/19/2021 at 18:25 point

Hi j4f, great project, nice job. I assembled the kit bought by Mc John. It worked immediately as soon as mounted, but when I set the frequency of 8 MHz the bootstrap stops at "IOS Z80 is running from now". If I set the working frequency to 4 MHz then it works normally. Thanks for any suggestions.

  Are you sure? yes | no

Just4Fun wrote 06/21/2021 at 12:40 point

Hi, this is a very unusual issue... Have you checked the board assembly if it is correctly assembled (values, solder joints, etc...)?  Check D8, D9 and R19 and R13 if they are the right values and correctly assembled. Then the only thing I can suggest is to try to change the Z80 CPU (remember only CMOS version!).

  Are you sure? yes | no

Vitaly Rudik wrote 03/08/2021 at 05:36 point

My changes are here:
Note: I connected /IORQ z80 to INT0 MCU

  Are you sure? yes | no

Just4Fun wrote 03/11/2021 at 08:56 point

Interesting... Thanks for sharing.

  Are you sure? yes | no

Vitaly Rudik wrote 03/07/2021 at 20:09 point

The highest baud rate when it worked for me was 38400.
I added flow control and now it is working on 115200.

void serialEvent()
// Set INT_ to ACTIVE if there are received chars from serial to read and if the interrupt generation is enabled
  if (Serial.available()) 
    digitalWrite(MCU_RTS_, HIGH);
      digitalWrite(INT_, LOW);
      digitalWrite(INT_, HIGH);  
    digitalWrite(MCU_RTS_, LOW);

and in loop()

          ioData = 0xFF;
          if (Serial.available() > 0)
            ioData =;
            LastRxIsEmpty = 0;                // Reset the "Last Rx char was empty" flag
          else LastRxIsEmpty = 1;             // Set the "Last Rx char was empty" flag
          digitalWrite(MCU_RTS_, LOW);

  Are you sure? yes | no

proto raven wrote 03/07/2021 at 14:36 point

I am having trouble getting XMODEM to work and may be misunderstanding something.

I am using Z80-MBC2 CP/M 2.2 BIOS - S030818-R140319

with extraputty terminal program that has xmodem support (flow control set to none)

I set MBC2 to receive a file , then I run XMODEM on terminal and send.

The count starts at 0/3 then goes to 10/3 before hanging.

Am I getting this totally wrong or missing something?

  Are you sure? yes | no

villaromba wrote 03/07/2021 at 19:03 point

What baud rate are you using? Have you tried a lower rate to see if it will work successfully?

  Are you sure? yes | no

proto raven wrote 03/08/2021 at 01:33 point

got the xmodem to work, but where it appears I went wrong is that I had assumed that the latest IOS/SD setup had default Rx input buffer size to 128 bytes
seems this is not the case and one has to add it.

if my thinking is wrong please correct me so I dont lead others astray.

  Are you sure? yes | no

Paolo Amoroso wrote 06/19/2022 at 18:54 point

Which IOS/SD version comes with the default Rx input buffer size to 128 bytes?

When sending files to the Z80-MBC2 under CP/M 3.0 from my Linux system via Minicom, XMODEM times out in most cases. On the CP/M side, running XMODEM with the /X0 option doesn't help.

  Are you sure? yes | no

r.orfei wrote 07/20/2021 at 18:18 point

XMODEM <filename> /X0 /R -------> to Receive

XMODEM <filename> /X0 /S -------> to Send

(X0 means: "use CON:" which should be the putty comm channel

  Are you sure? yes | no

proto raven wrote 03/01/2021 at 11:28 point

Thanks for a fun project to build. Just finished my initial build and works great. Now lets see what I can do with it.

  Are you sure? yes | no

Vitaly Rudik wrote 02/23/2021 at 08:27 point

Hi Just4Fun!
I have assembled this device, it is a cool project. But I noticed some overengineering. You don't have to use RS-trigger to extend WAIT signal and use BUSRQ signal to reset the trigger, it is enough to use only one OR gate.
WAIT_RES is positive in this case. The IORQ signal instantly goes through OR gate to WAIT input and suspends the IO operation. When atmega finished to process the operation it sets high level on WAIT_RES and wait for high level on IORQ pin then it can reset WAIT_RES.
Of course, it needs some changes in firmware.
If we replace 74hc00 with 74hc32 we can simplify bank switching. . I drew an additional XOR gate which allows to use High or Low 32k of address space for banking. It is optional feature. 
The XOR gate can be based on 2 transistors and 3 resistors

  Are you sure? yes | no

Robin Hourahane wrote 01/05/2021 at 16:57 point

Hi, I've been working on my own version of IOS-MBC2 but I think I'm running out of memory trying to use the Arduino SD library so I can new files to the SD card. Has anyone manage to use this library or another to write new files to the SD card.

Alternatively has anyone tried using a ATmega128 instead of the ATmega32, can't see why it wouldn't work but thought I'd ask before trying just in case its a known to cause issues.


  Are you sure? yes | no

villaromba wrote 01/11/2021 at 16:17 point

I currently use the Atmel 1284 if of any help for extra mem.

  Are you sure? yes | no

Robin Hourahane wrote 01/11/2021 at 18:35 point

Thanks for the info.

Hoping that the extra memory will allow me to use the standard SD library to read, write and create files so I can add opcodes to access the FAT file system from CP/M using a new program to do the copying.

My SD changes are on the  use-std-sd-library branch


I have now got a Atmega1284 and its working well thanks to villaomba timer changes. My SD card problems were down to the change in library not memory but as I want to add a lot more functionality I'll stick with the larger chip.

  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