GithubHelp home page GithubHelp logo

yapinm / c64tang Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vossstef/tang_nano_20k_c64

0.0 0.0 0.0 6.99 MB

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

License: GNU General Public License v3.0

C 0.24% VHDL 92.58% Verilog 7.15% Batchfile 0.02%

c64tang's Introduction

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

c64tang's People

Contributors

vossstef avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.