Points of Required Attention™
Smaghetti, a new Super Mario Advance 4 editor, is currently in development! Check out the thread HERE!

Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,316,268
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 03-29-24 07:38 AM
Guest: Register | Login

0 users currently in ROM Hacking | 4 guests

Main - ROM Hacking - SMB2j skid sound into SMB1 New thread | New reply


CKY-9K
Posted on 04-23-08 10:03 PM Link | Quote | ID: 82274


Pokey
Level: 57

Posts: 384/693
EXP: 1427197
Next: 58731

Since: 06-27-07
From: cKy

Last post: 182 days
Last view: 90 days
I've already accomplished doing this. However the skid sound is located in the worst place to compromise for compression. It's coding is located around level 1-2 and 1-4's level layout.

I'm not really good with ASM, but couldn't I expand the ROM and move the code to an empty spot?

____________________








ianmario
Posted on 07-10-10 12:23 AM Link | Quote | ID: 132812

Newcomer
Level: 6

Posts: 3/4
EXP: 566
Next: 341

Since: 07-09-10
From: hmm what happened here

Last post: 5011 days
Last view: 5010 days
Hello I AM AWSOME!Probably, you would have to find the spot where Mario Skids and see how to add a sound to that. I've never thought of that!

____________________
WHO EVER KEEPS MESSING WITH MY PROFILE, STOP!!

Insectduel
Posted on 07-10-10 09:19 PM Link | Quote | ID: 132853


Hammer Brother
Level: 68

Posts: 555/1069
EXP: 2681376
Next: 47424

Since: 02-16-08
From: Insectduel's office

Last post: 1229 days
Last view: 1228 days
SMB1 did use a 512 byte trainer header. If your ROM is 41,488 bytes, then you should learn ASM and especially JMP or JSR.

Trax
Posted on 07-11-10 09:27 AM Link | Quote | ID: 132866


Yellow Stalfos
Level: 71

Posts: 981/1145
EXP: 3028842
Next: 138272

Since: 07-06-07
From: Québec

Last post: 3599 days
Last view: 2851 days
Hmmm, I'm perplex. Super Mario Bros. (JU) [!].nes has no trailer, a length of A010 bytes, and virtually no free space at all...

Hamtaro126
Posted on 07-11-10 07:56 PM (rev. 3 of 07-11-10 08:01 PM) Link | Quote | ID: 132885


Cheep-cheep
Level: 33

Posts: 143/194
EXP: 212355
Next: 16824

Since: 05-02-07
From: Shelton, WA

Last post: 2444 days
Last view: 2287 days
Posted by Trax
Hmmm, I'm perplex. Super Mario Bros. (JU) [!].nes has no trailer, a length of A010 bytes, and virtually no free space at all...


We all can get by with using doppleganger's SMB disassembly (SMBDis) via Romhacking.net.
http://www.romhacking.net/docs/344/

Mske sure you have a prebuilt header, and 8k CHR from the SMB ROM

And even though it breaks compatibility with current SMB tools (AND normal IPS patch format), you can still make a new hack out of it, via UPS, Binary Diff, or better yet, Xdelta.

Just make sure to know what you are doing and possibly learn bankswitching too, For that, get Disch's Mapper Documentation collection:

http://www.romhacking.net/docs/157/
http://www.romhacking.net/docs/353/
http://www.romhacking.net/docs/362/

Beware of the Sprite 0 detection near the end of Non Maskable Interrupt (NMI) code, I could not even hack it without corrupting the whole game, making it glitch!

Trainers are a outdated and stupid feature that is mainly for compatiblity reasons, Do not even use it unless you want to get criticized by Romhacking.Net and such!

____________________
Mah boi, romhacking is what all true warriors strive for!

I wonder what's for dinner?

ShaneM
(post deleted) ID: 158681

ShaneM
Posted on 10-10-14 07:32 AM Link | Quote | ID: 158724


Snifit
Compromised account.
Please contact an admin to restore access.
Level: 36

Posts: 178/285
EXP: 292366
Next: 15744

Since: 02-17-14

Last post: 3109 days
Last view: 2624 days
Since SMB1 is NROM, it is limited to 8000 bytes of binary. Here are some ways to attain over 200 free bytes to add the code (more than enough). Use doppleganger's SMB1 disassembly and assemble with a make.bat file:


Remove residual code. Here are some places that code can be removed, also some other ways to save space; if you follow my advice, you'll get roughly 200 free bytes (note that not everything labeled in the disassembly as 'residual' are really residual; the ones I listed I've proven residual):


;In "PrintVictoryMessages:", remove these
cmp #$09
bcs IncMsgCounter

;In "Palette1_MTiles:" remove these
.db $24, $2f, $24, $3d ;flag ball (residual object)

;In "WaterPipe:" remove this:
ldy AreaObjectLength,x

