Giter Club home page Giter Club logo

z80atmega128's Introduction

Z80ATmega128

日本語版READMEはこちら

Overview

This project aims to build a Z80A system and run CP/M-80 natively on it.

You might be wondering why I chose the Z80 today. Well, it happened to be discovered in my collection of electronic components after being tucked away for 30 years. Moreover, it's an original Zilog Z80A from the NMOS process era, likely manufactured around 1980!

However, rather than simply replicating a single-board microcontroller system from the 1980s, I've decided to take a different approach. Reproducing such a system lacks novelty and excitement, not to mention the difficulty of sourcing the necessary parts.

Hence, I've devised the following design principles:

  1. A hybrid configuration utilizing both Z80A and ATmega128-16AU (AVR) microcontrollers.
  2. I won't be using ROM; instead, a 64KB SRAM will be shared between the Z80A and AVR. AVR will manage the placement of the Z80's bootstrap code.
  3. AVR firmware will handle the Z80 hardware I/O and interrupt cycles completely. Any Z80's I/O devices can, in principle, be described by software!
  4. Design circuits using components that are as easy to procure as possible. (As of 2023, mainly in the Japanese electronic parts market.)

Achievements

  • CP/M 2.2 works directly on the Z80 processor.
  • The system can boot CP/M from a microSD card containing the CP/M image file.
  • CP/M 3 (Non-banked memory version) works as well.
  • You can enjoy playing the text adventure game ZORK I, II and III !
  • The printed circuit board (PCB) is available.
  • Demo Video

Contents

.
├── avr                      AVR firmware
├── z80                      Z80 software
│   ├── cpm22                CP/M-80 Ver2.2
│   │   ├── bios               BIOS
│   │   ├── sys                CPM.SYS(CCP/BDOS) and cpm.ihx(IPL+CCP/BDOS+BIOS)
│   │   └── image              CP/M 2.2 Disk image
│   └── cpm3                 CP/M 3 (CP/M Plus)
│       └── image              CP/M 3 Disk image
├── doc
│   ├── Hardware/            Hardware documents
│   ├── Software/            Software documents
│   └── README.md            Table of contents
└── schematics
    └── KiCad
        ├── *.kicad_sch      Schematic diagram
        └── *.kicad_pcb      PCB diagram

Required tools

Prototype

PCB


Schematic diagram

License

GPLv3

z80atmega128's People

Contributors

46nori avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

fabsmuller

z80atmega128's Issues

Error in making the disk image due to no `sdcard` definition for mkfs.cpm

The following error occurs with mkfs.cpm on Ubuntu22.04.
cpmtool version is 2.20-2build1.

mkfs.cpm -f sdcard -b ./tmp/cpm22/CPM.SYS DISK00.IMG
mkfs.cpm: unknown format sdcard
make: *** [Makefile:41: DISK00.IMG] Error 1

Countermeasure:
This version doesn't have the definition sdcard in diskdef.
Add the following to the file: /etc/cpmtools/diskdefs.

diskdef sdcard
  seclen 512
  tracks 256
  sectrk 64
  blocksize 8192
  maxdir 256
  skew 0
  boottrk 1
  os 2.2
end

Patch failure of CPM22-asz80.patch

Makefile fails with the following error during generating CP/M 2.2 system.

vscode@Z80ATmega128:/z80/cpm22/sys$ make

...

