C64 Emulation with Teensy 3.6

Status
Not open for further replies.
ok, with 3.3v only + iec + 2x joystick ports (on 3.3v, too) + display the pcb can be really "teensy" small.
i don't think that more advanced old joysticks (with..hm, don't know how to translate it (in German "Dauerfeuer") - autofire (?) ) will work with 3.3v. But functions like this are cheating anyway ;-)

btw... did you notice, that the T3.6 is the smallest c64 ever (if you don't count the display - only the usb is needed for the minimal version) ? ;-)
 
Last edited:
A first try:

c64_throughole_brd.png
It looks large - but it is exactly the size of the display.
Userport(3Volt), 2x Joysticks (3Volt), IEC(5Volt), Audo Line Out, USB Host
I did not find a minimum 5x DIL bidir-levelshifter that would fit - so I decided to just use the working transitor-approach.
Very easy to solder (i hope)
 
Last edited:
Would that be like a shield for a Teensy 3.6 to snap into? Thus allowing you to remove it for other projects later on?

Is there a port to connect a 1541 disk drive up to it?

I am ordering a TFT screen tonight..

Very cool project!
 
After some thinking, I have a solution for the sound. I have not written one single line for it, yet, but I'm pretty sure it will work..
I'll reduce the samplingrate to the PAL/NTSC linefrequency (15625Hz for PAL). Since the SID max freq is about 4..5kHz this will have no audible influence.
Then, I remove the whole audio-lib from the project and just use reSID directly on a small buffer...(8..16 samples) Every scanline outputs one sample.
This way reSID is perfectly synced with the rest and I can use the spare cycles of VIC "Badlines" to call it and fill the buffer.

@Synthetech: Yes, that's the plan. And yes, you can remove the Teensy 3.6. One little thing: As it is needed to solder the USB-PINS it will not fit on breadboards after that. Maybe I find a solution for this "problem", too.. or just use a cable, instead ?
The IEC Port uses the original connector - at least i hope, from the pictures it looks pretty similar - but I have to wait for it to arrive!

@Defragster: I'll send you a beta.
 
Last edited:
After some thinking, I have a solution for the sound. I have not written one single line for it, yet, but I'm pretty sure it will work..
I'll reduce the samplingrate to the PAL/NTSC linefrequency (15625Hz for PAL). Since the SID max freq is about 4..5kHz this will have no audible influence.
Then, I remove the whole audio-lib from the project and just use reSID directly on a small buffer...(8..16 samples) Every scanline outputs one sample.
This way reSID is perfectly synced with the rest and I can use the spare cycles of VIC "Badlines" to call it and fill the buffer.

Do you know if this method will handle the digitunes like "Polly_Wants_a_Tracker.sid"? It updates the SID about once every 6us. I would also check the voices in Impossible Mission and Ghost Busters.

It would still be great if you could just put a SID socket on your board, but I understand that isn't easy if you don't have a SID.

David
 
... I'll reduce the samplingrate to the PAL/NTSC linefrequency (15625Hz for PAL). Since the SID max freq is about 4..5kHz this will have no audible influence.
...
@Defragster: I'll send you a beta.

Very cool and very nice Frank! Excited to see it!

That change will free up a lot of cycles (and other resources?) for you I hope. Also sounds like using the "CPU Stall of Badlines" where normally the VIC-II stops the CPU and "spends a few dozen cycles loading in the next line of text so that it can properly index the character generator ROM for the next eight scanlines" explains why you have the opportunity/need to buffer the next 8 sound samples! Sounds like a great plan.

I was reading a bit about the C64 - something I never used as I was off to college about then and happy with my TRS-80- and it sounds like they did amazing things with that 8 bit 'system'. Are you running T_3.6 at 180 or 240 MHz?
 
@Dave, reSID is not fast enough to call it every 6us - no way.
Even the reSID documenation says "requires fast machines" (and they meant PCs, not microcontrollers...)

Some month ago (last year or 2015?) I recorded MP3s (Ghostbusters.DMP, LAX_UP.DMP) with a analog cable from the audioshield to the computer-line in.
https://drive.google.com/drive/folders/0Bx2Jw84lqebkb2xIYUR4MU1rdzg
DMP is a SID-Registerdump all 20ms. Teensy64 calls it way more often, but 6us is out of reach.
Then, i'm using an old reSID version - the newer ones are needing more memory than a Teensy has available...
 
Last edited:
@Defragster: Making it compatible to the IEC was a task that turned out to be very complicated - not the emulation itself, but in parallel with video and sound.
I'm still not 100%sure that it will work all together. I have have a PLAN B and C for the worst case..
Yes, the TRS80 was great, too. In Europe, the C64 was more popular than in USA and there was (and still IS!) a very active "scene" and they wrote/write great games and demos. Most of them are not NTSC compatible. Usually these demos squeeze the last drop out of the c64-hardware (with graphic + sound effects the c64-hardware-developers never dreamed..) For example there are various new graphic-modes or it's possible to display sprites in the screen-borders (which is normally NOT supported by the chipset). If you take a look at the video, you see this effect (sprites in borders) in "Paperboy" - I'm glad that the emulation can handle this effect. It can handle some more too, but will never be as perfect as VICE. It's likely that Teensy64 will have problems with newer demos/games. But 80's or early 90's software will work ok :)
Sometimes, they release new games/demos even today.

Edit: I tend to use 240MHz because it allows higher flicker-free screen refresh rates. It may turn out that 240MHz are needed to run the emulation (at the moment 180MHz are sufficiant)
 
Last edited:
Can the IEC support be set to disable on power up with a Jumper? Most often for high speed game/sound/video it wouldn't be used would it? Maybe there are more devices on it than I know - or maybe it is only active when required?

I recall the border sprite note - that is great it handles that. Nice it can run at 180 MHz - I saw that was the speed once and wasn't sure if 240 was better or needed.
 
@Dave, reSID is not fast enough to call it every 6us - no way.
Even the reSID documenation says "requires fast machines" (and they meant PCs, not microcontrollers...)

OK. Just wondering. It is one of those things that sounds good, but is impractical. (I apologize if I sound ungrateful. This is an awesome project that is way beyond my abilities.)

Still, lots of games use the regular PAL/NTSC update frequencies, so I'm still in for at least one board.

David
 
I blame this thread for me in trying to aquire a real c64 :) no power supply but price was good. :) $12 shipped.
now to aquire more :) never have enough c64 stuffs.. and yes I will likely purchase one of these boards too :)
 