;In "ScrollScreen:" remove this
sta ScrollIntervalTimer

;In "FlagpoleSlide:" remove these
cmp #FlagpoleFlagObject
bne NoFPObj

;In "NoFPObj:" remove this
inc GameEngineSubroutine

;In "UseMiscS" remove this
sty JumpCoinMiscOffset

;In "MovePlatformUp:" remove these
cpy #$29
lda #$09

;In "CheckEndofBuffer" remove all these
iny
lda (EnemyData),y
and #%00111111
cmp #$2e
beq CheckRightBounds

;In "SetupGFB" remove this
jsr GetFirebarPosition

;In "BPGet:" remove these
lda FlyCCBPriority,y
sta Enemy_SprAttrib,x

;In "DrawFlameLoop:" remove this
sta Sprite_Y_Position+12,y

;In "FirebarSpin:" remove
ldy #$18

;In "SpinCounterClockwise:" remove
ldy #$08

;In "RightPlatform:" remove
sta $00

;Remove "ResidualXSpdData:" completely

;In "CheckToAnimateEnemy:" remove this
iny

;In "DrawBrickChunks:" remove
lda #$75

;In "PowerUpGrabFreqData:" remove these at the end
.db $22, $1c, $14

;In "FindAreaMusicHeader:" remove this
sty MusicOffset_Square2

;Remove "ResidualHeaderData:" completely



;Did you know you could get 16 free bytes from changing lda BrickShatterEnvData,y in "ContinueBrickShatter:" to "lda BowserFlameEnvData,y"? They both make the same SFX but now you have 16 free bytes where the data used to be!


Optimize the following routine to get another 32 bytes:

;This is the original routine
SetPlatformTilenum:
ldx ObjectOffset
iny
jsr DumpSixSpr
lda #$02
iny
jsr DumpSixSpr
inx
jsr GetXOffscreenBits
dex
ldy Enemy_SprDataOffset,x
asl
pha
bcc SChk2
lda #$f8
sta Sprite_Y_Position,y
SChk2: pla
asl
pha
bcc SChk3
lda #$f8
sta Sprite_Y_Position+4,y
SChk3: pla
asl
pha
bcc SChk4
lda #$f8
sta Sprite_Y_Position+8,y
SChk4: pla
asl
pha
bcc SChk5
lda #$f8
sta Sprite_Y_Position+12,y
SChk5: pla
asl
pha
bcc SChk6
lda #$f8
sta Sprite_Y_Position+16,y
SChk6: pla
asl
bcc SLChk
lda #$f8
sta Sprite_Y_Position+20,y
SLChk: lda Enemy_OffscreenBits
asl
bcc ExDLPl
jsr MoveSixSpritesOffscreen
ExDLPl: rts

;okay, now change it to this:

SetPlatformTilenum:
ldx ObjectOffset
iny
jsr DumpSixSpr
lda #$02
iny
jsr DumpSixSpr
inx
jsr GetXOffscreenBits
dex
ldy Enemy_SprDataOffset,x
ldx #$06
SChk: asl
bcc SChkNx
pha
lda #$f8
sta Sprite_Y_Position,y
pla
SChkNx: iny
iny
iny
iny
dex
bne SChk
ldx ObjectOffset
tya
sec
sbc #$18
tay
lda Enemy_OffscreenBits
asl
bcc ExDLPl
jsr MoveSixSpritesOffscreen
ExDLPl: rts


There are many more ways to clear up free space. This next method will get you about 150 free bytes:

SMB1 was very wasteful with level data. For example look at this:


^The above leftmost brick can be made to a horizontal brick length 4 and the rightmost brick can be removed (see below). This can be done with various objects in ALL levels/rooms to save space while functioning the same.




The above trick can also be done with enemies while function the same, too. See below.

Before:


After:


Notice that I changed it from a 'Little Goomba' to a '2 Little Goomba (V=10).

With the above, counting every possible level, you get around 150 free bytes this way. I hope this was helpful instead of having to convert this from NROM to MMC3 and extra routines. 200 or so free bytes is a lot of free space to make many routines.

EDIT: Here is another code that can be optimized.

;Original code

CheckPlayerVertical:
lda Player_OffscreenBits
cmp #$f0
bcs ExCPV
ldy Player_Y_HighPos
dey
bne ExCPV
lda Player_Y_Position
cmp #$d0
ExCPV: rts

;Optimized code
CheckPlayerVertical:
lda Player_OffscreenBits
and #$f0
clc
beq ExCPV
sec
ExCPV: rts

;you've saved 7 bytes


Also, remove anything labeled as "free space" etc. They will always be bytes of $FF. They are scattered throughout the file and will add up to another 20 or so free bytes.

