MMC5 with CHR-RAM

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

User avatar
hellfire
Posts: 7
Joined: Wed Mar 23, 2016 2:24 am

MMC5 with CHR-RAM

Post by hellfire »

Hi everyone!

I'm just twiddling with some demo effects using a 16x16 tile set which is updated using chr-ram during the empty screen areas.

I'm currently trying to move this from an MMC3 mapper to MMC5 (because I need some more PRG-RAM and the extended attribute data).
But I can't get anything into CHR-RAM yet.
What I've done is to change byte 6 (mapper id) from $40 to $50.
Nametable0 ($2000) and CHR-RAM ($0000) are filled just like before.
When I use CHR-ROM instead (by changing byte 5 in the header), I can see my (constant) nametable.
I'm testing with Nintendulator, Nestopia and a PAL NES with Everdrive N8.

So what's the trick to write to CHR-RAM?
User avatar
hellfire
Posts: 7
Joined: Wed Mar 23, 2016 2:24 am

Re: MMC5 with CHR-RAM

Post by hellfire »

Ok, had a closer look into the Nintendulator source code and there's absolutely no support for CHR-RAM for MMC5...
Is there a reason why it would be impossible to connect CHR-RAM to the MMC5?
User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: MMC5 with CHR-RAM

Post by thefox »

Emulators (and flash cart mappers) often implement only a subset of features that are used by commercial games. (Support for more than 8 KB of CHR-RAM was also a feature that was missing for a long time in many emulators.)

There's no intrinsic reason why CHR-RAM couldn't be used with MMC5.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: MMC5 with CHR-RAM

Post by rainwarrior »

hellfire wrote:Ok, had a closer look into the Nintendulator source code and there's absolutely no support for CHR-RAM for MMC5...
Is there a reason why it would be impossible to connect CHR-RAM to the MMC5?
I don't think there's a "reason", I think the implementation is just a consequence of the original iNES format not having a way to specify CHR-RAM size (amended in a more recent revision of the format), and the lack of extant MMC5 games using CHR-RAM.

Almost any mapper should be able to substitute CHR-RAM for CHR-ROM.
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Re: MMC5 with CHR-RAM

Post by Disch »

Somewhat related:

One thing that always confused me about MMC5... when using 8x16 sprites there is 12K of CHR used for rendering, but only 8K of addressing space in PPU memory. We all know how this works in rendering (sprites use front 8K, BG uses back 4K) -- but what about software access via $2007?

Would $2007 reads/writes access only the sprite patterns? Or would it depend on something else?

This seems like a detail you'd need to figure out if you want CHR-RAM on MMC5 ... since you'd need to know what CHR you're writing to.
zzo38
Posts: 1096
Joined: Mon Feb 07, 2011 12:46 pm

Re: MMC5 with CHR-RAM

Post by zzo38 »

Disch wrote:Would $2007 reads/writes access only the sprite patterns? Or would it depend on something else?

This seems like a detail you'd need to figure out if you want CHR-RAM on MMC5 ... since you'd need to know what CHR you're writing to.
It is a detail I would want even if it is not CHR-RAM, because we should need to know all of the detail needed for correct implementation, even if they are features that are not currently used by anything.
(Free Hero Mesh - FOSS puzzle game engine)
User avatar
hellfire
Posts: 7
Joined: Wed Mar 23, 2016 2:24 am

Re: MMC5 with CHR-RAM

Post by hellfire »

rainwarrior wrote:I think the implementation is just a consequence of the original iNES format not having a way to specify CHR-RAM size, and the lack of extant MMC5 games using CHR-RAM.
Almost any mapper should be able to substitute CHR-RAM for CHR-ROM.
Well, I somehow expected the Everdrive could handle CHR-RAM as it already works on RAM anyway. Too optimistic, of course. Even seems like they just ripped off the existing mapper code (which makes perfectly sense when they just want to get the games running).

Too bad a lot of hardware potential just lies to waste now.
So, basically we have to wire some RAM to an actual MMC5, check how it behaves and update the mapper code for Nintendulator and the Everdrive/Powerpak...
That's probably too much of a quest for me right now. So I'll stick with the MMC3 for some longer.
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: MMC5 with CHR-RAM

Post by Dwedit »

Would a real MMC5 board route the write pins correctly to CHR-RAM?
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: MMC5 with CHR-RAM

Post by tepples »

Not a stock board. Early NES games had all 72 contacts on the Game Pak edge connector. Later board revisions removed unused contacts, such as the unused expansion pins in the middle and the PPU /WR pin on CHR ROM boards, presumably to save money on gold-plating them. This is why some repro makers prefer Super Mario Bros. 2 when making translated Final Fantasy III: it's one of the few NES games with MMC3 and WRAM published before Nintendo made this change. By the MMC5 era, Nintendo had already been leaving these pins off the board, meaning the PPU /WR pin on the 72-pin connector touches the PCB's substrate, not a contact.

(EA did the same thing on its Genesis games. This worried me when I bought a used loose BlockOut at a pawn shop, as most of the unused pins were on one side of the edge connector, making me think the cart may be damaged. Fortunately, it worked in my Genesis 3.)

As for a modified board, you'll have to ask someone who has made a repro of Rockman 4 Minus Infinity.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: MMC5 with CHR-RAM

Post by lidnariq »

Fortunately, you're mistaken; PPU /WR is present on (at least) my NES-ELROM-01, because that connects to MMC5 pin 33.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: MMC5 with CHR-RAM

Post by tokumaru »

And what does the MMC5 do with that signal?
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: MMC5 with CHR-RAM

Post by lidnariq »

I'd guess it's for handling writes to the 3rd nametable via the PPU's bus.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: MMC5 with CHR-RAM

Post by tepples »

Thanks for the clarification about the possibility of writing to ExRAM through the PPU.

In that case, bending up your CHR RAM's /WE and connecting it to MMC5 pin 33 should allow it to work. Is a test ROM needed? How big is the CHR RAM that you plan to use: 8Kx8 or 32Kx8?
User avatar
hellfire
Posts: 7
Joined: Wed Mar 23, 2016 2:24 am

Re: MMC5 with CHR-RAM

Post by hellfire »

tepples wrote:How big is the CHR RAM that you plan to use: 8Kx8 or 32Kx8?
How would you write more than 8kB into PPU_DATA when the nametables start at $2000?
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: MMC5 with CHR-RAM

Post by tepples »

Write 8K, write to bank regs, write 8K more... Videomation manages it.
Post Reply