Expanded SMB1 ROM, How do I put extra ROM in $4000-$7FFF?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
User avatar
Hamtaro126
Posts: 786
Joined: Thu Jan 19, 2006 5:08 pm

Expanded SMB1 ROM, How do I put extra ROM in $4000-$7FFF?

Post by Hamtaro126 »

I am using MMC3 to expand Super Mario Bros 1. I lost the code that my friend gave me (BBitmaster) that does a simular expansion. but it does 6000-7FFF and he does not have the code anymore either. So I need help to put extra ROM in $4000-7FFF

I am mostly using the extra space for Music. Just so you know.
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch »

Short answer: with MMC3, you don't.


Long answer:

It's not uncommon for RAM to be at $6000-7FFF, but only and handful of mappers put ROM there (and MMC3 isn't one of them). $4020-$5FFF generally goes unused or is used only for register space.

iirc bbit's hack copied some code to RAM at $6000-7FFF, then jumped to it. This can be accomplished by intercepting the reset vector (which you'd have to do anyway to prep mapper regs -- which you should be doing!!!) and doing the following:

1) ensure reset vector points to somewhere in the fixed page. On MMC3, this means it must be between $E000-FFFF. SMB does not do this normally, so this will take some work. Note bbit's hack did not do this initially -- I fixed it for him shortly after he released it (but no I don't have the hack any more).

2) Turn PPU off (write 0 to $2000, $2001 -- since you're cutting off the normal reset routine to do some work, this should be done right away)

3) Swap in your PRG page that has the code you want to put in

4) Enable WRAM (see reg $A001)

5) Copy the desired code/data from ROM (wherever you swapped it in -- probably between $8000-9FFF or $A000-BFFF) to RAM ($6000-7FFF)

6) Swap back in the normal PRG the game uses

7) Prep all other mapper regs that need to be prepped (that is: all of them. General rule: on startup, write to every mapper reg at least once so that every reg is at a known state)

8) Jump to SMB's normal reset routine (which iirc is $8000)
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Or you could take the SMB1 disassembly and reorder the routines to have some of them execute from $8000-$BFFF and some from $C000-$FFFF. This would let you use UNROM, but then it would get in the way of providing the changes as an IPS patch.
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch »

Werd. Yeah the disassembly does make it lots easier.
doppelganger
Posts: 183
Joined: Tue Apr 05, 2005 7:30 pm

Post by doppelganger »

<grins contentedly>
Be whatever the situation demands.
Post Reply