[posted] Commodore C64 Emulation on a Teensy 3.6 Microcontroller

@gothmag
I just received my Teensy64 board and have been having a play. I've started doing a basic implementation of the D64 image format. There is a good library available called diskimage.c, though it appears to load the entire disk image into memory. I don't think this is good on a microcontroller.

As a result I have been writing my own by taking some parts of diskimage.c and following the documentation at http://unusedino.de/ec64/technical/formats/d64.html. I've done a rough implementation of loading a directory, following the directory entries from track 18/1 on. I've used the existing method in pacthes.cpp for hooking the load. In my current builds LOAD "$" returns the sdcard contents and LOAD "$IMAGE.D64" loads the directory from the image file. I've followed the existing code from Frank for the SDCard patch basically. In the image you can see the title, blocks free, file type are incorrect. I'm currently doing the BAM stuff for this.

@all: If anyone else is already doing this work, please let me know.

View attachment 12132

I'd be very interested in this as well, even if not all disk images would be possible due to fastloaders and/or copy protection it might still be very useful.
 
I'd be very interested in this as well, even if not all disk images would be possible due to fastloaders and/or copy protection it might still be very useful.

Stay tuned - great to have interest. The board kits with ILI9341 and T_3.6 connectivity are available. Frank may be 'offline' a short time - though the more interested folks the better. PM me if I can help get you a kit.

I don't have history with C64, but I know enough to understand the complexity and proficiency of what FrankB has done here and am excited to see it move forward.
 
I just thought I'd add. I had my dad mail me my sd2iec. I've only tested 1 thing, which is all I've got time for now, and M.U.L.E. works. It's one of my favorite games from when I was a kid so that's great. This is essentially the way forward I think. "Native" loading and directory traversal like itec has started on followed by sd2iec emulation/porting. Not everything since the channels are an abomination, but it's close. Again I won't have time for a little while but it seems like it'll be the quickest way to make it work properly. https://sd2iec.de/
 
Last edited:
Yeah, something like the SD2IEC would work for a lot of cracked programs, but that's all. Demos, and a lot of programs use custom loader routines.
 
Demos on the Amiga were cool, the commodore I could pass on. M.U.L.E. Is an actual disk image, do you have an example of something that you don't think would work? I've got everything on sd2iec. No disks at my house though.
 
M.U.L.E was copy-protected and used with EA's custom sector loader. The disk image you have of it is a crack. Anything that works on the SD2IEC has to use the standard loading routines (no block reads or custom disk format), which means they are all cracks if they work.
 
I think I will end up with a less compatible implementation than the sd2iec that loads incredibly quickly. I won't do all the extra copy protection sectors in the d64 format or other image formats with additional tracks/BAM, GEOS etc

Directory listing is now complete and I am just starting to test loading of prg files from the D64. I haven't looked at SEQ files yet.

I am also looking at the new internal sd2iec with the teensy64 as an option. I am not sure if I could power it from the 5v on Frank's board though.
 
Are you looking at this one - or one like it? : https://www.ebay.com/itm/Internal-f...r-C64-Vic20-/232564602479?hash=item3625ee366f

I was there yesterday [ebay reminded me today] and the sd2iec I got is no longer available so I can't link the page - it was $25 not $45 - and shipped for $5 less to US. What Frank tested against in pic below. I didn't wire mine up yet. I assume that runs from PCB's 5V. That was the goal in that jumper block (drawing linked below).

That one above doesn't show power used - Fed from USB, the PCB should get most of 500 mA. With ~190 used for the base unit - maybe more depending on USB_Host. From a USB passing more, the T_3.6 may have enough? I just clocked the ILI9341 at 187mA with display at BASIC screen with wireless USB connected - did not catch a change doing a DIR load "$" of onboard SD.

Linked board isn't labeled - but I assume it wants 5V - if taken off a 5V VIN pin that will bypass the regulator and pull 5V from there for whatever it is worth.

sd2iec.PNG
 
Some more progress on the D64 disk images. I need to take in to account a few things like wildcards, secondaryAddress, SEQ files and then do the write code.

Looks like it is going to work with the same restrictions as SD2IEC but much faster and less compatible.

 
@defragster
I have this one on the way: https://www.thefuturewas8bit.com/sd2iec-classic.html

It looks like I could squeeze that in pretty easily and have a slower but more compatible drive as an option. It will be handy for testing if I end up finishing the code.

I asked the manufacturer about the power requirements for the sd2iec and they pointed me to a page for hooking vias on the c64 motherboard for power.

I'll measure it when it arrives and hope that there is headroom on the teensy64. If not it will require a separate usb for the sd2iec drive or a change to a 5v plugpack I guess.
 
Robin, Paul, thank you.


@all: I took a break for some time.
I have received private messages and emails which I will probably answer next weekend.


The development continues (of course).
 
Cool some hackaday coverage! I'm in for 2 VGA boards when they're ready. Unfortunately I've had another hw/sw project hat is taking much longer than expected so haven't had a chance to do much other than put jiffydos on mine. Glad to see you're back Frank.
 
Hi, I'm interested in this project. I work with microcontrollers from years and I'm a Commodore64 lover. How can I obtain a complete kit?
 
Hi, I'm interested in this project. I work with microcontrollers from years and I'm a Commodore64 lover. How can I obtain a complete kit?

Same here :) The Teensy board I know where to get and with a component list, the rest is easy to buy locally. Except for the base board (Frank's design right?). I would love to put something like this together. The version with a small LED-display is an awesome way to get a small portable game play device for the car :D
 
gothmag already got the LED board and now is interested in the VGA board.

I have part kits for both to US ship with PCB's - PM Frank if interested - he was shipping outside US.
 
I sent out three PM's - if in the US and interested send me one.

To answer question I got about what is needed having the kit ...

All the parts and connectors needed to populate the PCB to install your T_3.6 are included.

For the LED version it needs an ILI9341 - like from PJRC.com. For the C64 VGA it takes a compatible VGA display to work with.

From Frank's notes - Additional Parts needed:
SD Card
Screws
USB Keyboard
C64-Compatible Joystick(s)
Active Speakers (PC Speakers) – DO NOT CONNECT HEADPHONES
 
Last edited:
The stick I got for my Aiie box is not bad. About the right size for me, seems pretty solid but feels a bit cheap.

View attachment 11904

Hi, this setup looks like I thought to make: add some buttons for simple Load/run/reset/directions without attach a real usb keyboard in order to make an all-in-one portable device. Can I have more info about keyboard you've implemented? You've used GPIOs?
 
If you want an own keyboard, perhaps the easiest way, without modifiying the T64 sourcode involves using a Teensy LC in keyboard mode connected via USB to the T36. But I've not tried that so far.
 
Back
Top