RAM watching on a real NES?
Moderator: Moderators
- NovaSquirrel
- Posts: 483
- Joined: Fri Feb 27, 2009 2:35 pm
- Location: Fort Wayne, Indiana
- Contact:
RAM watching on a real NES?
A user on Kaydus's nesdev Discord server mentioned wanting to be able to keep track of game stats from a game being played on an actual NES, for speedrunning purposes (automatic splits) and to keep track of things like death count. This made me think of modifications I've seen that replace the NES's RAM with dual-ported RAM, but I feel like a Game Genie-like device that watches for writes to specific RAM addresses would be a lot better because that would avoid modifying the NES, and it would work with PRG-RAM too.
I guess the obvious changes from dual ported RAM + microcontroller are that you'd need to find a 72-pin cartridge connector somewhere (and I hear they're difficult to find) and you'd probably need some sort of programmable logic to be able to react to the write fast enough.
Another option I can see would be the Everdrive N8's USB port, with a custom mapper that watches for writes in addition to performing mapper functions, if the hardware is capable of controlling the USB port like that.
Any advice or better ways to accomplish this? Or preferably a preexisting product?
I guess the obvious changes from dual ported RAM + microcontroller are that you'd need to find a 72-pin cartridge connector somewhere (and I hear they're difficult to find) and you'd probably need some sort of programmable logic to be able to react to the write fast enough.
Another option I can see would be the Everdrive N8's USB port, with a custom mapper that watches for writes in addition to performing mapper functions, if the hardware is capable of controlling the USB port like that.
Any advice or better ways to accomplish this? Or preferably a preexisting product?
Re: RAM watching on a real NES?
I'm not sure a "game genie" could do this well, as the NES RAM is being accessed directly from the CPU, not via the cartridge, and you can't afford to interfer with the CPU usage during a speedrunNovaSquirrel wrote:A user on Kaydus's nesdev Discord server mentioned wanting to be able to keep track of game stats from a game being played on an actual NES, for speedrunning purposes (automatic splits) and to keep track of things like death count. This made me think of modifications I've seen that replace the NES's RAM with dual-ported RAM, but I feel like a Game Genie-like device that watches for writes to specific RAM addresses would be a lot better because that would avoid modifying the NES, and it would work with PRG-RAM too.
I guess you could do a low-key version that detects what addresses are being read from the cartridge, but then you have the issue with mappers.
Re: RAM watching on a real NES?
The cartridge does have access to the address and data buses, so I suppose it could tell when the CPU is writing to RAM and snatch a copy of the value if the address matches one of the addresses being watched.
Re: RAM watching on a real NES?
You could read that RAM with your program, once per frame, and print its contents to screen with 2 sprites.
nesdoug.com -- blog/tutorial on programming for the NES
Re: RAM watching on a real NES?
Anything where you insert code in NMI might change lag frames, which can invalidate a run's timing. It has to be based on snooping writes and logging them somewhere.
Re: RAM watching on a real NES?
I have been thinking about the exact same thing sometimes when watching speedrunners doing their splits manually. I think you could do a lot of stuff by simply watching PRG accesses, just have to configure it for each game separately. So a GameGenie-like device should be sufficient. You could test this theory on emulators quite easily, e.g., with Lua support in FCEUX.
I think many speedrunners wouldn't go for a EDN8/PowerPak solution since they seem to prefer to do attempts on original cartridges. But it would make for a cool demo.
The device could keep track of frame count based on M2. Or even cycle count, if you have enough bits in your counter.
Another idea would be to use the expansion port, but unfortunately it doesn't have the necessary signals. It has the data bus, but only A15 of the address bus. So you'd need a GameGenie-like device to pass more information via the EXP pins, but that kind of defeats the point of using the expansion port.
I think many speedrunners wouldn't go for a EDN8/PowerPak solution since they seem to prefer to do attempts on original cartridges. But it would make for a cool demo.
The device could keep track of frame count based on M2. Or even cycle count, if you have enough bits in your counter.
Another idea would be to use the expansion port, but unfortunately it doesn't have the necessary signals. It has the data bus, but only A15 of the address bus. So you'd need a GameGenie-like device to pass more information via the EXP pins, but that kind of defeats the point of using the expansion port.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
Re: RAM watching on a real NES?
If all you can snoop on the NES expansion port are A15 and D7-D0, watching for this sequence should handle the obvious cases:
- A15 = high, D7-D0 = target RAM address bits A7-A0
- A15 = high, D7-D0 = target RAM address bits A15-A8
- A15 = low, D7-D0 = target RAM value
Re: RAM watching on a real NES?
Doesn't the cartridge port have all the signals? What prevents a Game Genie-like device from detecting writes to RAM and copying the values to show them on a built-in display?
Re: RAM watching on a real NES?
The cartridge port has all 26 signals needed to monitor the CPU's activity: M2, PRG /CE, R/W, A14-A0, and D7-D0. But using a cartridge port device with an authentic cartridge will cause the cartridge to stick out of the front of the Control Deck. This in turn invites accusations of using a Game Genie or similar cartridge port device capable of more than just "snooPING AS usual", in particular things that invalidate a run.
Re: RAM watching on a real NES?
Yeah I kind of like the idea of using the expansion port (if it wasn't for the obvious issues) because it seems less intrusive, although in practice people could cheat their asses off if they wanted, even if "the cartridge wasn't sticking out of the system". It's all based on trust.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
-
- Posts: 46
- Joined: Fri Apr 07, 2017 5:02 pm
Re: RAM watching on a real NES?
While it does sound interesting, being able to read RAM on console, coming from a speedrunner perspective this would be a big no no. Looking at the RAM during a run is not allowed as it can provide an unfair advantage, like knowing what RNG seed you are on, enemy/boss patterns etc. Anything that you can't do on an original, unmodified console is not allowed. It could prove useful for practice however, but would need to be turned off for actual run attempts.
Re: RAM watching on a real NES?
It depends what the system would do I guess.
I don't see a problem in doing automated splits like this. But if the system would show, e.g., what state the RNG is in, that of course is not OK.
I don't see a problem in doing automated splits like this. But if the system would show, e.g., what state the RNG is in, that of course is not OK.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
- rainwarrior
- Posts: 8735
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: RAM watching on a real NES?
I've seen many speedrunners using these things. I think in general as long as they're open about it, in most cases it's still considered an acceptable run? I'm sure rules vary a bit depending on who runs the leaderboard for any particular game, though.thefox wrote:I think many speedrunners wouldn't go for a EDN8/PowerPak solution since they seem to prefer to do attempts on original cartridges. But it would make for a cool demo.
Re: RAM watching on a real NES?
I think if a device like this existed, it would very quickly be embraced by the speedrun community, and no one would blame the device. I t wouldn't just be some unknown thing some guy is using.tepples wrote:The cartridge port has all 26 signals needed to monitor the CPU's activity: M2, PRG /CE, R/W, A14-A0, and D7-D0. But using a cartridge port device with an authentic cartridge will cause the cartridge to stick out of the front of the Control Deck. This in turn invites accusations of using a Game Genie or similar cartridge port device capable of more than just "snooPING AS usual", in particular things that invalidate a run.
It's very easy to cheat in speedrunning if you really want to, and it happens a lot as it is. But there also exists a sense of trust, a code of honor as such (which is what caused the community to point out the blatant lies going on at Twin Galaxies), and it's usually very easy to out a cheater.
Last edited by Sumez on Thu Aug 09, 2018 10:41 pm, edited 1 time in total.
- rainwarrior
- Posts: 8735
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: RAM watching on a real NES?
Yeah, with so many people who stream their attempts, there being witnesses and recordings not just of the successful attempts but you can also see that they "put in the time" to deserve that run. Big difference in trust from the era of people mailing in VHS tapes. Cheating still happens but there's some good ways to build a trusted reputation at least.