When the Commodore 64 was released in 1982, it was a masterpiece of engineering. It had capabilities far outstripping other home computers, and that was all due to two fancy chips inside the C64. The VIC-II, the video chip for the C64, had sprites and scrolling, all stuffed into a single bit of silicon. The SID chip was a complete synthesizer on a chip. These bits of silicon made the C64 the best selling computer of all time, but have also stymied efforts to emulate a complete C64 system on a microcontroller.
[Frank Bösing] has just managed to emulate an entire C64 on a Teensy 3.6. The Teensy uses an exceptionally powerful microcontroller, but this is a labor of love and code.
The inspiration for this project comes from a reverse-engineered SID chip that was ported to the Teensy 3.2. The SID chip is the make it or break it feature of any C64 emulation, but the Teensy 3.2 didn’t have enough RAM for the most recent versions of reSID. With the release of the Teensy 3.6, [Frank] figured the increased amount of RAM would allow a complete C64 system, so he built it.
The new C64 emulator uses a Teensy 3.6, with a small add-on ‘shield’ (or whetever we’re calling them) to provide connectors for joysticks and the Commodore IEC bus. There’s audio out, support for USB keyboards, and support for an IL9341 SPI display or a regular ‘ol VGA display.
The entire development of this Commodore emulator has been documented over on the PJRC forums, and all the code is over on GitHub. It’s a fantastic piece of work, and as the video (below) shows, this is a real Commodore 64 that fits in your pocket.
40 thoughts on “Emulating A Complete Commodore 64”
” It’s a fantastic piece of work, and as the video (below) shows, this is a real Commodore 64 that fits in your pocket.”
Makes people happy to see you. ;-)
No C=64 emulation is complete without a 20” crt tv set of the same vintage. For that true favourite original game floppy disc degaussing experience.
Considering some of the “brains” were in the floppy you’ll need that too.
No, The C64 did not need the disk-drive – in fact most people would manage well with only a tape-drive.
But yes, the disk-drive were intelligent (about the same CPU with less RAM as the C64 itself), and could be used similar to an SQL database, so it was really easy to make advanced programs in BSAIC on the C64.
I think it’s in Europe that most C64 did not have a disk drive, i’m Canadian and I’ve never seen a store selling C64 games on anything but disk, American magazines also offered disks, either with the magazine or on order.
Lots of 1541 in Germany those times. But I saw lots of game-tapes, too, so there must have been a market.
My first computer was a C=128 with a 1571. however over the years, I picked up old 64’s some cartridge games, even a few tape games, I think I may still have the tape drive in the back room. I later got a +4 just to tinker with, had a nice monitor that matched the +4. I programmed some pro 2nd Amendment text to display on the screen and took it to a gun show. A fellow at the show loved them machine so much, he traded me a very nice Ithaca 10 gauge double barrel shotgun for the machine. Even had an SX64 that I picked up following major back surgery and had that set up on the coffee table next to the couch where I lay recovering for over a month. The SX was a godsend in that situation.
This, of course was in the USA. So we did use tape drives, and cartridges in our C=128 and 64’s.
I thought there were three of Commodore’s 6502 chips in the drive. Or was it one 6502 and three 6522 types?
One 6502 cpu, 2x 6522 via, and about 2K of ram, iirc. But all that was there essentially just to get sectors back and forth between buffers. The rom routines were just smart enough to manage sector allocation and follow file chains, and that was all largely transparent as far as the C64 itself was concerned, bcz the 1541 presented it all througha serial protocol.
A lot of users in Europe made use of the Datasette which was reliable if slow though most North American users bought a 1541 since the computer was sold very discounted in those markets.
No, that is not a c64 emulation, that is a nostalgia emulation.
I beg to differ. The monitor is definitely an essential part of the system. I imagine a 4k monitor and a bigass air core inductor hand wound to perfectly mimic the magnetic field of crt’s of the era in a 3D printed casing. It must be a high resolution monitor to be able to replicate the rgb segments.
That’s the emulation to see: enough RF interference to have the display show up as a floating ghost on all the other TVs in the house…
Will need something to churn out an obnoxious 15.75 kHz whistle, too. Seemed like the horizontal deflection always made it into the audio circuits. Most TVs did it, but that 1702 official C= brand monitor was especially loud in that way
Emulate it with a 20 inch flat panel, mounted in a box, filled with bricks.
Don’t forget to include a toaster, to churn out a couple hundred watts of heat
By now, older CRT monitors (used with the VGA version of this project) have probably aged sufficiently to give you that 1980’s television set nostalgia feeling.
No C=64 emulation is complete without making you wait several minutes while the 300 byte/second program load over the serial bus takes place.
While the 1541 did transfer at about 400B/s, the IEC bus is capable of theoretical speeds up to about 20KB/s.
Not to mention that the face of the CRT usually had enough static charge on it to hold a full sheet of paper stuck to it, sometimes handy when typing in long listings before you saved them to tape
“The Teensy is an exceptionally powerful microcontroller”
I think NXP/Freescale didn’t rename their Kinetis (Teensy 3.6 is using K66) microcontroller family. Therefore Teensy is just the brand name of the development system. There are way more powerful microcontrollers.
How the hell is 32 kB of RAM insufficient for SID emulation? What kind of hell am I living in? The SID has just a few registers, a few internal state registers and that’s all. The only place where you may need a bit of memory is for applying some filters…
Reading this makes my eyes bleed.
After a brief look at the ReSid sources, it seems it uses big lookup tables to generate waveforms, which would be a good things because the SID sounds didn’t consist in pure waves: its flaws made its sound that distinctive.
I always understood that the “flaws” were mainly in the filters. The sound/waveform generators themselves are basically a set of counters.
Yes and no. the counters make the ideal triangle and sawtooth wave samples but the DAC inside and the analog circuits where flawed. and of course the filters. and also the filters where controlled by some DAC-values that had a huge variation from sid to sid. these non-linear DAC behaviours need to be emulated somehow. one approach is a ram-lookup-table – especially when speed optimization is an issue. but this could also be used as a new feature to implement wave-table synthesis extension.
feel free to write better SID emulator, with blackjack and hookers
I wonder if its possible to accomplish the same using bare metal programming on a Pi zero W, which is cheaper and more powerful…
There is the VICE emulator for almost everything Commodore, which uses the same base SID emulator code as this project, so if that’s available for Linux on the particular ARM architecture used in rPi’s, then it’d be easier than you’d expect.
Aside from the video output, it really lacks the “look and feel” of the C64.
It needs a similar looking enclosure, maybe a “hat/shield/bonnet/bone/”(or whetever [sic]we’re calling them)” that will slip over a keyboard.
Well, this is probably close enough…
Back in the day I was doing Commodore 64 development, we had an IEEE bus adapter and a “professional grade” Commodore dual 1.2 Mbyte floppy setup. Those 1.2 Mbyte floppies were like solid state drives compared to the awful 1541 floppy drive, very fast, very reliable, very expensive. We had a hot office with no A/C and the 1541 drives would die all the time, even with fans attached to them. Also Commodore used some sort of shellac in the manufacturing process which was a terrific bug attraction, and our office was directly above a pizza restaurant, so my system had to be opened up and cleaned out on a regular basis to remove the accumulated dead cockroaches. The Commodore programming manual was very good but no match for the excellent “De Re Atari” documentation for the Atari 800.
One of the first boards I ever made for my Apple //e was an card with the commodore SID chip on it. Thinking back probably could have made a mint if I would have sold them.
Why does this not have a link to Jeri Ellsworth’s C64 Direct-to-TV ???
There. I fixed it.
I got one of those after reading about them in an article here on HaD, I hadn’t heard of them before then.
There’s also the new C64 mini. Like the NES mini, SNES mini of recent years it’s also an emulator in a box, but it’s the first one I’ve been tempted to purchase.
Because it is just one of many and because it’s not a good one. Bad SID (no filters! filters is what makes the SID special!) and a lot of quirks and flaws.
There are several much better efforts out there, both in software and (programmable) hardware.
My exact thoughts, Paul. +1 for the Jeri Ellsworth nod.
Then where is the link to what made the DTV possible in the first place, the C-One?
Jens Schönfeld > Jeri Ellsworth
Please be kind and respectful to help make the comments section excellent. (Comment Policy)