I'm testing this:

2017-05-25 23.32.18.jpg

The 2nd Joystick port (dsub-9) is missing - still waiting for delivery.
Attached to the USB-Host-Port is a wireless-keyboard adapter.
On the right, not good visible, is a "User Port" - i'm not sure if i can add it to the final version. If yes, it will be not very compatible.
This board uses no SMD and is easy to solder, and is the same size as the display.
The green part is audio-out.
2017-05-26 00.13.45.jpg
 
Last edited:
Fresh from Germany I got a Beta kit today of the Teensy64! I should be able to get it assembled in the next week - looked up this thread to get assembly and code details and will update.
 
Ordered SparkFun Joystick and button parts - wireless mouse/keyboard for USB - DB9 pin female to plug the joystick. Frank looking to get time on this again - hoping to get a working beta test system.
 
Teensy64 comes to America

Joystick and buttons got here today from SparkFun (Very solid unit - same price as assembled stuff on Amazon with bad reviews ) - DB9 connector tomorrow so I can wire them up. Also the wireless USB keyboard & adapter arrived today.

Here are images of the Alpha Version Teensy64 as I assembled it so far { missing by design are a transistor T1 and three Resistors R{1,2,3] }.

20170724_220120_s.jpg20170724_223953_S.jpg20170724_220221_s.jpg

I soldered Male pins in between the pics when I put on the Display header. The T_3.6 was used without pins and they got soldered too. T_3.6 still works alone and when plugged in.

Frank is about to order an updated PCB that will not have the User port - so not populated in pics. I need some stand off mount hardware for the display.

Frank: Please check my images for any faults - I didn't power with Display or USB attached yet. When I get a HEX file in coming days from Frank I'll update. I also didn't alcohol brush off any rosin - looks pretty clean?
 
Last edited:
Looks good ! Your joystick ist awesome..
I you want a disk, you can add a cheap "SD2IEC"
(for example something like this https://www.ebay.de/i/232392226150?chn=ps&dispItem=1 )

Unfortunately, my used diskdrive died shortly after buy.. so i added a SD2IEC board. Works good so far... but this means I have - at the moment - no chance to test a real drive.
 
Last edited:
Hex uploaded - mostly successful? Not seeing keyboard yet - and stops on READY screen . . . not sure it likes my SD card?
Teensy64
Jul 25 2017 19:58:41
F_CPU (MHz):240
F_BUS (MHz):120
Audioblock (samples):16
Audio Samplerate:30789

Initializing SD card...OK
sizeof Device = 28
sizeof Pipe = 64
sizeof Transfer = 64
power up USBHS PHY
Loading /C64/BOULDE~1.PRG 0x801- 0x5B80

20170725_131648.jpg
 
hm. This looks like a usb problem. There should be more usb messages in the log.
if this is a new wireles keyboard, you might have to "pair " it somehow ? have you tried it with a computer ?
can you try an other keyboard (with cable), please ?
 
It auto pairs - yes it works on my Computer.

Just plugged in a wired keyboard and it is taking 'Enter' for a new line at READY

I cannot type quotes and many other characters - My keyboard is English? a Problem?

I can type : Print 4

>> Offline a couple hours
 
Looks like Pauls USB HOST has a problem with your wireless keyboard, as it does not enumerate..

Your wired keyboard - which keys do not work ? The language should'nt matter.
An other person who tried the very first version from this thread did not report this problems. -( his keyboard works...

Edit:
You might want to try Paul USB HOST keyboard code standalone..
Edit:
Please note, the C64 did not have all keys, and they layout was different.
 
Last edited:
Status
Not open for further replies.
Back
Top