The RetroShield comes in a Z80 flavour, complete with a small amount of sample code.
However the sample code mixes the actual Z80-usage with some unrelated things, such as button-scanning, LCD display, and SPI-RAM access which makes it harder to use as a standalone "thing".
This repository aims to make the retro-shield easier to deal with, by abstracting the CPU-driving into a single standalone class. Allowing you to use it in your arduino-sketch along with whatever else you wish to do.
There are currently two pieces of sample-code for the Z80 retroshield, one uses the loop()
-based approach this repository contains, the other uses a timer-function to drive the processor. Using a timer is cleaner since it gives you more speed and predictability, however the execution becomes more complex because you can't do things like invoke Serial.read()
/Serial.write()
inside an interrupt-handler - though you can disable the time for the duration of your "stuff".
In short running things in loop()
is more predictable, but slower.
Create a Z80
object, and pass it handlers for:
- Reading a byte of RAM from address XXX.
- Writing byte NN to address XXX of RAM.
- Reading a byte from I/O address NN.
- Writing byte NN to I/O address NN.
Once you've done that call .Tick()
to run the processor regularly.
The sample code should demonstrate the usage in a clean fashion, but questions are welcome!
This repository contains a useful standalone demo, but for real usage you should probably look at the repository here:
The z80retroshield library can be installed via the Arduino IDE, and comes complete with examples, documentation and a sane upgrade-path.
The retroshield itself:
Now some Z80 links
- Sample Z80 code:
- Sample Z80 emulator:
- My blog posts on the topic of creating Z80-based computer: