close-circle
Close
0%
0%

A 4$, 4ICs, Z80 homemade computer on breadboard

No iron, no cry! Build a mini 4MHz Z80 64kB RAM system with Basic and Forth interpreters, CP/M 2.2, QP/M 2.71, Assembler and C toolchains

Similar projects worth following
This is the Z80-MBC (Mobile Breadboard Computer), a mini 4MHz Z80 64kB RAM system with Basic and Forth interpreters, CP/M 2.2, QP/M 2.71, Assembler and C toolchains. It can be easily expanded and it has an "Arduino heart" using an Atmega32A as an "universal" I/O emulator, and can be used and powered with a tablet or smartphone too...

During some surfing on Ebay I realized that with 4$ it is possible to buy enough ICs to build a complete Z80 system that can be done using a breadboard, and taste some flavor of retro computing.... So I did it and here it is the story!

Here is a video with the Z80-MBC in action:

and here with a smartphone (so it is explained the word "Mobile" in his name...) with a common OTG cable (the various test clips in this video were used for some measurements with a Logic Analyzer):


* * HARDWARE OVERVIEW * *


The needed ICs are:

  • Z80 CPU CMOS (Z84C00) 4Mhz or greater ($1.16)
  • Atmega32A ($1.70)
  • TC551001-70 (128kB RAM) ($1.10)
  • 74HC00 ($0.25)

Total cost: $4.21

The wires were taken from salvaged broken LAN cables, and the other components were salvaged from others unused breadboards.

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

Flash the Arduino bootloader at first (with the method you prefer), next you can start to build the whole thing!


Of course I used the Arduino IDE to develop the IOS (I/O Subsytem) that interacts with the Z80 bus and "virtualizes" the peripherals seen by the Z80 CPU.
As oscillator it is used the internal 8MHz Atmega32A oscillator, so no quartz is needed, and from this one is derived the 4MHz clock for the Z80 CPU (so the "Internal 8MHZ osc." bootloader variant must be chosen when flashing the bootloader from the Arduino IDE!).