Make sure that the assembled binary file is no GREATER or LESS than 32,768 bytes. Whenever you add or minus code, you need to pad it or else there will be trouble. I can tell you are new to this. My advice is use something like Notepad++ that tells you the line numbers for when the assembler shoots out a "value out of range" or a line with an error or what not.

Here's one more that's easy to miss. The underwater level has a room pointer to World 3 that's never used. (Room pointers always take 3 bytes). So removing it will give you three more. I just mentioned this because this one was hard to find. But the other wasteful ones are easy.

In total, another 33 bytes right here (I took advantage of these in my SMB1 hacks to load the beta tiles I found):


;In "VRAM_AddrTable:", remove
.dw UnusedAttribData

;and
.dw BowserPaletteData

;You can also remove the 8 bytes from the "BowserPaletteData" data and just change the palette to $1A using FCEUX PPU viewer.

;you can also remove these; remember to update where the immediate values are loaded for certain objects like trees (only takes a few minutes):
.db $45, $47, $45, $47 ;breakable brick (not used)
.db $24, $47, $24, $47 ;half brick (not used)

;remove this completely
DoNothing:
lda #$ff ;this is residual code, this value is
sta $06c9 ;not used anywhere in the program
rts

;In "ProcHammerObj:" remove
sta $01

;In "SwimCCXMoveData:" remove
.db $04, $04

;In "ShufAmtLoop:" remove
jsr DoNothing



Here's another way to get 55 more free bytes:



;original did this...change it to what I have after this to save 55 bytes

PRandomSubtracter:
.db $f8, $a0, $70, $bd, $00

FlyCCBPriority:
.db $20, $20, $20, $00, $00

MoveFlyingCheepCheep:
lda Enemy_State,x ;check cheep-cheep's enemy state
and #%00100000 ;for d5 set
beq FlyCC ;branch to continue code if not set
lda #$00
sta Enemy_SprAttrib,x ;otherwise clear sprite attributes
jmp MoveJ_EnemyVertically ;and jump to move defeated cheep-cheep downwards
FlyCC: jsr MoveEnemyHorizontally ;move cheep-cheep horizontally based on speed and force
ldy #$0d ;set vertical movement amount
lda #$05 ;set maximum speed
jsr SetXMoveAmt ;branch to impose gravity on flying cheep-cheep
lda Enemy_Y_MoveForce,x
lsr ;get vertical movement force and
lsr ;move high nybble to low
lsr
lsr
tay ;save as offset (note this tends to go into reach of code)
lda Enemy_Y_Position,x ;get vertical position
sec ;subtract pseudorandom value based on offset from position
sbc PRandomSubtracter,y
bpl AddCCF ;if result within top half of screen, skip this part
eor #$ff
clc ;otherwise get two's compliment
adc #$01
AddCCF: cmp #$08 ;if result or two's compliment greater than eight,
bcs BPGet ;skip to the end without changing movement force
lda Enemy_Y_MoveForce,x
clc
adc #$10 ;otherwise add to it
sta Enemy_Y_MoveForce,x
lsr ;move high nybble to low again
lsr
lsr
lsr
tay
BPGet: lda FlyCCBPriority,y ;load bg priority data and store (this is very likely
sta Enemy_SprAttrib,x ;broken or residual code, value is overwritten before
rts


;;;;delete the above and replace it with this to save the 55 extra bytes:

ldy #$20
lda Enemy_State,x ;LDA $1E,X
and #$20
bne end ;$CEE8
jsr MoveEnemyHorizontally ;$BF07
ldy #$17
end: lda #$05
jmp SetXMoveAmt ;$BF9B


In total, if you did everything I told you to do, you've saved near 300 bytes! More than enough to add skid sound. To add the skid sound, rip the code from the SMB2J disassembly by doppleganger. If you can't find it, let me know and I'll assist you. --ShaneM

EDIT: Here is the skid code in SMB2J:


SkidSfxFreqData:
.db $47, $49, $42, $4a, $43, $4b

PlaySkidSfx: ;;this code needs to be used in NoiseSfxHandler. make a conditional bmi mnemonic for this to work (hint: ldy NoiseSoundQueue as the class 2 statement).
sty NoiseSoundBuffer
lda #$06
sta Noise_SfxLenCounter

ContinueSkidSfx:
lda Noise_SfxLenCounter
tay
lda SkidSfxFreqData-1,y
sta SND_TRIANGLE_REG+2
lda #$18
sta SND_TRIANGLE_REG
sta SND_TRIANGLE_REG+3
bne DecrementSfx3Length



____________________
At the end, when the day is over, the only one left to face is yourself. Have you been true to yourself and made the most of your day?

Main - ROM Hacking - SMB2j skid sound into SMB1 New thread | New reply

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

Page rendered in 0.022 seconds. (350KB of memory used)
MySQL - queries: 63, rows: 89/90, time: 0.016 seconds.