How does the Genesis handle resets, compared to Nintendo consoles?

Discussion of development of software for any "obsolete" computer or video game system.
User avatar
poorstudenthobbyist
Posts: 221
Joined: Fri Jun 24, 2016 4:20 pm

How does the Genesis handle resets, compared to Nintendo consoles?

Post by poorstudenthobbyist » Sun Dec 06, 2020 7:14 am

I've tried making a Genesis multicart board, triggered by the reset button, and it works fine for most games, but I've found a few that will cause graphical glitches on the next game loaded after hitting the reset button. Sometimes they go away after a bit, other times it'll completely lock up the console. I know some games utilized the reset button to solve puzzles, like I think an X-Men game used that?

I don't recall any SNES games doing something like that, and I've never run into problems with SNES multicarts (but maybe I haven't tried enough games). I can't find much information about this online. Does anyone have any insight?
Check out my website for NES, SNES, and Genesis tutorials here. And visit my store for some custom tools and boards for making games here.

You can also follow me on Twitter for infrequent updates and bad jokes!

User avatar
TmEE
Posts: 776
Joined: Wed Feb 13, 2008 9:10 am
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Contact:

Re: How does the Genesis handle resets, compared to Nintendo consoles?

Post by TmEE » Sun Dec 06, 2020 8:43 am

There are two resets on MD, !MRES (power on reset) and !VRES (soft reset). Games can and do differentiate first reset from succeeding ones and generally do not do full initialization upon a soft reset. You are supposed to have a menu program that is ran every reset that does some sort of initialisation so that game will always start with a defined state rather than whatever is left from previous game.

User avatar
poorstudenthobbyist
Posts: 221
Joined: Fri Jun 24, 2016 4:20 pm

Re: How does the Genesis handle resets, compared to Nintendo consoles?

Post by poorstudenthobbyist » Sun Dec 06, 2020 8:58 am

Ok, that's what I had assumed was the case, that it was a soft reset instead of a "harder" reset. Thanks for the info!

Does Nintendo's reset routine do a hard reset then, or have I just gotten lucky?
Check out my website for NES, SNES, and Genesis tutorials here. And visit my store for some custom tools and boards for making games here.

You can also follow me on Twitter for infrequent updates and bad jokes!

User avatar
TmEE
Posts: 776
Joined: Wed Feb 13, 2008 9:10 am
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Contact:

Re: How does the Genesis handle resets, compared to Nintendo consoles?

Post by TmEE » Sun Dec 06, 2020 9:25 am

I imagine SNES games always do full init upon reset. It just was in Sega software guidelines to differentiate soft and hard resets and this leads to the problems you observe. You could perhaps patch the games to always do full init. Majority test controller port pin directions as they are set to default only on a hard reset, while soft reset won't change them. If a game sees power on preset it will do full init, if it sees the values it set, it skips most of the init.

User avatar
Nikku4211
Posts: 377
Joined: Sun Dec 15, 2019 1:28 pm
Location: Bronx, New York
Contact:

Re: How does the Genesis handle resets, compared to Nintendo consoles?

Post by Nikku4211 » Sun Dec 06, 2020 11:17 am

You have got to make sure that the player doesn't accidentally go to the menu when they're just trying to play X-Men.
I have an ASD, so empathy is not natural for me. If I hurt you, I apologise.

Pokun
Posts: 1746
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: How does the Genesis handle resets, compared to Nintendo consoles?

Post by Pokun » Sun Dec 06, 2020 2:18 pm

So the RESET button is connected to an interrupt or something?

Kind of like Sega SC-3000 which has a software RESET button which just triggers the NMI, and the software must put a reset routine in the NMI handler. But on the Sega SG-1000, Mark III and Master System it's renamed to the PAUSE button (or HOLD on early models), but is still just connected to NMI. So most games will pause when the RESET/PAUSE button is pushed, while a SC-3000-specific program (like BASIC) does a soft-reset instead.

All Nintendo systems that I know of up to and including the SNES, has the RESET button connected to the CPU's /RESET line (on the SNES the CIC is somehow involved as well though) and does a hardware reset. Since RAM is retained though, it's still possible for a game to different between a hot and cold reset (by leaving a signature or something somewhere in RAM), and I think some SNES games do that (at least the development docs suggests to do that). So yeah maybe you were lucky.

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

Re: How does the Genesis handle resets, compared to Nintendo consoles?

Post by lidnariq » Sun Dec 06, 2020 2:41 pm

Genesis has five separate reset signals, two of which are on the card edge.

+WRES, the output from the reset button itself.
/MRES, B02, triggers a hard reset
/SRES, a buffered copy of /MRES
/VRES, B27, an output from the bus arbiter that directly drives the 68k's /RESET input
/ZRES, an output from the bus arbiter that directly drives the Z80's /RESET input

User avatar
poorstudenthobbyist
Posts: 221
Joined: Fri Jun 24, 2016 4:20 pm

Re: How does the Genesis handle resets, compared to Nintendo consoles?

Post by poorstudenthobbyist » Sun Dec 06, 2020 9:16 pm

lidnariq wrote:
Sun Dec 06, 2020 2:41 pm
/MRES, B02, triggers a hard reset
When you say "triggers", do you mean one could drive the /MRES signal on the cartridge to simulate a hard reset?
Pokun wrote:
Sun Dec 06, 2020 2:18 pm
All Nintendo systems that I know of up to and including the SNES, has the RESET button connected to the CPU's /RESET line (on the SNES the CIC is somehow involved as well though) and does a hardware reset. Since RAM is retained though, it's still possible for a game to different between a hot and cold reset (by leaving a signature or something somewhere in RAM), and I think some SNES games do that (at least the development docs suggests to do that). So yeah maybe you were lucky.
According to the documentation by nocash,
Reset Button (on the console)
Resets various CPU/PPU/APU registers, but leaves WRAM intact, so for example, games could use the button to restart the current level, or to enter the main menu.
I wonder if any games do anything like that. I can't think of any off the top of my head. I've seen so many different multicart threads here and on other forums online and no one has reported weird game problems, though, I can't say I've seen any with Genesis either and I definitely have problems with some games on those.
Check out my website for NES, SNES, and Genesis tutorials here. And visit my store for some custom tools and boards for making games here.

You can also follow me on Twitter for infrequent updates and bad jokes!

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

Re: How does the Genesis handle resets, compared to Nintendo consoles?

Post by lidnariq » Sun Dec 06, 2020 10:40 pm

poorstudenthobbyist wrote:
Sun Dec 06, 2020 9:16 pm
lidnariq wrote:
Sun Dec 06, 2020 2:41 pm
/MRES, B02, triggers a hard reset
When you say "triggers", do you mean one could drive the /MRES signal on the cartridge to simulate a hard reset?
Yes. /MRES is an RC on the mainboard that controls the power-on-reset timer. The cart has access to the pin, so can discharge the capacitor.

It's a 10µF capacitor – at least in the hardware described by this schematic – so you need to make sure that you can deal with that surge current if you discharge it.

below schematic fragment is cropped out from schematics here: GamesX wiki:Schematics:Console Related Schematics § Genesis/Megadrive
Attachments
genesis_cpu_and_custom_chips_just_reset_signals.png
genesis_cpu_and_custom_chips_just_reset_signals.png (2.2 KiB) Viewed 2343 times

User avatar
poorstudenthobbyist
Posts: 221
Joined: Fri Jun 24, 2016 4:20 pm

Re: How does the Genesis handle resets, compared to Nintendo consoles?

Post by poorstudenthobbyist » Mon Dec 07, 2020 6:56 am

Neat! I can make up a transistor circuit triggered by /VRES that discharges that capacitor through a 100 ohm resistor or something. Assuming VCC2 is 5V then the time constant would be 1ms, max surge current only 50mA.

It'd be nice if I could just connect it directly to the /VRES pin, I bet there's a good chance that if I connected the /VRES to the /MRES through a 1k resistor, the pin would be able to handle 5mA for the split second it needs to discharge the capacitor. I can't find a datasheet on it though.
Check out my website for NES, SNES, and Genesis tutorials here. And visit my store for some custom tools and boards for making games here.

You can also follow me on Twitter for infrequent updates and bad jokes!

Pokun
Posts: 1746
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: How does the Genesis handle resets, compared to Nintendo consoles?

Post by Pokun » Mon Dec 07, 2020 9:18 am

poorstudenthobbyist wrote:
Sun Dec 06, 2020 9:16 pm
According to the documentation by nocash,
Reset Button (on the console)
Resets various CPU/PPU/APU registers, but leaves WRAM intact, so for example, games could use the button to restart the current level, or to enter the main menu.
I wonder if any games do anything like that. I can't think of any off the top of my head. I've seen so many different multicart threads here and on other forums online and no one has reported weird game problems, though, I can't say I've seen any with Genesis either and I definitely have problems with some games on those.
Yeah that's what I meant. Though to nitpick, the PPU's /RESET line is only connected to the RESET button on the front-loading NES. On all Famicoms and the top-loading NES it's permanently tied to high, so only the CPU is reset.

I don't know what Nintendo games detects a warm boot though. I do it myself in my homebrew by checking a signature in RAM to retain the high-score and such things on warm resets.
Many games fails to initialize memory though, and may potentially be affected by this. Most famously Final Fantasy 1 uses uninitialized RAM as a random seed for its RNG. So if you put it on a multicart that relies on resetting, this may affect what enemies you encounter in FF1. If the RAM value used for the RNG is always the same at boot due to this, it wouldn't be very random at all.

User avatar
poorstudenthobbyist
Posts: 221
Joined: Fri Jun 24, 2016 4:20 pm

Re: How does the Genesis handle resets, compared to Nintendo consoles?

Post by poorstudenthobbyist » Mon Dec 07, 2020 9:26 am

Ah, I was looking specifically at SNES here (haven't delved into NES multicarts yet) but the information is helpful and welcomed. And really interesting!
Check out my website for NES, SNES, and Genesis tutorials here. And visit my store for some custom tools and boards for making games here.

You can also follow me on Twitter for infrequent updates and bad jokes!

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

Re: How does the Genesis handle resets, compared to Nintendo consoles?

Post by lidnariq » Mon Dec 07, 2020 12:19 pm

poorstudenthobbyist wrote:
Mon Dec 07, 2020 6:56 am
It'd be nice if I could just connect it directly to the /VRES pin, I bet there's a good chance that if I connected the /VRES to the /MRES through a 1k resistor, the pin would be able to handle 5mA for the split second it needs to discharge the capacitor. I can't find a datasheet on it though.
If I remember correctly, VRES is low because MRES is low, so you unfortunately can't just put a stateless connection like that.

(VRES can be low for other reasons, such as WRES or MARK3 (B30))

Also, using MRES to reset the console will make the TMSS screen show up again. (Oh well)

tepples
Posts: 22275
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: How does the Genesis handle resets, compared to Nintendo consoles?

Post by tepples » Mon Dec 07, 2020 3:09 pm

I forget: Does asserting /VRES during the TMSS screen cause the TMSS screen to be skipped? If so, a mapper could assert /MRES, wait maybe 50 ms, and assert /VRES.

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

Re: How does the Genesis handle resets, compared to Nintendo consoles?

Post by lidnariq » Mon Dec 07, 2020 3:24 pm

Looking at the disassembly here, it looks like you could carefully capture the microseconds that it reads the "SEGA" from the header, and assert /VRES at that moment to bypass TMSS.

That time is probably deterministic enough that one might be able to just re-assert /VRES briefly a certain amount of time after the first time /VRES rises.

Post Reply