-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fjpolo/tang nano20k: Loopy Mappers (#52)
Contributed by fjpolo: 1. Add NESGamepad. 2. Mapper 24/26 [VRC6] and 19[Namco106/163]
- Loading branch information
Showing
26 changed files
with
1,872 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
*.o | ||
impl | ||
nes.gprj.user | ||
|
||
*.vcd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,71 @@ | ||
# NESTang - NES for Sipeed Tang FPGA Boards | ||
|
||
<p align="right"> | ||
<a title="Releases" href="https://github.com/nand2mario/nestang/releases"><img src="https://img.shields.io/github/commits-since/nand2mario/nestang/latest.svg?longCache=true&style=flat-square&logo=git&logoColor=fff"></a> | ||
</p> | ||
|
||
<img src="doc/images/nestang0.8rc.jpg" width=400> | ||
|
||
NESTang is an open source project to recreate the Nintendo Entertainment System (NES) with Sipeed Tang FPGA boards, including Sipeed [Tang Primer 25K](https://wiki.sipeed.com/hardware/en/tang/tang-primer-25k/primer-25k.html), [Tang Nano 20K](https://wiki.sipeed.com/hardware/en/tang/tang-nano-20k/nano-20k.html) and [Tang Primer 20K](https://wiki.sipeed.com/hardware/en/tang/tang-primer-20k/primer-20k.html). | ||
|
||
Main features, | ||
|
||
- 720p HDMI output with sound. | ||
- Cycle accurate gameplay quality has been achieved since the NES circuits have been almost entirely replicated. | ||
- Rom loading from MicroSD cards with easy-to-use menu system. | ||
- Playstation 2 controllers support and experimental USB gamepads support. | ||
|
||
## Setup for Tang Primer 25K | ||
|
||
The Tang Primer 25K is the latest small-form-factor FPGA board from Sipeed. It features a modular design that is easily extensible with pmod and sdram modules. Here is what you need to run NESTang, | ||
|
||
* The Tang Primer 25K with 4 modules: sdram, dvi, ds2 and sd, with the modules plugged in as follows (pmod positions are important as pins are fixed), <br><img src="doc/images/primer25k_setup.jpg" width=400 /> | ||
* NESTang program [v0.8rc or later](https://github.com/nand2mario/nestang/releases), downloaded to the board with Gowin programmer. | ||
* A MicroSD card to hold ROMS, formatted in FAT32. Then put the .nes roms in the root dir. | ||
* **64GB/128GB cards**: Windows does not allow FAT32 on cards >32GB, you can use [Parition Assistant](https://www.diskpart.com/free-partition-manager.html) to force it to FAT32 instead of exFAT. | ||
* The roms may appear out of order. If you want them to show in alpabetical or other specific order, you can use [DriveSort](http://www.anerty.net/software/file/DriveSort/?lang=en). | ||
* Connect one or two DualShock2 controllers to the DS2 pmod. Or you can connect one USB gamepad to use the [experimental USB gamepad support](doc/usb_gamepad.md). The board only has one USB port. So use DS2 if you want two players. | ||
* Insert the MicroSD card, connect an HDMI monitor or TV, and enjoy your games. | ||
|
||
## Setup for Tang Nano 20K | ||
|
||
The Tang Nano 20K is a popular FPGA board for putting 20K LUTs and HDMI output into a tiny dongle. The board also features FPGA-gaming-friendly SDRAM memory. Here's what you need to run NESTang: | ||
|
||
* The Tang Nano 20K board. | ||
* Sipeed ps2 controller adapters connected to the board's pin 15-20 on both sides. Releases since 0.6 also support [USB gamepads](doc/usb_gamepad.md). | ||
* Playstation or USB controllers connected to the adapters. | ||
* HDMI cable to connect the board to a monitor. | ||
* Latest NESTang program downloaded from [github](https://github.com/nand2mario/nestang/releases) and transferred to the board using either [openFPGALoader](https://github.com/trabucayre/openFPGALoader) or Gowin programmer. | ||
* A MicroSD card to hold ROMS, formatted in FAT32. Then put the .nes roms in the root dir. | ||
* **64GB/128GB cards**: Windows does not allow FAT32 on cards >32GB, you can use [Parition Assistant](https://www.diskpart.com/free-partition-manager.html) to force it to FAT32 instead of exFAT. | ||
* The roms may appear out of order. If you want them to show in alpabetical or other specific order, you can use [DriveSort](http://www.anerty.net/software/file/DriveSort/?lang=en). | ||
* Insert the MicroSD card and power up the board to start playing your favorite games! | ||
|
||
## Setup for Tang Primer 20K | ||
|
||
See [setup instructions for tang primer 20k](doc/primer20k.md) | ||
|
||
## Development | ||
|
||
If you want to generate the bitstream from source, see [Build Instructions](https://nand2mario.github.io/nestang-doc/dev/build_bitstream/). | ||
|
||
[Usb_hid_host](https://github.com/nand2mario/usb_hid_host) was development so NESTang could support USB gamepads. Follow the link if you want to use it for your FPGA projects. It supports keyboards and mice too. | ||
|
||
## Next steps | ||
|
||
See NESTang [changes.md](CHANGES.md). | ||
|
||
Here are what I may work on when I get time. No promise though. Suggestions and pull requests are welcome! | ||
* Cheats support. | ||
* Saves and loads. | ||
|
||
## Special Thanks | ||
|
||
* [fpganes](https://github.com/strigeus/fpganes) by Ludvig Strigeus. | ||
* [hdl-util/hdmi](https://github.com/hdl-util/hdmi) by Sameer Puri. | ||
* [NES for Tang Nano 9K](https://github.com/hi631/tang-nano-9K) by hi631 | ||
|
||
nand2mario (`nand2mario at outlook.com`) | ||
|
||
Since 2022.9 | ||
# NESTang - NES for Sipeed Tang FPGA Boards | ||
|
||
<p align="right"> | ||
<a title="Releases" href="https://github.com/nand2mario/nestang/releases"><img src="https://img.shields.io/github/commits-since/nand2mario/nestang/latest.svg?longCache=true&style=flat-square&logo=git&logoColor=fff"></a> | ||
</p> | ||
|
||
<img src="doc/images/nestang0.8rc.jpg" width=400> | ||
|
||
NESTang is an open source project to recreate the Nintendo Entertainment System (NES) with Sipeed Tang FPGA boards, including Sipeed [Tang Primer 25K](https://wiki.sipeed.com/hardware/en/tang/tang-primer-25k/primer-25k.html), [Tang Nano 20K](https://wiki.sipeed.com/hardware/en/tang/tang-nano-20k/nano-20k.html) and [Tang Primer 20K](https://wiki.sipeed.com/hardware/en/tang/tang-primer-20k/primer-20k.html). | ||
|
||
Main features, | ||
|
||
- 720p HDMI output with sound. | ||
- Cycle accurate gameplay quality has been achieved since the NES circuits have been almost entirely replicated. | ||
- Rom loading from MicroSD cards with easy-to-use menu system. | ||
- Playstation 2 controllers support and experimental USB gamepads support. | ||
|
||
## Setup for Tang Primer 25K | ||
|
||
The Tang Primer 25K is the latest small-form-factor FPGA board from Sipeed. It features a modular design that is easily extensible with pmod and sdram modules. Here is what you need to run NESTang, | ||
|
||
* The Tang Primer 25K with 4 modules: sdram, dvi, ds2 and sd, with the modules plugged in as follows (pmod positions are important as pins are fixed), <br><img src="doc/images/primer25k_setup.jpg" width=400 /> | ||
* NESTang program [v0.8rc or later](https://github.com/nand2mario/nestang/releases), downloaded to the board with Gowin programmer. | ||
* A MicroSD card to hold ROMS, formatted in FAT32. Then put the .nes roms in the root dir. | ||
* Windows does not allow FAT32 on cards >32GB, here's a [work-around](https://answers.microsoft.com/en-us/windows/forum/all/format-a-sandisk-extreme-64gb-micro-sd-card-to/ff51be64-75b9-435f-9d39-92299b9d006e). | ||
* The roms may appear out of order. If you want them to show in alpabetical or other specific order, you can use [DriveSort](http://www.anerty.net/software/file/DriveSort/?lang=en). | ||
* Connect one or two DualShock2 controllers to the DS2 pmod. Or you can connect one USB gamepad to use the [experimental USB gamepad support](doc/usb_gamepad.md). The board only has one USB port. So use DS2 if you want two players. | ||
* Insert the MicroSD card, connect an HDMI monitor or TV, and enjoy your games. | ||
|
||
## Setup for Tang Nano 20K | ||
|
||
The Tang Nano 20K is a popular FPGA board for putting 20K LUTs and HDMI output into a tiny dongle. The board also features FPGA-gaming-friendly SDRAM memory. Here's what you need to run NESTang: | ||
|
||
* The Tang Nano 20K board. | ||
* Sipeed ps2 controller adapters connected to the board's pin 15-20 on both sides. Releases since 0.6 also support [USB gamepads](doc/usb_gamepad.md). | ||
* Playstation or USB controllers connected to the adapters. | ||
* HDMI cable to connect the board to a monitor. | ||
* Latest NESTang program downloaded from [github](https://github.com/nand2mario/nestang/releases) and transferred to the board using either [openFPGALoader](https://github.com/trabucayre/openFPGALoader) or Gowin programmer. | ||
* A MicroSD card to hold ROMS, formatted in FAT32. Then put the .nes roms in the root dir. | ||
* Windows does not allow FAT32 on cards >32GB, here's a [work-around](https://answers.microsoft.com/en-us/windows/forum/all/format-a-sandisk-extreme-64gb-micro-sd-card-to/ff51be64-75b9-435f-9d39-92299b9d006e). | ||
* The roms may appear out of order. If you want them to show in alpabetical or other specific order, you can use [DriveSort](http://www.anerty.net/software/file/DriveSort/?lang=en). | ||
* Insert the MicroSD card and power up the board to start playing your favorite games! | ||
* Original NES joysticks are now suported: [documentation](doc/NESGamepad.md) | ||
|
||
## Setup for Tang Primer 20K | ||
|
||
See [setup instructions for tang primer 20k](doc/primer20k.md) | ||
|
||
## Development | ||
|
||
If you want to generate the bitstream from source, see [Build Instructions](https://nand2mario.github.io/nestang-doc/dev/build_bitstream/). | ||
|
||
[Usb_hid_host](https://github.com/nand2mario/usb_hid_host) was development so NESTang could support USB gamepads. Follow the link if you want to use it for your FPGA projects. It supports keyboards and mice too. | ||
|
||
## Next steps | ||
|
||
See NESTang [changes.md](CHANGES.md). | ||
|
||
Here are what I may work on when I get time. No promise though. Suggestions and pull requests are welcome! | ||
* Cheats support. | ||
* Saves and loads. | ||
|
||
## Special Thanks | ||
|
||
* [fpganes](https://github.com/strigeus/fpganes) by Ludvig Strigeus. | ||
* [hdl-util/hdmi](https://github.com/hdl-util/hdmi) by Sameer Puri. | ||
* [NES for Tang Nano 9K](https://github.com/hi631/tang-nano-9K) by hi631 | ||
|
||
nand2mario (`nand2mario at outlook.com`) | ||
|
||
Since 2022.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
# Original NES Gamepad Setup | ||
|
||
NESTang since 0.9(check with @nand2mario) supports Original NES Gamepads, also supporting 8BitDo gamepads. | ||
|
||
## No Level-Shifter | ||
|
||
This setup was tested using an [8BitDo N30 2.4g wireless gamepad for original NES](https://www.8bitdo.com/n30-wireless-for-original-nes/). After some testing, this controller setup does not require a 3V3<->5V level shifter and can be directly connected to the FPGA IOs. | ||
|
||
### Requirements | ||
|
||
- An original NES Gamepad | ||
- Wires | ||
|
||
### Wiring diagram | ||
|
||
<img src="images/NESGamepad_wiring.png" width=400> | ||
|
||
|
||
## Level-Shifter | ||
|
||
In some cases, although not tested, probably cases such as original NES/Famicom controllers, TTL5V signals might be needed for correct functionality. In this case, a LVCMOS3V3<->TTL5V level shifter is needed. | ||
|
||
### Requirements | ||
|
||
- An original NES Gamepad | ||
- Wires | ||
- [4 Channels IIC I2C Logic Level Shifter Bi-Directional Module](https://www.aliexpress.com/item/1005004225321778.html?spm=a2g0o.order_list.order_list_main.27.22111802nFvcM9) | ||
- This is needed because NESTang has Low Voltage CMOS 3.3V signals and NES Gamepad uses 5V TTL logic. | ||
|
||
### Wiring diagram | ||
|
||
<img src="images/NESGamepad_wiring_levelShifter.png" width=400> | ||
|
||
## NES to FamiCom | ||
|
||
There's a way to convert 2 NES joysticks to FamiCom input connector: | ||
|
||
<img src="images/NESGamepad_NES2FamiCom.jpg" width=400> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# ToDo: | ||
- Update verilator tests | ||
|
||
# Changelog | ||
[25.01.2024] | ||
- Add 8BitDo Home button support to go back to main menu | ||
- Add schematic on how to convert two NES joysticks to a FamiCom connector | ||
|
||
[13.01.2024] | ||
- First version working :) | ||
- Using 120uS clock instead of 12uS because of slew rate | ||
|
||
[29.11.2023] | ||
- Fix first data bit being at latch state | ||
- Fix Verilator FSM | ||
- Remove ClockDivider module | ||
- Get rid of end_state | ||
|
||
[26.11.2023] | ||
- Test physical gamepad | ||
- Use resistor-based LVCMOS3V3 to TTL5V signal converter | ||
- Use resistor-based TTL5V to LVCMOS3V3 signal converter | ||
- Latch signal pulled to low before 12uS needed | ||
- Gamepad not responding with bits | ||
- Wrong timing, change 60Hz clock to 12uS clock | ||
- Use 60Hz clock to sample @16,6mS | ||
- Add formal verification using SymbiYosis | ||
|
||
|
||
[14.11.2023] | ||
- Remove log2 helper function | ||
- Latch signal duration ~12uS | ||
- Change how button__state is latched | ||
- Add data_available signal | ||
- Change cycle_stage to be a bit shifter (though it takes more bits) | ||
- Improve Verilator test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[tasks] | ||
cvr | ||
prf | ||
|
||
[options] | ||
cvr: mode cover | ||
prf: mode prove | ||
multiclock on | ||
vcd on | ||
|
||
[engines] | ||
smtbmc boolector | ||
|
||
[script] | ||
read -formal NESGamepad.v | ||
prep -top NESGamepad | ||
|
||
[files] | ||
NESGamepad.v |
Oops, something went wrong.