The 74HC00 is mainly 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.
The 128kB RAM TC551001 is used only for half (64kB) because the Z80 address space is only 64kB (I've chosen this IC for the low cost).
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 can use any Z80 CMOS speed grade, because the lowest is 4MHz.
The 74HC00 can be substituted with a 74HCT00 if you already have one.
The RAM chip TC551001-70 can be substituted with any suitable 64kB RAM (do not use < 64kB RAM).
The USER led (D5 in the schematic) MUST be blue or white just to be sure that V(forward) is >= 3V.


Here is a video that shows a simple basic program that interacts with the "USER led" and "USER key":



On the breadboard there are others status led: the HALT led turns on if an HALT instruction is been executed and the Z80 CPU is in a Halt state, the DMA led turns on during DMA operations when the Z80 bus is in Hi-Z, the IO_OP led turns on when the Z80 CPU is accessing a I/O virtual device "emulated" by the Atmega32A (as the serial port), the LED_D0 led is the classical "Arduino" led (that one connected to D13 pin on the Arduino Uno) that here is connected with the Arduino D0 pin and is turned on normally as a power on indicator.


The serial port SERIAL-USB (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.


In the schematic there is also the IOEXP port to expand the I/O capabilities, i.e. adding GPIO ports or a RTC for future expansions.


* * SOFTWARE OVERVIEW * *


I've "ported" the Basic interpreter to the Z80-MBC using the sources provided in the great Grant Searle site , after the needed modification due the different HW design. In the Grant's site is requested an acknowledgement to his site to use this source, so I did here (and I have also emailed to him about this thing).
The resulting ROM image is stored inside the Atmega32A and loaded in the...

Read more »

SRecord-custom.zip

Batch and custom files for SRecord utility to make custom virtual disk images.

Zip Archive - 16.06 kB - 05/29/2017 at 15:03

download-circle
Download

CPMtools-custom.zip

Batch and custom files for CPMtools utility to make custom virtual disk images.

Zip Archive - 4.48 kB - 05/29/2017 at 15:02

download-circle
Download

S221116_R110517_Z80.ino

The sketch for the Atmega32A (New release. Adds the QP/M 2.71 and RTC support).

x-arduino - 167.77 kB - 05/23/2017 at 19:21

download-circle
Download

BIOS QPM271 - S080517.asm

Source file of the BIOS for QP/M 2.71 with the RTC support

asm - 34.20 kB - 05/23/2017 at 19:19

download-circle
Download

QPM271_DiskPack.zip

QP/M 2.71 Disk 0 image

Zip Archive - 110.02 kB - 05/23/2017 at 19:18

download-circle
Download

View all 28 files

  • How to make custom Virtual Disk images

    Just4Fun05/29/2017 at 14:29 1 comment

      To do that you need two really powerful tools: Cpmtools to create CP/M disk images and SRecord to manipulate ROM/EPROM images.
      Take in account that the structures of the virtual disk 0 and 1 of the Z80-MBC are different. Disk 0 has the two first tracks reserved for the system image (loaded into RAM by the CP/M loader), instead disk 1 doesn't have this "reservation". This means that the images have a different "structure". More, because disk 0 must have the system image inside the two first tracks, the disk 0 image creation will be different if the OS is CP/M rather than QP/M.
      So to make things easier I've prepared some batch file to simplify the needed operations.
      As for the Assembler and C toolchains you need a Windows host or VM.


      Here all the steps to set up the needed tools:

      1. Create a working directory on your Windows Machine;
      2. Download Cpmtools and unzip in your working directory;
      3. Download last version of SRecord and unzip in your working directory;
      4. Download from the Files section CPMtools-custom.zip and unzip the files into the directory containing the Cpmtool executables (as cpmcp.exe). During the copy overwrite the file DISKDEFS because the new one contains the needed definitions for the Z80-MBC;
      5. Download from the Files section SRecord-custom.zip and unzip the files into the directory containing the SRecord executables (as srec_cat.exe).

      Now you are ready to create your custom image. First create a sub-directory (called e.g. CPM-files) in the cpmtools directory to store all the files to load in the disk image. Check that they fit into the 128kB avaliable space.


      Steps to create a Disk 1 image

      1. Go to the cpmtools directory and with an editor modify/add/delete in the file MakeDisk1.bat the various lines "cpmcp -f z80mbc-d1 %dskfile% CPM-files\xxxxx.yyy 0:xxxxx.yyy" to match the directory in your host (if needed) and all the files to load (xxxxx.yyy);
      2. From the cpmtools directory open the provided DOS command shell and give the following command (I'll use here the name disk1.dsk for the disk image file):
        MAKEDISK1 disk1.dsk
      3. After the execution copy the file disk1.dsk in the SRecord directory;
      4. Go to the SRecord directory, open the provided DOS command shell and give the following command:
        D1TOHEX disk1.dsk
      5. After the execution you will find four files named from disk1_SEG0.hex to disk1_SEG4.hex to upload into the virtual disk with iDisk.


      Steps to create a Disk 0 CP/M image

      1. Go to the cpmtools directory and with an editor modify/add/delete in the file MakeDisk0CPM.bat the various lines "cpmcp -f z80mbc-d0 %dskfile% CPM-files\xxxxx.yyy 0:xxxxx.yyy" to match the directory in your host (if needed) and all the files to load (xxxxx.yyy);
      2. From the cpmtools directory open the provided DOS command shell and give the following command (I'll use here the name disk0CPM.dsk for the disk image file):
        MAKEDISK0CPM disk0CPM.dsk
      3. After the execution copy the file disk0CPM.dsk in the SRecord directory;
      4. Go to the SRecord directory, open the provided DOS command shell and give the following command:
        D0TOHEXCPM disk0CPM.dsk
      5. After the execution you will find four files named from disk0CPM_SEG0.hex to disk0CPM_SEG4.hex to upload into the virtual disk with iDisk.


      Steps to create a Disk 0 QP/M image

      1. Go to the cpmtools directory and with an editor modify/add/delete in the file MakeDisk0QPM.bat the various lines "cpmcp -f z80mbc-d0 %dskfile% CPM-files\xxxxx.yyy 0:xxxxx.yyy" to match the directory in your host (if needed) and all the files to load (xxxxx.yyy);
      2. From the cpmtools directory open the provided DOS command shell and give the following command (I'll use here the name disk0QPM.dsk for the disk image file):
        MAKEDISK0QPM disk0QPM.dsk
      3. After the execution copy the file disk0QPM.dsk in the SRecord directory;
      4. Go to the SRecord directory, open the provided DOS command shell and give the following command:
        D0TOHEXQPM disk0QPM.dsk
      5. After the execution you will find four files named from disk0QPM_SEG0.hex to disk0QPM_SEG4.hex to upload into the virtual disk with iDisk.

      Remember that you...

    Read more »

  • A new OS: QP/M 2.71 and a RTC for timestamping

    Just4Fun05/23/2017 at 15:37 0 comments

      Here is an interesting alternative to CP/M developed by MICROCode Consulting that supports also file timestamping, and it is 100% CP/M 2.2 "compatible".
      MICROCode Consulting has released the original installation files and all the documentation in their site with the "restricted usage" condition, that means free for non-commercial use and for personal use only, so it should be ok for us. Anyway I've sent them a mail about this project.
      To enable timestamping you need a DS3231 based RTC module like this one:


      WARNING: these modules can cause battery "explosion"! How to fix it

      This cheap modules have a trickle charging circuit that may cause the "explosion" of the battery if you use a standard CR2032 cell. More, it can damage also a rechargeable LIR2032 cell (see this thread). So the safer thing is "disable" the trickle charging circuit (a CR2032 can last 5/10 years, so there is no practical need to a rechargeable battery, after all...).
      To avoid any charging current flowing into the battery you can take away the series limiting 200 Ohm resistor (or cut the trace). Alternatively you can take away the red diode, or destroy it (it is in series with the 200 Ohm resistor). In the following photo you can see the module with some Kapton tape (used as thermal barrier) before to desolder the 200 Ohm resistor (on the right marked as 201) with an hot air gun:

      And here after the desoldering:

      Now the module it's safe and a CR2032 can be used. To connect it use the SCL/SDA/VCC/GND terminals and connect them at the corresponding pins of the IOEXP/I2C connector of the Z80-MBC (pay attention because the position of the signals is different):


      QP/M quick set up guide

      The setup is quite similar to those used to install CP/M. The Assembler automated toolchain must be already set up and the Virtual Disk Module present.


      Here all the steps:

      1. Connect the DS3231 module (with the CR2032 battery inside);
      2. Update the IOS using the new file S221116_R110517_Z80.ino in the File section;
      3. Reboot the Z80-MBC and from a terminal emulator you'll see this:
        Press Y. If you are enough fast you have the RTC set up with the right date/time taken from the sketch compile time (if you are lazy like me you'll find this very handy...). In any case it is possible adjust the date/time manually too from the boot selection menu;
      4. Reboot the Z80-MBC again and select the iLoad boot mode;
      5. From the File section download the file "QPM271_DiskPack.zip", unzip it in the directory used for the Assembler automated toolchain;
      6. Upload the file "iDisk - S250317.hex" to the Z80-MBC using the Dos batch L.BAT (see Assembler automated toolchain) with the command:
        L "iDisk - S250317.hex"
        
      7. When iDisk waits for the input stream, from the Tera Term menu select "File" -> "Send file..." and choice one of the unzipped .hex file from QPM271_DiskPack.zip;
      8. Repeat step 7 for all the four files;
      9. Press the Reset button on the Z80-MBC and enter into the boot selection menu and select 4 to load the OS from disk 0 (and select the disk light ON if not already done, to have an idea of the behavior):

      NOTE: as already noticed, if you experience errors during the serial upload increase the delay after each line from the Tera Term menu (Setup -> Serial port -> Transmit delay -> msec/line). In my VM I set up a 90ms delay. This is due because Arduino serial port doesn't have any handshaking.

      Now you have QP/M 2.71 up and running, but you need further operations to enable the file timestampig (as stated in the QP/M Installation Guide):

      1. To enable file disk timestamping it is necessary run the utility QSTAMPX from A:
        and do the "disk timestamping" for both A: and B: disks.
        When done type the command D $T and check that the output is similar to this:

      2. Now to set up a starting date to all files give the command QSUB SETDATE to run a simple batch that I made to do this initialization easily;
      3. Copy the file SETDATE.QSB to drive B: (using the command QPIP B:=SETDATE.QSB) and repeat from B: the same batch (QSUB SETDATE). Now the command D $T will give this output:...
    Read more »

  • AUTOEXEC for CP/M

    Just4Fun05/02/2017 at 16:39 1 comment

      Playing with the Z80-MBC I realized that there was a missing feature: to run a program automatically after the "cold" boot.
      So after some searches I found a way to implement in the BIOS a function similar to AUTOEXEC.BAT for DOS using the CP/M SUBMIT command and a batch file that I called AUTOEXEC.SUB (of course...).
      Editing the AUTOEXEC.SUB file it is possible to run a sequence of commands after the cold boot (as with AUTOEXEC.BAT for DOS), and it is possible enable or disable the execution of the AUTOEXEC batch file from the IOS boot selection menu (but this isn't possible with DOS...).


      AUTOEXEC for CP/M quick set up guide

      You must have CP/M 2.2 already up and running (see CP/M 2.2, iDisk and a new IOS), and you can have also only a "single disk" installed (but I recommend the original dual disk configuration), meaning that only U1 (see the A110417 schematic) is populated. Of course the Assembler automated toolchain must be already set up.


      Here all the steps:

      1. Update the IOS using the new file S221116_R300417_Z80.ino in the File section;
      2. Reboot the Z80-MBC and select the iLoad boot mode;
      3. From the File section download the file CPM22SYS_BIOS_S050217_R300417.hex. This file contains only the new CP/M system image for the system tracks of Disk 0, so the "user files" will be left untouched;
      4. Upload the file "iDisk - S250317.hex" to the Z80-MBC using the Dos batch L.BAT (see CP/M 2.2, iDisk and a new IOS) with the command:
        L "iDisk - S250317.hex"
      5. When iDisk waits for the input stream:from the Tera Term menu select "File" -> "Send file..." and choice CPM22SYS_BIOS_S050217_R300417.hex. After the upload iDisk will show a summary, at this point press W to proceed and confirm your choice (as done for the CP/M 2.2 installation described in CP/M 2.2, iDisk and a new IOS). Wait until the write and verify phase is completed.
      6. Press the Reset button on the Z80-MBC and enter into the boot selection menu and select 4 for CP/M loader.


      All done!


      NOTE: as already noticed, if you experience errors during the serial upload increase the delay after each line from the Tera Term menu (Setup -> Serial port -> Transmit delay -> msec/line). In my VM I set up a 90ms delay. This is due because Arduino serial port doesn't have any handshaking.


      How use it

      To create or edit AUTOEXEC.SUB from drive A, you can use the ED command or an other editor like the Turbo Pascal editor. In this case remember to terminate the file with a CR, or "strange" things will occur when executing the SUBMIT AUTOEXEC command.
      You can test the execution giving the command SUBMIT AUTOEXEC from drive A (you can omit the extension .SUB inside the SUBMIT command).
      To enable the AUTOEXEC execution after the cold boot change the corresponding state to ON from the usual IOS boot selection menu.
      If the AUTOEXEC is enabled but the AUTOEXEC.SUB file doesn't exist in the drive A, an error will be displayed:


      New "disk packs"

      I've updated both "disk packs" in the files CPM22_DualDiskPack_v2.zip and CPM22_SingleDiskPack_v2.zip with the new BIOS in the system tracks. So if you are installing them for the first time or you need for any reason to reload them, the new BIOS will be installed. I've added an example of AUTOEXEC.SUB too.


      How it works

      The "trick" used was to inject the string "SUBMIT AUTOEXEC" into the CCP (the Command Processor of CP/M) input buffer. The BIOS after the cold boot checks if the AUTOEXEC flag is set in the IOS, and in this case makes the injection. When the CCP starts after the cold boot, it runs this injected command.

      In this video there is an in depth explanation for a "legacy" Altair 8800 clone.

      The CP/M 2.2 and the new BIOS sources are in the file "CPM22 BIOS - S050217 R300417.zip" in the File section.

  • CP/M 2.2, iDisk and a new IOS

    Just4Fun04/20/2017 at 20:36 1 comment


      CP/M 2.2 quick set up guide

      The set up is very simple. I've done an utility (iDisk) to simplify all the needed operations. Of course the Virtual Disk Module must be present, but you can have also only a "single disk" installed (but I recommend the original dual disk configuration), meaning that only U1 (see the A110417.pdf schematic) is populated.
      The Assembler automated toolchain must be already set up.


      Here all the steps:

      1. Update the IOS using the new file S221116_R130417_Z80.ino in the File section;
      2. Reboot the Z80-MBC and select the iLoad boot mode (if not already selected);
      3. From the File section download the file "iDisk - S250317.hex" and copy it into your PC in the directory used for the Assembler automated toolchain . (Do not use the source file "iDisk - S250317.c" because it requires a special compiling option);
      4. From the File section download the file "CPM22_DualDiskPack.zip" and unzip it (for a single disk configuration download the file "CPM22_SingleDiskPack.zip"). Each disk image is divided into four .hex files called "segment" (32kB each) that are named accordingly (e.g. D0XXX_SEG1.hex means the segment 1 of disk 0);
      5. Upload the file "iDisk - S250317.hex" to the Z80-MBC using the Dos batch L.BAT (see Assembler automated toolchain) with the command:
        L "iDisk - S250317.hex"
        	
      6. When iDisk waits for the input stream:
        from the Tera Term menu select "File" -> "Send file..." and choice one of the unzipped .hex file from CPM22_DualDiskPack.zip (or CPM22_SingleDiskPack.zip for a single disk configuration). After the upload iDisk will show a summary:
        at this point press W to proceed and confirm your choice.
        You don't have to follow any order in the "segments" upload sequence, iDisk will know how to do. To know before each upload what "segments" have been already written into the disks just see the "Disk segment write status":
        in the photo the segments 0, 1 and 3 of Disk 1 have been already successfully written, so you can choose any of the remaining;
      7. Repeat step 6 for all the eight (or four for the single disk pack) "segment" files;
      8. Press the Reset button on the Z80-MBC and enter into the boot selection menu:
        select 4 for the CP/M loader (and select the disk light ON if not already done, to have an idea of the behavior).

      All done!


      NOTE: if you experience errors during the serial upload increase the delay after each line from the Tera Term menu (Setup -> Serial port -> Transmit delay -> msec/line). In my VM I set up a 90ms delay. This is due because Arduino serial port doesn't have any handshaking.


      Disk speed

      The Virtual Disk Module is based on simple EEPROMs using a 200KHz I2C serial bus. Of course do not expect the same speed of an hard disk with a DMA controller!
      The speed probably is like using the floppy drive of those days...


      Single disk configuration

      You can have also only a "single disk" installed (but I recommend the original dual disk configuration), meaning that only U1 (see the A110417.pdf schematic) is populated.

      In this case you have about 120kB free, because the first two tracks of Disk 0 are reserved for the system image (Disk 1 doesn't have the system image, so all the 32 tracks are used for the file system).

      Because the BIOS is the same and is configured for a dual disk system, if you try to select the "B:" drive you'll get a "BAD SECTOR" error.


      Disk pack contents

      In the disk 0 image there are the various external CP/M commands, the Basic interpreter, the CP/M Assembler and the Macro Assembler.
      I've added also D, an alternative DIR command, and PEG, a bin to hex converter (and vice-versa) to exchange files:

      In the disk 1 image there is the complete Turbo Pascal compiler v3.01A with a sample program (SA.PAS):

      In the "single disk pack" the CP/M Assembler and the Macro Assembler are missing, and the Turbo Pascal is without the installing executable (not a big issue anyway) and without the sample program.


      In a next Log I'll explain how create custom disk images.


      Mind the .map!

      During the development of iDisk I encountered "strange"...

    Read more »

  • Virtual Disk Module, a new IOS and ViDiT

    Just4Fun04/13/2017 at 19:37 3 comments

    It's time for a new "module", the Virtual Disk Module! In the photo is that one on the right, near the previous GPIO module.

    In the File section is possible see the simple schematic A110417.pdf with two I2C EEPROM 24LC1025.

    With this module it is possible to emulate two disks of 128kB each (probably like the floppy disk drives of those years).

    Each disk is divided into 32 tracks of 32 sectors. Each sector is 128 bytes long.

    Of course to manage this new HW there is a new release of IOS. The new file S221116_R180217_Z80.ino is in the File section.

    This new IOS checks if the module is present and prints a message if found:

    There is also a new item in the boot selection menu if the virtual disk is found, to use the User led as a disk activity led:

    I suggest to activate this option to have an idea of the behavior.


    ViDiT

    In the File section I've added a simple test program (file "ViDiT - S090417.c") to check the virtual disk. Of course you need to compile it with the C "toolchain":


    About I2C speed

    With this IOS the I2C speed is 200KHz. Note that if you are using a 16MHz external quartz to clock the Atmega32 the I2C speed will be 400kHz. In this case I suggest to lower the two 4k7 pull-up resistors (on SDA and SCL signals) to about 2k2.



    The next Log will bring the CP/M 2.2 up and running...

  • Forth language, new multi-boot selection and a new name

    Just4Fun02/17/2017 at 21:33 4 comments

    Forth


    Thanks to Bill Westfield now we have a new language for the Z80-MBC, the fig-FORTH v1.3 (here the link to the Bill GitHub repository with the source he adapted for the TASM assembler with the needed modifications for the Z80-MBC).

    The acronym "fig" stands for "Forth Interest Group", that was a world-wide non-profit organization (now dissolved) for the promotion of the Forth computer language.
    I've just started to play with this thing, and I must say that it is not the most friendly language I've seen... anyway it is an interesting different approach.

    To enable Forth just upload the new IOS release S221116_R120217_Z80.ino in the Files section, and select the Forth language from the new multi-boot menu (see next paragraph).

    Here it is a "blink" demo program:

    ( ****************************
    (                     
    ( Blink test - Forth - Z80-MBC
    (
    ( ****************************
    : ledon 1 0 P! ;
    : ledoff 0 0 P! ;
    : delay 4000 0 DO NOOP LOOP ;
    : blink CR ." Blinking..." CR BEGIN ledon delay ledoff delay 0 UNTIL ;

    To execute give the command "blink":


    If you are using Tera Term to send a text file to load a forth source, remember to set up a delay of 1ms for each character (serial port managed by the Arduino bootlader doesn't have any handshaking, so for now this is required to handle the serial stream without errors when sending a text file using a terminal emulator):


    New multi-boot selection


    Now pressing the User key after a reset brings to a new menu to chose the preferred boot mode. During this phase the LED-D0 will blink until you choose the boot mode:


    New name


    As you can see from the previous photos, from this release the MBC acronym changes to "Multi Boot Computer"...

  • An automated C language toolchain

    Just4Fun02/09/2017 at 21:26 0 comments

    Here how set up a toolchain to program the Z80-MBC using the C language. It is based on SDDC (Small Device C Compiler) and uses the same "process" of the previous Assembler toolchain.
    In the following it is assumed the the Assembler toolchain is already set up in a Windows host as described in in the Log: New iLoad boot mode and an automated Assembler toolchain.
    So only the SDDC relevant part is explained here.


    Here it is a short video with the toolchain in action:


    What you need to do:

    1. Create a working directory (or use the previous one) where to store the C sources and the two batch files (C.BAT and L.BAT) in the C_batch.zip file from the File section (if you are using the same assembler working directory overwrite the previous L.BAT);
    2. With a text editor search the line:
      "C:\Program Files\teraterm\ttermpro.exe" /c=3 /BAUD=9600 /w="Z80-MBC Terminal" /m=LoadZ80.ttl
      inside C.BAT and L.BAT and verify that both the path and the COM number (/c=3 means COM3) meet your system;
    3. Download and install SDDC from here;
    4. Download the file S030217_crt0.s from the Files section in the working directory;
    5. Open the DOS command line and give the command: "sdasz80 -o S030217_crt0.s".
      Then rename the generated S030217_crt0.rel as crt0.rel. Copy it in the SDDC directory "C:\Program Files\SDCC\lib\z80" (may be a bit different in your system) overwriting the old one.

    All done!

    As usual close Tera Term before every new upload.

    To check if it is all ok, download from the File section the file C_demo.zip and unzip it in the working directory.
    From the DOS command line give the command: "C Blink.c" to check if all the toolchain works as in the video.
    Try also the other demo ANSItest.c (taken from here) to check the ANSI capabilities of a different terminal emulator or a physical terminal:


    About SDDC

    I'm pretty new to SDDC. The SDDC documentation is 8051 "focused", so the given examples can be misleading if used with an other processor in mind.
    When "porting" SDDC to a target HW, there are 3 things to prepare:

    • customize the crt0.rel file that contains the initialization code for the target system;
    • add to the library the function putchar(char c) to send output to the console;
    • add to the library the function getchar() to read from the keyboard.

    I found the documentation quite missing about how to modify for a custom system.
    In particular in the provided crt0.s example there isn't a needed global declaration of three variables (l__INITIALIZER, s__INITIALIZED and s__INITIALIZER). Without this declaration the code will not compile.
    And to make this customization you need to know how the provided assembler works, but the assembler manual is not provided. So you must find it googling...
    If you are used to the Arduino IDE, read carefully the SDDC manual. This C compiler is a lot more "rude" about types and syntax... (as C standard is...).


    Last minute update

    Just found the assembler and linker documentation here!

  • Two layers PCB!

    Just4Fun02/06/2017 at 20:44 0 comments

    Thanks to Bill Westfield now we have a beautiful ready to made PCB!


    I've uploaded in the Files section all the Eagle files (schematic + PCB) zipped as 4chipZ80-Eagle-PCB.zip.
    There are two versions, the first one with some little bugs and a second one with the needed corrections (see the "readme" file inside the zip for the explanations).

    In any case I suggest to check at the Bill GitHub repository here for any update/information before sending it to a service (so you are sure to use the last updated version...).


  • New iLoad boot mode and an automated Assembler toolchain

    Just4Fun01/31/2017 at 20:36 4 comments

      This new IOS release (S221116_R230117_Z80.ino in the Files section) brings a new dual-boot mode. Now it's possible choose if boot with the usual Basic or use the new iLoad boot mode.
      iLoad (S260117.asm in the Files section) is an Intel-Hex bootloader that allows to load from the serial port a binary program using the Intel-Hex format, and execute it. I've used a large part of the source from this site.

      To select a boot mode just push the Z80-MBC Reset button and immediately after push the User button at least until the User led turns off.
      The selection works as a toggle switch, and is stored in the EEPROM.
      Here it is a video that shows how to switch:

      Using the iLoad boot mode it's possible to automate all the process from the source to the execution in the target.
      This video shows an automatic Assembler toolchain; only one command from the source assembler to the execution on the target (the source file BlinkDemo.asm used in the video is in the File section):


      HOW TO SET UP AN "AUTOMATED" ASSEMBLER TOOLCHAIN

      What you need to do:

      1. Set up a Windows host or a VM (Virtual Machine). I've used a Windows XP SP3 VM onto a linux host;
      2. Load the Windows driver for your serial-USB adapter. Remember that your dongle *must* have the DTR signal;
      3. Create a working directory where to store the assembler sources, the assembler program and the two batch files (A.BAT and L.BAT) in the asmbatch.zip file (see the File section). With a text editor search the line:
        "C:\Program Files\teraterm\ttermpro.exe" /c=3 /BAUD=9600 /w="Z80-MBC Terminal" /m=LoadZ80.ttl
        inside A.BAT and L.BAT and verify that both the path and the COM number (/c=3 means COM3) meet your system;
      4. Download and copy in the previous directory the TASM v3.2 assembler from here. The on-line manual is here;
      5. Download and install the "Tera Term" terminal emulation from here;
      6. Set up Tera Term. From the Tera Term "Setup" menu select "Serial port..." and configure the parameters for your COM<n> connection to your serial-USB adapter. Set 9600 Baud, 8N1, Flow control none, Transmit delay 40ms/line. Save configuration with "Save setup..." from the "Setup" menu;
      7. Copy the file LoadZ80.ttl (see Files section) in the "Tera Term" installation directory, where it is installed the main file ttermpro.exe (for a standard installation for an English Windows version should be "C:\Program Files\teraterm");
      8. Open the file LoadZ80.ttl with a text editor and go to line 10. Edit the "setdir" parameter to meet your working directory path and name created at point 3. on your system, and save the file;
      9. Open the DOS command line and go in the working directory (using the CD dos command), attach the serial-USB dongle to the Z80-MBC and for a VM "connect" the dongle to the emulated usb of your VM. All done!

      Now it's time to check if it is all ok. From the DOS command line give the command: "A blinkdemo.asm" to check if all the toolchain works as in the video. To load the last compiled program give the command "L" without parameters. To load a specific intel-hex file give the command "L <filename.hex>".

      Close Tera Term before every new upload.


      iLoad behavior

      Please 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.
      iLoad will check the hex stream for errors, and protects itself if "someone" try to load a program (or a part) over it ("illegal address" error).

  • GPIO Expansion Module

    Just4Fun01/22/2017 at 13:50 2 comments

    This is the first add-on module for the Z80-MBC. It is a 16x GPIOs expansion module based on a MCP23017 IC, and can be easily connected to the Z80-MBC using the IOEXP connector (based on a I2C serial interface), of course on a breadboard...

    In the Files section I've added the schematic (A080117.pdf) and all the KiCad4 files (A080117 Kicad4.zip).
    There is also a new release of the IOS (S221116_R200117_Z80.ino) that takes care of it. During the boot phase, if the GPIO expansion module is found, a specific text is displayed:

    No configuration is needed, just plug it.

    Here is a short demo video:


    Each GPIO can be configured as input or output, and for each single input it is possible activate a 100K pull-up resistor. Of course this can be done from the Basic language, using new "virtual" I/O addresses as a language extension (if the module is not present, these I/O addresses are simply ignored):

    New WRITE I/O addresses:

            0x03:
              // GPIOA write (GPIO Expansion Module):
              //                I/O DATA:    D7 D6 D5 D4 D3 D2 D1 D0
              //                            ---------------------------------------------------------
              //                             D7 D6 D5 D4 D3 D2 D1 D0    GPIOA value (see MCP32017 datasheet)
                      
            0x04:
              // GPIOB write (GPIO Expansion Module):    
              //                I/O DATA:    D7 D6 D5 D4 D3 D2 D1 D0
              //                            ---------------------------------------------------------
              //                             D7 D6 D5 D4 D3 D2 D1 D0    GPIOB value (see MCP32017 datasheet)
              
            0x05:
              // IODIRA write (GPIO Expansion Module):
              //                I/O DATA:    D7 D6 D5 D4 D3 D2 D1 D0
              //                            ---------------------------------------------------------
              //                             D7 D6 D5 D4 D3 D2 D1 D0    IODIRA value (see MCP32017 datasheet)
                      
            0x06:
              // IODIRB write (GPIO Expansion Module):
              //                I/O DATA:    D7 D6 D5 D4 D3 D2 D1 D0
              //                            ---------------------------------------------------------
              //                             D7 D6 D5 D4 D3 D2 D1 D0    IODIRB value (see MCP32017 datasheet)
                      
            0x07:
              // GPPUA write (GPIO Expansion Module):
              //                I/O DATA:    D7 D6 D5 D4 D3 D2 D1 D0
              //                            ---------------------------------------------------------
              //                             D7 D6 D5 D4 D3 D2 D1 D0    GPPUA value (see MCP32017 datasheet)
                     
            0x08:
              // GPPUB write (GPIO Exp. Mod. ):
              //                I/O DATA:    D7 D6 D5 D4 D3 D2 D1 D0
              //                            ---------------------------------------------------------
              //                             D7 D6 D5 D4 D3 D2 D1 D0    GPPUB value (see MCP32017 datasheet)

    New READ I/O addresses:

              0x03:
                // GPIOA read (GPIO Expansion Module):
                //                I/O DATA:    D7 D6 D5 D4 D3 D2 D1 D0
                //                            ---------------------------------------------------------
                //                             D7 D6 D5 D4 D3 D2 D1 D0    GPIOA value (see MCP32017 datasheet)
                //
                // NOTE: a value 0x00 is forced if the GPIO Expansion Module is not present
               
              0x04:
                // GPIOB read (GPIO Expansion Module):
                //                I/O DATA:    D7 D6 D5 D4 D3 D2 D1 D0
                //                            ---------------------------------------------------------
                //                             D7 D6 D5 D4 D3 D2 D1 D0    GPIOB value (see MCP32017 datasheet)
                //
                // NOTE: a value 0x00 is forced if the GPIO Expansion Module is not present

    And here is the Basic program used in the video (the HW wiring is shown in the comments):

    1 REM * * * GPIO EXPANSION MODULE (A080117) DEMO  * * *
    2 REM
    3 REM (USER Key -> slow led, GPIO-A(9) Key -> fast led)
    4 REM --------------------------------------------------
    5 REM Demo HW wiring (see A080117 schematic):
    6 REM
    7 REM   GPIO-B
    8 REM    (J3)
    9 REM   +----+   LED
    10 REM  | 2  |--->|---+
    11 REM  | 3  |--->|---+      RESISTOR
    12 REM  | 4  |--->|---+        680
    13 REM  | 5  |--->|---+-------/\/\/-----o GND
    14 REM  | 6  |--->|---+
    15 REM  | 7  |--->|---+
    16 REM  | 8  |--->|---+
    17 REM  | 9  |--->|---+
    18 REM  +----+        |
    19 REM                |
    20 REM                |
    21 REM  GPIO-A        |
    22 REM   (J4)         |
    23 REM  +----+   LED  |
    24 REM  | 2  |--->|---+
    25 REM  | 3  |--->|---+
    26 REM  | 4  |x 
    27 REM  | 5  |x
    28 REM  | 6  |x
    29 REM  | 7  |x     PUSH BUTTON            RESISTOR
    30 REM  | 8  |x        ---                   1K
    31 REM  | 9  |---------o o------------------/\/\/-----o GND
    32 REM  +----+ 
    33 REM
    34 REM
    35 REM
    36 REM --------------------------------------------------
    37 REM
    38 REM Set MCP23017 GPIOB all pins as output (IODIRB=0x00)
    39 OUT 6, 0
    40 REM Set MCP23017 GPIOA 0-1 as output, others as input (IODIRA=0xFC)
    41 OUT 5, 252 
    42 REM Set MCP23017 GPIOA 2-7 pull-up resistor on (GPPUA=0xFC)
    43 OUT...
    Read more »

View all 11 project logs

Enjoy this project?

Share

Discussions

mick wrote a day ago point
I think it's one of those things - people find time to play with it when they can. :) That's my position at the moment. Too much stuff all happening at the same time. However, I've also been doing a bit of work on porting Nas-Sys 3 over to make this system look very much like a Nascom 2 running through a tty. Probably not a lot of interest in that (other than for myself!). Is anyone still interested in having somewhere to act as a repository for custom disk images for this project? They aren't very big and I still have quite a bit of spare space on my web site where I could perhaps host them as zip files.

  Are you sure? yes | no

villaromba wrote a day ago point

Are we at the end of the line on this project or is there more in the pipe-line to come???

  Are you sure? yes | no

Just4Fun wrote 13 hours ago point

Hi, next items in my "to do" list are an SD card and CP/M 3 with banked RAM. Of course they require an HW/SW update and a lot of time... May be after summer...

Currently I'm playing with an other project (probably I'll publish it here when done)...

  Are you sure? yes | no

mick wrote 07/03/2017 at 18:57 point
My new baby :) https://www.dropbox.com/s/mbuumplvvw16brc/front.jpg?dl=0
and its backside: https://www.dropbox.com/s/990az27og0slrqz/back.jpg?dl=0
I knew I'd eventually find a use for that wiring pencil...

  Are you sure? yes | no

john wrote 07/03/2017 at 22:46 point

Very nice!

  Are you sure? yes | no

Just4Fun wrote 07/04/2017 at 06:11 point

Neat! I've some wire like yours but never used it...

  Are you sure? yes | no

Dylan Brophy wrote 07/04/2017 at 14:52 point

:-) Z80 computers rule!

  Are you sure? yes | no

mick wrote 07/01/2017 at 16:38 point

I've just got this built using a similar layout to the one that John used, on pad board. I've included the I/O expansion, virtual disks & a DS1307 rtc chip (because I already had one) c/w cell holder lifted from an old motherboard. Still a bit of space left. :)  I'm just considering using it to boot a modified Nas-Sys as a machine code monitor. Possibly even with a crude method of saving & loading to "disk".

I'm no expert, but as only A0-A5 are needed for the loader, couldn't that free 3 AVR pins for use as a SPI interface to a SD card "hard disk"?

  Are you sure? yes | no

Just4Fun wrote 07/03/2017 at 13:14 point

Yes, it can be done... (it is one of the items in my long "to do" list...). Of course you must do the needed modifications in the sketch, and add pull-down resistors on the A6-A8 address lines.

  Are you sure? yes | no

Cyril V. wrote 06/23/2017 at 18:09 point

I just finish building this project - Works at the first boot love it :)  (BTW - I did find here is some Basic games: http://www.moorecad.com/classicbasic/index.html).
 
My goal now is to free some pins on the Atmega32 for some
I/O (VGA/SD...).  After some research, I find this project http://www.shaels.net/uploads/Media/SiteDownloads/Mini80/Mini80b.pdf which use a 74HC165 for the address bus to save 6 pins on the MCU (Propeller).

But the 74HC165 can use access only 8 lines of the address bus vs the 9 lines direct on the Atmega32.

Can I use a 16 bits shift register (with only using 9 lines) like this one  http://users.ece.utexas.edu/~valvano/Datasheets/74F676.pdf and for the code does something like that https://forum.arduino.cc/index.php?topic=50633.0
will work?

(btw - I have couple PCB V2 left than I can sell for $4 + shipping - PM me if interested).

  Are you sure? yes | no

Just4Fun wrote 06/23/2017 at 19:46 point

Great! :)

BTW: if you want try some modifications, take in account that there are parts of the code that are strictly tied to the Z80 bus behavior...

PS: the 9th address line is not currently used... :) (and the 74F676 seems to be parallel in serial out, so no good anyway)

PPS: So the 24LC512 based virtual disk worked....

  Are you sure? yes | no

Cyril V. wrote 06/24/2017 at 01:25 point

Thank you for info. I just order couple 74HC165 I will give it a try.

For the 24LC512, I finally manage to find two 24LC1025 for $6 couple the day after on eBay, so I did not bother with the 24LC512. But you can easily find 24LC512 for under $1. 

  Are you sure? yes | no

Just4Fun wrote 06/24/2017 at 07:07 point

Just checked now... the HC165 are parallel in serial out too, so no good!! (always check the datasheet before buy...).

BTW: take in account that address lines are used for the I/O emulation too...

PS: I've looked at the schematic you linked again... it seems to me a bit "convoluted"... the HC165 is used to READ A0-A7 but the propeller chip has 8 pins not used... very strange...

  Are you sure? yes | no

Cyril V. wrote 06/25/2017 at 00:11 point

Here is the the website: http://www.shaels.net/index.php/mini80/mini80-general/119-mini8o-overview.

You completely right. Well live and learn :).

The rest of the propeller ports are used for VGA and keyboard:  http://www.shaels.net/index.php/mini80/documents/120-min80-proto1-io-prts-and-devices

The thing is running @ 3.3V : "The CMOS construction of the Z80 should allow the Z80 to operate at a reduced voltage. Digital CMOS devices generally set there logic voltage levels as a percentage of the power supply voltage and not by absolute voltages. This feature should allow the Z80 to operate at the 3.3 volt
level allowing it to interconnect with the Parallax Propeller chip. At
 3.3 volts the Z80 max CPU clock speed will have to be de-rated."

  Are you sure? yes | no

Just4Fun wrote 06/25/2017 at 13:06 point

Hmmm... the Z80 there is completely out of specs.... No...  this isn't my way... definitely... :)

  Are you sure? yes | no

villaromba wrote 05/27/2017 at 14:11 point

Finally QP/M up & running - thankyou ! Looking forward to seeing how to add more progs BUT Drive A is R/W, with 24k space remaining. Drive B is R/W, with 42k space remaining.

Where's it all going to go !!!! ???

  Are you sure? yes | no

Just4Fun wrote 05/27/2017 at 17:30 point

You should use it as a dual floppy machine of those years... I mean using A: for the system and B: for user programs. Of course loading with iDisk the needed disk image, or following the way used by john.

If you do not need turbo pascal just... delete it... :)

  Are you sure? yes | no

villaromba wrote 06/01/2017 at 20:37 point

Thanks for clear instructions, I need them  :) , ..on how to add  custom images with CP/M Tools. Experimented with B: and it works perfectly with my added programs. 

  Are you sure? yes | no

john wrote 05/25/2017 at 12:23 point

I could have sworn I read this in the posts somewhere, but I can't find it now.  Can someone tell me how to transfer files to the drive through the console?  I'm wanting to put Zork on the B: drive.  Will PIP do this?

  Are you sure? yes | no

Just4Fun wrote 05/25/2017 at 14:37 point

For now he only way is convert a file to IntelHex format and send it using the terminal emulation. I think that PIP can be used. See here: http://www.gaby.de/cpm/manuals/archive/cpm22htm/ch1.htm#Section_1.6.4 

You can also use PEG to convert inside the target (Z80).

Anyway you have remembered to me that I have to write a "Log" to describe how create custom disk images... For "large" programs/applications this is the way to go...

  Are you sure? yes | no

john wrote 05/25/2017 at 17:34 point

That's where i was headed, but I can't get QPIP to do anything with CON: as the source.  I'm putting CP/M back to try that version of PIP (not sure if it's different).

Edit: 

CP/M PIP does seem to work and I can get the file to disk, but because of the bin to hex conversion the file is now too big to fit on the disk.  Looking forward to your next log :)

  Are you sure? yes | no

Just4Fun wrote 05/25/2017 at 17:44 point

Yep, I was  just trying that... It seems looping...

I've tested on an emulator with standard CP/M and I was able to write a text from the console using PIP, giving also CTRL-J after every CR.

  Are you sure? yes | no

john wrote 05/26/2017 at 00:59 point

I went around the world to get there, but I eventually got this to work...  I was able to use Grant Searle's DOWNLOAD. COM code from his CP/M project to get the files over.  If anyone's interested, I had to change the DOWNLOAD2.HEX to relocate 0x4100 to 0x0100 and then recalculate the checksums.  Then I pasted that into ZDE and saved it to the disk.  A quick PEG to convert from Intel HEX to a COM file and then just followed the directions to transfer the Zork files over.  Then I found myself "West of House".    :)

  Are you sure? yes | no

Just4Fun wrote 05/26/2017 at 07:26 point

Great idea!

BTW: I've just ordered "some" HD64180 (=Z180) and MC68008. Starting to think what to do with these... May be next winter mini system... :)

  Are you sure? yes | no

john wrote 05/24/2017 at 15:06 point

Nice work!  Waiting on the RTC module to arrive, but since I had a spare Arduino I tried the "DS1307 Emulator Library"...  Works great!

Z80-MBC (Multi Boot Computer) - A041116
IOS - I/O Subsystem - S221116 R110517

IOS: Found RTC DS3231 Generic Module (24/05/17 11:00:36)
IOS: Found Virtual Disk Module
IOS: Disk light is ON
IOS: AUTOEXEC execution is OFF
IOS: Loading phase 1 boot program...
IOS: Loading phase 1 done.
IOS: Z80 is running from now.

Z80-MBC CP/M 2.2 Cold Loader - S150417

Loading... done

Z80-MBC QP/M 2.71 BIOS - S080517

QP/M 2.71 Copyright 1985 (c) by MICROCode Consulting

A>time
24-May-17       11:00:43
A>

And from MBASIC:

LIST
10 SECONDS = INP(7)
20 SECONDS = INP(8)
30 MINUTES = INP(8)
40 HOURS = INP(8)
50 DAY = INP(8)
60 MONTH = INP(8)
70 YEAR = INP(8)
100 PRINT "THE TIME IS: ";
110 PRINT HOURS; : PRINT ":"; : PRINT MINUTES; : PRINT ":"; : PRINT SECONDS
Ok


RUN
THE TIME IS:  12 : 36 : 18 
Ok

  Are you sure? yes | no

Just4Fun wrote 05/24/2017 at 17:05 point

Great! These RTC have the same I2C address and the same structure for the main date/time registers. Instead the "control register" are different and at different location. Anyway it seems that are "compatible" at least in the way I've used it...!

  Are you sure? yes | no

john wrote 05/24/2017 at 17:14 point

Yes - I think the 3231 control register ends up being in the RAM on the 1307, so writes to it have no effect, and the initial read to check if the OSC is running fails, so the time setting routine gets triggered.  I added a write to the 1307 register to change the SQW pin to 1 Hz and it worked on the emulator.  I found a 1307 in my parts bin, so I'll wire that up soon.

  Are you sure? yes | no

villaromba wrote 05/27/2017 at 15:53 point

John, thanks for this  info. Where did you find the INP(x) address data from. The module has a temp sensor on it as well, so is it possible to INP that as well ?

  Are you sure? yes | no

WestfW wrote 05/24/2017 at 05:23 point

Neat!  (Man, I had totally forgotten just how tiny CP/M is...)

----------------------------

IOS: Z80 is running from now.

Z80-MBC CP/M 2.2 Cold Loader - S150417
Loading... done

Z80-MBC CP/M 2.2 BIOS - S050217 R300417
CP/M 2.2 Copyright 1979 (c) by Digital Research

A>dir
A: ASM      COM : D        COM : DDT      COM : DUMP     COM
A: ED       COM : HELLO    COM : LOAD     COM : MAC      COM
A: MBASIC   COM : PEG      COM : PIP      COM : STAT     COM
A: SUBMIT   COM : XSUB     COM : HELLO    ASM : GPIO     BAS
A: AUTOEXEC SUB : HELLO    PRN : HELLO    HEX
A>mbasic
BASIC-80 Rev. 5.21
[CP/M Version]
Copyright 1977, 78, 79, 80 (C) by Microsoft
Created: 15-Dec-80
34811 Bytes free
Ok
10 print 124
list
10 PRINT 124
Ok
run
 124
Ok

  Are you sure? yes | no

Just4Fun wrote 05/24/2017 at 07:30 point

Now you are ready for QP/M too... :)

  Are you sure? yes | no

WestfW wrote 05/24/2017 at 01:35 point

For the record, a 24xx1025 behaves oddly if you forget to connect A2 to VCC.  Writes to the lower half work fine, but not writes to the second 64k...  (sigh.)

  Are you sure? yes | no

Starhawk wrote 05/23/2017 at 16:49 point

Nifty project! Gotta love the budget, and that you're getting great results with it. But I have a couple questions...

One, what would it take, code-wise, to replace the RAM you used, with a UMC UM61512-series chip? The ones on eBay are very fast, ~15nS (vs. ~70nS for your current RAM)...?

Two, how hard would it be to add a real floppy drive to this? I have real 5.25" floppy drives and disks... the experience is worth the trouble, IMO. (Or would it just be that much easier to use SD cards...? Not the same, by any means, but I do have a 32mb card I could toss in there, if CP/M can see it.)

Three, I have a TL866C programmer. That will suffice for Arduino'ing the ATMEGA32, right...?

Since this computer won't /quite/ fit in my budget (currently $4.96) once shipping costs are factored in (aargh!), I'll probably be ordering parts next month, if I don't lose interest [rolleyes] -- which I do all too frequently.

  Are you sure? yes | no

Just4Fun wrote 05/24/2017 at 07:28 point

Hi,

here the answers:

1. Yes, you can use it without any change. Anyway there isn't any advantage to use a so fast SRAM because the Z80 clock is 4MHz, and a 120ns SRAM is more than adequate...;

2. It can be done but is not so easy. Using a SD is a  lot much simpler. But in any case you need an other MPU (at least with the current HW);

3. I haven't a TL866C so I don't know... But I remember that an other user used it. Search among the various comments...

  Are you sure? yes | no

Starhawk wrote 05/24/2017 at 14:48 point

I'm not so hot with the coding... kinda wish I was... maybe sometime soon, you can figure out how to add SD support? I'd help if I could but TBH I can't.

I'm going to try and build it in early June... I don't have the money now :(

  Are you sure? yes | no

Just4Fun wrote 05/24/2017 at 17:31 point

When I said "a lot more simple" I doesn't mean that it is an "absolute" simple task...

You must implement a I2C-SPI bridge and probably heavily modify the disk emulation of the IOS...

  Are you sure? yes | no

Starhawk wrote 05/24/2017 at 20:30 point

...or just add a second ATMEGA ;) drivers would be the difficulty there, though, really... SD cards are way new stuff compared to CP/M...

Maybe it really /would/ be easier to plunk in an 82077AA-5, PLCC socket and all... after all, at least /partial/ support should be in the OS for that... although, at the time CP/M was prevalent, most floppy drives were actually the now-rare-as-hens'-teeth 8-inch variety, not the more well-known 5.25" or 3.5" formats... so some (probably significant) adaptation would almost certainly be necessary. That, and, well, the datasheet for the 82077AA series of single-chip floppy controllers is dated May '94... well past the expiry date of /any/ copy of CP/M...

Probably there's a challenge there. Dunno. I'm not a programmer. I don't mind helping to test, but I can't contribute code... I know just enough programming to know that it's really not for me. I can't think in code. Sorry.

  Are you sure? yes | no

villaromba wrote 05/24/2017 at 16:59 point

Yes, I use the TL866 to do all my ATMega32 programming for this excellent project. You need to get the 'fuse bits' correct in the Config i.e the SUT0, CKSEL3, CKSEL1, CKSEL0, SPIEN, BOOTSZ1 & 0 boxes all ticked, others unticked. 

  Are you sure? yes | no

Starhawk wrote 05/24/2017 at 17:02 point

Thanks, that's very helpful :)

  Are you sure? yes | no

Just4Fun wrote 05/14/2017 at 17:05 point


Stay tuned...

  Are you sure? yes | no

john wrote 05/16/2017 at 13:22 point

Suspense is killing me - do I need to dig up a DS1307?

  Are you sure? yes | no

Just4Fun wrote 05/16/2017 at 13:31 point

-LOL-

No, take a cheap DS3231 based module... :)

PS: do not connect any battery into it or it "may" explode if powered... I'll explain all...

  Are you sure? yes | no

john wrote 05/16/2017 at 21:12 point

That's funny - I saw the QP/M and timestamps on the files but completely missed the 3231 log message!

  Are you sure? yes | no

Just4Fun wrote 05/17/2017 at 06:10 point

:)

  Are you sure? yes | no

WestfW wrote 05/13/2017 at 00:14 point

BTW, did you write any test code for the I2C devices that just runs on the AVR without involving the Z80?  Or do standard arduino sketches work?

  Are you sure? yes | no

Just4Fun wrote 05/14/2017 at 16:49 point

To check I2C I used the standard "I2C scanner" example.

  Are you sure? yes | no

WestfW wrote 05/13/2017 at 00:12 point

Hmmph.  Adding the I2C EEPROM to the prototyping area on the PCB, and discovering that I didn't include any power pads that are convenient to use :-(


  Are you sure? yes | no

Cyril V. wrote 05/04/2017 at 18:18 point

What do you think of using this I2c 1602 screen +  5 buttons for possible I/O (it is driven by a
MCP23017)(ebay clone for $5): https://learn.adafruit.com/rgb-lcd-shield

  Are you sure? yes | no

Just4Fun wrote 05/05/2017 at 07:15 point

Yes you can use it. The Z80-MBC will see only a MCP23017 of course, and it is up to you write a program that it is capable to "drive" what is connected to the GPIOs (see GPIO.BAS as an example).

Because the SDA and SCL pullup resistors are already in the Z80-MBC schematic, you *must* check that there isn't any further pullup resistor on your board. If there is any, you must take it away.

Check that the A0, A1 and A2 address pins of the MCP23017 are all connected to GND (like in the schematic you posted), otherwise the IOS will not see it.

  Are you sure? yes | no

Cyril V. wrote 05/05/2017 at 23:44 point

Just waiting for the parts, I will let you how it goes :)

  Are you sure? yes | no

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

Thanks! I'm very curious too... :)   

  Are you sure? yes | no

joel076 wrote 05/04/2017 at 16:32 point

Can i use BS62LV1027PCP55 as ram instead?

  Are you sure? yes | no

Just4Fun wrote 05/05/2017 at 07:03 point

I've given a look to the datasheet and it seems ok.

  Are you sure? yes | no

Cyril V. wrote 05/03/2017 at 12:54 point

For the Virtual Disk Module can the two 24LC1025 EEPROM be replaced by a lower memory capacity like the 24LC512 or even the 24LC256 (for emulating the two disks of 128kB)?

  Are you sure? yes | no

