MMC1 failing on hw, working in emulators

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

3gengames
Formerly 65024U
Posts: 2284
Joined: Sat Mar 27, 2010 12:57 pm

Re: MMC1 failing on hw, working in emulators

Post by 3gengames »

Yeah, they all showed initial boot state of the mapper like WRAM enabled, banks accessible, etc. Here's the ROM from archive, should be most recent AFAIK:


https://drive.google.com/open?id=0B1laU ... WxfMDg1MVk


It should give you the info you want. Turn power off for a little while, turn it on, and if it boots in random banks, it'll change. Like I said, IIRC MMC1B2 iss the only one I remember always booting in the last bank. MMC1 and MMC1A all boot randomly, if I remember correctly. If you want the source, I'll put it on Github.
Last edited by 3gengames on Fri Oct 21, 2016 11:10 am, edited 1 time in total.
calima
Posts: 1745
Joined: Tue Oct 06, 2015 10:16 am

Re: MMC1 failing on hw, working in emulators

Post by calima »

Thanks, will report back. Looks very useful, why not post it to a permanent location and link from the wiki?
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: MMC1 failing on hw, working in emulators

Post by rainwarrior »

calima wrote:Why not post it to a permanent location
This forum is a pretty good place to upload it.
Attachments
MMC1Test.nes
(256.02 KiB) Downloaded 286 times
calima
Posts: 1745
Joined: Tue Oct 06, 2015 10:16 am

Re: MMC1 failing on hw, working in emulators

Post by calima »

It was a Retrostage board, and it consistently booted in 0f / the last bank.

Now I'm completely out of ideas. Why would a MMC1 ROM work in emulators but not in hw, if the init code is correctly reached?
User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: MMC1 failing on hw, working in emulators

Post by thefox »

Have you made sure to initialize all mapper registers?

Is it possible that their MMC1 implementation is somehow incompatible? (There are some minor details that one might get wrong, like the ignoring of double-writes and the fact that only the address of the last write determines the target register. Whether this would be an issue depends on how your program uses MMC1, though.)
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
3gengames
Formerly 65024U
Posts: 2284
Joined: Sat Mar 27, 2010 12:57 pm

Re: MMC1 failing on hw, working in emulators

Post by 3gengames »

Make sure the pointers for NMI and such in the last bank 0F point to the upper region and not the lower one? Maybe it's made to assume two boot banks in order and it is booting into the lower bank instead of the upper, which still fails. My test program there always boots to the upper bank and all the code is there, too.
calima
Posts: 1745
Joined: Tue Oct 06, 2015 10:16 am

Re: MMC1 failing on hw, working in emulators

Post by calima »

Yes, the init code is in the upper bank, starting at 0xFEDA.

This is the MMC1 part:

Code: Select all

        ; MMC1 init
        lda     #$80
        sta     $8000
        lda     #$00

        sta     $e000
        sta     $e000
        sta     $e000
        sta     $e000
        sta     $e000

        sta     $8000
        sta     $8000
        sta     $8000
        sta     $8000
        sta     $8000
NMI shouldn't matter, since interrupts are disabled when in there.

edit: I wonder if Retrostage is a member here?

@3gengames
So the test ROM couldn't detect booting to an odd bank?
User avatar
Dwedit
Posts: 4924
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: MMC1 failing on hw, working in emulators

Post by Dwedit »

One last dumb idea:
NES consoles are finicky in general about cartridges. Clean it and blow on it?
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
3gengames
Formerly 65024U
Posts: 2284
Joined: Sat Mar 27, 2010 12:57 pm

Re: MMC1 failing on hw, working in emulators

Post by 3gengames »

It will detect booting in an odd bank because the odd bank will appear in the last bank and be booted from. That's what the bank booted in will tell you, what bank appeared in the upper region at first.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: MMC1 failing on hw, working in emulators

Post by tepples »

Try burning an appropriately sized Holy Diver Batman ROM to the cart.

Also put this in the last 15 bytes of all banks (starting at base + $3FF1):

Code: Select all

entry_fff1:
  sei
  lda #$FF
  sta entry_fff1+2
  jmp reset_handler
  .assert reset_handler >= $C000, error, "reset handler must be in the fixed bank"
  .addr nmi_handler, entry_fff1, irq_handler
"Why write $FF over $FF? I thought MMC1 didn't have bus conflicts."
It doesn't. I designed this code to work not only on MMC1 but also on AOROM, BNROM, and the mapper 180 variant of UNROM.
calima
Posts: 1745
Joined: Tue Oct 06, 2015 10:16 am

Re: MMC1 failing on hw, working in emulators

Post by calima »

Retrostage wrote:My mapper is based off of the MMC1B, which during power-on will default to a 16Kb banking and PRG-RAM enabled state. $C000-$FFFF is fixed on power-up.
Mystery continues as time allows.
Post Reply