Forum Rule: Always post complete source code & details to reproduce any issue!
Page 3 of 10 FirstFirst 1 2 3 4 5 ... LastLast
Results 51 to 75 of 242

Thread: [posted] Commodore C64 Emulation on a Teensy 3.6 Microcontroller

  1. #51
    Junior Member
    Join Date
    Oct 2017
    Posts
    5
    I got the parts this weekend and now have a. teensy64 as well!

    I had some trouble early on with USB input but all is working now, I have to fix my joysticks though or create a smaller one.

    So far I've been able to play a few games. For anyone having trouble finding PRG you can also try getting the .d64 images and extract the PRG with a tool called c1541 from the VICE emulator.

    I'll try to make a list of games I've tried and the results of which work and which don't.

    I also have a 1541 that I'll try and see if it works

    I wasn't able to upload a picture for whatever reason, I'll try to link it https://imgur.com/a/2AfsX
    Last edited by menno; 10-31-2017 at 06:38 PM.

  2. #52
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,768
    Hi menno, the picture was too large. I shrinked it a bit:

    Click image for larger version. 

Name:	nnFebE0.jpg 
Views:	189 
Size:	141.4 KB 
ID:	11951

    Please add 330Ohm resistor if you add speakers directly, without amplifier. The Teensy does not like it, without it, you're shorting the DAC-pin.

    I've added two features :

    - 2017/10/30: Added Joystickport-swap with NUMLOCK
    - 2017/10/31: Added volume adjustment with CTRL-Right and Cursor UP/DOWN
    Last edited by Frank B; 10-31-2017 at 07:53 PM.

  3. #53
    Junior Member
    Join Date
    Oct 2017
    Posts
    5
    Quote Originally Posted by Frank B View Post
    Hi menno, the picture was too large. I shrinked it a bit:

    Please add 330Ohm resistor if you add speakers directly, without amplifier. The Teensy does not like it, without it, you're shorting the DAC-pin.

    I've added two features :

    - 2017/10/30: Added Joystickport-swap with NUMLOCK
    - 2017/10/31: Added volume adjustment with CTRL-Right and Cursor UP/DOWN
    Thanks! I've added the resistors, they are in the plug, but sound is very silent now, I'm looking into a tiny amplifier to fix it, I've already updated to the latest version but my keyboard doesn't have a numlock key but I'll figure something out for that

  4. #54
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,768
    Do you have an amplifier on stock ? Mail me, if not..
    NumLock: Should this be configurable ? Which key would be better for such keyboards ?

  5. #55
    Junior Member
    Join Date
    Oct 2017
    Posts
    5
    I don't have anything on stock, I might have some parts to make one (though it's probably easier just order one from China)

    The keyboard I'm using is a rii rt-mwk01, with the teensy usbhost test I should be able to figure out a key that I can use for it, I'll let you know once I figured it out!

  6. #56
    Question: (and maybe this is too far outside the scope of this project)

    Might it be possible for this project to be *retrofitted* to accept the VIC chip data from an actual C64 motherboard and output in VGA? None of the IEC, ReSID, ps/2 keyboard stuff would be required, which would (I hope) open up enough I/O for such a task. I'm picturing something that would plug into the socket, then output VGA.

    Edit: You probably have also implemented the Character ROM internally, simplifying things even further, also it also looks like the entire project could be hung on the Expansion port if U6 (Color RAM) is also emulated in the Teensy.

    Edit: I see the Teensy 3.5 is 5v tolerant, which would be idea for this. Will your VIC/VGA code run on the Teensy 3.5?

    I can think of at least a hundred die-hard C64 guys (perhaps a few more) who would really go for something like this.
    -8b
    Last edited by eightbitswide; 11-02-2017 at 04:10 PM.

  7. #57
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,768
    Hm, might be possible.. But it would -still- be an emulation. I wonder, if a FPGA wouldn't be better.
    The crystal input might be a bit problematic - on the other hand, it can be ignored, maybe ? The would mean, the c64-clock would be drivenby the teensy. We should take a look at the shematic - I'm not sure.
    Maybe open an other thread for this ?

  8. #58
    Quote Originally Posted by Frank B View Post
    Maybe open an other thread for this ?
    Great idea.. New thread opened.
    https://forum.pjrc.com/threads/47434...-on-the-Teensy

  9. #59
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,701
    Thought I would mention, that I picked up a couple of cheap controllers on ebay: https://www.ebay.com/itm/371085473534
    They are a pretty low quality product, that have laud clicks and the like but I have been able to try one of them out on Boulder dash and it worked
    Great job.

    Couple of quick comments:
    1) Might be nice to know a preferred way to install your code and software. That is with the github project: https://github.com/FrankBoesing/Teensy64
    You probably want some of this in your Arduino sketch folder: C64 directory and you need part of it in your Sketch/libraries folder: Teensy64
    I just copied this directory to the appropriate place, but will need to remember when I do a sync and see you made changes.

    2) it took me a bit of time to get the program to compile and run for me. I am using my private copy of the usb host code. Slight superset of current official one.
    There was an issue with the keyboard_usb.cpp code in the project. There are lines in there that have: println("Title", val, HEX);
    which no longer compile. That is because internal to usb host library Paul renamed the print/println functions to print_ and println_ and then for those files that need to use these. I first added the macros to your file. Still did not compile as you had other Serial.print lines... So I made those also not use Serial....

    3) After that I was able to get it to run Took me a bit to figure out how to use the keyboard. That is if I try to type the line: 10 print "hello world", when I pressed the " key on the keyboard I got something like a ; instead. Finally found " as a SHIFT+2 key.

    Again great stuff... Soon now assemble other board.

  10. #60
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,768
    Quote Originally Posted by KurtE View Post
    Thought I would mention, that I picked up a couple of cheap controllers on ebay: https://www.ebay.com/itm/371085473534
    They are a pretty low quality product, that have laud clicks and the like but I have been able to try one of them out on Boulder dash and it worked
    Great job.

    Couple of quick comments:
    1) Might be nice to know a preferred way to install your code and software. That is with the github project: https://github.com/FrankBoesing/Teensy64
    You probably want some of this in your Arduino sketch folder: C64 directory and you need part of it in your Sketch/libraries folder: Teensy64
    I just copied this directory to the appropriate place, but will need to remember when I do a sync and see you made changes.

    2) it took me a bit of time to get the program to compile and run for me. I am using my private copy of the usb host code. Slight superset of current official one.
    There was an issue with the keyboard_usb.cpp code in the project. There are lines in there that have: println("Title", val, HEX);
    which no longer compile. That is because internal to usb host library Paul renamed the print/println functions to print_ and println_ and then for those files that need to use these. I first added the macros to your file. Still did not compile as you had other Serial.print lines... So I made those also not use Serial....

    3) After that I was able to get it to run Took me a bit to figure out how to use the keyboard. That is if I try to type the line: 10 print "hello world", when I pressed the " key on the keyboard I got something like a ; instead. Finally found " as a SHIFT+2 key.

    Again great stuff... Soon now assemble other board.
    Thank you very much for your comments. Very helpful ! The Keymapping is close to the original keymapping- It's possible to change that, but other emulators use the C64 keymap, too.
    I really don't know why they did the " on shift-2: But, luck for German users, the " is shift-2 on the normal German keyboard too
    (Edit: But "Z" and "Y" are swapped for Germans :-( )

    Have you tried to do something with the Keboard-LED's in my code ? I had no luck so far (?)


    @All : Currently, I'm working on a really big update. I was hoping to get it done today, but no chance.. turned out to be much more complicated than I thought. My brain is fried and I need a pause. The Videochip (VIC) and a little part of the CPU will work complete different. Reason for this is, that some games show flickering sprites or other parts. I'm hoping to prevent this with a even "more close to the original" emulation. Keeping the same speed while doing more work is complicated...)
    This will take a week more. Minimum.

    A betatester tried the (old)VGA Version. It's working for him. Maybe he writes something here..

    Frank.

    edit: @Kurt: For VGA, please use the "raw HID" setting, and run the "Auto adjust" on your display.
    edit: I've udated the list in Post #2
    Last edited by Frank B; 11-05-2017 at 09:51 PM.

  11. #61
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,701
    Frank, I will take a look at the LED stuff hopefully tomorrow. Was busy most of day still playing with serial stuff. Did some testing on can I do different formats: 8n1, 8n2, 7e1, 7e2 on the different types of serial adapters that are supported (FTDI, CDCACM, PL2303, CH341). Then for the fun of I add CP210x support as well. Not sure if they all work to their fullest extent but hopefully be fully complete.

    I was using wireless keyboard with no LEDS when I was testing earlier today. so will swap out to a simple one that has the leds.

  12. #62
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,701
    I have taken a quick look at the LED stuff and there are some issues.

    For example I know from the main keyboard code I had to defer updating the LEDS when you were processing the keyboard input message... I see you brought in some but not all of this. I added this and sometimes this can work...

    I am now finding that allocating of transfer buffers is failing. I added 2 to the contribute number of transfers part of your class and this now makes it work on Caps lock (if I enable that in your code) for a few on or offs, but then still fails with failing to allocate... So I need to trace when these buffers are begin allocated and freed. Also need to see if issue as well in main test program. May not show up there as have many USB devices as part of the test so lots of transfer structures... So maybe masked.

    Still looking.

  13. #63
    Junior Member
    Join Date
    Oct 2017
    Posts
    5
    Quote Originally Posted by Frank B View Post

    A betatester tried the (old)VGA Version. It's working for him. Maybe he writes something here..
    I've not had much time to test it all, but VGA output seems to be working fine for me, do I understand it correctly that it doesn't work for others?

    I'd attach an image but I don't seem to be able to upload it to this forum.

  14. #64
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,701
    Hi Frank, I think I have the LEDS working, a lot cleaner now... It worked in test program earlier by luck...

    My whole update leds function is now just:
    Code:
    void KeyboardController::updateLEDS() {
    	// Now lets tell keyboard new state.
    	mk_setup(setup, 0x21, 9, 0x200, 0, sizeof(leds_.byte)); // hopefully this sets leds
    	queue_Control_Transfer(device, &setup, &leds_.byte, this);
    }
    Same code appears to work in yours (different class name).

  15. #65
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,768
    Quote Originally Posted by KurtE View Post
    Hi Frank, I think I have the LEDS working, a lot cleaner now... It worked in test program earlier by luck...

    My whole update leds function is now just:
    Code:
    void KeyboardController::updateLEDS() {
        // Now lets tell keyboard new state.
        mk_setup(setup, 0x21, 9, 0x200, 0, sizeof(leds_.byte)); // hopefully this sets leds
        queue_Control_Transfer(device, &setup, &leds_.byte, this);
    }
    Same code appears to work in yours (different class name).
    That's all ? Cool :-) I'll try that tomorrow. Thank you very much !
    I'm very busy (with other things too) at the moment - sorry have not much time for the forum and other things. The new aproach for VIC looks good, at the moment.. most problems are solved, but still much work.

    @menno: No, you're the first one how tried VGA - as far as I know.

  16. #66
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,768
    Kurt,
    i could not resist... it' bedtime, but i wanted to see it
    Code:
            USBHS_ASYNC_ON;
            keyboard.LEDS(0x02);
            keyboard.updateLEDS();
            delay(100);
            USBHS_ASYNC_OFF;
    Great. Works. Thanks again

  17. #67
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,701
    You are welcome,

    Hi Frank,

    One other comment, Currently being setup to build your app, I appear to have the issue, that either I have to setup and remove your platform.txt or I have to add empty defs.h to each of the other apps that I am testing. Or did I miss adding something to the file... (I had merged in your stuff) as to leave TYQT installed. .. Probably should just copy your file in and then let tyqt modify it again..

  18. #68
    Is there a walk-through on how to use the Arduino IDE to build this? I got the files, and installed the SDFat library, but I am not sure how to load/compile the project! I have a board sitting here built and ready to go!

  19. #69
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    7,085
    With the IDE installed and then TeensyDuino you should be able to build and program a new BLINK to the T_3.6.

    Then in the IDE's Sketchbook Folder you need the source from a downloaded zip or local fork of: https://github.com/FrankBoesing/Teensy64

    That page shows two libraries that should also go into the Library folders:
    External libraries required to be in sketchbook/libraries:
    Teensy-reSid
    SdFat
    With that in place it should compile with the Teensy at 240 MHz - there may be updated notes here: https://forum.pjrc.com/threads/46168...l=1#post152499

    Post any feedback.

  20. #70
    I have no issues using any of the Teensy 3.6 examples (like BLINK). The teensy-resid and sdFat are there. I downloaded the source and put it into my projects directory, but there is only C64.ino as a project file that will load and that generates an error about missing the .h file.

  21. #71
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    7,085
    A copy of the Teensy64 directory from github is needed there - many more files than just the INO.

    You can close and open the IDE after that is copied to make sure it is found.

  22. #72
    OK.. I don't understand. I have been using the Arduino IDE for many years. I have zero issues using it. I installed the Teensy 3.6 installer and I can select the BLINK example and it blinks the LED. The Re-sid and sdFat examples are also present. I took the Teensy64-master.zip and tried to install it as a library - doesn't work. I then tried putting the unzipped contents into my projects directory. The only project file that exists in the entire zip file is C64.ino. What is suppose to be loaded? What is the story with the platform.txt file? I have no idea where that file is suppose to reside. It seems that it is suppose to replace something in the Arduino system (based on the description in the first post), but that is not clear.
    Last edited by JimDrew; 11-09-2017 at 02:55 AM.

  23. #73
    I was able to test the board by loading the Adafruit ILI9341 example and changing the display pins to match what is used for the Teensy64 board. So, at least that works.

  24. #74
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    7,085
    AdaFruit and BLINK are good feed back knowing it works and the IDE is working and ready to go.

    I haven't worked with this in too long - will see if I can get it going on a new computer ...

  25. #75
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    7,085
    In libraries needed as noted: reSID and SdFat

    Teensy64 also goes in libraries directory.

    For the main project file I opened as extracted: C:\tCode\lib_zip\Teensy64-master\Teensy64-master\C64\c64.ino

    Ignoring the other files works with these HACKS to the Teensy CORE code

    About line 52 make this change: C:\arduino-1.8.5\hardware\teensy\avr\cores\teensy3\AudioStrea m.h:
    #ifndef AUDIO_BLOCK_SAMPLES
    #if defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
    #define AUDIO_BLOCK_SAMPLES 32 // teensy64 was :: 128
    About lines 768 and 770 add and remove comments on these lines in : C:\arduino-1.8.5\hardware\teensy\avr\cores\teensy3\kinetis.h:
    #if (F_CPU == 240000000)
    #define F_PLL 240000000
    #ifndef F_BUS
    // #define F_BUS 60000000
    //#define F_BUS 80000000 // uncomment these to try peripheral overclocking
    #define F_BUS 120000000 // all the usual overclocking caveats apply...
    I think I saw one warning and got:

    Using library Teensy64 in folder: C:\tCode\libraries\Teensy64 (legacy)
    Using library SPI at version 1.0 in folder: C:\arduino-1.8.5\hardware\teensy\avr\libraries\SPI
    Using library USBHost_t36 at version 0.1 in folder: C:\arduino-1.8.5\hardware\teensy\avr\libraries\USBHost_t36
    Using library SdFat at version 1.0.3 in folder: C:\tCode\libraries\SdFat
    Using library reSID in folder: C:\tCode\libraries\reSID (legacy)
    Sketch uses 377904 bytes (36%) of program storage space. Maximum is 1048576 bytes.
    Global variables use 234812 bytes (89%) of dynamic memory, leaving 27332 bytes for local variables. Maximum is 262144 bytes.
    Last edited by defragster; 11-09-2017 at 05:53 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •