This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Does your CopyNES modded NES retain RAM at reset?

Does your CopyNES modded NES retain RAM at reset?
by on (#127228)
When using my PowerPak with my USB CopyNES modded NES, I am finding that it does not retain RAM values at all when I reset. I'm getting mostly 0s with some very consistent values sparsely set. (I'm talking about the CPU RAM, not PPU here.)

On my Famicom with the same PowerPak without CopyNES RAM values are retained on reset as I expect.

I'm not sure if this specifically has to do with the PowerPak vs NES reset circuit (does it run its own init code when reset on an NES?) or if it's my NES, or what exactly. I have a USB CopyNES, does that do something weird on reset even when not plugged in?

I don't feel like setting up to burn an eprom tonight to try a plain cartridge test, but I will try this tomorrow. (I don't appear to have any NES games on hand that are designed to retain any RAM information over reset.)

In the meanwhile, I made a simple NROM program that displays and modifies 256 byte pages of RAM:

B - fills page with ascending values
A - fills page with descending values
Up - previous page
Down - next page

B/A will not operate on the stack page, and they skip the first 16 bytes of the ZP page.

Edit: have identified that the CopyNES is the cause of this problem.
Re: Does NES retain RAM at reset?
by on (#127229)
It should over reset, it doesn't use DRAM for main RAM and nametable RAM. You are probably looking at locations that get killed because of a floating bus and r/w pins in the reset state.

PPU Internal RAM is DRAM, though. That will degrade when not running.
Re: Does NES retain RAM at reset?
by on (#127230)
The ROM I posted allows you to view all 2k of internal RAM. What locations are you talking about?

I'm not asking about PPU at all, sorry if that was unclear.
Re: Does NES retain RAM at reset?
by on (#127231)
Any location that might be suspect on a floating bus. That means basically any value, really, since floating pins just float. That's basically it. Maybe the other CPU. I basically answered's a reset state, nothing is known, nothing can be assumed really.
Re: Does NES retain RAM at reset?
by on (#127232)
Sorry, it is very unclear to me what you are saying. Are you saying that RAM is or is not retained over reset on your NES? Have you tested it?

What does "other CPU" mean?
Re: Does NES retain RAM at reset?
by on (#127233)
I don't have to test it. The RAM in the NES is static RAM. Dynamic loses it's state without being refresh, nothing erases static RAM. It does not degrade from not being read, as long as the chip has power, the only thing that can kill should be the fluctuating bus. Which is probably what you are seeing, the other system might have hardware to avoid those problems, while the NES does not. The only RAM on the system that degrades if held in reset are sprites and palette data and PPU register data probably. That all needs read and re-written to keep it fresh.
Re: Does NES retain RAM at reset?
by on (#127234)
I want to know whether other NES machines do the same thing, or if this is specific to my NES (possibly because of the use of either PowerPak or the installed CopyNES). Does it happen only in some cases, and is it generally reliable outside of those cases? Are there revisions that have different behaviour here?

Emulators appear to universally retain RAM at reset, and in my tests this behaviour agrees with my Famicom at least.

Can you test your own hardware? (What do you mean you don't have to test it?) Your theoretical ideas don't help my problem, unless you can suggest a new approach to test.
Re: Does NES retain RAM at reset?
by on (#127237)
Not only the NES retains RAM (as well as nametables), but games relies on this, too. This is why some emus have a different "Hard reset" and "soft reset".
Re: Does NES retain RAM at reset?
by on (#127238)
rainwarrior wrote:
(What do you mean you don't have to test it?)
Static RAM can lose its contents for only two reasons:
- Loss of power
- Deliberate writes to RAM
This isn't theoretical: It is guaranteed per the datasheets for the various 2 KiB RAM ICs that Nintendo has used.

If you're seeing massive loss of data from RAM in an NES with both the copynes and the powerpak, and you've already eliminated the possibility of power surges causing brownouts, it has to be the fault of one of those two devices. I think I remember people mentioning elsewhere that the Powerpak is known to be no good for power-on tests...
Re: Does NES retain RAM at reset?
by on (#127240)
The PowerPak is no good for power-on tests because the NES transitions from power-up state to running state while the PowerPak menu is displayed. But the menu runs at all only after a cold boot or a long reset; a short press of the reset button should put your program in warm reset state. And because it has the same effects on PPU ports $2003-$2007 as a cold boot (namely no access to video memory for one frame, and problems with a pair of sprites until a frame is fully rendered), you can even use it as a proxy for some cold boot effects.

Only two things can change data in an SRAM: power loss and pulling /CE and /WE low. I think what they're trying to say is that if noise is on the CPU bus during a reset, the address decoder might see the noise and end up pulling /CE low, and /WE might likewise end up pulled low.

Caution for using SMB1: The SMB1+Duck Hunt multicart does not preserve values across reset.
Re: Does NES retain RAM at reset?
by on (#127242)
Edit: the cause has been identified, see below.

Yes, I'm well aware that some games expect RAM retention. What I want to know is whether this has happened for anyone else. How common is the problem? Can I identify and eliminate a single factor which is causing it?

The first two things I will try eliminating are the PowerPak (about to solder up a plain cartridge to test), and the CopyNES (will try removing this next). As I said in my post, the pattern that appeared in RAM after reset appeared to be consistent, so I strongly suspect code is running.

1. Can anyone test the ROM I posted with a PowerPak + NES? Is your result different than mine?
2. Can anyone test the ROM I posted on an NES with CopyNES? Is your result different than mine?

Does anyone know if a disconnected CopyNES is capable of running code at reset?

Could a disconnected CIC pin 4 cause a problem like this?

It could just be something unreliable about my NES' old hardware too, that's another reason I'm wondering if this happens to other people. If this happens to some minority of NES machines, it's something that could easily go undetected. (I have a small collection of games, maybe about 20, and I couldn't identify any that retained anything on reset, not even a high score table.)
Re: Does your NES retain RAM at reset?
by on (#127243)
On my PowerPak, values are saved across a reset. Fill + view + reset + view results in no change, except possibly a garbage sprite or two due to OAM refresh fail.
Re: Does your NES retain RAM at reset?
by on (#127245)
Thanks tepples.

After placing my test ROM on a plain cart I've verified that this has nothing to do with the PowerPak, the behaviour was the same.

After removing the CopyNES and placing my 2A03 CPU directly into the socketed motherboard, my NES now retains RAM on reset. Success!

So... what is the CopyNES doing on reset? I thought it was supposed to be entirely transparent if it wasn't plugged in via USB.

Edit: apparently it does indeed run code on reset by design, and there's a RAM wipe in there. So... question answered. So there is in fact at least one way that a CopyNES modded NES differs from a stock NES! Reset and power both put RAM in a consistent state, whether or not the cable is plugged in.