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
K6502.h
- Committer:
- beaglescout007
- Date:
- 2016-04-03
- Revision:
- 0:3dac1f1bc9e0
File content as of revision 0:3dac1f1bc9e0:
/*===================================================================*/ /* */ /* K6502.h : Header file for K6502 */ /* */ /* 1999/10/19 Racoon New preparation */ /* */ /*===================================================================*/ #ifndef K6502_H_INCLUDED #define K6502_H_INCLUDED // Type definition #ifndef DWORD typedef unsigned long DWORD; //typedef unsigned int DWORD; #endif #ifndef WORD typedef unsigned short WORD; //typedef unsigned short WORD; #endif #ifndef BYTE typedef unsigned char BYTE; //typedef char BYTE; #endif #ifndef NULL #define NULL 0 #endif /* 6502 Flags */ #define FLAG_C 0x01 #define FLAG_Z 0x02 #define FLAG_I 0x04 #define FLAG_D 0x08 #define FLAG_B 0x10 #define FLAG_R 0x20 #define FLAG_V 0x40 #define FLAG_N 0x80 /* Stack Address */ #define BASE_STACK 0x100 /* Interrupt Vectors */ #define VECTOR_NMI 0xfffa #define VECTOR_RESET 0xfffc #define VECTOR_IRQ 0xfffe // NMI Request #define NMI_REQ NMI_State = 0; // IRQ Request #define IRQ_REQ IRQ_State = 0; // Emulator Operation void K6502_Init(); void K6502_Reset(); void K6502_Set_Int_Wiring( BYTE byNMI_Wiring, BYTE byIRQ_Wiring ); void K6502_Step( register WORD wClocks ); // I/O Operation (User definition) static inline BYTE K6502_Read( WORD wAddr); static inline WORD K6502_ReadW( WORD wAddr ); static inline BYTE K6502_ReadZp( BYTE byAddr ); static inline WORD K6502_ReadZpW( BYTE byAddr ); static inline BYTE K6502_ReadAbsX(); static inline BYTE K6502_ReadAbsY(); static inline BYTE K6502_ReadIY(); static inline void K6502_Write( WORD wAddr, BYTE byData ); static inline void K6502_WriteW( WORD wAddr, WORD wData ); // The state of the IRQ pin extern BYTE IRQ_State; // The state of the NMI pin extern BYTE NMI_State; #endif /* !K6502_H_INCLUDED */