I have ported my old project “pNesX” game console emulator to the nucleo.
Dependencies: SDFileSystem mbed
Intro
I have ported my old project “pNesX” to the STM32 Nucleo. The pNesX is a NES emulator for the PlayStation that I have created 16 years ago!
Emulation part was almost without change, the sound part was newly added.
Parts
STM32 Nucleo F446RE |
QVGA 2.2 TFT SPI (with the SD card slot) |
Audio jack(TS or TRS) |
USB Connector |
Register 100k, 10k, 4.7k, 100 |
Capacitor 0.01uF, 2.2uF |
Breadboard |
Wires |
Computer Speakers |
USB GamePad |
Wiring diagram
TFT J2 | Nucleo |
---|---|
VCC | 3V3 |
GND | GND |
CS | PB_5(D4) |
Reset | PA_10(D2) Pull Up(100k) |
D/C | PA_8(D7) |
MOSI | PA_7(D11) |
SCK | PA_5(D13) |
LED | LED-100ohm-3V3 |
MISO | PA_6(D12) |
TFT J4 | Nucleo |
---|---|
SD_CS | PA_9 |
SD_MOSI | PB_15 |
SD_MISO | PB_14 |
SD_SCK | PB_13 |
Audio | Nucleo |
---|---|
TIP | PA_4(A2) |
USB con. | Nucleo |
---|---|
GND | GND |
+ | PA_12 |
- | PA_11 |
5V | 5V |
Limitations
- Since the rest of the RAM is about 50kbyte, maximum capacity of the game ROM is about 50kbyte.
- The length of the file name up to 32 characters.
- The number of files in the folder is up to 100.
Used Library
- SDFileSystem by Neil Thiessen
- F401RE-USBHost by Norimasa Okamoto
- USBHostGamepad by Yuuichi Akagawa
Diff: pNesX_logo.cpp
- Revision:
- 0:3dac1f1bc9e0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pNesX_logo.cpp Sun Apr 03 07:45:29 2016 +0000 @@ -0,0 +1,99 @@ +/*===================================================================*/ +/* */ +/* pNesX_logo.cpp : pNesX Logo image data(4bit bmp) */ +/* */ +/* 2016/1/20 Racoon */ +/* */ +/*===================================================================*/ +extern const unsigned char pNesX_logo[]; + +const unsigned char pNesX_logo[] = +{ + 0x42,0x4D,0x4A,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x6A,0x00,0x00,0x00,0x28,0x00, + 0x00,0x00,0x63,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x30,0xB0,0xF8,0x00,0x2F,0xAD,0xF5,0x00,0x2D,0xA7, + 0xEC,0x00,0x2A,0x9C,0xDD,0x00,0x26,0x8A,0xC3,0x00,0x22,0x7A,0xAC,0x00,0x1B,0x5B, + 0x81,0x00,0x14,0x40,0x5A,0x00,0x0D,0x26,0x35,0x00,0x0B,0x18,0x20,0x00,0x09,0x11, + 0x16,0x00,0x08,0x0D,0x0F,0x00,0x08,0x08,0x08,0x00,0x9C,0xCC,0xC5,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xCC, + 0xC7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x5C,0xCC,0xC9,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x39,0xCC,0xCC,0x50,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x17,0xCC,0xCC,0x70,0x24,0x54, + 0x30,0x00,0x00,0x02,0x33,0x33,0x20,0x00,0x00,0x02,0x33,0x33,0x31,0x00,0x00,0x00, + 0x24,0x45,0x54,0x31,0x00,0x00,0x00,0x00,0x23,0x45,0x54,0x43,0x00,0x00,0x23,0x33, + 0x33,0x30,0x00,0x00,0x01,0x33,0x33,0x33,0x20,0x00,0x00,0x00,0x00,0x00,0x05,0xCC, + 0xCC,0x94,0x8B,0xCC,0x97,0x30,0x00,0x06,0x99,0x99,0x82,0x00,0x00,0x06,0x99,0x99, + 0x95,0x00,0x00,0x05,0x8A,0xCC,0xCB,0x98,0x62,0x00,0x00,0x15,0x8A,0xBC,0xCC,0xB9, + 0x74,0x00,0x48,0x99,0x99,0x95,0x00,0x00,0x03,0x89,0x99,0x99,0x60,0x00,0x00,0x00, + 0x00,0x00,0x03,0x9C,0xCC,0xCA,0xCC,0xCC,0xCC,0xA5,0x10,0x04,0xBC,0xCC,0xC5,0x00, + 0x00,0x18,0xCC,0xCC,0xC7,0x00,0x01,0x6C,0xCC,0xCC,0xCC,0xCC,0xC9,0x51,0x00,0x5B, + 0xCC,0xCC,0xCC,0xCC,0xCC,0x73,0x04,0x9C,0xCC,0xCA,0x41,0x00,0x05,0xCC,0xCC,0xCB, + 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xCC,0xCC,0xCC,0xCC,0xCC,0xCB,0x51,0x02, + 0x8C,0xCC,0xC7,0x10,0x00,0x4A,0xCC,0xCC,0xC9,0x20,0x03,0x9C,0xCC,0xCA,0x88,0xCC, + 0xCC,0xB6,0x10,0x7C,0xCC,0xCC,0x77,0x7B,0xCC,0xC7,0x20,0x49,0xCC,0xCC,0x94,0x00, + 0x06,0xCC,0xCC,0xC8,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0xCC,0xCC,0xC8,0x79, + 0xCC,0xCC,0xA4,0x00,0x6C,0xCC,0xC9,0x10,0x00,0x6C,0xCC,0xCC,0xCC,0x50,0x04,0xCC, + 0xCC,0xC5,0x22,0x59,0x99,0x87,0x30,0x69,0xCC,0xC8,0x20,0x15,0xBC,0xCC,0x60,0x04, + 0xAC,0xCC,0xC9,0x40,0x28,0xCC,0xCC,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x29, + 0xCC,0xCC,0x92,0x02,0x7C,0xCC,0xC8,0x10,0x4C,0xCC,0xCC,0x50,0x02,0x8C,0xCC,0xCC, + 0xCC,0x71,0x05,0xCC,0xCC,0xA1,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x44,0x11,0x35, + 0xAC,0xCC,0x91,0x00,0x49,0xCC,0xCC,0x94,0x3B,0xCC,0xCC,0xB4,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x17,0xCC,0xCC,0x80,0x00,0x39,0xCC,0xCB,0x40,0x28,0xCC,0xCC,0x70, + 0x04,0xBC,0xCC,0xCC,0xCC,0x93,0x03,0xBC,0xCC,0xC6,0x66,0x66,0x66,0x66,0x65,0x00, + 0x01,0x35,0x67,0x9C,0xCC,0xCC,0xC3,0x00,0x05,0x9C,0xCC,0xC8,0x6C,0xCC,0xCC,0x82, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0xCC,0xCC,0x92,0x00,0x17,0xCC,0xCC,0x70, + 0x16,0xCC,0xCC,0x92,0x06,0xCC,0xCC,0xCC,0xCC,0xC5,0x02,0x8C,0xCC,0xCC,0xCC,0xCC, + 0xCC,0xCC,0xC7,0x10,0x06,0x9C,0xCC,0xCC,0xCC,0xCC,0xA2,0x00,0x00,0x5A,0xCC,0xCC, + 0xCC,0xCC,0xCC,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x8C,0xCC,0xC5,0x00, + 0x04,0xCC,0xCC,0x93,0x04,0xBC,0xCC,0xC5,0x18,0xCC,0xCC,0xCC,0xCC,0xC7,0x10,0x6C, + 0xCC,0xCC,0x99,0x99,0x9C,0xCC,0xCB,0x30,0x4B,0xCC,0xCC,0xCC,0xCC,0xC9,0x50,0x00, + 0x00,0x05,0x9C,0xCC,0xCC,0xCC,0xCC,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x7C,0xCC,0xC8,0x30,0x04,0xBC,0xCC,0xB3,0x02,0x8C,0xCC,0xC7,0x4C,0xCC,0xCC,0x8C, + 0xCC,0xC9,0x30,0x39,0xCC,0xCA,0x53,0x33,0x39,0xCC,0xCC,0x40,0x5C,0xCC,0xCC,0xB9, + 0x87,0x63,0x10,0x00,0x00,0x00,0x59,0xCC,0xCC,0xCC,0xC9,0x20,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x5C,0xCC,0xCC,0x74,0x16,0xCC,0xCC,0xC4,0x00,0x6C,0xCC,0xC8, + 0x7C,0xCC,0xCB,0x5C,0xCC,0xCC,0x50,0x06,0xCC,0xCC,0x82,0x00,0x29,0xCC,0xCC,0x50, + 0x4C,0xCC,0xC8,0x43,0x23,0x31,0x00,0x00,0x00,0x00,0x05,0xBC,0xCC,0xCC,0xC7,0x10, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x29,0xCC,0xCC,0xCC,0x9C,0xCC,0xCC,0xC4, + 0x00,0x4C,0xCC,0xCC,0xBC,0xCC,0xC8,0x28,0xCC,0xCC,0x70,0x01,0x7C,0xCC,0xC8,0x54, + 0x6C,0xCC,0xCC,0x40,0x07,0xCC,0xC8,0x42,0x38,0xCC,0x98,0x50,0x00,0x00,0x04,0xCC, + 0xCC,0xCC,0xCB,0x51,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xCC,0xCC,0xAC, + 0xCC,0xCC,0xCC,0x93,0x00,0x18,0xCC,0xCC,0xCC,0xCC,0xC6,0x16,0xCC,0xCC,0xA3,0x00, + 0x26,0xBC,0xCC,0xCC,0xCC,0xCC,0xC8,0x20,0x04,0x9C,0xCC,0xA8,0x9C,0xCC,0xCB,0x40, + 0x00,0x00,0x06,0xCC,0xCC,0xCC,0xCC,0xA5,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x05,0xCC,0xCC,0x77,0xCC,0xCC,0xCC,0x61,0x00,0x06,0xCC,0xCC,0xCC,0xCC,0xA4,0x03, + 0xAC,0xCC,0xC5,0x00,0x01,0x58,0xCC,0xCC,0xCC,0xCC,0x94,0x10,0x01,0x37,0xCC,0xCC, + 0xCC,0xCC,0xC7,0x20,0x00,0x00,0x08,0xCC,0xCC,0xCC,0xCC,0xCA,0x51,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x01,0x77,0x77,0x72,0x47,0x89,0x86,0x20,0x00,0x04,0xCC,0xCC, + 0xCC,0xCC,0x81,0x02,0x7C,0xCC,0xC7,0x10,0x00,0x01,0x57,0x89,0x98,0x76,0x30,0x00, + 0x00,0x00,0x46,0x79,0x99,0x87,0x62,0x00,0x00,0x00,0x3B,0xCC,0xCC,0x87,0xCC,0xCC, + 0xB5,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x02,0x8C,0xCC,0xCC,0xCC,0x60,0x00,0x6C,0xCC,0xC9,0x30,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0xCC, + 0xCC,0x72,0x7C,0xCC,0xCA,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x01,0x6C,0xCC,0xCC,0xCC,0x30,0x00,0x4A,0xCC,0xCC,0x50, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x8C,0xCC,0xCC,0x50,0x38,0xCC,0xCC,0x94,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4B,0xCC,0xCC,0xC8,0x10,0x00, + 0x08,0xCC,0xCC,0x71,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x03,0x9C,0xCC,0xCA,0x30,0x03,0x8C,0xCC,0xCA,0x40,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x28,0xCC, + 0xCC,0xC6,0x00,0x00,0x06,0xCC,0xCC,0x93,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0xCC,0xCC,0xC8,0x20,0x00,0x49, + 0xCC,0xCC,0x94,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x06,0x88,0x88,0x83,0x00,0x00,0x03,0x88,0x88,0x84,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x16,0x88,0x88, + 0x86,0x00,0x00,0x14,0x88,0x88,0x87,0x30,0x00,0x00 +}; + +