【Jihai APM32F407 Tiny Board】 1. NES emulator
[Copy link]
NES Emulator
1. Introduction to NES
NES is the abbreviation of "Nintendo Entertainment System", which is a home game console launched by Nintendo in the 1980s. In Japan, it is called Famicom (Family Computer). NES was first launched in Japan in 1983 and then released in North America in 1985, becoming the dominant force in the home game market at that time.
The console is revered for its extensive game library, classic game series, and influence on the home gaming market. It introduced many classic games such as Super Mario Bros., The Legend of Zelda, Contra, and Castlevania, which are still considered classics in gaming history.
2. Transplantation Preparation
2.1 Download
First download the relevant information, function library, some examples, circuit schematics, etc., as shown below
This time we use RTT for development, and we need to download the board support package
At the same time, update PYOCD to the latest version, otherwise the download may fail.
Next, create a new RTT project, as shown below, the main function prints once every 1s
Use the external serial port to connect to the serial port 1 of the development board, open the terminal, and you can see that it prints once every 1s
Since the printed information is not easy to observe and sometimes you need to use the terminal, here we adjust the printed information to the onboard LED light, similar to the heartbeat light. Check the onboard LED light schematic, as shown below:
Add the heartbeat light code. When using the GET_PIN function, you need to include the drv_common.h header file, otherwise the compilation will report an error.
I encountered many pitfalls in the process of using RTT development, so I gave up using RTT development and decisively started with the standard library for development, which took less time than using RTT development. This time, I used an SPI routine to modify and adjust, adding spi, LCD, and NES emulator code. Since using RTT took too much time, the process will not be described in detail, and there are many steps.
2.2 SPI Driver
This time, SPI1 is used to connect to ili9341, and the configuration is as follows:
Read and write functions:
2.3 LCD display implementation
Add LCD source code, add LCD path, replace header files, etc.
LCD pin configuration:
The next step is to replace the write data and write command functions, and adjust the internal functions to the SPI read and write functions:
3. Transplantation Process
NES emulator porting is not introduced in detail here, add source code, header file path
Adjust the NES emulator display content:
Main function, add nes header file, and execute function:
4. Effect
NES模拟器
|