Relying on different IRAM initial values

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

Post Reply
User avatar
aquasnake
Posts: 515
Joined: Fri Sep 13, 2019 11:22 pm

Relying on different IRAM initial values

Post by aquasnake »

Some IRAMs can be used as pseudo registers to realize the secondary boot function.

After IRAM is initialized, a specific value is written. After reset again, the program detects the pseudo register. If it is not equal to the previous specific value, it reinitializes and enters the cold boot subroutine.
Otherwise, it is judged as warm boot, the reset vector can be transferred to other address branches to realize different start interfaces.

FDS games rely on this feature. Some flash carts will also detect and decide whether to reset to the current game or the system menu.

If the IRAM value at the time of power on is exactly equal to the specific value to be initialized (this possibility exists), it will cause an unexpected branch to enter by mistake. If only one byte is detected and the error probability is 1/256, we can increase the decision word length, for example, two bytes, and effectively reduce it to 1/65536. Sometimes there are other radiation disturbances, in order to increase the robustness of the program, it is more reliable to increase it to 4 bytes.
Post Reply