News: 11 March 2016 - Forum Rules

Author Topic: Expanding SMB1 CHR ROM and switching graphics during play?  (Read 4090 times)

Saturnyoshi

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Expanding SMB1 CHR ROM and switching graphics during play?
« on: December 30, 2015, 06:05:30 pm »
So, first of all, hello everyone! I'm Saturnyoshi, I have been doing hacking for years but only ever really done level and graphics hacks, until recently that is, I have been getting into ASM hacking for SMB1, and so far I have only done simple stuff like making coins kill you and porting a couple patches to Instectduel's SMB ROM with SMB2 items.
Now, what I want to do is add more graphics space and be able to switch the graphics on the fly, kind of like how Super Mario Unlimited has animated tiles and DahrkDaiz's old unfinished hack Mario Seasons switched graphics after 2 worlds.
So, what I have so far is a copy of SmbDis by doppelganger that has unused areas of code removed, I can insert it into the game just fine and it works properly. I read a little bit on how to expand Donkey Kong's PRG ROM, but as I'm still very new to ASM hacking I don't understand how it could be applied to SMB1.

Thanks in advance for any help!

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: Expanding SMB1 CHR ROM and switching graphics during play?
« Reply #1 on: December 30, 2015, 06:33:26 pm »
SMB1 uses CHRROM, so you will just need to add a mapper that supports that and add code to tell the mapper when to switch banks.

Dr. Floppy

  • Restricted Access
  • Hero Member
  • *
  • Posts: 970
  • Make America GREAT Again!
    • View Profile
    • BaddestHacks.net
Re: Expanding SMB1 CHR ROM and switching graphics during play?
« Reply #2 on: December 30, 2015, 07:20:18 pm »
Here's a nice little MMC1 patch!

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

From there, it's just a matter of (a) expanding the ROM further to allow as much CHR-ROM as you want, and (b) writing a routine to swap-in the desired banks at the desired times.

Saturnyoshi

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: Expanding SMB1 CHR ROM and switching graphics during play?
« Reply #3 on: December 30, 2015, 07:39:00 pm »
Thank you Dr. Floppy! But is the source available? I don't know how I would be able to insert ASM hacks into that easily.
Also, not gonna lie, I need at least 1 graphics page more of space, so any chance of an even BIGGER ROM?

Dr. Floppy

  • Restricted Access
  • Hero Member
  • *
  • Posts: 970
  • Make America GREAT Again!
    • View Profile
    • BaddestHacks.net
Re: Expanding SMB1 CHR ROM and switching graphics during play?
« Reply #4 on: December 31, 2015, 06:50:51 pm »
Thank you Dr. Floppy! But is the source available? I don't know how I would be able to insert ASM hacks into that easily.
Also, not gonna lie, I need at least 1 graphics page more of space, so any chance of an even BIGGER ROM?

Yeah, the (patched) ROM can easily be expanded by adding EXACTLY 57,344 bytes to the end of the file, and altering byte 0x00000005 of the iNES header from #01 to #08. That should give you plenty of extra CHR-ROM space.

As for the ASM code, it depends on what you want (four frames of animation on some levels, eight frames on all levels, etc.).

Disch

  • Hero Member
  • *****
  • Posts: 2814
  • NES Junkie
    • View Profile
Re: Expanding SMB1 CHR ROM and switching graphics during play?
« Reply #5 on: January 01, 2016, 04:28:43 am »
adding EXACTLY 57,344 bytes

 :huh:

Or... you know... $E000 bytes, since that's way easier to use/remember and any tool you use to do this kind of modification is going to default to using hex anyway.    :P

Dr. Floppy

  • Restricted Access
  • Hero Member
  • *
  • Posts: 970
  • Make America GREAT Again!
    • View Profile
    • BaddestHacks.net
Re: Expanding SMB1 CHR ROM and switching graphics during play?
« Reply #6 on: January 01, 2016, 06:11:07 pm »
:huh:

Or... you know... $E000 bytes, since that's way easier to use/remember and any tool you use to do this kind of modification is going to default to using hex anyway.    :P

Translhextion presumes decimal value input for the "Insert Bytes at End" option.

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7412
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Expanding SMB1 CHR ROM and switching graphics during play?
« Reply #7 on: January 01, 2016, 06:27:34 pm »
I heard that was a super-buggy hex editor that almost nobody but Kitsune Sniper used. ;D
"My watch says 30 chickens" Google, 2018

Disch

  • Hero Member
  • *****
  • Posts: 2814
  • NES Junkie
    • View Profile
Re: Expanding SMB1 CHR ROM and switching graphics during play?
« Reply #8 on: January 01, 2016, 08:00:59 pm »
Any hex editor that doesn't default to hex shouldn't be called a hex editor.   :P

Joking aside, Translhextion is pretty terrible.  Maybe it was passable when it first came out, but it certainly has not aged well.

Everyone needs to try HxD or the hex editor in pro versions of Visual Studio so they can see what a good hex editor looks and feels like.  Unfortunately neither of those editors support table files  :/  One of these days....

Saturnyoshi

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: Expanding SMB1 CHR ROM and switching graphics during play?
« Reply #9 on: January 02, 2016, 01:47:11 pm »
Thanks everyone! Now my ROM is giant and there doesn't appear to be any issues!
As for the ASM code, it depends on what you want (four frames of animation on some levels, eight frames on all levels, etc.).
Hmm, I think I'll need 4 frames for sprite graphics, shared across the whole game, and every other world needs 4 frames of tile graphics, so that would be 4*5=20, which luckily just fits in!
Everyone needs to try HxD or the hex editor in pro versions of Visual Studio so they can see what a good hex editor looks and feels like.
HxD has always been my preferred hex editor.

Well, now that I have all this, how can I insert my custom code into the ROM? Does this change any code of the game itself, and is there any way I can just work with doppelganger's dissasembly?

Rotwang

  • Full Member
  • ***
  • Posts: 170
    • View Profile
Re: Expanding SMB1 CHR ROM and switching graphics during play?
« Reply #10 on: January 02, 2016, 06:56:37 pm »
:huh:

Or... you know... $E000 bytes, since that's way easier to use/remember and any tool you use to do this kind of modification is going to default to using hex anyway.    :P

Don't you think you're being a bit pedantic?

Dr. Floppy

  • Restricted Access
  • Hero Member
  • *
  • Posts: 970
  • Make America GREAT Again!
    • View Profile
    • BaddestHacks.net
Re: Expanding SMB1 CHR ROM and switching graphics during play?
« Reply #11 on: January 02, 2016, 07:02:36 pm »
Well, now that I have all this, how can I insert my custom code into the ROM?

You have a routine written-up already?


(Can I see it?)  :thumbsup: