News: 11 March 2016 - Forum Rules

Author Topic: Super Mario Bros. MMC1 Assembly  (Read 1945 times)

setz

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
    • sj-gfx
Super Mario Bros. MMC1 Assembly
« on: April 08, 2017, 12:34:45 pm »
I recently, as part of another project, I had to convert SMB1's smbdis.asm to use a mapper. I chose MMC1.

I hadn't found it before, and I think it's something that could really help new people wanting to hack SMB, so I uploaded it here.

The init and bankswap routines come off of nesdev, and they're certainly simple compared to games I've worked with in the past, my own project has a few optimizations, but I wanted to keep the hack simple. I covered using them in the readme, also contains build scripts that would need pointed to the correct cc65 binaries.

If the hack is extensive, the hacker will likely have to shuffle some more routines into banks 1 and 2, but its all much easier to do via assembly than via binary, so I'm assuming the people wanting advanced hacks will have knowledge on how to do that.

Hopefully some of you will find this helpful.
-sj

Disch

  • Hero Member
  • *****
  • Posts: 2814
  • NES Junkie
    • View Profile
Re: Super Mario Bros. MMC1 Assembly
« Reply #1 on: April 08, 2017, 02:21:02 pm »
Oooooo... I hate to be a negative nancy... but I'm a real stickler on technical hacks.  This hack does some highly questionable things, and if you don't get the right startup state you can have graphical glitches or possibly crashes.  Plus it'll just crash if used as intended.



- You never reset the MMC1 toggle (do a single write of $80 to any MMC1 reg).  This should be done in reset before doing anything else MMC1 related.

- MMC1 makes no guarantee as to what bank is swapped in $8000-BFFF at startup, so you either have to move the reset vector to the fixed bank, or duplicate the 'Start' routine so it exists in every bank.

- Since you're swapping 8K CHR pages ... and there's no routine to change to 4K mode .... SwapChrBank1 is completely useless.

- You never actually swap a CHR bank in.  Fine if there's only 1 bank, but if someone expands to add more CHR, it might lead to corrupted graphics at startup due to the wrong bank being swapped in (and possibly a crash if Spr-0 hit misses)

- In your CHR swapping routine, you swap to PRG bank 1 (to get more space), but you never swap back to the original bank.  So if a hack decides to actually use that routine, if it doesn't manually restore the original bank, the game will crash.  And if the hack calls the routine from the $8000-BFFF swappable region, the game will crash before it even has the opportunity to swap the original bank back in.



Sorry to be a jerk   :'(

setz

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
    • sj-gfx
Re: Super Mario Bros. MMC1 Assembly
« Reply #2 on: April 08, 2017, 03:43:02 pm »
You're not a jerk at all! This is great to hear. I'm going to be looking into this, thanks.

Edit: For my purposes, it was tested on emu and worked, I don't have a powerpak, all that, haven't needed more CHR, etc. So it's good to hear what's wrong with this, and how it can be improved.
-sj

Dr. Floppy

  • Restricted Access
  • Hero Member
  • *
  • Posts: 970
  • Make America GREAT Again!
    • View Profile
    • BaddestHacks.net
Re: Super Mario Bros. MMC1 Assembly
« Reply #3 on: April 10, 2017, 12:00:11 am »
Perhaps this is what you're looking for?

http://www.romhacking.net/hacks/1000/