john wrote 05/03/2017 at 19:15 point

I think it's a bits/bytes thing.  The 24LC1025 is a 128K x 8 (1024K bit)  device, so each chip can hold a 120KB disk image. 

  Are you sure? yes | no

Cyril V. wrote 05/03/2017 at 19:28 point

I can't find cheap 24LC1025/24LC1026 on ebay (more than $20 with shipping for only one chip). Any cheaper alternatives?

  Are you sure? yes | no

john wrote 05/03/2017 at 19:54 point

I picked them up for about $3.50 from Mouser.

  Are you sure? yes | no

Just4Fun wrote 05/04/2017 at 06:41 point

I've given a look to the datasheets. The 24LC256 is a "no-go" because the A15 address bit is missing. The 24LC512 may be... It seems compatible. Of course you need four of them to have an equivalent memory space (or two for a "single disk" system).

Here the the way to use them:


I haven't any 24LC512 so I can't test if it works or not. May be I've forget something... It's only a 2 minutes schematic...

So try it at your risk....

  Are you sure? yes | no

Cyril V. wrote 05/04/2017 at 12:30 point

Great, thank you.

  Are you sure? yes | no

WestfW wrote 04/22/2017 at 09:31 point

I've added Gerbers for the V2 (untested) version of the PCB; something I should have done a long time ago...   https://github.com/WestfW/4chipZ80/tree/master/Gerbers-V2

  Are you sure? yes | no

