In this article we look at a shield for your Arduino Mega which enables you to use a 6502 processor with your Arduino Mega
Popular video game consoles and computers, such as the Atari 2600, Atari 8-bit family, Apple II, Nintendo Entertainment System, Commodore 64, Atari Lynx, BBC Micro and others, use the 6502 or variations of the basic design
As a ZX Spectrum owner (the ZX80 shield we will talk about soon) and then a Commodore 64 owner that sparked my interest in this kit – typing in simple basic programs
Lets look at the shield
Hardware Details
- The Arduino Mega is used to emulate system hardware such as ROM, RAM, I/O devices.
- The 6502 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 6502 processor
Parts
Arduino Mega | Aliexpress link |
LCD Keypad shield | Aliexpress link |
Software
The gitlab link has sketches for the following
- Apple-1
- KIM-1
- A modified version of Commodore 64 BASIC
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 6502.
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 first fit an LCD Keypad shield to my Arduino Mega and enable that functionality in the sketch by setting this
I am going to use the Apple-1 ino sketch which first of all requires the DIO2 library to be installed via the library manager.
#define USE_LCD_KEYPAD 1
Now I upload the sketch to the Arduino – this is what I saw on the LCD Keypad shield.
Now as stated earlier unplug the usb cable from the Mega, plug in the Retroshield 6502 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: 0x0 SRAM_END: 0x17FF ======================================================= > WOZ Monitor, Integer BASIC, Apple Cassette Interface > by Steve Wozniak ======================================================= Notes: 1) Enter E000R to start Apple BASIC. 2) Cassette Interface added to RetroShield 6502 by Lorenz Born. ACI Audio Out is available on GPIO output. Somebody should write code to handle incoming audio :)
As stated in the serial monitor window I now type in E000R and lets try some commands
PRINT "RND(5) = "; RND(5) RND(5) = 2 PRINT "LEN('ABCDEF') = "; LEN("ABCDEF") LEN('ABCDEF') = 6
Links
https://www.tindie.com/products/8bitforce/retroshield-6502-for-arduino-mega-2/