Skip to content
/ c64tang Public
forked from MiSTle-Dev/C64Nano

c64 living in a Gowin FPGA on a Sipeed Tang modules with HDMI Video and Audio Output

License

Notifications You must be signed in to change notification settings

yapinm/c64tang

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tang_nano_20k_c64

C64 living in a Gowin GW2AR FPGA on a Sipeed Tang Nano 20k with HDMI Video and Audio Output.

Original C64 core by Peter Wendrich
Dram controller by Till Harbaum
c1541 by https://github.com/darfpga

Features:

Keyboard and legacy digital Joystick interface aligned in pinmap and interface to match MiSTeryNano project's bl616 misterynano_fw.
Basically BL616 µC is acting as a USB host for a USB keyboard (and later on USB Joystick + OSD control) using a SPI communication protocol. Have a look MiSTeryNano readme chapter 'Installation of the MCU firmware' to get an idea how to install the needed Firmware.

Note ENTIRE PROJECT IS STILL WORK IN PROGRESS
So far Video/Audio/Keyboard/Joystick/Cartride/c1541_sd working.
Dedicated .fs bitstream for default configuration and .fs for cartridge ROM demo included.

Info HDMI Signal 720x576p@50Hz isn't an official VESA mode. Working on e.g. BENQ GL2450HM (FHD) , Acer VN247 (FHD), Dell S2721DGF (2k), LG 27UP85NP (4K). Check EDID timing of your target display for support. Monitor Asset Manager might help to figure out.

emulated Diskdrive 1541

Emulated 1541 on a raw microSD card (no FAT fs !) including parallel bus Speedloader.
Place one or more .D64 file in the tools folder and run 'create_C64_ALL_D64.bat'. It will create a DISKSRAWC64.IMG. Use only SIMPLE D64 files : 174 848 octets (35 Tracks)
Use e.g. win32diskimager or Balena Etcher to program a microSD card with DISKSRAWC64.IMG. BE CAREFUL NOT WRITING ON YOUR OWN HARDDRIVE! Insert card in TN slot.
LED 1 is the Drive activity indicator.
For those who forgot after all those years...
Disk directory listing:
LOAD"$",8
LIST
Load first program from Disk:
LOAD"*",8
RUN
Multiple D64 images on sdcard can be selected by Numpad '+' forwards followed by a Drive Reset pushing Numpad 'Enter' or one image backwards by Numpad '-' and Numpad 'Enter'. Sorry no OSD selection yet...

Push Button utilization

  • S1 push button Reset
  • S2 to swap physical Joystick or GamePad in between c64 Joystick ports 1 or 2 (selected port indicated by LED 0). Two Player control.

Gamecontrol Joystick support

legacy Digital Joystick
or
Gamepad Right stick for Move and Left L1 shoulder Button for Fire or following Pad controls:

Buttons - -
Left L1
Fire
triangle button
Up
.
square button
Left
- circle button
Right
- cross button
Down
-

or Keyboard Numpad Keys:

0
Fire
8
Up
-
4
Left
- 6
Right
- 2
Down
-

Keyboard

  • Numpad '*' toggle Numpad Joystick emulation:
    'default' - PORT 1 = Joystick or JOYKEYS on Numpad, PORT 2 = Gamepad
    'toggle' - PORT 1 = Gamepad, PORT 2 = Joystick or JOYKEYS on Numpad
    Keypad layout: left 4, right 6, up 8, down 2 and fire 0
  • Numpad change selected disk image on internal 1541 SD card
    - Numpad '+' next image
    - Numpad '-' previous image
  • Numpad 'Enter' c1541_sd drive Reset (you have to press once after image selection change and wait for 2 sec)

Layout similar with some enhancements.

LED

0 Joystick selection indication
1 c1541 drive activity

Powering

Prototype circuit with Keyboard can be powered by Tang USB-C connector from PC or a Power Supply Adapter.

Synthesis

Source code can be synthesized, fitted and programmed with GOWIN IDE Windows or Linux.

Pin mapping

see pin configuration in .cst configuration file

cartride ROM

The bin2mi tool can be used to generate from a game ROM new pROM VHDL code (bin2mi xyz.crt xyz.mi)
From typical .CRT images the first 0x40 bytes need to be discarded and filesize header in .mi need to be fixed to 8192/16384.
Change in fpga64_buslogic.vhd (see comment) and top level (exrom = '0') needed to compile a cartrige load varaint.

HW circuit considerations

  • Joystick interface is 3.3V tolerant. Joystick 5V supply pin has to be left floating !

Pinmap D-SUB 9 Joystick Interface
pinmap

Joystick pin Tang Nano pin FPGA pin Joystick Function
1 J6 9 28 Joy3 RIGHT
2 J6 11 25 Joy2 LEFT
3 J6 10 26 Joy1 DOWN
4 J5 12 29 Joy0 UP
5 - - POT Y
6 J5 8 27 FIRE B.
7 n.c n.c 5V
8 J5 20 - GND
9 - - POT X

Pinmap Dualshock 2 Controller Interface
pinmap

DS pin Tang Nano pin FPGA pin DS Function
1 J6 17 19 MISO JOYDAT
2 J6 16 20 MOSI JOYCMD
3 n.c. - 7V5
4 J6 20 - GND
5 J6 19 - 3V3
6 J6 18 18 CS JOYn
7 J6 15 17 MCLK JOYCLK
8 n.c. - IRQ
9 n.c. - ACK

BOM

Sipeed Tang Nano 20k
D-SUB 9 M connector
Commodore/Atari compatible Joystick
Prototype Board
TFT Monitor with HDMI Input
microSD or microSDHC card
USB Keyboard
Sipeed M0S Dock
USB-C to USB-A adapter to connect regular USB devices to the M0S Dock or alternatively a 4 port mini USB hub
USB Keyboard firmware for M0S Dock

alternative Gamecontrol option:
Sipeed Gamepad Adapter for Tang FPGA
Dualshock 2 Controller Gamepad

About

c64 living in a Gowin FPGA on a Sipeed Tang modules with HDMI Video and Audio Output

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • VHDL 92.6%
  • Verilog 7.2%
  • Other 0.2%