I thought it would be fun project to emulate a MOS 6502 inside of a Teensy 4.1 and build a board to allow drop-in replacement of the original CPU. This Teensy can run at around 800 Mhz so should have enough power to emulate both the 6502 as well as the local bus interface. It also contains 1 MB of RAM so the motherboard RAM, ROM, and cartridge ROMS could also be emulated.

The 652 emulator is sensitive to the motherboard clock and is cycle accurate. It also supports the idiosyncrasies of the original CPU such as over-fetching, page wrapping, and the undocumented and unstable opcodes. The 6502 local bus is only a few megahertz so is easy to implement with the fast Teensy 4.1.

The PCB was built to contain the voltage level shifters as well as map the Teensy pinout to the 6502.  It is a two layer board with all through-hole components for easy assembly.

The first computer I tried the MCL65+ in was the Commodore VIC 20.  I was able to max out the system memory by emulating it all using an array in the Teensy.  I also emulated a number of cartridge games which was a lot of fun!  

 It turns out that the VIC-20 BASIC was not tolerant of much acceleration… When I ran an accelerated ZeroPage and Stack range the performance boost was only about 15%. This is because when I tried to accelerate the BIOS and video regions, the VIC-20 video would no longer work. I guess there are timing dependancies with the BIOS that must not be exceeded.

I had better luck with some of the cartridge games. Some of them actually ran better when they were accelerated because, at the normal clock speed, they were slow and less responsive! When accelerating the game and VIC-20 memory ranges they ran much faster which was more enjoyable. Donkey Kong, Pac-Man, and Jungle Hunt all ran well at the accelerated speed. Defender was a little too fast to control!

The next machine I tried the MCL65+ in was an Apple II Plus and it ran perfectly in both cycle accurate and accelerated modes. When I ran it in accelerated I estimate it was more than ten times faster than a stock 1 Mhz Apple II+. This was accomplished by emulating all of the computer’s ROM and RAM in the 800 Mhz microcontroller’s memory. Just the I/O and video memory ranges were left as regular 6502 bus access to the motherboard which run at 1Mhz.

I took some videos of two BASIC programs I made to measure the system’s performance before and after the acceleration. One is the classic x=x+1, print x, goto 10 program and the other prints an array of characters. Both very simple however the accelerated speed increase is dramatic.. the text just flies by!