Difference between RAM and cartridge SRAM?

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

Moderator: Moderators

User avatar
Sumez
Posts: 909
Joined: Thu Sep 15, 2016 6:29 am
Location: Denmark (PAL)

Re: Difference between RAM and cartridge SRAM?

Post by Sumez » Wed Sep 25, 2019 2:24 am

$700-$7FF is just regular NES RAM same as the rest of it, using it for a stack in the compiled C code is a CC65 specific thing.

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

Re: Difference between RAM and cartridge SRAM?

Post by Pokun » Wed Sep 25, 2019 3:27 am

Yes, the 6502 is hardwired to always use page 1 ($0100 to $01FF) for the hardware stack.

User avatar
rainwarrior
Posts: 7669
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Difference between RAM and cartridge SRAM?

Post by rainwarrior » Wed Sep 25, 2019 9:12 am

It's not even a cc65 specific thing. You can put cc65's software stack anywhere in RAM, and it doesn't need to take up a whole page either. It's not really relevant to this discussion about hardware RAM layout though.


The hardware stack at $100-$1FF is relevant, though that's not what aquasnake brought up.

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

Re: Difference between RAM and cartridge SRAM?

Post by Pokun » Wed Sep 25, 2019 2:19 pm

Also, since page 0 and page 1 are mapped to the internal RAM on the NES they can also still be used as normal RAM. They are not magical in any way except that they can be used by zero page addressing and the hardware stack respectively. Of course any usage of page 1 should be carefully controlled so that it doesn't clash with the stack.
Sumez wrote:
Pokun wrote:but battery backed WRAM is also used, and besides it can still be used as normal work RAM no matter if it has a battery or not.
Important difference is though, that most mappers with battery backed RAM also often include a way to protect writes to the RAM, since unintended writes while turning off power to the console could potentially corrupt battery backed RAM. For cartridge RAM only used as "WRAM", that corruption wouldn't matter.

So if you want to use the cartridge RAM for both saves and extra work RAM, you need to either restrict usages to specific situations where you open the mapper for writes, or simple accept a higher risk of corrupted saves.

I'm not sure what actual licensed games historically did in these situations.
Good point.

Ever since I learned that mappers like both MMC1 and MMC3 has write protection of the cartridge RAM, I've been wondering why games like Dragon Quest always reminds you of holding RESET when turning off power. Isn't the write protection enough?

User avatar
rainwarrior
Posts: 7669
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Difference between RAM and cartridge SRAM?

Post by rainwarrior » Wed Sep 25, 2019 3:12 pm

I think the write protect registers are mostly just protection against software bugs, but the chaos of power-off had other ways to corrupt it.

I think later games have diodes on the board that help protect against the power-off problem. Like StarTropics doesn't give you any special power-off instructions, it just warns you not to switch off during the brief moment while the game is in-progress of a save.

nocash
Posts: 1090
Joined: Fri Feb 24, 2012 12:09 pm
Contact:

Re: Difference between RAM and cartridge SRAM?

Post by nocash » Wed Sep 25, 2019 8:50 pm

Pokun wrote:Ever since I learned that mappers like both MMC1 and MMC3 has write protection of the cartridge RAM, I've been wondering why games like Dragon Quest always reminds you of holding RESET when turning off power. Isn't the write protection enough?
That write protection exists only in MMC1B or newer. Apart from that, I don't know if that protection flag is enough, if neccessary one could combine it with additional "analog" protections, like checking if VCC is higher than 3V.

blocker1
Posts: 1
Joined: Fri Jul 05, 2019 8:57 am

Re: Difference between RAM and cartridge SRAM?

Post by blocker1 » Thu Sep 26, 2019 11:41 am

Was unable to view this thread coz of router login issue which got resolved with the help of 192.168.178.1 Admin Login, User, Password & IPguide. Okay so, SRAM is a memory chip that is faster and requires less power than DRAM. More costly than DRAM, SRAM is generally used by the computer as cache memory. ... DRAM is a memory chip that can hold more data than an SRAM chip, although it is slower and needs more power
Last edited by blocker1 on Sun Nov 17, 2019 10:28 pm, edited 1 time in total.

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

Re: Difference between RAM and cartridge SRAM?

Post by Pokun » Thu Sep 26, 2019 12:09 pm

rainwarrior wrote:I think the write protect registers are mostly just protection against software bugs, but the chaos of power-off had other ways to corrupt it.

I think later games have diodes on the board that help protect against the power-off problem. Like StarTropics doesn't give you any special power-off instructions, it just warns you not to switch off during the brief moment while the game is in-progress of a save.
nocash wrote:
Pokun wrote:Ever since I learned that mappers like both MMC1 and MMC3 has write protection of the cartridge RAM, I've been wondering why games like Dragon Quest always reminds you of holding RESET when turning off power. Isn't the write protection enough?
That write protection exists only in MMC1B or newer. Apart from that, I don't know if that protection flag is enough, if neccessary one could combine it with additional "analog" protections, like checking if VCC is higher than 3V.
I see, so the flag might not be reliable as the voltage drops.

On the SNES they say it didn't have the hold-RESET requirement, but it sounds like protecting the cartridge memory is a job for the cartridge and have nothing to do with the console. Actraiser is the only SNES game that I remember to actually have the Dragon Quest-style "please hold RESET when turning off the system" kind of message when saving and quitting (it's an Enix game after all).

User avatar
Memblers
Site Admin
Posts: 3770
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: Difference between RAM and cartridge SRAM?

Post by Memblers » Thu Sep 26, 2019 3:53 pm

I always assumed that MMC1 write protection was for the power-on state, rather than power-off. Since you can never predict when the user will cut the power, you'd have to disable the RAM all the time to keep it safe. Which seems totally useless.
tepples wrote:Others are ferroelectric RAM (FeRAM), as used in Sonic the Hedgehog 3.
Kind of interesting that they used it once in a fairly big release, then seemingly never used it again in any game carts (AFAIK). It must have been 256 bytes or something small. I remember in 2005 or so I briefly considered using FRAM in my Squeedo design before I understood it had read endurance. I'm not 100% sure but I want to say the price difference was something like $1.50 for 32kB SRAM, VS $10 for 8kB FRAM. Neat stuff, but too expensive, using Flash+SRAM made more sense than EPROM+FRAM.

There was another technology that's not in any game carts (AFAIK), but there were some chips that were a drop-in replacement for SRAM, but it was a combined SRAM and Flash. It would restore the SRAM contents on power-on, and save the SRAM contents automatically when the chip loses power. Seems to have died out and/or been a boutique part though.

Post Reply