News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: my super mario bros. 1 rom hacking questions  (Read 7771 times)

kirb1993

  • Jr. Member
  • **
  • Posts: 14
    • View Profile
    • my website!
my super mario bros. 1 rom hacking questions
« on: March 28, 2019, 08:07:18 pm »
how do i make it so that whenever you collect a super mushroom, it kills you instead of turning you into big mario?
« Last Edit: April 14, 2019, 04:05:47 pm by kirb1993 »
poyo!!! :)

sics

  • Full Member
  • ***
  • Posts: 238
  • Contact me!
    • View Profile
    • Deviantart: Terwilf
Re: a question about hacking super mario bros. 1
« Reply #1 on: March 29, 2019, 09:06:47 pm »
 Recently in another post Eden.GT shared a pack with patches to modify all kinds of things in the SMB1 :thumbsup:

I'm just going to dump this to you here- out of the bunch it contains a patch that changes the display of lives so that exceeding 9, it will be 10. It will correctly display the number of lives up to 99, in which it will proceed to A0, B0, and so on.

100+ IPS patches.zip

I believe every sprite and enemy has been coded in SMB so that the very last bottom pixels will be stuck on the first pixels of solid BG tiles.

kirb1993

  • Jr. Member
  • **
  • Posts: 14
    • View Profile
    • my website!
Re: a question about hacking super mario bros. 1
« Reply #2 on: March 29, 2019, 09:37:52 pm »
Recently in another post Eden.GT shared a pack with patches to modify all kinds of things in the SMB1 :thumbsup:
whoa! cool!
poyo!!! :)

sics

  • Full Member
  • ***
  • Posts: 238
  • Contact me!
    • View Profile
    • Deviantart: Terwilf
Re: a question about hacking super mario bros. 1
« Reply #3 on: March 30, 2019, 12:14:15 pm »


Poyo! :thumbsup:

kirb1993

  • Jr. Member
  • **
  • Posts: 14
    • View Profile
    • my website!
another smb1 rom hacking question
« Reply #4 on: April 07, 2019, 01:08:07 am »
in super mario bros. utility, is it possible to change an enemy like a goomba into a block like a brick block?
poyo!!! :)

Metal64

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: another smb1 rom hacking question
« Reply #5 on: April 07, 2019, 08:25:17 pm »
in super mario bros. utility, is it possible to change an enemy like a goomba into a block like a brick block?

No

Eden.GT

  • Full Member
  • ***
  • Posts: 103
  • Hardcore SMB1 Player and Hacker
    • View Profile
Re: another smb1 rom hacking question
« Reply #6 on: April 11, 2019, 06:31:52 am »
If you're changing the sprite, just use a tile editor like YY-CHR.
Is the pool clean?

kirb1993

  • Jr. Member
  • **
  • Posts: 14
    • View Profile
    • my website!
super mario bros. rom hacking question #3
« Reply #7 on: April 13, 2019, 08:13:15 pm »
i have just one more question.

can you re-route a pipe so it'll go to world 1-2 (for example) instead of going into the bonus room?
poyo!!! :)

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6934
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: a question about hacking super mario bros. 1
« Reply #8 on: April 14, 2019, 01:59:02 am »
Can you please ask all your Super Mario Bros. questions in a single thread?
"My watch says 30 chickens" Google, 2018

kirb1993

  • Jr. Member
  • **
  • Posts: 14
    • View Profile
    • my website!
Re: a question about hacking super mario bros. 1
« Reply #9 on: April 14, 2019, 04:04:56 pm »
Can you please ask all your Super Mario Bros. questions in a single thread?

yeah, okay.
poyo!!! :)

NesDraug

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 113
    • View Profile
Re: super mario bros. rom hacking question #3
« Reply #10 on: April 15, 2019, 02:04:34 am »
i have just one more question.

can you re-route a pipe so it'll go to world 1-2 (for example) instead of going into the bonus room?




If Mario walks over this blue middle square (available in the enemies section) he will be teleported to the given place next time he goes down a (can enter) pipe.
To my knowledge you can't create new "teleporters" so you have to find the ones in the game and work with what you got.
« Last Edit: April 15, 2019, 02:40:16 pm by NesDraug »
Hello! You found my shop of strange and wonderful things!
https://www.tumblr.com/blog/nesdraug

kirb1993

  • Jr. Member
  • **
  • Posts: 14
    • View Profile
    • my website!
Re: super mario bros. rom hacking question #3
« Reply #11 on: April 15, 2019, 11:47:41 pm »



If Mario walks over this blue middle square (available in the enemies section) he will be teleported to the given place next time he goes down a (can enter) pipe.
To my knowledge you can't create new "teleporters" so you have to find the ones in the game and work with what you got.

that's pretty cool!
poyo!!! :)

NesDraug

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 113
    • View Profile
