An overview of implementing FC red and white machine simulator using C++

Hits: 0

It must be mentioned that the FC game console should be familiar to everyone ( ~you will not find this article if you are unfamiliar~ ). The FC game console, also known as the red and white machine, was launched by Nintendo in 1983 and soon became popular in China. However, the more familiar ones in China may be Xiaobawang and other compatible machines (laughing)~~

But no matter what, the red and white machine still makes many of us childhood memories. Presumably the partners who played games together at the beginning have entered all walks of life, and naturally they have become “programmers”. Haven’t you thought about implementing a red and white machine yourself? Maybe this is a bit difficult, after all, we still need to prepare different hardware, design circuit welding, etc. Fortunately, we can implement a red and white machine emulator on PC (or android) through pure code.

If you want to do good work, you must first sharpen your tools. Before starting, we had better meet the following basic requirements.

Purpose of this series of articles

The purpose of this series is not to lead you , but us . Because the author himself is also a rookie just getting started. I want to share and learn with everyone. In view of the author’s ability, errors and inaccuracies are inevitable in the article. Hope to be able to understand, criticize and correct, and make progress together.
The ultimate purpose of this series of articles is to develop a FC simulator with good portability and support for more common games, in which all parts, including the APU part, are implemented by ourselves without borrowing from other [open source projects] .

Hope you already have the ability:

  • Basic C/C++ programming skills. This series of articles assumes that you already have them, so there will be no in-depth explanation of syntax knowledge.
  • It’s best to have basic knowledge of audio, it doesn’t matter if you don’t have it, and I didn’t have it before I developed it.
  • It is best to have a certain basic knowledge of hardware, which is easy to understand some implementation details.

The development platform of this project

This is not a hard requirement. The reason why Qt is used is that Qt has a relatively high degree of encapsulation of interface and audio operations, so that this series does not need to spend a lot of energy on the non-emulator implementation. However, in addition to the necessary parts such as interface and audio, this tutorial will use writing methods that have nothing to do with Qt. Therefore, you can also choose to choose VS2019, or even Android to develop with native libraries. As long as you are familiar with the relevant interfaces.

This series of articles assumes that you are familiar with and have installed the relevant development environment, so the installation of Qt and other environments will not be described in detail.

Simple Analysis

  • The CPU is the most important part of the whole system (but not the hardest). The CPU model of the red and white machine is RP2A03, which uses the 6502 instruction set and the frequency is about 1.79MHZ (the frequency is very important, which will be discussed in detail in the following article).

  • The PPU is the processing unit responsible for the screen display, which can be understood as the graphics card of the current PC computer.

  • APU is responsible for audio processing, but it is also commonly called pAPU (pseudo fake, fake). Because the APU is integrated in the CPU and does not exist independently.

  • Cartridge cartridges, also commonly known as cassettes, are what we used to call ” game cards “. The executable program and data of the game are saved internally. However, because the default supported game size is very small (32KB executable file and 8KB image data), it is far from enough for some slightly complex games, so there is also a thing called Mapper inside to dynamically change the address mapping to achieve Expansion of storage space. The more Mappers supported, the more games you can play.

  • Needless to say, the handle , up, down, left and right, BABA is finished~

[ Tips ]
In view of time and energy, the update time of this series of articles is not fixed, but we will insist on updating.
If you have any questions, you can contact me by email:
In addition, I have already completed a simple FC simulator in advance. If you are already a god or want to read the code directly, you can visit directly (remember to click starts)
https: //

Leave a Reply

Your email address will not be published.