[posted] Commodore C64 Emulation on a Teensy 3.6 Microcontroller

Hi,
I don't know.. it really should work without problems. Have you tried to remove the normal SD library ? At least this should work.

For comparison, my output is:
Code:
Bibliothek Teensy64_new im Ordner: C:\Users\Frank\Documents\Arduino\libraries\Teensy64_new (legacy) wird verwendet
Bibliothek SdFat-master in Version 1.0.3 im Ordner: C:\Users\Frank\Documents\Arduino\libraries\SdFat-master  wird verwendet
Bibliothek SPI in Version 1.0 im Ordner: C:\Arduino\hardware\teensy\avr\libraries\SPI  wird verwendet
Bibliothek Audio in Version 1.3 im Ordner: C:\Arduino\hardware\teensy\avr\libraries\Audio  wird verwendet
Bibliothek SerialFlash in Version 0.5 im Ordner: C:\Arduino\hardware\teensy\avr\libraries\SerialFlash  wird verwendet
Bibliothek reSID im Ordner: C:\Users\Frank\Documents\Arduino\libraries\reSID (legacy) wird verwendet
No mention of SD

Seems that I have to fork the Audio-lib and add it to the emu-code to get rid of the includes of sd.h
 
ron2way: I've decided to make my own audio-library for the emu. It will only have a copy of the needed audio-dac, without references to SerialFlash, Wire, or SD.
Please wait a few days - I want to add some other things before I start with that. I hope that I can do it next weekend.
I addition, it will completely remove other teensyduino-core things that slow down the emu unnecessarily.

Then, i've noticed that fastloaders do not work with IEC. That's the next important thing on my list.. I hope I can solve that...
 
Latest update to version 08 is on GitHub now:

+ VGA (work in progress)
+ PS/2 Keyboards (optional)
+ Remove teensy Audio-Library - just copied the output_dac.* files from the official lib
- removed "SD.h" from lib, there shouldn't be any conflicts anymore.
+ minor impovements

Please take a look at settings.h to configure.
 
I have a fastloader (jiffydos-like) partially working - that means the timing must be close to OK.


LOL... is anybody interested in this and this project ? I'm talking with myself...
Maybe it's better to stop and spend time more meaningfully?
 
Compiling Solved!

At last a successful compile after downloading your changes. Compiled on a linux64 but had to use a win7 machine to load the hex file to the teensy.
 
Update:

- "Bruce Lee" works now. Challenge finished. Sorry guys :)
- Fastloader "Jiffydos" works

I want to make it a bit nicer, update follows today. My workaround to make fastloaders work - which need a very exact timing was to disable the screenrendering during loading.

@ron2way: great !
 
Last edited:
Anybody interested in a VGA Version ?
My preliminary board looks like this:


2017-10-10 22.27.25.jpg
Because the demand is very small, I ask before continuing and will only finalize the final board if there is demand for the VGA version.
 
Last edited:
Ok..:)

I'm almost through with testing the preliminary board - so far, everything works (with additional diode as protection). 20x Fastloading with Jiffydos + SD2IEC seems to work, too (but a bit more testing is required).
( I don't know any other emulator that can do this with real hardware.. are there any ? I'd like to know..)
Screen-refresh + Sound is disabled during IEC access (would be a little too much work for teensy..)

Just played one of my old fav games, "Bruce Lee" on this board + 22'' display.