Re: my super mario bros. 1 rom hacking questions
« Reply #12 on: April 16, 2019, 02:32:57 am »
But now I got a question. Is there a way to make Bowser throw less hammers? Like just two at a time?
Hello! You found my shop of strange and wonderful things!
https://www.tumblr.com/blog/nesdraug

kirb1993

  • Jr. Member
  • **
  • Posts: 14
    • View Profile
    • my website!
Re: my super mario bros. 1 rom hacking questions
« Reply #13 on: April 21, 2019, 03:16:20 pm »
another question i have:
is it possible for me to make it so that small mario can throw fireballs? and no, the glitch does not count as an answer.
poyo!!! :)

Psyklax

  • Hero Member
  • *****
  • Posts: 1076
    • View Profile
    • Psyklax Translations
Re: my super mario bros. 1 rom hacking questions
« Reply #14 on: April 21, 2019, 06:46:05 pm »
another question i have:
is it possible for me to make it so that small mario can throw fireballs? and no, the glitch does not count as an answer.

For the love of God, it's possible to change every byte in Super Mario Bros and turn it into Donkey Kong. :D The question isn't "is it possible" but "how do I do it". I know how I would do it... but I won't. :D

I'll explain at least. You said in another of your threads that you don't know what ASM hacking means. It's assembly hacking: assembly is the language that the game is written in (technically machine code, but whatever). By hacking the code, you can do anything. So how would I do what you ask? Well, I'd set a breakpoint in the debugger for the controller 1 input (at $4016) and hold B when I'm fire Mario, and see how the game checks the B input. What the game will presumably do is say "okay, you pushed B. Are you fire Mario? If so, go to the fire shooting routine, if not just carry on". What you need to do is find that instruction and change it so that it goes to the fire shooting routine in any situation. How? Ah, that's where the assembly lies. :)

Oh what do you know, it's in the SMB disassembly as the ProcFireball_Bubble routine:
https://gist.github.com/1wErt3r/4048722
It does pretty much what I just said.

If none of this makes sense to you, welcome to ROM hacking! :D Just give it some patience, and you'll get it eventually.

Hey, this SMB disassembly is fun. It tells you a lot of things. Here's a Game Genie code I just made which makes water bubbles all the time for no reason:
OZYLPV

And hey, here's another Game Genie code that lets you shoot fireballs whenever you want:
OZZUPV
Oh wait, that's what you wanted to do. Damn... :) Well, you'll notice that you turn big when you do them because small Mario obviously has no sprites for shooting fireballs. Anyway, enjoy!

DanielFA

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: my super mario bros. 1 rom hacking questions
« Reply #15 on: April 22, 2019, 09:36:04 am »
Hi!

Someone asked a question on another forum that I asked myself last year when I was playing the 256W hack of SMB1 (NES): How to make underwater blocks hittable? Well, after taking a look to doppelganger's disassembly, I found yesterday the answer:

Code: [Select]
AreaType = $074E ; $00 for underwater, $01 for overground, $02 for underground and $03 for castle
Here is where the exception for underwater levels is made:

Code: [Select]
0DCDA AC 4E 07       ldy AreaType
0DCDD F0 13          beq NYSpd

Therefore, the BEQ will always branch to another place when the level has AreaType=$00 preventing the block hitting. But you can fool the process redirecting it to another RAM address where you put the value $01 (overground level). You can make this without editing the disassembly and reassembling it simply by using cheat codes on your emulator or altering the ROM on a hex editor. You only need to find a free address! For example, in the original SMB (NES version) $E432=$FF is not used, so make it $01 and change $DCDA-$DCDC to $AC $32 $E4. This is a quick test on an altered world 1-1 (with a cheat code that forces $074E=$00):



Here you have a FCEUX cheat file for the NES version (FDS version has different addresses): Underwater Hitting  ;)

Edit:

Recently in another post Eden.GT shared a pack with patches to modify all kinds of things in the SMB1

