Reset button, how does it work?

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Reset button, how does it work?
by on (#132337)
So I've been wondering if all the reset button on the console does is merely copying the reset vector to the program counter, or more? Does a hardware reset cause any changes to the PPU or the APU (resetting the channel sequencers or whatever) , and if so, does everything return to an unknown state like during startup?
Re: Reset button, how does it work?
by on (#132341)
http://wiki.nesdev.com/w/index.php/PPU_power_up_state
Re: Reset button, how does it work?
by on (#132342)
And http://www.pagetable.com/?p=410 (6502 RESET is treated as a special case of an interrupt)
Re: Reset button, how does it work?
by on (#132344)
It's imporant to know that, on a western PAL or NTSC front loader NES, the RESET button actually reset the CIC, which in turn resets both the CPU and PPU.

On the original Famicom, as well as the redesigned Famicom AV, and the USA top loader (which looks similar to the Famicom AV), the Reset button just resets the CPU, and the PPU continues to run (and display a picture on the screen) while the button is held.

I don't know what is the situation on Famiclones.
Re: Reset button, how does it work?
by on (#132358)
I figured this would be a good place to ask. I have a multicart with several games on it, and one of them is Karateka. When you lose, the game seems like it performs a software based reset, as it would take you back to the multicart menu. Did any other games use reset as a way to get back to the title screen? No one would've noticed it actually reset until it was on a multicart, as they probably wouldn't even imagine a thing such as a multicart could even exist.
Re: Reset button, how does it work?
by on (#132360)
Most games do go back to the title screen after a Reset press.

The only one I can think of that doesn't is X-Men for the Sega Genesis, where one scene near the end requires the player to press the Reset button to restart an in-game computer. If the player presses Reset during this sequence, the game instead goes to the next scene; otherwise, it goes to the game's the opening scene. The way it tells the difference is by storing data in a certain part of RAM, which is preserved across a reset unless the game program explicitly clears it.
Re: Reset button, how does it work?
by on (#132363)
OneCrudeDude: A simulated reset can be done with a single instruction. jmp ($FFFC)

This is very handy for returning to the title screen in a lot of situations.
Re: Reset button, how does it work?
by on (#132378)
I think his point is that he finds it odd that Karateka returns to the [i]multicart's[i] menu screen, not the regular title screen, leading to the question of whether or not it is common for games to invoke a soft reset to return to their title state.
Re: Reset button, how does it work?
by on (#132380)
Thread makes me think of Zanac. If you die, you end up back at the main title screen and so on, which is almost certainly accomplished by simply jmping to wherever the "main entry point" is (but not the reset vector (i.e. not jmp ($fffc))). Instead, if you hit reset on the console 13 times, you end up with a stage select menu when trying to start the game. As a kid I thought this was incredible because "how does it know I'm hitting reset?!?!" -- when later I found out the NES was simply a 6502 console the reset vector point became obvious -- surely there's just some code that the vector points to which does clc/adc #1 to some ZP variable and later does cmp #13/bcs do_stage_select).

I'm sure there are games which just do jmp ($fffc) or some equivalent. And for a multicart, they probably had to insert a small bit of code to do the right thing (configure mapper) each time. They could have also done it through some means like setting the reset vector to a RAM address (ex. $0400) then in every game stick some actual code into RAM (at $0400) that did the mapper setup/etc.. Wouldn't be the first time I've seen games use a reset vector address outside of ROM space.
Re: Reset button, how does it work?
by on (#132395)
mikejmoffitt wrote:
I think his point is that he finds it odd that Karateka returns to the [i]multicart's[i] menu screen

Either games are patched to jump back to the menu on reset or the mapper watches the incoming clock signal to see whether it has stopped (as would happen during reset). I have made multicarts using the former.
Re: Reset button, how does it work?
by on (#132405)
I am aware that on the RF Famicom, the reset button is only connected to the CPU; I have seen the schematics. You should consider that different implementations will do different things, as already mentioned.

tepples wrote:
Either games are patched to jump back to the menu on reset or the mapper watches the incoming clock signal to see whether it has stopped (as would happen during reset). I have made multicarts using the former.


Although I have not done (yet), I have suggested once, that a game could check if the reset vector has been tampered with; if so, display an extra option on the main menu that says "QUIT" and jumps through the reset vector if activated.