Reset button, how does it work?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
User avatar
za909
Posts: 229
Joined: Fri Jan 24, 2014 9:05 am
Location: Hungary

Reset button, how does it work?

Post by za909 »

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?
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Reset button, how does it work?

Post by tepples »

lidnariq
Posts: 10677
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Reset button, how does it work?

Post by lidnariq »

And http://www.pagetable.com/?p=410 (6502 RESET is treated as a special case of an interrupt)
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Re: Reset button, how does it work?

Post by Bregalad »

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.
User avatar
OneCrudeDude
Posts: 274
Joined: Fri Aug 23, 2013 2:14 am

Re: Reset button, how does it work?

Post by OneCrudeDude »

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.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Reset button, how does it work?

Post by tepples »

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.
User avatar
rainwarrior
Posts: 8062
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Reset button, how does it work?

Post by rainwarrior »

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.
User avatar
mikejmoffitt
Posts: 1352
Joined: Sun May 27, 2012 8:43 pm

Re: Reset button, how does it work?

Post by mikejmoffitt »

I think his point is that he finds it odd that Karateka returns to the multicart's 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.
User avatar
koitsu
Posts: 4203
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Reset button, how does it work?

Post by koitsu »

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.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Reset button, how does it work?

Post by tepples »

mikejmoffitt wrote:I think his point is that he finds it odd that Karateka returns to the multicart's 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.
zzo38
Posts: 1080
Joined: Mon Feb 07, 2011 12:46 pm

Re: Reset button, how does it work?

Post by zzo38 »

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.
[url=gopher://zzo38computer.org/].[/url]
Post Reply