Points of Required Attention™
Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,484,900
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 04-26-24 03:17 AM
Guest: Register | Login

0 users currently in ROM Hacking | 3 guests | 1 bot

Main - ROM Hacking - General SMB1/SMB2J Hacking Thread New thread | New reply

Pages: 1 2

teeporage777
Posted on 06-17-17 06:10 AM Link | Quote | ID: 165709

Newcomer
Level: 6

Posts: 4/5
EXP: 560
Next: 347

Since: 06-06-17

Last post: 2502 days
Last view: 2236 days
Hello mint cookie, download smb utility. This is for editing levels text and other things. Another tool i use is tile layer pro for editing graphics. i hope this helps

DanielFA
Posted on 04-21-19 05:56 PM (rev. 10 of 04-22-19 01:39 AM) Link | Quote | ID: 166977

Newcomer
Level: 6

Posts: 3/6
EXP: 645
Next: 262

Since: 01-13-19
From: Argentina

Last post: 1604 days
Last view: 1604 days
Hi again!

As I got stuck with my SMB3 graphics hack since it needed advanced ASM knowledge, I decided to start with some tutorials and the available SMB1/SMB2J disassemblies from doppelganger. Well, 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:

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:

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
Posted by teeporage777
but these underwater levels are killing me. everythings fine besides the fact that blocks under water no matter if they are coins a mushroom they wont activate

Looking at the famous disassembly I found a nice cheat for the original SMB1 ROM that makes underwater blocks hittable and they'll give you coins or power-ups. Here is where the exception for underwater levels is made:

0DCDA AC 4E 07       ldy AreaType
0DCDD F0 13 beq NYSpd

As Quick Curly told you:
Posted by Quick Curly
$074E is defined as "AreaType". If you manually set $074E in RAM to 00, the active level will be considered a water level

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 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 ROM $E432=$FF is not used, so make it $01 and change $DCDA-$DCDC to $AC $32 $E4. Here you have a cheat file for FCEUX: Underwater Hitting. Here a quick test on an altered world 1-1 (with a cheat code that forces $074E=$00):



If you want to implement this circumvention on another ROM, it should have this code somewhere:

0DCD5 20 8F DF       jsr CheckForSolidMTiles
0DCD8 B0 10 bcs SolidOrClimb
0DCDA AC 4E 07 ldy AreaType
0DCDD F0 13 beq NYSpd
0DCDF AC 84 07 ldy BlockBounceTimer
0DCE2 D0 0E bne NYSpd

So, how to find it on the ROM/RAM with a hex editor if it isn't located on those addresses?

Well, you must search for the string "20 8F DF B0 10 AC 4E 07 F0 13 AC 84 07 D0 0E" or parts of it then you change "4E 07" to whatever address you found empty or unused, change the $00/$FF on that address to $01 and presto!
Posted by Quick Curly
I feel like hitting "?" blocks underwater would have been a pursuit in Super Mario Bros. hacking at some point in time, but I couldn't seem to find anything from searching

I was thinking about it some years ago when I came across the SMB1 256W hack but at the time ASM was unknown by me. Thanks to doppelganger's effort it was now really easy for me to find it!
Pages: 1 2


Main - ROM Hacking - General SMB1/SMB2J Hacking Thread New thread | New reply

Acmlmboard 2.1+4δ (2023-01-15)
© 2005-2023 Acmlm, blackhole89, Xkeeper et al.

Page rendered in 0.017 seconds. (350KB of memory used)
MySQL - queries: 42, rows: 64/64, time: 0.014 seconds.