Page 1 of 1

MMC3 - Repro problems, works on the PowerPak and Emulators

Posted: Thu Mar 17, 2016 4:33 pm
by Vectrex2809
So I made a little MMC3 game (which works on all emulators and on the PowerPak and my friend is trying to make a repro of it. However he always gets a solid gray screen. So I wanted to make sure my MMC3 init code was okay or if it's just him. The game isn't too big (32K PRG / 64K CHR) since I use the MMC3 mostly for the bank sizes and the IRQs.

Here's my MMC3 init code as well as a few things that might help

Code: Select all


  .inesprg 2   ; 2x 16KB PRG code
  .ineschr 8   ; 4x  8KB CHR data
  .inesmap 4   ; mapper 4 = MMC3
  .inesmir 1   ; background mirroring

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

BANKSWAP		= $8000
BANKDATA		= $8001
MIRROR			= $A000
RAMPROTECT		= $A001
IRQLATCH		        = $C000
IRQRELOAD		= $C001
IRQOFF			= $E000
IRQON			= $E001

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  LDA #%00000000
  STA BANKSWAP
  LDA #%00000000
  STA BANKDATA

  LDA #%00000001
  STA BANKSWAP
  LDA #%00000010
  STA BANKDATA

  LDX #$02
  LDY #$1C
.copyloop
  STX BANKSWAP
  STY BANKDATA
  INY
  INX
  CPX #$06
  BNE .copyloop

  LDA #$00
  STA RAMPROTECT
  STA MIRROR
Any idea of might've went wrong?

Re: MMC3 - Repro problems, works on the PowerPak and Emulato

Posted: Thu Mar 17, 2016 4:41 pm
by tepples
Your init code has to be in $E000-$FFFF because the PRG bank registers' values are unspecified at power-on.

Do other similarly sized ROMs work when you try to make a repro?

Re: MMC3 - Repro problems, works on the PowerPak and Emulato

Posted: Thu Mar 17, 2016 4:51 pm
by tokumaru
The reset code, including the mapper configuration, must be at $e000-$ffff, which is always hardwired to the last bank. Also, it appears you're only selecting the CHR banks. You need to select which 8KB PRG banks go at $8000-$bfff before you can use them. It may be obvious which banks go there since you only have 32KB of PRG-ROM, but the mapper doesn't know that.

Re: MMC3 - Repro problems, works on the PowerPak and Emulato

Posted: Thu Mar 17, 2016 4:54 pm
by Vectrex2809
tepples wrote:Your init code has to be in $E000-$FFFF because the PRG bank registers' values are unspecified at power-on.

Do other similarly sized ROMs work when you try to make a repro?
Ah-ha! It's in the $C000-$DFFF range so that's why it doesn't work probably. I'll try putting it in the $E000-$FFFF range then.
Is this written in the wiki? I think that would be useful information to write in it if it isn't there.

Re: MMC3 - Repro problems, works on the PowerPak and Emulato

Posted: Thu Mar 17, 2016 5:25 pm
by tokumaru
It's general knowledge that registers have unknown values on startup, meaning the MMC3 is in an unknown state on power up. The only MMC3 ROM slot hardwired to the same ROM bank in all configurations is $e000-$ffff. Some mappers don't even have any slots you can count on being mapped to a constant bank, so they need to have the reset code in all banks.

A warning about this is relevant to all mappers, not only the MMC3. You need to read the documentation of the mapper you're using to see if there are any slots guaranteed to point to a constant bank, in which case that's where the reset code must be, otherwise every bank has to include a little reset stub in the same position, so it's guaranteed to be mapped on power on.

Re: MMC3 - Repro problems, works on the PowerPak and Emulato

Posted: Thu Mar 17, 2016 7:14 pm
by Dwedit
Also see: Cheetahmen 2 didn't have the reset stub, and occasionally boots up on the inaccessible levels.