patch -i CPM22-asz80.patch -o tmp/cpm22.asm tmp/CPM22.Z80
patching file tmp/cpm22.asm (read from tmp/CPM22.Z80)
Hunk #1 FAILED at 11 (different line endings).
Hunk #2 FAILED at 48 (different line endings).
Hunk #3 FAILED at 83 (different line endings).
Hunk #4 FAILED at 195 (different line endings).
Hunk #5 FAILED at 224 (different line endings).
Hunk #6 FAILED at 376 (different line endings).
Hunk #7 FAILED at 385 (different line endings).
Hunk #8 FAILED at 397 (different line endings).
Hunk #9 FAILED at 421 (different line endings).
Hunk #10 FAILED at 458 (different line endings).
Hunk #11 FAILED at 475 (different line endings).
Hunk #12 FAILED at 492 (different line endings).
Hunk #13 FAILED at 518 (different line endings).
Hunk #14 FAILED at 536 (different line endings).
Hunk #15 FAILED at 547 (different line endings).
Hunk #16 FAILED at 581 (different line endings).
Hunk #17 FAILED at 611 (different line endings).
Hunk #18 FAILED at 630 (different line endings).
Hunk #19 FAILED at 666 (different line endings).
Hunk #20 FAILED at 680 (different line endings).
Hunk #21 FAILED at 700 (different line endings).
Hunk #22 FAILED at 725 (different line endings).
Hunk #23 FAILED at 794 (different line endings).
Hunk #24 FAILED at 810 (different line endings).
Hunk #25 FAILED at 820 (different line endings).
Hunk #26 FAILED at 848 (different line endings).
Hunk #27 FAILED at 886 (different line endings).
Hunk #28 FAILED at 896 (different line endings).
Hunk #29 FAILED at 911 (different line endings).
Hunk #30 FAILED at 994 (different line endings).
Hunk #31 FAILED at 1016 (different line endings).
Hunk #32 FAILED at 1052 (different line endings).
Hunk #33 FAILED at 1065 (different line endings).
Hunk #34 FAILED at 1078 (different line endings).
Hunk #35 FAILED at 1093 (different line endings).
Hunk #36 FAILED at 1149 (different line endings).
Hunk #37 FAILED at 1187 (different line endings).
Hunk #38 FAILED at 1197 (different line endings).
Hunk #39 FAILED at 1205 (different line endings).
Hunk #40 FAILED at 1240 (different line endings).
Hunk #41 FAILED at 1281 (different line endings).
Hunk #42 FAILED at 1309 (different line endings).
Hunk #43 FAILED at 1361 (different line endings).
Hunk #44 FAILED at 1373 (different line endings).
Hunk #45 FAILED at 1410 (different line endings).
Hunk #46 FAILED at 1433 (different line endings).
Hunk #47 FAILED at 1445 (different line endings).
Hunk #48 FAILED at 1457 (different line endings).
Hunk #49 FAILED at 1465 (different line endings).
Hunk #50 FAILED at 1486 (different line endings).
Hunk #51 FAILED at 1507 (different line endings).
Hunk #52 FAILED at 1681 (different line endings).
Hunk #53 FAILED at 1761 (different line endings).
Hunk #54 FAILED at 2040 (different line endings).
Hunk #55 FAILED at 2079 (different line endings).
Hunk #56 FAILED at 2149 (different line endings).
Hunk #57 FAILED at 2165 (different line endings).
Hunk #58 FAILED at 2191 (different line endings).
Hunk #59 FAILED at 2271 (different line endings).
Hunk #60 FAILED at 2292 (different line endings).
Hunk #61 FAILED at 2313 (different line endings).
Hunk #62 FAILED at 2324 (different line endings).
Hunk #63 FAILED at 2338 (different line endings).
Hunk #64 FAILED at 2358 (different line endings).
Hunk #65 FAILED at 2454 (different line endings).
Hunk #66 FAILED at 2467 (different line endings).
Hunk #67 FAILED at 2497 (different line endings).
Hunk #68 FAILED at 2505 (different line endings).
Hunk #69 FAILED at 2525 (different line endings).
Hunk #70 FAILED at 2539 (different line endings).
Hunk #71 FAILED at 2548 (different line endings).
Hunk #72 FAILED at 2566 (different line endings).
Hunk #73 FAILED at 2579 (different line endings).
Hunk #74 FAILED at 2592 (different line endings).
Hunk #75 FAILED at 2803 (different line endings).
Hunk #76 FAILED at 2848 (different line endings).
Hunk #77 FAILED at 2862 (different line endings).
Hunk #78 FAILED at 2912 (different line endings).
Hunk #79 FAILED at 2926 (different line endings).
Hunk #80 FAILED at 2957 (different line endings).
Hunk #81 FAILED at 3111 (different line endings).
Hunk #82 FAILED at 3157 (different line endings).
Hunk #83 FAILED at 3192 (different line endings).
Hunk #84 FAILED at 3237 (different line endings).
Hunk #85 FAILED at 3249 (different line endings).
Hunk #86 FAILED at 3277 (different line endings).
Hunk #87 FAILED at 3285 (different line endings).
Hunk #88 FAILED at 3303 (different line endings).
Hunk #89 FAILED at 3337 (different line endings).
Hunk #90 FAILED at 3403 (different line endings).
Hunk #91 FAILED at 3427 (different line endings).
Hunk #92 FAILED at 3460 (different line endings).
Hunk #93 FAILED at 3552 (different line endings).
Hunk #94 FAILED at 3647 (different line endings).
94 out of 94 hunks FAILED -- saving rejects to file tmp/cpm22.asm.rej
make: *** [Makefile:55: tmp/cpm22.asm] Error 1

Bugfix of PCB Rev1.00

The local labels /WR, /RD for ATmega128 conflicted with the Z80's /WR, /RD, causing unintended connections on the PCB.

SELDSK of CP/M 2.2 BIOS is very slow.

SELDSK of CP/M 2.2 BIOS is very slow. It causes significant performance reduction at file access across disks.
The root cause is that pf_open() of Petit FatFS takes 2 or 3 seconds.

The AVR Firmware DISK I/O emulation function; OUT_0A_DSK_SelectDisk(), calls it.
This function is executed in an interrupt handler that triggers the Z80's OUT instruction, which causes the Z80 to stop completely.

microSD card format should be FAT32

The following in SetupGuide_en.md needed to be corrected. It should be FAT32.

2. Creating a microSD Card
   - Format the microSD card as **FAT16**.

Patch failure of CPM3-LDRBIOS.patch

Makefile fails with the following error during generating CP/M 3 image disk.

vscode@Z80ATmega128:/z80/cpm3/image$ make

...

patch -i CPM3-LDRBIOS.patch ./tmp/cpm3on2/LDRBIOS.ASM
patching file ./tmp/cpm3on2/LDRBIOS.ASM
Hunk #1 FAILED at 110 (different line endings).
1 out of 1 hunk FAILED -- saving rejects to file ./tmp/cpm3on2/LDRBIOS.ASM.rej
make: *** [Makefile:89: tmp/cpm3on2] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.