Need help with mmc5.cpp source, for custom modification

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

calima
Posts: 1015
Joined: Tue Oct 06, 2015 10:16 am

Re: Need help with mmc5.cpp source, for custom modification

Post by calima » Wed Nov 20, 2019 1:29 am

A massive CHR-RAM alone would give a worse experience, namely in loading times. Say you have a very animated hero and background, but want the flexibility to have many different enemies. The loading pause to write (+uncompress) all those would be several seconds, while the mixed setup lets you keep loading times low.

tepples
Posts: 21746
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Need help with mmc5.cpp source, for custom modification

Post by tepples » Wed Nov 20, 2019 7:19 am

A pause of "several seconds" is tolerable on the copyright screen.

The other option is to decompress a sprite sheet in the background at about 8 tiles each frame. For a character like Donny or Tami from Haunted: Halloween '86, whose animations fill eight 1 KiB pages out of the game's 32 KiB CHR RAM, loading a sprite sheet when the player tags out takes about one second. For an enemy, whose sprite sheet is usually 1 page (for most enemies) or 2-3 pages (for bosses), it's done in a quarter second just before the camera reaches the enemy, and the player usually can't even tell that any sort of loading happened.

The Game Boy, Genesis, and Super NES use all CHR RAM all the time. Consider how they pull it off.

calima
Posts: 1015
Joined: Tue Oct 06, 2015 10:16 am

Re: Need help with mmc5.cpp source, for custom modification

Post by calima » Wed Nov 20, 2019 11:35 am

That was several seconds of black screen. If the screen has to be on, and you're limited to the ~150 bytes per vblank, that's tens of seconds.

Genesis and SNES have DMA. GB has so little VRAM the issue does not affect it as much.

lidnariq
Posts: 8767
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Need help with mmc5.cpp source, for custom modification

Post by lidnariq » Wed Nov 20, 2019 12:28 pm

The N64 doesn't boot particularly quickly - it takes several seconds of black screen before it draws anything. There's no good reason to think that one needs to turn on the PPU just to avoid that initial blank screen.

