In this article we look at a shield for your Arduino Mega which enables you to use a Z80 processor with your Arduino Mega
This was a processor that was used in a lot of personal computers including the glorious ZX Spectrum
Lets now take a look at more details of the shield that you you can see fitted in the picture above.
Hardware Details
- The Arduino Mega is used to emulate system hardware such as ROM, RAM, I/O devices.
- The Z80 microprocessor executes code.
- Clock speed is about 170~200kHz
- 200KB ROM space available in Arduino.
- 6K RAM available in Arduino which can be expanded using an SPI ram chip
- Any existing Arduino shields (LCD, SDCard, etc.) can be used to add new features as these Arduino Mega pins are not used.
I purchased the kit with the smt parts already soldered. I then soldered the IC socket, header and LED.
The processor was then fitted carefully to the socket after straightening the pins a little bit. Always observe ESD protection when handling the 1802 processor
Parts
Arduino Mega | Aliexpress link |
LCD Keypad shield | Aliexpress link |
Software
The gitlab link has sketches for the following
- Microsoft Basic v4.7 (Modified by Grant Searle)
- Efex monitor
The process for uploading a sketch is as follows
Disconnect the RetroShield from Arduino Mega.
Program Arduino Mega with your desired sketch
Disconnect Arduino Mega from computer and plug in the RetroShield Z80.
Connect Arduino Mega to computer.
Open the Serial Monitor
Select `115200` for Baud and `Carriage Return` for line endings and you should text in the serial monitor depending on which sketch you loaded
Testing
I tried enabling the LCD keypad shield but for some odd reason nothing was displayed on the screen, it worked with the 6502 retroshield, so I disabled it by setting this in the code
#define USE_LCD_KEYPAD 0
I will need to try and debug and see what went wrong but lets continue without the LCD keypad shield
Now as stated earlier unplug the usb cable from the Mega, plug in the Retroshield Z80 and then plug the usb cable back in
Open the serial monitor and you should see something like this
Configuration: ============== Debug: 0 LCD-DISP: 1 SPI-RAM: 0 Bytes SRAM Size: 6144 Bytes SRAM_START: 0x2000 SRAM_END: 0x37FF ======================================================= > Z80 SBC By Grant Searle > Z80 BASIC Ver 4.7b Copyright (C) 1978 by Microsoft > Modified by Grant Searle > http://searle.hostei.com/grant/index.html ======================================================= Try running: 10 FOR A=0 TO 6.2 STEP 0.2 20 PRINT TAB(40+SIN(A)*20);"*" 30 NEXT A 40 END Z80 SBC By Grant Searle Memory top?
Press ENTER to use full memory, otherwise enter the value that you require.
After a few seconds (memory test) the following will appear on the terminal:
Z80 BASIC Ver 4.7b Copyright (C) 1978 by Microsoft 5758 Bytes free Ok
Now type in the following will give (current ROM version)
PRINT FRE(0) -5758 Ok
Now for Hello world – what else
10 PRINT "HELLO WORLD" RUN HELLO WORLD Ok
And now a simple program that asks the user for a number
10 PRINT "CAN YOU GIVE ME A NUMBER "; 20 INPUT NUMBER 30 PRINT "THE NUMBER YOU TYPED WAS ";NUMBER RUN CAN YOU GIVE ME A NUMBER ? 10 THE NUMBER YOU TYPED WAS 10 Ok
Links
https://www.tindie.com/products/8bitforce/retroshield-z80-for-arduino-mega/
http://searle.x10host.com/z80/SimpleZ80.html