AVR 65C02 Emulator

I created this project to provide a simple, inexpensive computer system that could be used to learn computer programming and microprocessor controls. I chose to emulate a 65C02 microprocessor as this is well-known general purpose device that has a wealth of information, code examples, and support available.

The system features include:
- 65C02 instruction set
- 16K Bytes of RAM
- 32K bytes of ROM
- Full access to the AVR's IO Registers
- IRQ supporting all AVR Interrupt sources

The Instruction set includes all of the WDC 65C02 instructions. Invalid (unused) opcodes are treated as NOP instructions. Decimal mode is supported.

The Emulator's 65c02 engine runs at about 2.1 MHz. Some minor fluctuations occur depending upon the memory accesses used but worst case is 1.9 MHz and best case can be up to 2.3 MHz.

The default OS is based on my SBC-2 OS but users can download their own 48k byte ROM image and run their own custom applications. The AVR’s flash has a 10,000 write-cycle rating so making periodic changes should not be a problem. I have included the following programs with my OS: Lee Davison's EhBASIC, Peter Jennings' Micro Chess, and FigForth. All are accessed from the SBC-2 OS.

Upon power up, the Bootloader will prompt you to either start the emulator or download a new ROM image. Press [Enter] to start the emulator or press [u] or [U] to begin the download. If no key is pressed, the Emulator will autotart after about 15 seconds. The download protocol is XMODEM/CRC only. The file must be a raw binary file that is exactly 49152 bytes long, corresponding to addresses $4000-$FFFF in ROM. Any other file type or size will result in improper operation of the emulator.

Component List (Digikey Part # and cost included):

1 – ATMega1284P Microcontroller (ATMEGA1284-PU-ND $7.33)
1 – 24MHz TTL oscillator (CTX757-ND $2.49)
1 – 5v TTL RS-232 to USB adapter (Pololu.com Item #391 $14.95)

Schematic:

Construction:

Simple point-to-point wiring can be used for this project. The Pololu Module can provide up to 25mA of 5 volt power to the system. If you connect more IO devices and exceed that total, disconnect the 5v output from the module and use an external 5v power supply connected to the VCC and GND pins.

The memory map for the emulated processor looks like this:

$0000-$3EFF – System RAM (just under 16k)
$3F00-$3FFF – IO page
$4000-$FFFF – ROM 48k

The AVR's data port access along with the other interface registers are described in the ATMega1284P’s datasheet in great detail. Please refer to that datasheet for implementation of those interfaces.

The ATMega1284P datasheet can be downloaded here (24MB): ATMega1284P.pdf

Source code for the project is provided in this 1.5MB file:AVR65C02.zip. You are free to use it for personal use without cost. Any commercial use of this software is subject to a license agreement and possible fees. Please respect my hard work and feel free to contact me if you have any questions.

*NEW* - I have created two new targets for the CC65 C compiler. One is for loading programs into RAM, the other will create a 48k image that can be loaded into ROM. Get the files here -> AVR_CC65.zip

I have included a method of installing updates without using an AVR programmer so any updates that I make can be easily installed by the end user. I will also program AVR's at no cost (postage not included) or provide pre-programmed AVR's. Contact me for pricing.

This project, including source code and documentation are provided as-is and without any warranty. Use it at your own risk.

Thanks for visiting!


Home
All info provided "as-is" and is Copyright 2013.
Last updated on July 4, 2013.