(After all, sound still works, and there's a tradition of starting the soundtrack before the picture in cinema as well as games anyway)

As to the other point, it's not a fair comparison to compare heavily animated CHR RAM bandwidth load to a impossible-to-animate CHR ROM load. The point is just that equal-sized CHR RAM can do a fine job of emulating CHR ROM.

tepples
Posts: 21746
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Need help with mmc5.cpp source, for custom modification

Post by tepples » Wed Nov 20, 2019 12:58 pm

It sounds like your main concern is boot time. Let's assume you can decompress 512 bytes per frame with forced blanking or 128 with display on. (This is close to what I get with an RLE-type codec in my projects for Retrotainment Games.) Then I'll apply this assumption to the boot sequences of two well-received NES games.

Now if players accept Solstice: The Quest for the Staff of Demnos

Wait for PPU to boot up (3 frames)
Load 4 KiB of tiles for an ASCII font and a publisher logo (8 frames)
Load 2 KiB of nametables for copyright screen and publisher logo screen (4 frames)

So far 15 frames have elapsed, and the player is just barely removing their finger from the Power button on the Control Deck. But you have enough data loaded to display something.

Display copyright screen while loading 32 KiB of game tiles (256 frames)
Display "$publisher Presents" while loading 32 KiB of game tiles (256 frames)

Now you've been displaying notices and logos for 512 frames, or the exact amount of time that Solstice plays a simple fanfare-ish tune before beginning the arp spam for which composer Tim Follin is so famous. Now toss up a title screen using the 64 KiB of data you've loaded.

Or if players accept Mike Tyson's Punch-Out!!

Punch-Out!! begins with rendering off for three seconds, playing bells and crowd noises before launching into the Gillette jingle "Look Sharp". By the previous assumption, that's enough to load 90 KiB of data. After the player has chosen to start the game, it spends four more seconds at the title screen with the glove breaking through the logo followed by "Let's keep it clean! Now come out boxing!". There's another 30 KiB loaded.

User avatar
rainwarrior
Posts: 7667
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Need help with mmc5.cpp source, for custom modification

Post by rainwarrior » Wed Nov 20, 2019 3:47 pm

That does give me a thought that it'd be reasonable to use the NMI to play music, and maybe also even display some sprite-only animation at the top of the screen while otherwise doing a bulk PPU upload. (Edit: no, what was I thinking. Sprites on will still mess with PPU bus. Interleaving periods of display would take a little more care than this.)

Anyway, unless you need to do something like play a video on your title screen, you could probably load only what you need to get started at first and "background" load the rest. There's lots of ways to hide load times from the user, and this has been continuously relevant to game development across all platforms that have media that need loading over the years... though honestly stuff like this is often neglected. :P
Last edited by rainwarrior on Thu Nov 21, 2019 2:39 pm, edited 1 time in total.

kuja killer
Posts: 80
Joined: Mon May 25, 2009 2:20 pm

Re: Need help with mmc5.cpp source, for custom modification

Post by kuja killer » Wed Nov 20, 2019 6:32 pm

oh the time thing you guy's mentioned, mannn, back on my one-time-only test of trying out CHR-RAM (mmc5 mapper) -- uhh, i think the nestopia emulator's header editor allowed setting CHR-RAM as high as 1 MB, instead of 8 KB (1 page)

I did that as a test, and then when the rom first boots up, i loaded all my game's 512 KB of graphics to the CHR-RAM thing without worrying about vblank or anything, cause the screen would be off anyways before the copyright ya know ?? ..and it still took like 10 or 15 seconds.

Felt super weird as if you were waiting for a playstation 1 game to startup after the "sony of america" screen thing.

calima
Posts: 1015
Joined: Tue Oct 06, 2015 10:16 am

Re: Need help with mmc5.cpp source, for custom modification

Post by calima » Thu Nov 21, 2019 3:14 am

Yes, if you went out of your way to hide it in copyright screens and menus it could work. Hm, 256kb SRAMs aren't even particularly expensive, ~4e each, about four times the cost of same-sized flash.

It's still such a pain to code for, and the unskippable long waits will annoy some users. At that point it becomes "does the programmer's time to implement that cost more than designing a custom rom-ram board".

User avatar
never-obsolete
Posts: 371
Joined: Wed Sep 07, 2005 9:55 am
Location: Phoenix, AZ

Re: Need help with mmc5.cpp source, for custom modification

Post by never-obsolete » Thu Nov 21, 2019 1:48 pm

You could try unrolling your loop and using absolute indexed instead of indirect (assuming you didn't already do this).
. That's just like, your opinion, man .

lidnariq
Posts: 8767
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Need help with mmc5.cpp source, for custom modification

Post by lidnariq » Thu Nov 21, 2019 2:26 pm

A naive block copy of the form

Code: Select all

innerloop:
LDA (zp),Y
STA $2007
INY
BNE innerloop
should take 14cy per byte copied, or about 127KB/sec. Should be able to fill a 512KB RAM in just a little over 4 seconds. (Yes, I'm omitting the outer loop above. Its performance shouldn't matter much because it happens 1/256 as often)
calima wrote:
Thu Nov 21, 2019 3:14 am
Hm, 256kb SRAMs aren't even particularly expensive, ~4e each, about four times the cost of same-sized flash.
I think I'm seeing better prices than that? Right now, I'm seeing 128Kx8 SRAMs for as low as 1.29USD/@100 (via Mouser), and 256Kx8 SRAMs for 2.08USD/@100 (via AVnet Europe).
In contrast, 5V flash I'm seeing 128Kx8 sectored Flash (SST39SF010A) as low as 0.75USD/@100 (via Digi-Key), and 256Kx8 whole-chip-erasable Flash (GLS27SF020) as low as 0.993USD/@100 (via Mouser).

The cheapest 5V RAM I can find at all is a 32Kx8 SRAM at 0.665USD/@100, but it feels a little fishy - only two distributors are offering that price and there's no volume discount (i.e. it smells like a close-out), so the same geometry for 0.905USD/@100 (via Arrow or Verical) is probably more trustworthy.

(Similarly, I found Arrow and Verical selling Micron's M29F200 256Kx8 5V flash for what also smells like a close-out price - 0.386USD/@100)

So ... all-in-all, manufacturing in the US can get a any flash + any RAM situation for roughly as much cost as a 256K RAM.

Not clear what the raw cost shipped for an unprogrammed MINDKIDS or COOLBOY cart would be. I can't even find them on Aliexpress, but I assume I'm looking in the wrong place.
the unskippable long waits will annoy some users.
There shouldn't be plural waits unless you're using the whole RAM as RAM, not as a fair comparison to the RAM+ROM situation.

Post Reply