Getting FCEUX to allow writing to CHR ROM

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
sonder
Posts: 116
Joined: Wed Jun 26, 2013 12:35 pm
Location: Baltimore
Contact:

Getting FCEUX to allow writing to CHR ROM

Post by sonder »

Your immediate question might be why would I want to do this?

Basically I'm looking to develop my game for a board that's being developed by infiniteneslives, which you may have heard of as the Homebrew FDS project. It was a good time to make a switch - I'd done enough sloppy development in my "sandbox" to start fresh and create a more solid engine, and I wanted more freedom to create lots of content, and this will be the cheapest way to realize physical cartridges of a large game for sure. I chose MMC5 because of its ability to be configured similar to the HBFDS mapper, support for lots of storage, and bankswitched CHR ROM. Thing is, from my tests it looks like it does not support bankswitched CHR RAM, which HBFDS will - 32KB of it at the least. I can enable CHR RAM but I cannot bankswitch it. This is fine for my sprites (I am planning to do dynamic updates there) but not for BG (which I want to have fast bulk switching for animation and splitscreen HUD so that the playfield can have more detail and animate lushly)

To get around this I thought the easy way was to somehow get FCEUX to allow writing to CHR ROM. I will store 8 blank CHR banks in the ROM file, configure MMC5 for 4KB bankswitching, and write to them from PRG ROM as needed, switching them in like bankswitched PRG RAM.

Compiling FCEUX looks non-trivial (as is the code) so if there's a commandline option or setting anyone knows of that disables write-protecting of ROM, that seems like it could work (though I suppose it's possible it might toss out any changes on a bankswitch...). Otherwise I guess I'll dive in - if anyone can offer me tips on the code in that case that would be a big help.
sonder
User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: Getting FCEUX to allow writing to CHR ROM

Post by thefox »

sonder wrote:Compiling FCEUX looks non-trivial (as is the code) so if there's a commandline option or setting anyone knows of that disables write-protecting of ROM, that would work. Otherwise I guess I'll dive in - if anyone can offer me tips on the code in that case that would be a big help.
Your request is highly unusual so it's hard to see why there would be a command line option for it. You're most likely going to have to modify the code.

OT: Why does the wiki page for MMC5 (http://wiki.nesdev.com/w/index.php/MMC5) say CHR capacity: Up to 1024 KB ROM (RAM support unknown). More speficially, why "RAM support unknown"? My NES mapper/signal skills may be a little bit rusty here, but is there any reason for MMC5 to even care whether it's connected to a RAM chip or to a ROM chip?
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
User avatar
MottZilla
Posts: 2837
Joined: Wed Dec 06, 2006 8:18 pm

Re: Getting FCEUX to allow writing to CHR ROM

Post by MottZilla »

Somewhere in the code there is just a simple check most likely, seeing if it should accept or throw away attempts to write the CHR pattern table memory. You could disable it if you find it. MMC5 can support CHR-RAM, the reason for saying "unknown" would best be because no MMC5 game ever used CHR-RAM. No board produced was configured for CHR-RAM. There was the FDS doki doki panic to mmc5 hack afterall that used chr-ram.
User avatar
sonder
Posts: 116
Joined: Wed Jun 26, 2013 12:35 pm
Location: Baltimore
Contact:

Re: Getting FCEUX to allow writing to CHR ROM

Post by sonder »

MottZilla wrote:Somewhere in the code there is just a simple check most likely, seeing if it should accept or throw away attempts to write the CHR pattern table memory. You could disable it if you find it. MMC5 can support CHR-RAM, the reason for saying "unknown" would best be because no MMC5 game ever used CHR-RAM. No board produced was configured for CHR-RAM. There was the FDS doki doki panic to mmc5 hack afterall that used chr-ram.
I think that technically, because I was able to enable CHR-RAM at all, that's the support it gives. But I believe the RAM is not programmed to obey MMC5 bank switching in FCEUX for some reason; I tested it. Maybe that's a bug? If mmc5 doki doki panic used it, maybe I'm not doing something. Because NES 2.0 allows for defining how much CHR RAM there is, above 8KB, which I've done.
sonder
User avatar
MottZilla
Posts: 2837
Joined: Wed Dec 06, 2006 8:18 pm

Re: Getting FCEUX to allow writing to CHR ROM

Post by MottZilla »

It's possible the emulator isn't setup to allow bankswitching CHR-RAM on certain mappers. This wouldn't be that strange. With enough time, you could fix that.
Post Reply