C64 on the S7 Retro board is evolving...
- aurelianlazarut6
- Aug 20
- 2 min read
USB Keyboard
I got some spare time and I mapped the USB keyboard keys to map correctly* to the C64, you can write programs in BASIC like on an original C64 (almost) - some special specific commodore keys are not implemented (RESTORE, RUN, Commodore Key etc.) because have no equivalent on the PC Keyboard but this will not stop you from typing BASIC programs.
USB Gamepad
I enabled the USB Gamepad (PS2 Controller actually) and mapped it the Joystick A signals. The "left joystick" on the PS2 Gamepad is now the Joystick A and the fire button is mapped to both left and right fire buttons on the PS2 Controller.
The USB Controller code is not my work and is written in Verilog and I have to modify it in order to bring out the Fire Buttons )and some extra buttons like pressing on the joysticks and the lower set of fire buttons, it took me while to figure out which byte is presenting them in the HID packet.(byte 6 contains all the buttons)
Below is the section which need to be modified in file "usb_hid_host.v"
original code here: https://github.com/nand2mario/usb_hid_host
6: if (valid) begin
game_sel <= ukpdat[4]; //select button
game_sta <= ukpdat[5]; //start button
game_joyL_push <= ukpdat[6]; //left jostick push
game_joyR_push <= ukpdat[7]; //right jostick push
game_fireL <= ukpdat[0]; //left fire button
game_fireR <= ukpdat[1]; //right fire button
game_fireL2 <= ukpdat[2]; //left low fire button
game_fireR2 <= ukpdat[3]; //right low fire button
endAfter this I realized I need to load a game in memory and have no method to do this. (I had no idea how a C64 binary look like)
The binary files on C64 have a "PRG" extension and the first two bytes are the pointer where the file should be loaded in memory (little endian - LSB first) after that is just binary data. This gave an idea to make a hardware loader with a UART and a very simple state-machine to load the binary from a PC directly into RAM. The C7 Retro board has a USB-Serial Bridge chip so in theory it should work.
I made a terrible hack and I wrote the content in RAM using the second port of the Dual Port Ram without stopping the C64 (unsafe I know)
For copying a file in RAM you setup the proper COM settings (115200,8,n,1) and run on the command terminal
copy program.prg \\.\\COM1And that's pretty much how I started playing games on my "hand made" Commodore 64.

Now I feel like Cuck Norris who was board in maternity that he built....
Next will be probably adding sound.
YouTube video with the same thing,,,
Have Fun,
A



Comments