Cyril V. wrote 04/22/2017 at 18:13 point

Thank you, this is great!

  Are you sure? yes | no

Just4Fun wrote 05/02/2017 at 06:17 point

Hi, I've just seen that in your schematic R16 and R17 have the values swapped (should be R16 = 680 and R17 = 360). Anyway this is not a big issue, and there shouldn't be any "visible" problem...

  Are you sure? yes | no

villaromba wrote 04/20/2017 at 09:18 point

Virtual Disk - works great & exactly as described !! Thank you ...  Is/will it be possible to save BASIC & Forth progs to the virtual disk, now or in the future? Looking forward to CP/M post

  Are you sure? yes | no

Just4Fun wrote 04/20/2017 at 12:47 point

The current BASIC & Forth interpreters can't use the virtual disk.

Inside the CP/M "disk pack" there will be the Basic-80 interpreter that is an upgrade of that one used before (and 100% compatible), with the Load and Save function of course, and a lot more. So there will not be any reason to use the "stand-alone" version anymore.

About the fig-Forth 1.3 it has inside a sort of disk system, but:

* is totally not compatible with CP/M file system;

* is incompatible with the Z80-MBC Virtual Disk (until modify the source).

So it probably will be better use a CP/M forth compiler...

  Are you sure? yes | no

john wrote 04/27/2017 at 11:56 point

For some reason I couldn't reply to your post below, but no - I didn't have any trouble getting the disk segments to load (with the EOL delay added).  Everything worked as advertised.

  Are you sure? yes | no

Just4Fun wrote 04/27/2017 at 12:20 point

Ok, thanks!

BTW: thinking to add a sort of AUTOEXEC-like function...

  Are you sure? yes | no

john wrote 04/26/2017 at 23:30 point

I just got this built and working, and as Just4Fun said, using mbasic inside of CP/M does let you load and save to disk.  I was able to paste in the Star Trek code and save it to disk.  I did have some weirdness with case of the filenames though.  I initially saved from mbasic in lowercase and then back in CP/M, couldn't ERAse or otherwise manipulate the file.  With caps lock on and everything in uppercase in mbasic, everything seemed to work fine.

  Are you sure? yes | no

Just4Fun wrote 04/27/2017 at 06:32 point

I think that the MBASIC "lowercase" behavior was intentionally wanted. I had the same behavior using a simulator so it is not an "issue". Probably they wanted a way to "reserve" lowercase file names to MBASIC environment (or something like that).

PS: Have you had the same villaromba's problem with iDisk? (I currently haven't the time to do further tests...)

  Are you sure? yes | no

john wrote 04/27/2017 at 15:10 point

Regarding the lowercase file names in mbasic / CP/M, I found (with a little help from google) that you should be able to delete the lowercase file with the "KILL" command from within mbasic.

  Are you sure? yes | no

Just4Fun wrote 04/28/2017 at 06:10 point

Thanks for the info. Just guessing the fancy "delete" command name from within mbasic (ERASE/DESTROY/EATITALL....)

  Are you sure? yes | no

villaromba wrote 04/08/2017 at 17:59 point

Oh WOW!! This looks really exciting .....can't wait !!!

  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