Remove residual/unnecessary code and data

refactor
Christophe Parent 2024-02-02 13:12:14 -08:00
parent c98ecb4e2d
commit acc90317a8
1 changed files with 13 additions and 111 deletions

View File

@ -74,7 +74,6 @@ FrenzyEnemyTimer = $078f
BowserFireBreathTimer = $0790 BowserFireBreathTimer = $0790
StompTimer = $0791 StompTimer = $0791
AirBubbleTimer = $0792 AirBubbleTimer = $0792
ScrollIntervalTimer = $0795
EnemyIntervalTimer = $0796 EnemyIntervalTimer = $0796
BrickCoinTimer = $079d BrickCoinTimer = $079d
InjuryTimer = $079e InjuryTimer = $079e
@ -410,7 +409,6 @@ Block_BBuf_Low = $03e6
Block_Metatile = $03e8 Block_Metatile = $03e8
Block_PageLoc2 = $03ea Block_PageLoc2 = $03ea
Block_RepFlag = $03ec Block_RepFlag = $03ec
Block_ResidualCounter = $03f0
Block_Orig_XPos = $03f1 Block_Orig_XPos = $03f1
BoundingBox_UL_XPos = $04ac BoundingBox_UL_XPos = $04ac
@ -428,7 +426,6 @@ FireballCounter = $06ce
FireballThrowingTimer = $0711 FireballThrowingTimer = $0711
HammerEnemyOffset = $06ae HammerEnemyOffset = $06ae
JumpCoinMiscOffset = $06b7
Block_Buffer_1 = $0500 Block_Buffer_1 = $0500
Block_Buffer_2 = $05d0 Block_Buffer_2 = $05d0
@ -913,7 +910,6 @@ ExitPause:
; $00 - used for preset value ; $00 - used for preset value
SpriteShuffler: SpriteShuffler:
ldy AreaType ; load level type, likely residual code
lda #$28 ; load preset value which will put it at lda #$28 ; load preset value which will put it at
sta $00 ; sprite #10 sta $00 ; sprite #10
ldx #$0e ; start at the end of OAM data offsets ldx #$0e ; start at the end of OAM data offsets
@ -1093,7 +1089,6 @@ StartWorld1:
sta OperMode_Task ; set game mode here, and clear demo timer sta OperMode_Task ; set game mode here, and clear demo timer
sta DemoTimer sta DemoTimer
ldx #$17 ldx #$17
lda #$00
InitScores: InitScores:
sta ScoreAndCoinDisplay,x ; clear player scores and coin displays sta ScoreAndCoinDisplay,x ; clear player scores and coin displays
dex dex
@ -1234,8 +1229,6 @@ PrintVictoryMessages:
bne IncMsgCounter ; if set, branch to increment message counters bne IncMsgCounter ; if set, branch to increment message counters
lda PrimaryMsgCounter ; otherwise load primary message counter lda PrimaryMsgCounter ; otherwise load primary message counter
beq ThankPlayer ; if set to zero, branch to print first message beq ThankPlayer ; if set to zero, branch to print first message
cmp #$09 ; if at 9 or above, branch elsewhere (this comparison
bcs IncMsgCounter ; is residual code, counter never reaches 9)
ldy WorldNumber ; check world number ldy WorldNumber ; check world number
cpy #World8 cpy #World8
bne MRetainerMsg ; if not at world 8, skip to next part bne MRetainerMsg ; if not at world 8, skip to next part
@ -1299,7 +1292,6 @@ PlayerEndWorld:
ldy WorldNumber ; check world number ldy WorldNumber ; check world number
cpy #World8 ; if on world 8, player is done with game, cpy #World8 ; if on world 8, player is done with game,
bcs EndChkBButton ; thus branch to read controller bcs EndChkBButton ; thus branch to read controller
lda #$00
sta AreaNumber ; otherwise initialize area number used as offset sta AreaNumber ; otherwise initialize area number used as offset
sta LevelNumber ; and level number control to start at area 1 sta LevelNumber ; and level number control to start at area 1
sta OperMode_Task ; initialize secondary mode of operation sta OperMode_Task ; initialize secondary mode of operation
@ -1630,9 +1622,6 @@ DisplayIntermediate:
beq GameOverInter ; if so, proceed to display game over screen beq GameOverInter ; if so, proceed to display game over screen
lda AltEntranceControl ; otherwise check for mode of alternate entry lda AltEntranceControl ; otherwise check for mode of alternate entry
bne NoInter ; and branch if found bne NoInter ; and branch if found
ldy AreaType ; check if we are on castle level
cpy #$03 ; and if so, branch (possibly residual)
beq PlayerInter
lda DisableIntermediate ; if this flag is set, skip intermediate lives display lda DisableIntermediate ; if this flag is set, skip intermediate lives display
bne NoInter ; and jump to specific task, otherwise bne NoInter ; and jump to specific task, otherwise
PlayerInter: PlayerInter:
@ -2145,8 +2134,6 @@ WriteBlankMT:
ReplaceBlockMetatile: ReplaceBlockMetatile:
jsr WriteBlockMetatile ; write metatile to vram buffer to replace block object jsr WriteBlockMetatile ; write metatile to vram buffer to replace block object
inc Block_ResidualCounter ; increment unused counter (residual code)
dec Block_RepFlag,x ; decrement flag (residual code)
rts ; leave rts ; leave
DestroyBlockMetatile: DestroyBlockMetatile:
@ -2622,12 +2609,9 @@ RepeatByte:
lda #$00 lda #$00
adc $01 adc $01
sta $01 sta $01
lda #$3f ; sets vram address to $3f00
sta PPU_ADDRESS
lda #$00 lda #$00
sta PPU_ADDRESS sta PPU_ADDRESS
sta PPU_ADDRESS ; then reinitializes it for some reason sta PPU_ADDRESS ; reinitialize vram address to $0000
sta PPU_ADDRESS
UpdateScreen: UpdateScreen:
ldx PPU_STATUS ; reset flip-flop ldx PPU_STATUS ; reset flip-flop
ldy #$00 ; load first byte from indirect as a pointer ldy #$00 ; load first byte from indirect as a pointer
@ -2913,8 +2897,6 @@ ISpr0Loop:
sta Sprite_Data,y sta Sprite_Data,y
dey dey
bpl ISpr0Loop bpl ISpr0Loop
jsr DoNothing2 ; these jsrs doesn't do anything useful
jsr DoNothing1
inc Sprite0HitDetectFlag ; set sprite #0 check flag inc Sprite0HitDetectFlag ; set sprite #0 check flag
inc OperMode_Task ; increment to next task inc OperMode_Task ; increment to next task
rts rts
@ -3155,7 +3137,6 @@ TerminateGame:
lda WorldNumber ; otherwise put world number of current lda WorldNumber ; otherwise put world number of current
sta ContinueWorld ; player into secret continue function variable sta ContinueWorld ; player into secret continue function variable
lda #$00 lda #$00
asl ; residual ASL instruction
sta OperMode_Task ; reset all modes to title screen and sta OperMode_Task ; reset all modes to title screen and
sta ScreenTimer ; leave sta ScreenTimer ; leave
sta OperMode sta OperMode
@ -3201,15 +3182,6 @@ ExTrans:
;------------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------------
DoNothing1:
lda #$ff ; this is residual code, this value is
sta $06c9 ; not used anywhere in the program
DoNothing2:
rts
;-------------------------------------------------------------------------------------
AreaParserTaskHandler: AreaParserTaskHandler:
ldy AreaParserTaskNum ; check number of tasks here ldy AreaParserTaskNum ; check number of tasks here
bne DoAPTasks ; if already set, go ahead bne DoAPTasks ; if already set, go ahead
@ -4015,7 +3987,6 @@ ExitCastle:
WaterPipe: WaterPipe:
jsr GetLrgObjAttrib ; get row and lower nybble jsr GetLrgObjAttrib ; get row and lower nybble
ldy AreaObjectLength,x ; get length (residual code, water pipe is 1 col thick)
ldx $07 ; get row ldx $07 ; get row
lda #$6b lda #$6b
sta MetatileBuffer,x ; draw something here and below it sta MetatileBuffer,x ; draw something here and below it
@ -4466,8 +4437,6 @@ DrawQBlk:
GetAreaObjectID: GetAreaObjectID:
lda $00 ; get value saved from area parser routine lda $00 ; get value saved from area parser routine
sec
sbc #$00 ; possibly residual code
tay ; save to Y tay ; save to Y
ExitDecBlock: ExitDecBlock:
rts rts
@ -4522,7 +4491,6 @@ RenderUnderPart:
beq WaitOneRow ; if middle part (mushroom ledge), wait until next row beq WaitOneRow ; if middle part (mushroom ledge), wait until next row
cpy #$c0 cpy #$c0
beq DrawThisRow ; if question block w/ coin, overwrite beq DrawThisRow ; if question block w/ coin, overwrite
cpy #$c0
bcs WaitOneRow ; if any other metatile with palette 3, wait until next row bcs WaitOneRow ; if any other metatile with palette 3, wait until next row
cpy #$54 cpy #$54
bne DrawThisRow ; if cracked rock terrain, overwrite bne DrawThisRow ; if cracked rock terrain, overwrite
@ -5712,8 +5680,6 @@ ScrollScreen:
ora $00 ; get saved bit here and save in PPU register 1 ora $00 ; get saved bit here and save in PPU register 1
sta Mirror_PPU_CTRL_REG1 ; mirror to be used to set name table later sta Mirror_PPU_CTRL_REG1 ; mirror to be used to set name table later
jsr GetScreenPosition ; figure out where the right side is jsr GetScreenPosition ; figure out where the right side is
lda #$08
sta ScrollIntervalTimer ; set scroll timer (residual, not used elsewhere)
jmp ChkPOffscr ; skip this part jmp ChkPOffscr ; skip this part
InitScrlAmt: InitScrlAmt:
lda #$00 lda #$00
@ -6134,7 +6100,7 @@ ExitDeath:
FlagpoleSlide: FlagpoleSlide:
lda Enemy_ID+5 ; check special use enemy slot lda Enemy_ID+5 ; check special use enemy slot
cmp #FlagpoleFlagObject ; for flagpole flag object cmp #FlagpoleFlagObject ; for flagpole flag object
bne NoFPObj ; if not found, branch to something residual bne NoFPObj ; if not found, branch to exit
lda FlagpoleSoundQueue ; load flagpole sound lda FlagpoleSoundQueue ; load flagpole sound
sta Square1SoundQueue ; into square 1's sfx queue sta Square1SoundQueue ; into square 1's sfx queue
lda #$00 lda #$00
@ -6146,8 +6112,8 @@ FlagpoleSlide:
SlidePlayer: SlidePlayer:
jmp AutoControlPlayer ; jump to player control routine jmp AutoControlPlayer ; jump to player control routine
NoFPObj: NoFPObj:
inc GameEngineSubroutine ; increment to next routine (this may inc GameEngineSubroutine ; increment to next routine
rts ; be residual code) rts
;------------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------------
@ -6593,7 +6559,6 @@ SetAnimSpd:
ImposeFriction: ImposeFriction:
and Player_CollisionBits ; perform AND between left/right controller bits and collision flag and Player_CollisionBits ; perform AND between left/right controller bits and collision flag
cmp #$00 ; then compare to zero (this instruction is redundant)
bne JoypFrict ; if any bits set, branch to next part bne JoypFrict ; if any bits set, branch to next part
lda Player_X_Speed lda Player_X_Speed
beq SetAbsSpd ; if player has no horizontal speed, branch ahead to last part beq SetAbsSpd ; if player has no horizontal speed, branch ahead to last part
@ -7313,7 +7278,6 @@ NoHammer:
;-------------------------------- ;--------------------------------
; $00 - used to set downward force ; $00 - used to set downward force
; $01 - used to set upward force (residual)
; $02 - used to set maximum speed ; $02 - used to set maximum speed
ProcHammerObj: ProcHammerObj:
@ -7331,8 +7295,6 @@ ProcHammerObj:
tax ; return offset to X tax ; return offset to X
lda #$10 lda #$10
sta $00 ; set downward movement force sta $00 ; set downward movement force
lda #$0f
sta $01 ; set upward movement force (not used)
lda #$04 lda #$04
sta $02 ; set maximum vertical speed sta $02 ; set maximum vertical speed
lda #$00 ; set A to impose gravity on hammer lda #$00 ; set A to impose gravity on hammer
@ -7428,7 +7390,6 @@ FMiscLoop:
bne FMiscLoop ; do this until all slots are checked bne FMiscLoop ; do this until all slots are checked
ldy #$08 ; if no empty slots found, use last slot ldy #$08 ; if no empty slots found, use last slot
UseMiscS: UseMiscS:
sty JumpCoinMiscOffset ; store offset of misc object buffer here (residual)
rts rts
;------------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------------
@ -7446,7 +7407,6 @@ MiscLoop:
;-------------------------------- ;--------------------------------
; $00 - used to set downward force ; $00 - used to set downward force
; $01 - used to set upward force (residual)
; $02 - used to set maximum speed ; $02 - used to set maximum speed
ProcJumpCoin: ProcJumpCoin:
@ -7476,8 +7436,6 @@ JCoinRun:
sta $00 sta $00
lda #$06 ; set maximum vertical speed lda #$06 ; set maximum vertical speed
sta $02 sta $02
lsr ; divide by 2 and set
sta $01 ; as upward movement amount (apparently residual)
lda #$00 ; set A to impose gravity on jumping coin lda #$00 ; set A to impose gravity on jumping coin
jsr ImposeGravity ; do sub to move coin vertically and impose gravity on it jsr ImposeGravity ; do sub to move coin vertically and impose gravity on it
ldx ObjectOffset ; get original misc object offset ldx ObjectOffset ; get original misc object offset
@ -7488,7 +7446,6 @@ JCoinRun:
RunJCSubs: RunJCSubs:
jsr RelativeMiscPosition ; get relative coordinates jsr RelativeMiscPosition ; get relative coordinates
jsr GetMiscOffscreenBits ; get offscreen information jsr GetMiscOffscreenBits ; get offscreen information
jsr GetMiscBoundBox ; get bounding box coordinates (why?)
jsr JCoinGfxHandler ; draw the coin or floatey number jsr JCoinGfxHandler ; draw the coin or floatey number
MiscLoopBack: MiscLoopBack:
@ -7562,8 +7519,7 @@ SetupPowerUp:
sec sec
sbc #$08 ; subtract 8 pixels sbc #$08 ; subtract 8 pixels
sta Enemy_Y_Position+5 ; and use as vertical coordinate of power-up object sta Enemy_Y_Position+5 ; and use as vertical coordinate of power-up object
PwrUpJmp: lda #$01
lda #$01 ; this is a residual jump point in enemy object jump table
sta Enemy_State+5 ; set power-up object's state sta Enemy_State+5 ; set power-up object's state
sta Enemy_Flag+5 ; set buffer flag sta Enemy_Flag+5 ; set buffer flag
lda #$03 lda #$03
@ -7882,8 +7838,6 @@ SpawnBrickChunks:
clc ; add 8 pixels to vertical coordinate clc ; add 8 pixels to vertical coordinate
adc #$08 ; and save as vertical coordinate for one of them adc #$08 ; and save as vertical coordinate for one of them
sta Block_Y_Position+2,x sta Block_Y_Position+2,x
lda #$fa
sta Block_Y_Speed,x ; set vertical speed...again??? (redundant)
rts rts
;------------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------------
@ -8114,10 +8068,6 @@ SetXMoveAmt:
MaxSpdBlockData: MaxSpdBlockData:
.byte $06, $08 .byte $06, $08
ResidualGravityCode:
ldy #$00 ; this part appears to be residual,
.byte $2c ; no code branches or jumps to it...
ImposeGravityBlock: ImposeGravityBlock:
ldy #$01 ; set offset for maximum speed ldy #$01 ; set offset for maximum speed
lda #$50 ; set movement amount here lda #$50 ; set movement amount here
@ -8138,13 +8088,8 @@ MovePlatformDown:
MovePlatformUp: MovePlatformUp:
lda #$01 ; save value to stack lda #$01 ; save value to stack
pha pha
ldy Enemy_ID,x ; get enemy object identifier
inx ; increment offset for enemy object inx ; increment offset for enemy object
lda #$05 ; load default value here lda #$05 ; load default value here
cpy #$29 ; residual comparison, object #29 never executes
bne SetDplSpd ; this code, thus unconditional branch here
lda #$09 ; residual code
SetDplSpd:
sta $00 ; save downward movement amount here sta $00 ; save downward movement amount here
lda #$0a ; save upward movement amount here lda #$0a ; save upward movement amount here
sta $01 sta $01
@ -8372,12 +8317,7 @@ CheckEndofBuffer:
beq CheckRightBounds ; if found, branch, otherwise beq CheckRightBounds ; if found, branch, otherwise
cpx #$05 ; check for end of buffer cpx #$05 ; check for end of buffer
bcc CheckRightBounds ; if not at end of buffer, branch bcc CheckRightBounds ; if not at end of buffer, branch
iny rts
jsr EnemyDataBankSwitch ; check for specific value here
and #%00111111 ; not sure what this was intended for, exactly
cmp #$2e ; this part is quite possibly residual code
beq CheckRightBounds ; but it has the effect of keeping enemies out of
rts ; the sixth slot
CheckRightBounds: CheckRightBounds:
lda ScreenRight_X_Pos ; add 48 to pixel coordinate of right boundary lda ScreenRight_X_Pos ; add 48 to pixel coordinate of right boundary
@ -8599,7 +8539,7 @@ InitEnemyRoutines:
.addr PlatLiftUp .addr PlatLiftUp
.addr PlatLiftDown .addr PlatLiftDown
.addr InitBowser .addr InitBowser
.addr PwrUpJmp ; possibly dummy value .addr NoInitCode
.addr Setup_Vine .addr Setup_Vine
.addr NoInitCode ; for objects $30-$36 .addr NoInitCode ; for objects $30-$36
@ -10157,7 +10097,6 @@ NotDefB:
SwimCCXMoveData: SwimCCXMoveData:
.byte $40, $80 .byte $40, $80
.byte $04, $04 ; residual data, not used
MoveSwimmingCheepCheep: MoveSwimmingCheepCheep:
lda Enemy_State,x ; check cheep-cheep's enemy object state lda Enemy_State,x ; check cheep-cheep's enemy object state
@ -10295,7 +10234,6 @@ SkpFSte:
SetupGFB: SetupGFB:
sta $ef ; save high byte of spinning thing, modified or otherwise sta $ef ; save high byte of spinning thing, modified or otherwise
jsr RelativeEnemyPosition ; get relative coordinates to screen jsr RelativeEnemyPosition ; get relative coordinates to screen
jsr GetFirebarPosition ; do a sub here (residual, too early to be used now)
ldy Enemy_SprDataOffset,x ; get OAM data offset ldy Enemy_SprDataOffset,x ; get OAM data offset
lda Enemy_Rel_YPos ; get relative vertical coordinate lda Enemy_Rel_YPos ; get relative vertical coordinate
sta Sprite_Y_Position,y ; store as Y in OAM data sta Sprite_Y_Position,y ; store as Y in OAM data
@ -10510,9 +10448,6 @@ GetVAdder:
PRandomSubtracter: PRandomSubtracter:
.byte $f8, $a0, $70, $bd, $00 .byte $f8, $a0, $70, $bd, $00
FlyCCBPriority:
.byte $20, $20, $20, $00, $00
MoveFlyingCheepCheep: MoveFlyingCheepCheep:
lda Enemy_State,x ; check cheep-cheep's enemy state lda Enemy_State,x ; check cheep-cheep's enemy state
and #%00100000 ; for d5 set and #%00100000 ; for d5 set
@ -10551,9 +10486,7 @@ AddCCF:
lsr lsr
tay tay
BPGet: BPGet:
lda FlyCCBPriority,y ; load bg priority data and store (this is very likely rts
sta Enemy_SprAttrib,x ; broken or residual code, value is overwritten before
rts ; drawing it next frame), then leave
;-------------------------------- ;--------------------------------
; $00 - used to hold horizontal difference ; $00 - used to hold horizontal difference
@ -11018,20 +10951,14 @@ DrawFlameLoop:
ldy Enemy_SprDataOffset,x ; get OAM data offset ldy Enemy_SprDataOffset,x ; get OAM data offset
lda Enemy_OffscreenBits ; get enemy object offscreen bits lda Enemy_OffscreenBits ; get enemy object offscreen bits
lsr ; move d0 to carry and result to stack lsr ; move d0 to carry and result to stack
pha
bcc M3FOfs ; branch if carry not set
lda #$f8 ; otherwise move sprite offscreen, this part likely
sta Sprite_Y_Position+12,y ; residual since flame is only made of three sprites
M3FOfs:
pla ; get bits from stack
lsr ; move d1 to carry and move bits back to stack lsr ; move d1 to carry and move bits back to stack
pha pha
bcc M2FOfs ; branch if carry not set again bcc M2FOfs ; branch if carry not set again
lda #$f8 ; otherwise move third sprite offscreen lda #$f8 ; otherwise move third sprite offscreen
sta Sprite_Y_Position+8,y sta Sprite_Y_Position+8,y
M2FOfs: M2FOfs:
pla ; get bits from stack again pla ; get bits from stack
lsr ; move d2 to carry and move bits back to stack again lsr ; move d2 to carry and move bits back to stack
pha pha
bcc M1FOfs ; branch if carry not set yet again bcc M1FOfs ; branch if carry not set yet again
lda #$f8 ; otherwise move second sprite offscreen lda #$f8 ; otherwise move second sprite offscreen
@ -11283,7 +11210,6 @@ FirebarSpin:
sta $07 ; save spinning speed here sta $07 ; save spinning speed here
lda FirebarSpinDirection,x ; check spinning direction lda FirebarSpinDirection,x ; check spinning direction
bne SpinCounterClockwise ; if moving counter-clockwise, branch to other part bne SpinCounterClockwise ; if moving counter-clockwise, branch to other part
ldy #$18 ; possibly residual ldy
lda FirebarSpinState_Low,x lda FirebarSpinState_Low,x
clc ; add spinning speed to what would normally be clc ; add spinning speed to what would normally be
adc $07 ; the horizontal speed adc $07 ; the horizontal speed
@ -11293,7 +11219,6 @@ FirebarSpin:
rts rts
SpinCounterClockwise: SpinCounterClockwise:
ldy #$08 ; possibly residual ldy
lda FirebarSpinState_Low,x lda FirebarSpinState_Low,x
sec ; subtract spinning speed to what would normally be sec ; subtract spinning speed to what would normally be
sbc $07 ; the horizontal speed sbc $07 ; the horizontal speed
@ -11620,11 +11545,9 @@ ExDPl:
rts ; leave rts ; leave
;-------------------------------- ;--------------------------------
; $00 - residual value from sub
RightPlatform: RightPlatform:
jsr MoveEnemyHorizontally ; move platform with current horizontal speed, if any jsr MoveEnemyHorizontally ; move platform with current horizontal speed, if any
sta $00 ; store saved value here (residual code)
lda PlatformCollisionFlag,x ; check collision flag, if no collision between player lda PlatformCollisionFlag,x ; check collision flag, if no collision between player
bmi ExRPl ; and platform, branch ahead, leave speed unaltered bmi ExRPl ; and platform, branch ahead, leave speed unaltered
lda #$10 lda #$10
@ -11954,9 +11877,6 @@ NoPUp:
;-------------------------------- ;--------------------------------
ResidualXSpdData:
.byte $18, $e8
KickedShellXSpdData: KickedShellXSpdData:
.byte $30, $d0 .byte $30, $d0
@ -13259,7 +13179,6 @@ ChkLandedEnemyState:
beq ProcEnemyDirection ; then branch elsewhere beq ProcEnemyDirection ; then branch elsewhere
cmp #$03 ; if already in state used by koopas and buzzy beetles cmp #$03 ; if already in state used by koopas and buzzy beetles
bcs ExSteChk ; or in higher numbered state, branch to leave bcs ExSteChk ; or in higher numbered state, branch to leave
lda Enemy_State,x ; load enemy state again (why?)
cmp #$02 ; if not in $02 state (used by koopas and buzzy beetles) cmp #$02 ; if not in $02 state (used by koopas and buzzy beetles)
bne ProcEnemyDirection ; then branch elsewhere bne ProcEnemyDirection ; then branch elsewhere
lda #$10 ; load default timer here lda #$10 ; load default timer here
@ -13766,21 +13685,12 @@ BlockBufferChk_Enemy:
pla ; pull A from stack and jump elsewhere pla ; pull A from stack and jump elsewhere
jmp BBChk_E jmp BBChk_E
ResidualMiscObjectCode:
txa
clc ; supposedly used once to set offset for
adc #$0d ; miscellaneous objects
tax
ldy #$1b ; supposedly used once to set offset for block buffer data
jmp ResJmpM ; probably used in early stages to do misc to bg collision detection
BlockBufferChk_FBall: BlockBufferChk_FBall:
ldy #$1a ; set offset for block buffer adder data ldy #$1a ; set offset for block buffer adder data
txa txa
clc clc
adc #$07 ; add seven bytes to use adc #$07 ; add seven bytes to use
tax tax
ResJmpM:
lda #$00 ; set A to return vertical coordinate lda #$00 ; set A to return vertical coordinate
BBChk_E: BBChk_E:
jsr BlockBufferCollision ; do collision detection subroutine for sprite object jsr BlockBufferCollision ; do collision detection subroutine for sprite object
@ -14015,7 +13925,7 @@ NoHOffscr:
;------------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------------
; $00-$01 - used to hold tile numbers ($01 addressed in draw floatey number part) ; $00-$01 - used to hold tile numbers ($01 addressed in draw floatey number part)
; $02 - used to hold Y coordinate for floatey number ; $02 - used to hold Y coordinate for floatey number
; $03 - residual byte used for flip (but value set here affects nothing) ; $03 - used for flip
; $04 - attribute byte for floatey number ; $04 - attribute byte for floatey number
; $05 - used as X coordinate for floatey number ; $05 - used as X coordinate for floatey number
@ -14044,7 +13954,7 @@ FlagpoleGfxHandler:
lda FlagpoleFNum_Y_Pos ; get vertical coordinate for floatey number lda FlagpoleFNum_Y_Pos ; get vertical coordinate for floatey number
sta $02 ; store it here sta $02 ; store it here
lda #$01 lda #$01
sta $03 ; set value for flip which will not be used, and sta $03 ; set value for flip, and
sta $04 ; attribute byte for floatey number sta $04 ; attribute byte for floatey number
sta Sprite_Attributes,y ; set attribute bytes for all three sprites sta Sprite_Attributes,y ; set attribute bytes for all three sprites
sta Sprite_Attributes+4,y sta Sprite_Attributes+4,y
@ -14628,7 +14538,6 @@ CheckToAnimateEnemy:
ldy #$00 ldy #$00
cmp #$15 ; check for mushroom retainer/princess object cmp #$15 ; check for mushroom retainer/princess object
bne CheckForSecondFrame ; which uses different code here, branch if not found bne CheckForSecondFrame ; which uses different code here, branch if not found
iny ; residual instruction
lda WorldNumber ; are we on world 8? lda WorldNumber ; are we on world 8?
cmp #World8 cmp #World8
bcs CheckDefeatedState ; if so, leave the offset alone (use princess) bcs CheckDefeatedState ; if so, leave the offset alone (use princess)
@ -16207,9 +16116,6 @@ PowerUpGrabFreqData:
.byte $28, $4a, $50, $4a, $64, $3c, $32, $3c, $32 .byte $28, $4a, $50, $4a, $64, $3c, $32, $3c, $32
.byte $2c, $24, $3a, $64, $3a, $34, $2c, $22, $2c .byte $2c, $24, $3a, $64, $3a, $34, $2c, $22, $2c
; residual frequency data
.byte $22, $1c, $14
PUp_VGrow_FreqData: PUp_VGrow_FreqData:
.byte $14, $04, $22, $24, $16, $04, $24, $26 ; used by both .byte $14, $04, $22, $24, $16, $04, $24, $26 ; used by both
.byte $18, $04, $26, $28, $1a, $04, $28, $2a .byte $18, $04, $26, $28, $1a, $04, $28, $2a
@ -16526,8 +16432,7 @@ HandleAreaMusicLoopB:
bne GMLoopB ; unconditional branch bne GMLoopB ; unconditional branch
FindAreaMusicHeader: FindAreaMusicHeader:
ldy #$08 ; load Y for offset of area music ldy #$08 ; load Y for offset of area music
sty MusicOffset_Square2 ; residual instruction here
FindEventMusicHeader: FindEventMusicHeader:
iny ; increment Y pointer based on previously loaded queue contents iny ; increment Y pointer based on previously loaded queue contents
@ -16893,9 +16798,6 @@ Star_CloudHdr:
EndOfLevelMusHdr: EndOfLevelMusHdr:
.byte $20, <WinLevelMusData, >WinLevelMusData, $3d, $21 .byte $20, <WinLevelMusData, >WinLevelMusData, $3d, $21
ResidualHeaderData:
.byte $20, $c4, $fc, $3f, $1d
UndergroundMusHdr: UndergroundMusHdr:
.byte $18, <UndergroundMusData, >UndergroundMusData, $00, $00 .byte $18, <UndergroundMusData, >UndergroundMusData, $00, $00