Page 1 of 1

MMC5 ExRAM Graphics (EDIT:Fixed)

Posted: Thu Apr 02, 2015 3:06 pm
by Vectrex2809
First, I know that MMC5 on real hardware is a pain but one of my friends has been doing some, should I say "Experiments", on Laser Invasion carts, so I decided I could do a game that uses MMC5 and have him do a (limited) repro run

Anyway... I managed to initiate the MMC5 mapper, and I have a full CHR screen ready (As in a CHR file big enough to fill the whole screen), BUT I don't seem to get how the ExRam works.
From what I can understand, the MMC5 graphics can be done in the $5C00-$5FFF range with XXYYYYYY (X for attribute of the tile and Y for 4KB CHR bank) writes to it, but I don't seem to know when I can do those writes, and I don't really seem to understand the ExRam "Modes" the MMC5 has (AFAIK, it has possibilities for normal RAM and extended nametables/attributes)
Needless to say, I'm a noob at MMC5 game programming, and I would need some help on how to use this ExRAM to use the special graphics done by the MMC5.


EDIT: SRC here - http://pastebin.com/ZE03i80C

What am I doing wrong? (Sorry for the unused variables, I tend to recycle SRCs from existing projects)

Basically, the PPU Viewer shows my screen perfectly fine, but FCEUX and NEStopia show only one 4KB CHR bank per "region" of the screen, and it's a different one on both emulators (my .chr file is 16KB wide)

EDIT #2 -

Code: Select all

  LDX #$00
.waitrender
  INX
  BNE .waitrender
  INY
  CPY #$26
  BNE .waitrender

  LDX #$00
.titlerender
  LDA #%00000000
  STA $5C00,x
  LDA #%00000001
  STA $5D00,x
  LDA #%00000010
  STA $5E00,x
  LDA #%00000011
  STA $5F00,x
  INX
  CPX #$00
  BNE .titlerender
Right after I turn on the screen with JSR PPUCleanup, I put the routine in my source code to wait for render more, and it now works perfectly on NEStopia and PuNes.
However, FCEUX seems to think the MMC5 is not in ExRAM graphics mode, and only shows the bottommost part of the CHR

Re: MMC5 ExRAM Graphics

Posted: Thu Apr 02, 2015 3:17 pm
by lidnariq
Vectrex2809 wrote:but I don't seem to know when I can do those writes
I don't really understand what the wiki is saying about when you can access, but there are three realistic possibilities:
1- You can write to it at any time
2- You can write to it during vblank only
3- You can write to it during active rendering only.

Shouldn't be hard to just try each of them...
and I don't really seem to understand the ExRam "Modes" the MMC5 has
The four modes mentioned here on the wiki are:
0- Can only be used as a nametable, for various three-screens-worth-of-data layouts.
1- Could be used as a nametable AND/OR in the finer 8×8 attribute zones with 16384 tiles
2- Can only be used by the CPU as an extra 1024 bytes of RAM
3- Can only be used by the CPU as an extra 1024 bytes of (temporary) ROM

At some point I'll get around to buying a pair of 512KiB EEPROMs and put them on my own Laser Invasion cart...

Re: MMC5 ExRAM Graphics

Posted: Thu Apr 02, 2015 3:36 pm
by Vectrex2809
lidnariq wrote:
Vectrex2809 wrote:but I don't seem to know when I can do those writes
I don't really understand what the wiki is saying about when you can access, but there are three realistic possibilities:
1- You can write to it at any time
2- You can write to it during vblank only
3- You can write to it during active rendering only.

Shouldn't be hard to just try each of them...
and I don't really seem to understand the ExRam "Modes" the MMC5 has
The four modes mentioned here on the wiki are:
0- Can only be used as a nametable, for various three-screens-worth-of-data layouts.
1- Could be used as a nametable AND/OR in the finer 8×8 attribute zones with 16384 tiles
2- Can only be used by the CPU as an extra 1024 bytes of RAM
3- Can only be used by the CPU as an extra 1024 bytes of (temporary) ROM

At some point I'll get around to buying a pair of 512KiB EEPROMs and put them on my own Laser Invasion cart...
Haha, seems like I'm not the only one willing to sacrifice some Laser Invasions. Come to think of it, I have almost 550 NES games and I don't even have that one XD
Apparently, I need mode 1 and some way of writing to it...

Re: MMC5 ExRAM Graphics

Posted: Thu Apr 02, 2015 4:11 pm
by lidnariq
Vectrex2809 wrote:Haha, seems like I'm not the only one willing to sacrifice some Laser Invasions. Come to think of it, I have almost 550 NES games and I don't even have that one XD
I saw it at the local retrogaming store for $5, and I figured that was a cheap investment for curiosity's sake. I did play it for a few minutes before decided it wasn't very interesting ... and then I carefully desoldered the ROMs.
Apparently, I need mode 1 and some way of writing to it...
Looks like Just Breed writes to it via the interface at $5C00-$5FFF even when it's set up for extended tiles.

Re: MMC5 ExRAM Graphics

Posted: Thu Apr 02, 2015 4:21 pm
by Vectrex2809
lidnariq wrote:
Vectrex2809 wrote:Haha, seems like I'm not the only one willing to sacrifice some Laser Invasions. Come to think of it, I have almost 550 NES games and I don't even have that one XD
I saw it at the local retrogaming store for $5, and I figured that was a cheap investment for curiosity's sake. I did play it for a few minutes before decided it wasn't very interesting ... and then I carefully desoldered the ROMs.
Apparently, I need mode 1 and some way of writing to it...
Looks like Just Breed writes to it via the interface at $5C00-$5FFF even when it's set up for extended tiles.
Actually, I figured out part of the problem... I stated in my code that I had only one 8KB CHR ROM bank, which was obviously false!
So now the screen is displayed perfectly in the PPU Viewer of FCEUX, but the FCEUX screen shows only one CHR bank, same for NEStopia.

I'll edit my OP with a copy of the SRC