mkarlsson

NES on Pipistrello

11 posts in this topic

A while ago James1095 pointed out in the Community Project section that there is a NES-on-FPGA project with source code available on the net.

http://forum.gadgetfactory.net/index.php?/topic/1754-fpga-nes/

 

The project is written by Brian Bennet for a Spartan6 LX16 board with analog VGA output so I decided to give the code a try by porting it to Pipistrello and the LogicStart MegaWing with the goal of getting the code to run with minimal changes.  In the end only a DCM unit for doubling the Pipistrello 50 MHz clock to 100 MHz needed to be added and the ucf file needed to be changed for Pipistrello pinout.

 

The hardest part was actually to compile the app for the PC used for downloading game ROMs to the board after the bit file is loaded (nesdbg).  The app has the serial port hardwired to COM5 so the Pipistrello serial port must be renamed COM5 in order for nesdbg to work (this can be done using the device manager).

 

Attached is a zip file with the software app for downloading game roms and two versions of the hardware - one version for using real NES joypads (connected to the top row on the PMOD connector) and one version for emulating the joypad with the joystick and the switches on the LogicStart MegaWIng.  The latter version is mainly for testing since I don't have any NES controllers to play with, and a game like Super Mario Bros can actually be played with this version although the joystick is a bit hard to use.  Switch 4 is "A", switch 5 is "B", switch 6 is "select" and switch 7 is "start".  The four sound channels can be muted using switches 0-3.

 

Steps:

1) Add the LogicStart MegaWing to Pipistrello and hook up the VGA monitor and the sound cable to the LogicStart board

2) Connect the Pipistrello/LogicStart board-set to the PC and rename the Pipistrello serial port to COM5 using the device manager.

2) Unzip the fpga_nes.zip file somewhere on the PC and cd to the root folder

3) Double-click on load_bitfile_emu.bat, this should download the joypad emulation bit file to Pipistrello.

4) Once the bit file is downloaded the VGA monitor should come up with a white area in the center surrounded by a light-blue border.

5) Next step is to double-click on run_nesdbg.bat which should get the FPGA NES Debugger up and running

6) Using the File pulldown menu, select "Load ROM..." and select a rom game (located at sw\roms\game_roms\supported)

7) A progress bar will show the progress of the download

8) The game should start up

 

One thing I did notice is that some of the sprites have a vertical line of missing pixels but over all it looks pretty good.

 

Enjoy!

fpga_nes.zip

Share this post


Link to post
Share on other sites

If you're talking about msvcr100d.dll this is the debug version of msvcr100.dll (note the 'd' at the end). If you compile a Release version of the program instead of Debug, most people should have the required DLL, if not they can download Microsoft Visual C++ 2010 SP1 Redistributable Package (x64) or Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)

Share this post


Link to post
Share on other sites

Update: Now supports video-out via HDMI, game load via SD-card, defaults to Super Mario Bros. at boot-up

 

This is a port of the NES fpga emulation for Pipistrello LX45 originally written by Brian Bennett and modified by Magnus Karlsson.
At boot-up the SD-card is checked for a game file (game.nes). If found it will load and start the game, else it will default to Super Mario Bros. which is pre-loaded in BRAM.
The attached bit file can be loaded to the Pipistrello board using fpgaprog (fpgaprog -f nes_top_smb_mb.bit)

 

NES_on_pipistrello_small.JPG

Hookup:
Video-out via HDMI connector (VGA resolution)
Sound-out via audio connector
Support for up to 2 NES game controllers connected to the top row of the PMOD connector.
PMOD connector hookup (top, from right to left): CLOCK, LATCH, DATA OUT(1), DATA OUT(2), GND, POWER

 

Here is a source for an inexpensive NES game controller that works:http://www.amazon.com/NES-Controller-Generic-Nintendo-Entertainment-System/dp/B000UCF9TA

 

See attached image for NES game controller socket pinout and attached Pipistrello bit file.

 

Enjoy!

nes_top_smb_mb.bit

post-36465-0-24628800-1383239807.jpg

Share this post


Link to post
Share on other sites

I actually made a PMOD board with 2 NES controller sockets and a PS2 connector that hopefully will be available soon for sale.

Here is a picture of the two boards together:

 

nes-pmod2b.JPG

Share this post


Link to post
Share on other sites

Wht if I told you that i wrote a code in python to avoid the use of Visual C++ and SP1.

 

You can choose the serial port, and it is compatible on linux, windows and macosx

 

 Enjoy! :) and share..

 

Good job Brian Bennett :)

 

Requirements:

->Python 2.7

-> Pyserial

 

 

NES_PROGRAMMING.zip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now