It is currently Sat Dec 15, 2018 6:36 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Detecting Cartridge RAM
PostPosted: Tue Sep 18, 2018 6:52 am 
Offline

Joined: Tue Nov 23, 2004 9:35 pm
Posts: 713
In most ordinary mappers, cartridge RAM resides at CPU $6000-$7FFF. Games which use that RAM will read from it and write to it. I understand that if you want to detect whether a game uses cartridge RAM and you cannot find an image of its PCB, the best approach would be to monitor the area at CPU $6000-$7FFF. This can be done via setting a breakpoint on accesses to that area.

There are games that may have vestigial code that writes to RAM because the development cartridge had RAM but the programmers figured out how to avoid using it on production cartridges. Extra RAM cost more money BITD. I have figured that reads from RAM are the accesses to watch out for. Execution of code from RAM should be rare in a cartridge system, but if there is execution then there must be RAM.

But even then, a read from the cartridge RAM could be a false positive. There are a few games that are known to read from RAM not because they have RAM there, but because they rely on open bus behavior. When reading from open bus, a game is not reading a definable memory value but whatever happened to be on the bus just before the read, typically the high byte of the address. Two well-known cases are Low-G-Man and Battletoads & Double Dragon. At this point you need to apply reasoning to the instances where this occurs. "Is this really RAM usage?" "Why does this game read only at a boss fight?" "Is there any rhyme or reason to the game's writes?"

Also, I have found that a game like Battle of Olympus reads from RAM when you start a new game or enter a password without having written to the RAM beforehand. The routine appears to read 64 bytes from the CPU RAM area to update the $2007 PPU register. It doesn't really seem to care what the values are because the program corrects itself by the time the next image appears.

Does anyone care to add anything to this summary?

_________________
Nerdly Pleasures - My Vintage Video Game & Computing Blog


Top
 Profile  
 
PostPosted: Tue Sep 18, 2018 7:24 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7017
Location: Canada
I think you want to primarily be looking for writes to RAM, not really for reads? If there really is RAM there it must be written before it is read. (Ideally you'd be looking for a write followed by a later read from the same address.)

Looking for an initialization signature for battery RAM is a separate thing, but I would be exceedingly surprised by something that has battery backed RAM and no obvious save feature in the game. (The farthest I'd stretch this is maybe a high score table, but that's an expensive feature just for a high score.)

AFAIK both the false positive read examples you gave read without writing first, and they don't do it on startup.

Are there actually any known cases of vestigial RAM use? I've never heard of one.


Top
 Profile  
 
PostPosted: Tue Sep 18, 2018 8:00 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20876
Location: NE Indiana, USA (NTSC)
rainwarrior wrote:
I would be exceedingly surprised by something that has battery backed RAM and no obvious save feature in the game. (The farthest I'd stretch this is maybe a high score table, but that's an expensive feature just for a high score.)

By Tetris DX on Game Boy Color, 8-bit games were adding a battery just for high scores.


Top
 Profile  
 
PostPosted: Tue Sep 18, 2018 8:05 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7017
Location: Canada
Sure, 10 years and 3 volts probably makes a bit of a difference there. ;) Arcade games did it all the time too, of course, but a battery was a relatively small expense for those... but even then a lot of arcade games omitted it.


Top
 Profile  
 
PostPosted: Tue Sep 18, 2018 8:06 am 
Offline
User avatar

Joined: Thu Sep 15, 2016 6:29 am
Posts: 833
Location: Denmark (PAL)
I'm not sure what your endgame is here? You're looking at an NES ROM to figure out if it was designed to use cartridge RAM? But having access to an NES ROM would mean dumping it from an actual cartridge, and whoever dumped it should be well aware of wether the cartridge in question has a RAM chip on the PCB - which is why we have iNES headers, usually considered a part of an "NES ROM". And this is ignoring the fact that almost every NES PCB out there is already well documented.

I also imagine any games that actually rely on cartridge RAM would visibly break really fast without it.

rainwarrior wrote:
Arcade games did it all the time too, of course, but a battery was a relatively small expense for those... but even then a lot of arcade games omitted it.

Aside from the Neo Geo system, pretty much no Japanese arcade games did it until the late 90s. I almost only see it in western games.


Top
 Profile  
 
PostPosted: Tue Sep 18, 2018 8:43 am 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 940
Location: cypress, texas
Great Hierophant wrote:
In most ordinary mappers, cartridge RAM resides at CPU $6000-$7FFF. Games which use that RAM will read from it and write to it. I understand that if you want to detect whether a game uses cartridge RAM and you cannot find an image of its PCB, the best approach would be to monitor the area at CPU $6000-$7FFF. This can be done via setting a breakpoint on accesses to that area.
Monitoring memory became much easier for me after I started using Sour's Mesen emulator. Open the "Memory Tools" hex editor/viewer and you can easily view reads and writes to whatever area you are viewing because the accesses can be color coded... like red for reads and blue for writes. And you are able to order Mesen to keep the color change for however many frames you would like. You can also toggle to only color reads, or writes, or executions. You are also allowed to choose your own colors. It's so helpful!! :mrgreen: :D

edit: highlighted quote


Top
 Profile  
 
PostPosted: Tue Sep 18, 2018 8:53 am 
Offline

Joined: Tue Nov 23, 2004 9:35 pm
Posts: 713
rainwarrior wrote:
Sure, 10 years and 3 volts probably makes a bit of a difference there. ;) Arcade games did it all the time too, of course, but a battery was a relatively small expense for those... but even then a lot of arcade games omitted it.


I think you can chalk it down to 10 years and Tetris DX being a first-party title. Not only does Tetris DX save high scores but also player profiles. Nintendo could afford the "battery tax" better than 3rd parties.

Don't GB and GBC carts use +5v parts?

Interestingly, you might think that all Famicom Disk System games would support saving high scores, but most do not. The Disk System guaranteed you writable storage, but not all games took advantage of that feature.

Sumez wrote:
I'm not sure what your endgame is here? You're looking at an NES ROM to figure out if it was designed to use cartridge RAM? But having access to an NES ROM would mean dumping it from an actual cartridge, and whoever dumped it should be well aware of wether the cartridge in question has a RAM chip on the PCB - which is why we have iNES headers, usually considered a part of an "NES ROM". And this is ignoring the fact that almost every NES PCB out there is already well documented.

I also imagine any games that actually rely on cartridge RAM would visibly break really fast without it.


I'm not interested in reinventing the wheel, I know that almost all licensed NES and most unlicensed, non-pirate NES, has been properly documented. However, I find that Famicom stuff, whether licensed or unlicensed, has not been so well-documented. However, as a learning tool, comparing what a NES game does in relation to the board it uses is helpful.

I also think it is unwise to assume that the original dumper necessarily knew what exactly was inside the cartridge, especially for difficult-to-open Famicom cartridges. The presence or absence of RAM would not matter to the dumper.

unregistered wrote:
Monitoring memory became much easier for me after I started using Sour's Mesen emulator. Open the "Memory Tools" hex editor/viewer and you can easily view reads and writes to whatever area you are viewing because the accesses can be color coded... like red for reads and blue for writes. And you are able to order Mesen to keep the color change for however many frames you would like. You can also toggle to only color reads, or writes, or executions. You are also allowed to choose your own colors. It's so helpful!! :mrgreen: :D


Mesen has been my poison :) of choice!

_________________
Nerdly Pleasures - My Vintage Video Game & Computing Blog


Top
 Profile  
 
PostPosted: Tue Sep 18, 2018 9:56 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7825
Location: Seattle
Great Hierophant wrote:
Don't GB and GBC carts use +5v parts?
Even during the NES era, it was a 3V battery and a SRAM that supported operation supplied by ≈3 to 5V.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group