TBD:
- fix board, order... takes some time :-(
- add code for correct right- and left borders on VGA

I'm going to order a cheap VGA->TV converter too, for testing.
 
Last edited:
For Jiffydos: You need the Jiffydos kernal eprom-file for the C64. Convert it with a tool like "bin2h.exe" to a c-header file, take the output and insert into "roms.cpp" as "const unsigned char rom_kernal[8192]="
You might want to leave the original as is and use "#ifdef" to switch between both versions.

Later, I'll add a menusystem to the emulator which can select the desired ROMs and other things.
 
Thought I would mention I assembled one over the last couple of days.

Frank_Board_1.jpgFrank_Board_2.jpg

As I am the Tinkering type, I made a few minor mods to the assembly. In particular I used long breakout pins on the Teensy, such that it makes it easier to jumper pins on the Teensy to other stuff like breadboard as well as nice place to hook up Logic Analyzer. In the past I purchased some from Adafruit and some from sparkfun (https://www.sparkfun.com/products/12693)

I also used some standoffs, such that it can sit on ground without having the Teensy hit...

So far the only thing I have tested out is the USB Host code and verified i could talk to a Keyboard...

Next up figure out how to install the Commodore 64 code to try it out. It is unfortunate that we got rid of my Wife's C64 and all of the games a long long long time ago. Likewise I no longer have my Amiga.

I should mention that the board is easy to assemble. With my boards I have to constantly look at the schematic and board layout to find which parts go where...
As you maybe can see the differences in this picture:
Frank_and_Well_Board.jpg

Also maybe try out some of my other ili9341_t3n library code to see if it works OK on this board... Should once I track down which PINS connect.
 
Kurt: Check this out for pin connects :: github.com/FrankBoesing/Teensy64 /T64_PinMapUse.txt
{ Frank - it doesn't look like I found a #define or anything for the DAC pin used }

On assembly - Yes Frank has done some good work! The Version like this with ILI9341 is currently available and AFAIK will still be supported - but it is a good general purpose display and USB board. The VGA board may be coming along and offer the same setup - with VGA video option ( and other minor interface part changes ).
 
Thanks Defragster - I verified my display test program works :D Next up try to install the C64 stuff... But might be awhile - power out, running on generator
 
Thanks Defragster - I verified my display test program works :D Next up try to install the C64 stuff... But might be awhile - power out, running on generator

Awesome you got Display working - now you can post USB_HOST status/debug on local screen as you work. I went through Frank's code and pulled those pins out to that file knowing without them the board would seem 'single use'. Frank went over it and made some edits so it should be right and helpful for all pins wired.

Yes Kurt, we are having a windy day aren't we :) - our lights have only flickered so far. Dropped once yesterday and I swapped my UPS that had about 0% reserve just hibernated on any dip ( or when my laser printer fired up the fuser ) - as I type new UPS kept machine up across a dip that dropped 2nd display and other stuff.

C64 stuff was good an easy when I did it. Just need a lib or two and I got it working. Have not recompiled recently with newest IDE/TD but there are README notes on Github that should get you there - post any issues.
 
Anybody interested in a VGA Version ?
My preliminary board looks like this:


View attachment 11745
Because the demand is very small, I ask before continuing and will only finalize the final board if there is demand for the VGA version.
Edit: It has a easy to solder SMD IC ("SOIC") for 3V<->5V conversion on the backside. The board can be used for other projects, too. Perhaps the 5V bidirectional pins are useful ?

I would definitely buy one as well :)
 
I might have some of the games already in a file format, I can check for the C-64 if you like.
 
I might have some of the games already in a file format, I can check for the C-64 if you like.

Easiest, and fasted to use is single-file software - PRG files. They load in less than a second from the Teensy-SD slot.
They are available on the internet. Some time ago I saw a big archive with hundrets of them..

I think, most PAL 80's and 90's games should work. The younger the games are are the more likely they use "dirty tricks" which may not be emulated at the moment..
NTSC is totally untested.
 
I have a rock-stable VGA now, at least on my display. I think, I was right with this post. However, for this test, I had to disable some important things
Reasons for pixel-flickering are: - GPIO-Access, DAC, USB. I am hoping that I can solve this with synchronizing the GPIO and DAC accesses with the VGA hsync-signal.
USB (Host) is not that easy - It helps a lot to disable the async transfers completely (after enumeration) - but there is still a little flickering. I tried to sync this is with VGA-vsync, and to enable the periodic transfers "outside" the screen only - but this resulted in too slow reaction to key-presses. Maybe hsync is better...

Anyway, the flickering is not too annoying, and I can't see it from 1.5 Meter distance.
 
I am hoping to try out a few C64 games, but I don't have any C64 joysticks... I found a few up on Ebay for about $200 8)

So thought I might build my own for now... Looked at some sites and it look like the connections to the 9 pin connector looks pretty straight forward, so I thought I would buy some simple joystick parts.

I saw Defragster purchased some stuff from Sparkfun... Should have purchased some of the same stuff. Actually Amazon has the joystick a bit cheaper. But I purchased a different one that also came with some buttons (8)... I probably should have looked a little more carefully as I think the size of it is a little out of scale :lol:

Joystick.jpg

May need to build a pretty big heavy box for it!
 
@Kurt: I bought an old digital ATARI Joystick for 5€ in the bay.. One of the next things I'll add is a "swap joystickports" function via keyboard.
All the c64 software uses the ports more or less randomly. It's a bit annoying to always plug the joystick into another socket. That's why I had two then.

@prickle: Nice !!


Last updates:
- Please update the reSID library - there was a little change to make it more exact.
- VGA: GPIO and DAC is now sychronized to VGA - flicker almost completely gone.
- VIC: Added a better emulation for graphic modes 1 and 3 in "idle" state - all other modes in "idle" are still ""TODO". Only very few programs use it, so not a big issue.

Please report issues on Github! Thank you!
 
I am hoping to try out a few C64 games, but I don't have any C64 joysticks... I found a few up on Ebay for about $200 8)

So thought I might build my own for now... Looked at some sites and it look like the connections to the 9 pin connector looks pretty straight forward, so I thought I would buy some simple joystick parts.

I saw Defragster purchased some stuff from Sparkfun... Should have purchased some of the same stuff. Actually Amazon has the joystick a bit cheaper. But I purchased a different one that also came with some buttons (8)... I probably should have looked a little more carefully as I think the size of it is a little out of scale :lol:

View attachment 11902

May need to build a pretty big heavy box for it!
You can buy them online, i am not sure whether they sell outside eu, but you can ask Thomas :
https://shop.pixelwizard.eu/commodore-c64/34/competition-pro-retro?c=6
 
Back
Top