After downloading it I found he fixed the same thing as me but simply NOPing that part of the code! :-[
« Last Edit: April 23, 2019, 09:41:31 am by DanielFA »

DanielFA

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: my super mario bros. 1 rom hacking questions
« Reply #16 on: November 06, 2019, 08:52:34 am »
Hi again!

I love the SMB2J gameplay but find the graphics awful, specially the ground tiles, so decided to copy the tiles from SMB1. But a problem arose in worlds 8-2 and 8-3 where there are platforms made by the 'cloud ledge' tiles:



Editing the graphics gives this:



OK, changing the palette assigned for the now 'mushroom ledge' tiles I can get this:



But in SMB1 they have a stem and they should look like this (edited image):



This obviously is a ASM task, so I took smb2jdis, made free space following ShaneM's explanation and got a new fully functional ROM with room for the desired code. Both SMB1 and SMB2J have a similar ledge object subroutine:

Code: [Select]
MushroomLedge:                       ;[SMB1]
          jsr ChkLrgObjLength        ;get shroom dimensions
          sty $06                    ;store length here for now
          bcc EndMushL
          lda AreaObjectLength,x     ;divide length by 2 and store elsewhere
          lsr
          sta MushroomLedgeHalfLen,x
          lda #$19                   ;render start of mushroom
          jmp NoUnder

EndMushL: lda #$1b                   ;if at the end, render end of mushroom
          ldy AreaObjectLength,x
          beq NoUnder
          lda MushroomLedgeHalfLen,x ;get divided length and store where length
          sta $06                    ;was stored originally
          ldx $07
          lda #$1a
          sta MetatileBuffer,x       ;render middle of mushroom
          cpy $06                    ;are we smack dab in the center?
          bne MushLExit              ;if not, branch to leave
          inx
          lda #$4f
          sta MetatileBuffer,x       ;render stem top of mushroom underneath the middle
          lda #$50

AllUnder: inx
          ldy #$0f                   ;set $0f to render all way down
          jmp RenderUnderPart        ;now render the stem of mushroom

NoUnder:  ldx $07                    ;load row of ledge
          ldy #$00                   ;set 0 for no bottom on this part
          jmp RenderUnderPart

MushLExit: rts                       ;and leave

And:

Code: [Select]
CloudLedge:                          ;[SMB2J]
          jsr ChkLrgObjLength        ;get cloud dimensions
          sty $06                    ;store length here for now ($06 = $0006 → Internal RAM)
          bcc EndCloud
          lda AreaObjectLength,x     ;divide length by 2 and store elsewhere (AreaObjectLength = $0730 → Internal RAM)
          lsr
          sta MushroomLedgeHalfLen,x ;(MushroomLedgeHalfLen = $0736 → Internal RAM)
          lda #$8a                   ;render start of cloud (#$8a = 138 → Numerical Value)
          jmp NoUnder

EndCloud: lda #$8c                   ;if at the end, render end of cloud (#$8c = 140 → Numerical Value)
          ldy AreaObjectLength,x
          beq NoUnder
          lda MushroomLedgeHalfLen,x ;get divided length and store where length
          sta $06                    ;was stored originally ($06 = $0006 → Internal RAM)
          ldx $07                    ;($07 = $0007 → Internal RAM)
          lda #$8b                   ;(#$8b = 139 → Numerical Value)
          sta MetatileBuffer,x       ;render middle of cloud (MetatileBuffer = $06a1 → Internal RAM)
          rts

AllUnder: inx
          ldy #$0f                   ;set $0f to render all way down (#$0f = 15 → Numerical Value)
          jmp RenderUnderPart        ;now render the support of the tree ledge

NoUnder:  ldx $07                    ;load row of ledge ($07 = $0007 → Internal RAM)
          ldy #$00                   ;set 0 for no bottom on this part (#$00 = 0 → Numerical Value)
          jmp RenderUnderPart

The other subroutines they call are the same in both games so I added the stem drawing part from one game to the other, assembled the code and got a valid ROM. I started it on FCEUX and played until 4-4 without any problem but when the FDS tried to open 5-1, it got stuck 'forever'...

What do you think?

Have I made something wrong adding the code and the BIOS can't read the level data? I had the same loading problem in the original ROM when using the 'unlimited time' and 'max lives' cheats. Oh, the game gets stuck when loading worlds A/D too... Just FYI, I managed to add new code on SMB1 but on the NES version, the FDS specific format confuses me a lot!

Here is a patch for the original ROM: SMB2_4.ips

Cyneprepou4uk

  • Sr. Member
  • ****
  • Posts: 294
  • I am the baldest romhacker
    • View Profile
Re: my super mario bros. 1 rom hacking questions
« Reply #17 on: November 07, 2019, 03:52:00 pm »
Bytes have been shifted. After you complete 4-4 and screen goes black, set execute breakpoint at $611C in both original and hack roms, and see for yourself how code goes from here. And your patch link sucks by the way.
« Last Edit: November 07, 2019, 03:59:23 pm by Cyneprepou4uk »
iromhacker.ru - NES ROM hacking tutorials for beginners

DanielFA

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: my super mario bros. 1 rom hacking questions
« Reply #18 on: November 07, 2019, 04:45:24 pm »
Thank you for answering! I'll try what you've said. About the link, yeah, now I see it's broken...  :-[

DanielFA

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: my super mario bros. 1 rom hacking questions
« Reply #19 on: November 22, 2019, 08:58:25 am »
After you complete 4-4 and screen goes black, set execute breakpoint at $611C in both original and hack roms, and see for yourself how code goes from here

I did what you said and got this:



Running the hacked ROM from there takes to a dead end. If I look into $D2A0 in both ROM's:



Now I don't know what to do but will try by myself. However, if someone wants to help me, this is the patch: SMB2JH I've patched the original FDS version:

Quote
ROM MD5       4E6C35327CA16B1466A714C228D2BBED       
ROM SHA-1     32071EEB6EA8BAED1817D08B96A8E64DD5D85F0B
ROM CRC32     DB1A13E2   

:angel: