Giter Club home page Giter Club logo

z80retroshield's Introduction

Z80RetroShield

The RetroShield is an addon/shield for the Arduino Mega which allows your arduino to drive, control, and interact with a real processor.

This library is designed to work with the Z80-based retroshield, allowing you to experiment and build projects which use a Z80.

Motivation

The retroshield project contains some sample code, however that sample code mixes the actual Z80-usage with some unrelated things, (button-scanning, LCD display, SPI-RAM access etc), which makes it harder to use as a standalone "thing".

This repository aims to make the Z80 retroshield easier to deal with, by abstracting the CPU-driving into a single standalone class, and packaging it as a library for the Arduino IDE. This should allow you to use it in your arduino-sketch along with whatever else you wish to do.

Installation

If you wish to install the library manually you can clone this repository beneath your arduino libraries folder, or download a release there.

The simpler way to install is via the Arduino library manager, enter "z80" into the search box and you'll find the library. Click "install" to install, then restart your IDE and open the examples:

Screenshot

Usage

The examples included within this library should be sufficient to demonstrate how to use the class, but in brief you:

  • Instantiate an instance of the Z80RetroShield object.
  • Configure a small number of callbacks
    • Which are fired to read/write RAM and handle I/O.
  • Call Tick() to allow the Z80 processor to execute.

Examples

You can view the examples by exploring the repository, and the examples should be visible via the Arduino-IDE interface:

  • basic
    • A BASIC interpreter, written in Z80 assembly!
  • ram-test.ino
    • Tests a simple program for reading/writing to RAM.
  • hello.ino
    • A simple example which writes a message to the serial-console.
  • speed_test.ino
    • Shows how many ticks/cycles we execute a second.
    • This shows the overhead of using the driver.
  • uc.ino
    • Read from serial-console, and output the input in upper-case.

Links

Now some Z80 links

Steve

z80retroshield's People

Contributors

hanyazou avatar skx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

z80retroshield's Issues

Rename ram to memory.

For neatness we should:

  • Rename ram_read to memory_read.
  • Rename ram_write to memory_write.

Leave the old names for compatibility though. Sigh.

Implement FORTH.

I found a FORTH implementation for a Z80 system here:

However it assumes that there is a lot more RAM than available; the driver is essentially the same as that used in our BASIC example - so porting it should be trivial - I've ordered some SPI FLASH-RAM which will allow me to access 64k of RAM, however the downside will be that such external RAM will be mandatory.

Still it will be a good "big" example to add.

Cortex M4 (Adafruit Grand Central ATSAMD51)

Hi,

I got a Z80 Retro Shield and was looking for a good sample and found your project.
I was able to get BASIC working right away. Very useful project.
Thank you very much.

Next I ran your project on an AT SAMD51 (Cortex M4 120MHz) board instead of an AT Mega 2560.
It ran fast.

My working branch on my github includes these changes below,
https://github.com/hanyazou/z80retroshield/commits/adafruit-grand-central-samd51

If you are interested in this fix I would like to send you a PR.
Please take a look at my branch.

Best regards.

12:43:52.226 -> Z80 configured to run endless stream of NOPs.
12:43:52.226 -> Cycle/Second will be dumped once per second.
12:43:52.226 -> Cycles per second second:63
12:43:52.991 -> Cycles per second second:1262937
12:43:54.019 -> Cycles per second second:1263436
12:43:55.020 -> Cycles per second second:1263236
12:43:56.016 -> Cycles per second second:1263336
12:43:56.997 -> Cycles per second second:1263436

SAMD51-RetroShield-Z80

Add BASIC

I should port the BASIC interpreter over as an example.

This is more complex than the other examples:

  • It uses in (0),a and out (0),a for serial I/O.
  • It uses in (1),a and out (1),a for setup of serial-port.
    *This can probably go away.
  • It uses an interrupt to signal new input is ready.
    • RST 38 called via IMM 1
    • If in (1),a & 0x02 then fetch a character.

So either the interrupt routine needs to be handled differently, as a timer, to poll, or I need to export new CPU primitive for raising/clearing the NMI pin.

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.