using CHRAM to save games?
Moderator: Moderators
using CHRAM to save games?
Any examples of games using CHRAM to save games?
Any emulator supports this?
Is the diode NPN decoding logic needed in this setup?
-Thank you
Any emulator supports this?
Is the diode NPN decoding logic needed in this setup?
-Thank you
...
Re: using CHRAM to save games?
RacerMate Challenge 2 does this, and this game inspired the addition of battery-backed CHR RAM to the definition of the NES 2.0 header. As kevtris wrote:
As for battery backed CHR RAM, the Racermate cartridge has 64K of CHR RAM total: 32K is battery backed, and 32K of it is not. They store all the stats and such in it. Why you would do such a thing, I do not have a clue... but they did! I traced out the circuit myself and couldn't believe it.
Re: using CHRAM to save games?
You always need something to guarantee that the RAM is firmly disabled when the console is off or the cartridge is removed from the console. This can be the same NPN pass transistor that's been used elsewhere, but it might also be some very low power logic (RacerMate Challenge uses a 74HCT32) or an extra chip enable on the RAM.
- krzysiobal
- Posts: 1037
- Joined: Sun Jun 12, 2011 12:06 pm
- Location: Poland
- Contact:
- rainwarrior
- Posts: 8734
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: using CHRAM to save games?
Upsides:
1. Cheaper to manufacture than a PRG-RAM save.
Downsides:
1. Only a few actively maintained emulators support it, though at least there's some popular ones in that set.
2. Access to it is very slow, so either your working set of game state that you wanna save has to fit in the < 2k main RAM, or you have to fetch only what you need from it during blanking periods. Inconvenient, but at least it's not as bad as using flash ROM saves, where you can't use it as a working set at all and main RAM is your only source of data to save.
3. DPCM conflicts with reads, so you shouldn't play samples while accessing it. (Minor issue?)
1. Cheaper to manufacture than a PRG-RAM save.
Downsides:
1. Only a few actively maintained emulators support it, though at least there's some popular ones in that set.
2. Access to it is very slow, so either your working set of game state that you wanna save has to fit in the < 2k main RAM, or you have to fetch only what you need from it during blanking periods. Inconvenient, but at least it's not as bad as using flash ROM saves, where you can't use it as a working set at all and main RAM is your only source of data to save.
3. DPCM conflicts with reads, so you shouldn't play samples while accessing it. (Minor issue?)
Re: using CHRAM to save games?
Would battery-backed CHR-RAM like this be any less susceptible to corruption when turning off the power without holding reset?
- krzysiobal
- Posts: 1037
- Joined: Sun Jun 12, 2011 12:06 pm
- Location: Poland
- Contact:
Re: using CHRAM to save games?
Yea, I started thinking about this aswell. Corruption woud occur when PPU/WE goes down. It happens only when CPU does write to $2007.
So theoretically, when voltage goes down and CPU starts executing garbage opcodes and unfortunately reaches write opcode,
in whole range of $0000-$ffff there are 1024 addresses that would trigger that ($2007, $200F, 2017, ... , $3fff). Chance is 1,56%
But PPU address pointer must also points to $0000-$1fff, which has chance of 50%.
So theoretically 0,78%
Considering corruption of WRAM at $6000-$7fff, it would happen witch chance of 8192/65536 = 12,5%.
Re: using CHRAM to save games?
You wouldn't use the whole $2000 area as save space though, right?krzysiobal wrote: ↑Sun Oct 18, 2020 1:52 pm But PPU address pointer must also points to $0000-$1fff, which has chance of 50%.
So theoretically 0,78%
So chances are even lower?
...
Re: using CHRAM to save games?
As I understand, it is only possible to write to VRAM when sprites are not fetching, for example during V-Blank or if sprites are disabled. (I base this on what I read about how Indiana Jones does mid-frame pallette writes on the title screen.) That might further reduce possibility of random writes. Please correct me if I am wrong on this: I understand writing to the pallettes is a different thing than writing to VRAM.olddb wrote: ↑Sun Oct 18, 2020 5:00 pmYou wouldn't use the whole $2000 area as save space though, right?krzysiobal wrote: ↑Sun Oct 18, 2020 1:52 pm But PPU address pointer must also points to $0000-$1fff, which has chance of 50%.
So theoretically 0,78%
So chances are even lower?
Also, I think that the save data would probably be on its own VRAM bank, so it may need to have that bank selected when powering off in order to corrupt it. I am not familiar with the game but it might not select that bank to update the save data very frequently, and it seems pretty difficult to accidentally select the correct VRAM bank and also write to the VRAM.
- rainwarrior
- Posts: 8734
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: using CHRAM to save games?
Wouldn't the latch selecting the bank would have to be guaranteed stable during power off to make this assumption?Ben Boldt wrote: ↑Sun Oct 18, 2020 6:55 pmAlso, I think that the save data would probably be on its own VRAM bank, so it may need to have that bank selected when powering off in order to corrupt it. I am not familiar with the game but it might not select that bank to update the save data very frequently, and it seems pretty difficult to accidentally select the correct VRAM bank and also write to the VRAM.
Though various mappers had "write protect" modes for their save RAM, so it's probably at least somewhat helpful.
Re: using CHRAM to save games?
Yes and your suggestion is correct that I don't know that. It would need to at least be guaranteed to degrade into a bank not used for saving. If it does something random, it still helps the odds of not being on the right bank though.rainwarrior wrote: ↑Sun Oct 18, 2020 7:50 pm Wouldn't the latch selecting the bank would have to be guaranteed stable during power off to make this assumption?
I am not sure the sequencing of the PPU when losing bias; maybe it stops allowing writes earlier than the CPU loses its mind. Would be interesting to find out.
Re: using CHRAM to save games?
In some early NES systems, this mapped address space (VRAM / ciram and chr-ram) can only be written indirectly by CPU and cannot be read out.
In the later stage, famiclone CPU can read cram.
In order to be strict with the programming habit, it is not recommended to use CPU to read out cram.
In the later stage, famiclone CPU can read cram.
In order to be strict with the programming habit, it is not recommended to use CPU to read out cram.
- rainwarrior
- Posts: 8734
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: using CHRAM to save games?
This is not true. I think you're thinking of OAM, not CHR? $2004 reads don't work on some PPU revisions. $2007 reads work on all. Even Super Mario Bros. relies on this.
Re: using CHRAM to save games?
Or maybe you're thinking of palette readback? That's the other thing that was added at the same time that OAM readback was.
- krzysiobal
- Posts: 1037
- Joined: Sun Jun 12, 2011 12:06 pm
- Location: Poland
- Contact: