Applied labels and byte designators

This commit is contained in:
codemann8
2024-04-05 20:50:04 -05:00
committed by aerinon
parent 2e2b493240
commit a70251d2b2
114 changed files with 2786 additions and 2970 deletions

View File

@@ -383,39 +383,3 @@ org $80D25B ; 0x525B - HUD Main L
db GFX_HUD_Main db GFX_HUD_Main
;================================================================================ ;================================================================================
org $828AD9
Underworld_SetBossOrSancMusicUponEntry:
org $02C11D
CalculateTransitionLanding:
org $02D9B9
Underworld_LoadSpawnEntrance:
org $08C505
Ancilla_ReceiveItem_objectFinished:
org $08CE2E
GTCutscene_AnimateCrystals_NoRotate:
org $08CEB6
GTCutscene_DrawSingleCrystal_SkipCrystal:
org $08CEC3
GTCutscene_DrawSingleCrystal_SkipSparkle:
org $08CF59
GTCutscene_SparkleALot:
org $098605
AddReceivedItem_notCrystal:
org $098766
AddReceivedItem_gfxHandling:
org $8AE817
DungeonMapBossRooms:

View File

@@ -153,7 +153,7 @@ RestoreBgEther:
INX #2 : CPX.b #$10 : BNE - INX #2 : CPX.b #$10 : BNE -
BRA ++ BRA ++
++ ++
JML $82FF51 ; Bank0E.asm : 3936 vanilla restore routine after loop which RTLs JML Palette_RestoreFixedColor-7 ; Bank0E.asm : 3936 vanilla restore routine after loop which RTLs
;================================================================================ ;================================================================================
DDMConditionalLightning: DDMConditionalLightning:
LDA.l DisableFlashing LDA.l DisableFlashing
@@ -161,7 +161,7 @@ DDMConditionalLightning:
BNE + BNE +
LDA.w Scrap LDA.w Scrap
LDX.b #$02 LDX.b #$02
JML $87FA7F ; Bank0E.asm : 4738 vanilla loop equivalent to below beginning at LDY #$00 JML FlashGanonTowerPalette_next_thunder-2 ; Bank0E.asm : 4738 vanilla loop equivalent to below beginning at LDY #$00
+ +
LDA.b Scrap00 : LDX.b #$02 : LDY.b #$00 LDA.b Scrap00 : LDX.b #$02 : LDY.b #$00
- -
@@ -172,7 +172,7 @@ DDMConditionalLightning:
LDA.w $F523, Y : LDA.l PaletteBuffer+$F0, X LDA.w $F523, Y : LDA.l PaletteBuffer+$F0, X
INY #2 INY #2
INX #2 : CPX.b #$10 : BNE - INX #2 : CPX.b #$10 : BNE -
JML $87FAAC ; Bank0E.asm : 4754 both branches converge here JML FlashGanonTowerPalette_bright_white ; Bank0E.asm : 4754 both branches converge here
;================================================================================ ;================================================================================
ConditionalGTFlash: ConditionalGTFlash:
LDA.l DisableFlashing : REP #$20 : BNE + LDA.l DisableFlashing : REP #$20 : BNE +
@@ -222,17 +222,17 @@ LoadElectroPalette:
LDA.w #$0404 : STA.b Scrap0E LDA.w #$0404 : STA.b Scrap0E
LDA.w #$001B : STA.b Scrap02 LDA.w #$001B : STA.b Scrap02
SEP #$10 SEP #$10
LDX.b Scrap0C : LDA.l $9BEBB4, X : AND.w #$00FF : ADC.w #$D630 LDX.b Scrap0C : LDA.l SwordPaletteOffsets, X : AND.w #$00FF : ADC.w #$D630
REP #$10 : LDX.w #$01B2 : LDY.w #$0002 REP #$10 : LDX.w #$01B2 : LDY.w #$0002
JSR ConditionalLoadGearPalette JSR ConditionalLoadGearPalette
SEP #$10 SEP #$10
LDX.b Scrap0D LDX.b Scrap0D
LDA.l $9BEBC1, X : AND.w #$00FF : ADC.w #$D648 LDA.l ShieldPaletteOffsets, X : AND.w #$00FF : ADC.w #$D648
REP #$10 : LDX.w #$01B8 : LDY.w #$0003 REP #$10 : LDX.w #$01B8 : LDY.w #$0003
JSR ConditionalLoadGearPalette JSR ConditionalLoadGearPalette
SEP #$10 SEP #$10
LDX.b Scrap0E LDX.b Scrap0E
LDA.l $9BEC06, X : AND.w #$00FF : ASL A : ADC.w #$D308 LDA.l LinkMailPalettesOffsets, X : AND.w #$00FF : ASL A : ADC.w #$D308
REP #$10 : LDX.w #$01E2 : LDY.w #$000E REP #$10 : LDX.w #$01E2 : LDY.w #$000E
JSR ConditionalLoadGearPalette JSR ConditionalLoadGearPalette
SEP #$30 SEP #$30

View File

@@ -4,22 +4,22 @@
LoadLibraryItemGFX: LoadLibraryItemGFX:
LDA.l LibraryItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID LDA.l LibraryItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues) %GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues)
JSL.l AttemptItemSubstitution JSL AttemptItemSubstitution
JSL.l ResolveLootIDLong JSL ResolveLootIDLong
STA.w SpriteID, X STA.w SpriteID, X
JSL.l PrepDynamicTile_loot_resolved JSL PrepDynamicTile_loot_resolved
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DrawLibraryItemGFX: DrawLibraryItemGFX:
PHA PHA
LDA.w SpriteID, X LDA.w SpriteID, X
JSL.l DrawDynamicTile JSL DrawDynamicTile
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SetLibraryItem: SetLibraryItem:
LDY.w SpriteID, X LDY.w SpriteID, X
JSL.l ItemSet_Library ; contains thing we wrote over JSL ItemSet_Library ; contains thing we wrote over
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -31,13 +31,13 @@ LoadBonkItemGFX:
LDA.b #$08 : STA.w SpriteOAMProp, X ; thing we wrote over LDA.b #$08 : STA.w SpriteOAMProp, X ; thing we wrote over
LoadBonkItemGFX_inner: LoadBonkItemGFX_inner:
LDA.b #$00 : STA.l RedrawFlag LDA.b #$00 : STA.l RedrawFlag
JSR LoadBonkItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID JSR LoadBonkItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSR LoadBonkItem JSR LoadBonkItem
JSL.l AttemptItemSubstitution JSL AttemptItemSubstitution
JSL.l ResolveLootIDLong JSL ResolveLootIDLong
STA.w SpriteItemType, X STA.w $0E80, X
STA.w SpriteID, X STA.w SpriteID, X
JSL.l PrepDynamicTile JSL PrepDynamicTile
PHA : PHX PHA : PHX
LDA.w SpriteID,X : TAX LDA.w SpriteID,X : TAX
LDA.l SpriteProperties_standing_width,X : BNE + LDA.l SpriteProperties_standing_width,X : BNE +
@@ -49,37 +49,37 @@ RTL
DrawBonkItemGFX: DrawBonkItemGFX:
PHA PHA
LDA.l RedrawFlag : BEQ .skipInit LDA.l RedrawFlag : BEQ .skipInit
JSL.l LoadBonkItemGFX_inner JSL LoadBonkItemGFX_inner
BRA .done ; don't draw on the init frame BRA .done ; don't draw on the init frame
.skipInit .skipInit
LDA.w SpriteID,X LDA.w SpriteID,X
JSL.l DrawDynamicTileNoShadow JSL DrawDynamicTileNoShadow
.done .done
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
GiveBonkItem: GiveBonkItem:
JSR LoadBonkItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID JSR LoadBonkItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
JSR LoadBonkItem JSR LoadBonkItem
JSR.w AbsorbKeyCheck : BCC .notKey JSR AbsorbKeyCheck : BCC .notKey
.key .key
PHY : LDY.b #$24 : JSL.l AddInventory : PLY ; do inventory processing for a small key PHY : LDY.b #$24 : JSL AddInventory : PLY ; do inventory processing for a small key
LDA.l CurrentSmallKeys : INC A : STA.l CurrentSmallKeys LDA.l CurrentSmallKeys : INC A : STA.l CurrentSmallKeys
LDA.b #$2F : JSL.l Sound_SetSfx3PanLong LDA.b #$2F : JSL Sound_SetSfx3PanLong
INC.w UpdateHUDFlag INC.w UpdateHUDFlag
RTL RTL
.notKey .notKey
PHY : TAY : JSL.l Link_ReceiveItem : PLY PHY : TAY : JSL Link_ReceiveItem : PLY
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LoadBonkItem: LoadBonkItem:
LDA.b RoomIndex ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte LDA.b RoomIndex ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP.b #115 : BNE + ; Desert Bonk Key CMP.b #$73 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert LDA.l BonkKey_Desert
BRA ++ BRA ++
+ : CMP.b #140 : BNE + ; GTower Bonk Key + : CMP.b #$8C : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower LDA.l BonkKey_GTower
BRA ++ BRA ++
+ +
@@ -88,11 +88,11 @@ LoadBonkItem:
RTS RTS
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LoadBonkItem_Player: LoadBonkItem_Player:
LDA $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte LDA.b RoomIndex ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP #115 : BNE + ; Desert Bonk Key CMP.b #$73 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert_Player LDA.l BonkKey_Desert_Player
BRA ++ BRA ++
+ : CMP #140 : BNE + ; GTower Bonk Key + : CMP.b #$8C : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower_Player LDA.l BonkKey_GTower_Player
BRA ++ BRA ++
+ +

View File

@@ -8,7 +8,7 @@ ModifyBoots:
+ : CMP.b #$02 : BNE + + : CMP.b #$02 : BNE +
PLA : AND.l AbilityFlags : AND.b #$FB : RTL ; no boots PLA : AND.l AbilityFlags : AND.b #$FB : RTL ; no boots
+ : LDA.l FakeBoots : CMP.b #$01 : BNE + + : LDA.l FakeBoots : CMP.b #$01 : BNE +
LDA.b LinkSlipping : BEQ ++ : LDA.b $59 : BNE + ; hover check LDA.b LinkSlipping : BEQ ++ : LDA.b PitTileActField : BNE + ; hover check
++ : PLA : AND.l AbilityFlags : ORA.b #$04 : RTL ; yes boots, not hovering ++ : PLA : AND.l AbilityFlags : ORA.b #$04 : RTL ; yes boots, not hovering
+ +
PLA PLA
@@ -17,15 +17,15 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
AddBonkTremors: AddBonkTremors:
PHA PHA
LDA.b $46 : BNE + ; Check for incapacitated Link LDA.b LinkIncapacitatedTimer : BNE + ; Check for incapacitated Link
JSL.l IncrementBonkCounter JSL IncrementBonkCounter
+ +
LDA.l BootsModifier : CMP.b #$01 : BEQ + LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BNE + ; Check for Boots LDA.l BootsEquipment : BNE + ; Check for Boots
PLA : RTL PLA : RTL
+ +
PLA PLA
JSL.l AddDashTremor : JSL.l Player_ApplyRumbleToSprites ; things we wrote over JSL AddDashTremor : JSL Player_ApplyRumbleToSprites ; things we wrote over
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
BonkBreakableWall: BonkBreakableWall:
@@ -36,7 +36,7 @@ BonkBreakableWall:
PLP : PLX : LDA.w #$0000 : RTL PLP : PLX : LDA.w #$0000 : RTL
+ +
PLP : PLX PLP : PLX
LDA.w $0372 : AND.w #$00FF ; things we wrote over LDA.w LinkDashing : AND.w #$00FF ; things we wrote over
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
BonkRockPile: BonkRockPile:
@@ -51,10 +51,10 @@ GravestoneHook:
LDA.l BootsModifier : CMP.b #$01 : BEQ + LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BEQ .done ; Check for Boots LDA.l BootsEquipment : BEQ .done ; Check for Boots
+ +
LDA.w $0372 : BEQ .done ; things we wrote over LDA.w LinkDashing : BEQ .done ; things we wrote over
JML.l moveGravestone JML moveGravestone
.done .done
JML.l GravestoneHook_continue JML GravestoneHook_continue
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
JumpDownLedge: JumpDownLedge:
LDA.l BootsModifier : CMP.b #$01 : BEQ + LDA.l BootsModifier : CMP.b #$01 : BEQ +

View File

@@ -51,7 +51,7 @@ DecideIfBunnyByScreenIndex:
LDA.b OverworldIndex : AND.b #$40 : PHA LDA.b OverworldIndex : AND.b #$40 : PHA
LDA.l InvertedMode : BNE .inverted LDA.l InvertedMode : BNE .inverted
.normal .normal
PLA : EOR #$40 PLA : EOR.b #$40
BRA .done BRA .done
.inverted .inverted
PLA PLA
@@ -60,7 +60,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FixBunnyOnExitToLightWorld: FixBunnyOnExitToLightWorld:
LDA.w BunnyFlag : BEQ + LDA.w BunnyFlag : BEQ +
JSL.l DecideIfBunny : BEQ + JSL DecideIfBunny : BEQ +
STZ.b LinkState ; set player mode to Normal STZ.b LinkState ; set player mode to Normal
STZ.w BunnyFlag : STZ.b BunnyFlagDP ; return player graphics to normal STZ.w BunnyFlag : STZ.b BunnyFlagDP ; return player graphics to normal
+ +
@@ -183,7 +183,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Fix pedestal pull overlay ; Fix pedestal pull overlay
PedestalPullOverlayFix: PedestalPullOverlayFix:
LDA.b #$09 : STA.w AncillaGeneral, X ; the thing we wrote over LDA.b #$09 : STA.w AncillaGeneralF, X ; the thing we wrote over
LDA.b IndoorsFlag : BNE + LDA.b IndoorsFlag : BNE +
LDA.b OverworldIndex : CMP.b #$80 : BNE + LDA.b OverworldIndex : CMP.b #$80 : BNE +
LDA.b OverlayID : CMP.b #$97 LDA.b OverlayID : CMP.b #$97
@@ -235,7 +235,7 @@ ParadoxCaveGfxFix:
CPX.w #$1E00 : BEQ .uploadLine CPX.w #$1E00 : BEQ .uploadLine
.uploadLine .uploadLine
LDA.b #$01 : STA.w MDMAEN LDA.b #$01 : STA.w DMAENABLE
.skipLine .skipLine
RTL RTL
@@ -246,7 +246,7 @@ ParadoxCaveGfxFix:
BRA .uploadLine BRA .uploadLine
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SetItemRiseTimer: SetItemRiseTimer:
LDA.w ItemReceiptMethod : CMP #$01 : BNE .not_from_chest LDA.w ItemReceiptMethod : CMP.b #$01 : BNE .not_from_chest
LDA.b #$38 : STA.w AncillaTimer, X LDA.b #$38 : STA.w AncillaTimer, X
RTL RTL
.not_from_chest .not_from_chest

View File

@@ -19,14 +19,14 @@ InvertDPad:
LDA.b #$80 : STA.w WRIO ; reset this so latch can read it, otherwise RNG breaks LDA.b #$80 : STA.w WRIO ; reset this so latch can read it, otherwise RNG breaks
JML.l InvertDPadReturn JML InvertDPadReturn
.crowd_control .crowd_control
LDA.l ControllerInverter : BNE + LDA.l ControllerInverter : BNE +
LDA.w JOY1L : STA.b Scrap00 LDA.w JOY1L : STA.b Scrap00
LDA.w JOY1H : STA.b Scrap01 LDA.w JOY1H : STA.b Scrap01
JML.l InvertDPadReturn JML InvertDPadReturn
+ DEC : BEQ .dpadOnly + DEC : BEQ .dpadOnly
DEC : BEQ .buttonsOnly DEC : BEQ .buttonsOnly
@@ -40,7 +40,7 @@ InvertDPad:
BIT.w #$8400 : BEQ + : EOR.w #$8400 : + ; swap B/down BIT.w #$8400 : BEQ + : EOR.w #$8400 : + ; swap B/down
STA.b Scrap00 STA.b Scrap00
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn JML InvertDPadReturn
.invertBoth .invertBoth
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA.w JOY1L LDA.w JOY1L
@@ -50,7 +50,7 @@ JML.l InvertDPadReturn
BIT.w #$0300 : BEQ + : EOR.w #$0300 : + ; swap left/right BIT.w #$0300 : BEQ + : EOR.w #$0300 : + ; swap left/right
STA.b Scrap00 STA.b Scrap00
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn JML InvertDPadReturn
.buttonsOnly .buttonsOnly
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA.w JOY1L LDA.w JOY1L
@@ -58,14 +58,14 @@ JML.l InvertDPadReturn
BIT.w #$4080 : BEQ + : EOR.w #$4080 : + ; swap Y/A BIT.w #$4080 : BEQ + : EOR.w #$4080 : + ; swap Y/A
STA.b Scrap00 STA.b Scrap00
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn JML InvertDPadReturn
.dpadOnly .dpadOnly
LDA.w JOY1L : STA.b Scrap00 LDA.w JOY1L : STA.b Scrap00
LDA.w JOY1H LDA.w JOY1H
BIT.b #$0C : BEQ + : EOR.b #$0C : + ; swap up/down BIT.b #$0C : BEQ + : EOR.b #$0C : + ; swap up/down
BIT.b #$03 : BEQ + : EOR.b #$03 : + ; swap left/right BIT.b #$03 : BEQ + : EOR.b #$03 : + ; swap left/right
STA.b Scrap01 STA.b Scrap01
JML.l InvertDPadReturn JML InvertDPadReturn
.onemind_controller_offset .onemind_controller_offset
db 0 ; player 0 - JOY1L - joy1d1 db 0 ; player 0 - JOY1L - joy1d1
@@ -75,8 +75,6 @@ JML.l InvertDPadReturn
db 2 ; player 4 - JOY2L - joy2d1 db 2 ; player 4 - JOY2L - joy2d1
db 6 ; player 5 - JOY4L - joy2d2 db 6 ; player 5 - JOY4L - joy2d2
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
HandleOneMindController: HandleOneMindController:
@@ -119,5 +117,5 @@ HandleOneMindController:
.no_onemind .no_onemind
STZ.b NMIDoneFlag STZ.b NMIDoneFlag
JML $808034 ; reset frame loop JML MainGameLoop ; reset frame loop

View File

@@ -3,19 +3,19 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DarkWorldSaveFix: DarkWorldSaveFix:
LDA.b #$70 : PHA : PLB ; thing we wrote over - data bank change LDA.b #$70 : PHA : PLB ; thing we wrote over - data bank change
JSL.l MasterSwordFollowerClear JSL MasterSwordFollowerClear
JML.l StatSaveCounter JML StatSaveCounter
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DoWorldFix: DoWorldFix:
LDA.l InvertedMode : BEQ + LDA.l InvertedMode : BEQ +
JMP DoWorldFix_Inverted JMP DoWorldFix_Inverted
+ +
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA.l FollowerIndicator : CMP.b #$04 : BEQ .setLightWorld ; check if old man is following LDA.l FollowerIndicator : CMP.b #$04 : BEQ .setLightWorld ; check if old man is following
LDA MirrorEquipment : AND #$02 : BEQ .noMirror ; check if we have the mirror LDA.l MirrorEquipment : AND.b #$02 : BEQ .noMirror ; check if we have the mirror
.skip_mirror_check ; alt entrance point .skip_mirror_check ; alt entrance point
LDA.l ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive LDA.l ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.setLightWorld .setLightWorld
LDA.b #$00 LDA.b #$00
.noMirror .noMirror
STA.l CurrentWorld ; set flag to light world STA.l CurrentWorld ; set flag to light world
@@ -31,7 +31,7 @@ SetDeathWorldChecked:
LDA.w DungeonID : CMP.b #$FF : BNE .dungeon LDA.w DungeonID : CMP.b #$FF : BNE .dungeon
LDA.b RoomIndex : ORA.b RoomIndex+1 : BNE ++ LDA.b RoomIndex : ORA.b RoomIndex+1 : BNE ++
LDA.l GanonPyramidRespawn : BNE .pyramid ; if flag is set, force respawn at pyramid on death to ganon LDA.l GanonPyramidRespawn : BNE .pyramid ; if flag is set, force respawn at pyramid on death to ganon
++ ++
.outdoors .outdoors
JMP DoWorldFix JMP DoWorldFix
@@ -47,11 +47,11 @@ RTL
;================================================================================ ;================================================================================
DoWorldFix_Inverted: DoWorldFix_Inverted:
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA.l FollowerIndicator : CMP.b #$04 : BEQ .setDarkWorld ; check if old man is following LDA.l FollowerIndicator : CMP.b #$04 : BEQ .setDarkWorld ; check if old man is following
LDA.l MirrorEquipment : AND #$02 : BEQ .setDarkWorld ; check if we have the mirror LDA.l MirrorEquipment : AND.b #$02 : BEQ .setDarkWorld ; check if we have the mirror
.skip_mirror_check ; alt entrance point .skip_mirror_check ; alt entrance point
LDA.l ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive LDA.l ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.setDarkWorld .setDarkWorld
LDA.b #$40 : STA.l CurrentWorld ; set flag to dark world LDA.b #$40 : STA.l CurrentWorld ; set flag to dark world
LDA.l FollowerIndicator LDA.l FollowerIndicator
CMP.b #$07 : BEQ .clear ; clear frog CMP.b #$07 : BEQ .clear ; clear frog

View File

@@ -142,13 +142,13 @@ TransferItemToVRAM:
STA.w $2116 STA.w $2116
LDX.b #$01 LDX.b #$01
STX.w $420B STX.w DMAENABLE
ADC.w #$0100 ADC.w #$0100
STA.w $2116 STA.w $2116
INX INX
STX.w $420B STX.w DMAENABLE
STZ.w ItemGFXPtr STZ.w ItemGFXPtr
STZ.w ItemGFXTarget STZ.w ItemGFXTarget
@@ -248,9 +248,9 @@ endmacro
FastSpriteDecomp: FastSpriteDecomp:
SEP #$30 SEP #$30
LDA.l $80CFC0,X : PHA : PLB ; bank LDA.l GFXSheetPointers_background_bank,X : PHA : PLB
LDA.l $80D09F,X : XBA ; high LDA.l GFXSheetPointers_background_high,X : XBA
LDA.l $80D17E,X ; low LDA.l GFXSheetPointers_background_low,X
REP #$10 REP #$10

View File

@@ -4,7 +4,7 @@ LoadStaticDecryptionKey:
PHB : PHA : PHX : PHY : PHP PHB : PHA : PHX : PHY : PHP
REP #$30 ; set 16-bit accumulator & index registers REP #$30 ; set 16-bit accumulator & index registers
LDX.w #StaticDecryptionKey ; Source LDX.w #StaticDecryptionKey ; Source
LDY.w #KeyBase ; Target LDY.w #KeyBase ; Target
LDA.w #$000F ; Length LDA.w #$000F ; Length
MVN $307F MVN $307F
@@ -24,14 +24,14 @@ RetrieveValueFromEncryptedTable:
LDY.b Scrap0A : PHY : LDY.b Scrap0C : PHY : LDY.b Scrap0E : PHY LDY.b Scrap0A : PHY : LDY.b Scrap0C : PHY : LDY.b Scrap0E : PHY
AND.w #$FFF8 : TAY AND.w #$FFF8 : TAY
LDA.b [$00], Y : STA.l CryptoBuffer : INY #2 LDA.b [Scrap00], Y : STA.l CryptoBuffer : INY #2
LDA.b [$00], Y : STA.l CryptoBuffer+2 : INY #2 LDA.b [Scrap00], Y : STA.l CryptoBuffer+2 : INY #2
LDA.b [$00], Y : STA.l CryptoBuffer+4 : INY #2 LDA.b [Scrap00], Y : STA.l CryptoBuffer+4 : INY #2
LDA.b [$00], Y : STA.l CryptoBuffer+6 LDA.b [Scrap00], Y : STA.l CryptoBuffer+6
LDA.w #$0002 : STA.b Scrap04 ;set block size LDA.w #$0002 : STA.b Scrap04 ;set block size
JSL.l XXTEA_Decode JSL XXTEA_Decode
PLA : STA.b Scrap0E : PLA : STA.b Scrap0C : PLA : STA.b Scrap0A PLA : STA.b Scrap0E : PLA : STA.b Scrap0C : PLA : STA.b Scrap0A
PLA : STA.b Scrap08 : PLA : STA.b Scrap06 : PLA : STA.b Scrap04 PLA : STA.b Scrap08 : PLA : STA.b Scrap06 : PLA : STA.b Scrap04
@@ -53,7 +53,7 @@ ChestDataPayload = $01EABC ; ChestData+$0150
GetChestData: GetChestData:
LDA.l IsEncrypted : BNE .encrypted LDA.l IsEncrypted : BNE .encrypted
INC.b Scrap0E : LDX.w #$FFFD ; what we wrote over INC.b Scrap0E : LDX.w #$FFFD ; what we wrote over
JML.l Dungeon_OpenKeyedObject_nextChest JML Dungeon_OpenKeyedObject_nextChest
.encrypted .encrypted
INC.b Scrap0E : LDX.w #$FFFE INC.b Scrap0E : LDX.w #$FFFE
@@ -78,10 +78,10 @@ JML.l Dungeon_OpenKeyedObject_nextChest
LDA.l ChestData, X : ASL A : BCC .smallChest LDA.l ChestData, X : ASL A : BCC .smallChest
JML.l Dungeon_OpenKeyedObject_bigChest ;(bank01.asm line #13783) JML Dungeon_OpenKeyedObject_bigChest ;(bank01.asm line #13783)
.smallChest .smallChest
JML.l Dungeon_OpenKeyedObject_smallChest JML Dungeon_OpenKeyedObject_smallChest
.couldntFindChest .couldntFindChest
JML.l Dungeon_OpenKeyedObject_couldntFindChest JML Dungeon_OpenKeyedObject_couldntFindChest
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -21,7 +21,7 @@ macro LoadDialogAddress(address)
PHB : PHK : PLB PHB : PHK : PLB
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
REP #$10 ; set 16-bit index registers REP #$10 ; set 16-bit index registers
PEI.b ($00) PEI.b (Scrap00)
LDA.b Scrap02 : PHA LDA.b Scrap02 : PHA
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$01 : STA.l AltTextFlag ; set flag LDA.b #$01 : STA.l AltTextFlag ; set flag
@@ -44,7 +44,7 @@ endmacro
macro CopyDialogIndirect() macro CopyDialogIndirect()
REP #$20 : LDA.l DialogOffsetPointer : TAX : LDY.w #$0000 : SEP #$20 ; copy 2-byte offset pointer to X and set Y to 0 REP #$20 : LDA.l DialogOffsetPointer : TAX : LDY.w #$0000 : SEP #$20 ; copy 2-byte offset pointer to X and set Y to 0
?loop: ?loop:
LDA.b [$00], Y ; load the next character from the pointer LDA.b [Scrap00], Y ; load the next character from the pointer
STA.l DialogBuffer, X ; write to the buffer STA.l DialogBuffer, X ; write to the buffer
INX : INY INX : INY
CMP.b #$7F : BNE ?loop CMP.b #$7F : BNE ?loop
@@ -149,7 +149,7 @@ FreeDungeonItemNotice:
.self_notice .self_notice
SEP #$20 SEP #$20
%CopyDialog(Notice_Self) %CopyDialog(Notice_Self)
JMP.w .done JMP .done
+ +
SEP #$20 SEP #$20
LDA.w ScratchBufferNV+1 LDA.w ScratchBufferNV+1
@@ -228,7 +228,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DialogResetSelectionIndex: DialogResetSelectionIndex:
JSL.l Attract_DecompressStoryGfx ; what we wrote over JSL Attract_DecompressStoryGfx ; what we wrote over
STZ.w MessageCursor STZ.w MessageCursor
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -251,7 +251,7 @@ DialogFairyThrow:
ORA.l BottleContentsTwo : ORA.l BottleContentsThree : ORA.l BottleContentsFour : BNE .normal ORA.l BottleContentsTwo : ORA.l BottleContentsThree : ORA.l BottleContentsFour : BNE .normal
.noInventory .noInventory
LDA.w SpriteActivity, X : !ADD #$08 : STA.w SpriteActivity, X LDA.w SpriteActivity, X : !ADD.b #$08 : STA.w SpriteActivity, X
LDA.b #$51 LDA.b #$51
LDY.b #$01 LDY.b #$01
RTL RTL
@@ -261,14 +261,14 @@ RTL
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DialogGanon1: DialogGanon1:
JSL.l CheckGanonVulnerability JSL CheckGanonVulnerability
REP #$20 REP #$20
LDA.w #$018C LDA.w #$018C
BCC + BCC +
LDA.w #$016D LDA.w #$016D
+ STA.w TextID + STA.w TextID
SEP #$20 SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt JSL Sprite_ShowMessageMinimal_Alt
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; #$0192 - no bow ; #$0192 - no bow
@@ -280,7 +280,7 @@ RTL
; s = silver arrow bow ; s = silver arrow bow
; p = 2nd progressive bow ; p = 2nd progressive bow
DialogGanon2: DialogGanon2:
JSL.l CheckGanonVulnerability JSL CheckGanonVulnerability
REP #$20 REP #$20
BCS + BCS +
@@ -304,7 +304,7 @@ DialogGanon2:
++ ++
STA.w TextID STA.w TextID
SEP #$20 SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt JSL Sprite_ShowMessageMinimal_Alt
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DialogEtherTablet: DialogEtherTablet:
@@ -366,7 +366,7 @@ DialogBombShopGuy:
+ +
TYA TYA
LDY.b #$01 LDY.b #$01
JSL.l Sprite_ShowMessageUnconditional JSL Sprite_ShowMessageUnconditional
RTL RTL
;--------------------------------------------------------------------------------------------------- ;---------------------------------------------------------------------------------------------------
@@ -382,7 +382,7 @@ AgahnimAsksAboutPed:
STA.w TextID STA.w TextID
.vanilla .vanilla
JML $85FA8E ; Sprite_ShowMessageMinimal JML Sprite_ShowMessageMinimal
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
Main_ShowTextMessage_Alt: Main_ShowTextMessage_Alt:
; Are we in text mode? If so then end the routine. ; Are we in text mode? If so then end the routine.
@@ -474,7 +474,7 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_Alt:
; Make sure that the sprite is facing towards the player, otherwise ; Make sure that the sprite is facing towards the player, otherwise
; talking can't happen. (What sprites actually use this???) ; talking can't happen. (What sprites actually use this???)
LDA.l $85E1A3, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other LDA.l Sprite_ShowSolicitedMessage_Direction, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other
PHY PHY
@@ -531,7 +531,7 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage:
; Make sure that the sprite is facing towards the player, otherwise ; Make sure that the sprite is facing towards the player, otherwise
; talking can't happen. (What sprites actually use this???) ; talking can't happen. (What sprites actually use this???)
LDA.l $85E1A3, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other LDA.l Sprite_ShowSolicitedMessage_Direction, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other
PLA : XBA : PLA PLA : XBA : PLA

View File

@@ -8,7 +8,7 @@
StoreLastOverworldDoorID: StoreLastOverworldDoorID:
TXA : INC TXA : INC
STA.l PreviousOverworldDoor STA.l PreviousOverworldDoor
LDA.l $9BBB73, X : STA.w EntranceIndex LDA.l Overworld_Entrance_ID, X : STA.w EntranceIndex
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -42,49 +42,49 @@ RTL
; TurnAroundOnUnderworld ; TurnAroundOnUnderworld
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
TurnAroundOnUnderworld: TurnAroundOnUnderworld:
LDA $26 : BEQ .done LDA.b LinkPushDirection : BEQ .done
; turn around if ($010E == #$43) != ($7F5099 == #$43) ; turn around if ($010E == #$43) != ($7F5099 == #$43)
LDX #$00 LDX.b #$00
LDA #$43 : CMP $010E : BEQ + LDA.b #$43 : CMP.w EntranceIndex : BEQ +
INX INX
+ +
CMP $7F5099 : BEQ + CMP.l PreviousOverworldDoor : BEQ +
DEX DEX
+ +
CPX #$00 : BEQ .done CPX.b #$00 : BEQ .done
LDA $26 : EOR #$0C : STA $26 LDA.b LinkPushDirection : EOR.b #$0C : STA.b LinkPushDirection
.done .done
JML $0FFD65 ; what we overwrote JML Underworld_LoadCustomTileAttributes ; what we overwrote
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; TurnUpOnOverworld ; TurnUpOnOverworld
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
TurnUpOnOverworld: TurnUpOnOverworld:
LDA.l EntranceTavernBack : CMP #$43 : BEQ .done LDA.l EntranceTavernBack : CMP.b #$43 : BEQ .done
LDA #$08 : STA $26 ; only fix this glitch if exit not vanilla LDA.b #$08 : STA.b LinkPushDirection ; only fix this glitch if exit not vanilla
.done .done
JML $07E68F ; what we overwrote JML Link_HandleMovingAnimation_FullLongEntry ; what we overwrote
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; WalkUpOnOverworld ; WalkUpOnOverworld
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
WalkUpOnOverworld: WalkUpOnOverworld:
LDA $20 : CMP #$091B : BNE .normal ; hardcoded Y coordinate LDA.b LinkPosY : CMP.w #$091B : BNE .normal ; hardcoded Y coordinate
STZ $2F STZ.b LinkDirection
RTL RTL
.normal .normal
LDA #$0002 : STA $2F ; what we overwrote LDA.w #$0002 : STA.b LinkDirection ; what we overwrote
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; CheckStairsAdjustment ; CheckStairsAdjustment
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CheckStairsAdjustment: CheckStairsAdjustment:
LDA.b $A0 LDA.b RoomIndex
CMP.w #$0124 ; vanilla check, rooms $0124 to $0127 have a lower exit position (currently ER ignores the entrance location) CMP.w #$0124 ; vanilla check, rooms $0124 to $0127 have a lower exit position (currently ER ignores the entrance location)
BCC .done BCC .done
LDA.w #$FFFF-1 LDA.w #$FFFF-1
CMP.w $0696 ; tavern back ($0696 == #$FFFF) should always have carry cleared CMP.w TileMapEntranceDoors ; tavern back ($0696 == #$FFFF) should always have carry cleared
.done .done
RTL RTL
; if carry cleared, shift position up ; if carry cleared, shift position up

View File

@@ -13,31 +13,31 @@ pullpc
CheckKholdShellCoordinates: CheckKholdShellCoordinates:
LDA.w $0D30, X LDA.w SpritePosXHigh, X
XBA XBA
LDA.w $0D10, X ; full 16 bit X coordinate of sprite LDA.w SpritePosXLow, X ; full 16 bit X coordinate of sprite
REP #$21 ; carry is guaranteed clear REP #$21 ; carry is guaranteed clear
SBC.w #$0020 SBC.w #$0020
CMP.b $22 CMP.b LinkPosX
BCS .not_colliding BCS .not_colliding
ADC.w #$0040 ; carry is guaranteed clear ADC.w #$0040 ; carry is guaranteed clear
CMP.b $22 CMP.b LinkPosX
BCC .not_colliding BCC .not_colliding
SEP #$20 SEP #$20
LDA.w $0D20, X LDA.w SpritePosYHigh, X
XBA XBA
LDA.w $0D00, X ; full 16 bit Y coordinate of sprite LDA.w SpritePosYLow, X ; full 16 bit Y coordinate of sprite
REP #$21 ; carry is guaranteed clear REP #$21 ; carry is guaranteed clear
SBC.w #$001F ; could go to 27 and still let link squeeze in SBC.w #$001F ; could go to 27 and still let link squeeze in
CMP.b $20 CMP.b LinkPosY
BCS .not_colliding BCS .not_colliding
ADC.w #$0037 ; carry is guaranteed clear ADC.w #$0037 ; carry is guaranteed clear
CMP.b $20 CMP.b LinkPosY
BCC .not_colliding BCC .not_colliding
SEP #$20 ; collision detected SEP #$20 ; collision detected

View File

@@ -1,9 +1,3 @@
!add = "clc : adc"
!addl = "clc : adc.l"
!sub = "sec : sbc"
!bge = "bcs"
!blt = "bcc"
; Free RAM notes ; Free RAM notes
; Normal doors use $AB-AC for scrolling indicator ; Normal doors use $AB-AC for scrolling indicator
; Normal doors use $FE to store the trap door indicator ; Normal doors use $FE to store the trap door indicator

View File

@@ -1,10 +1,10 @@
CheckDarkWorldSpawn: CheckDarkWorldSpawn:
STA $A0 : STA $048E ; what we wrote over STA.b RoomIndex : STA.w RoomIndexMirror ; what we wrote over
LDA.l DRFlags : AND #$0200 : BEQ + ; skip if the flag isn't set LDA.l DRFlags : AND.w #$0200 : BEQ + ; skip if the flag isn't set
LDA.l MoonPearlEquipment : AND #$00FF : BNE + ; moon pearl? LDA.l MoonPearlEquipment : AND.w #$00FF : BNE + ; moon pearl?
LDA.l LinksHouseDarkWorld : CMP $A0 : BEQ ++ LDA.l LinksHouseDarkWorld : CMP.b RoomIndex : BEQ ++
LDA.l SanctuaryDarkWorld : CMP $A0 : BEQ ++ LDA.l SanctuaryDarkWorld : CMP.b RoomIndex : BEQ ++
LDA.l OldManDarkWorld : CMP $A0 : BNE + LDA.l OldManDarkWorld : CMP.b RoomIndex : BNE +
++ SEP #$30 : LDA #$17 : STA $5D ++ SEP #$30 : LDA.b #$17 : STA.b LinkState
INC $02E0 : LDA.b #$40 : STA CurrentWorld : REP #$30 INC.w BunnyFlag : LDA.b #$40 : STA.l CurrentWorld : REP #$30
+ RTL + RTL

View File

@@ -67,7 +67,7 @@ jsl QuadrantLoadOrderAfterScroll
org $82895d ; Bank 02 line 1812 (JSL Dungeon_LoadRoom : JSL Dungeon_InitStarTileChr : JSL $00D6F9 : INC $B0) org $82895d ; Bank 02 line 1812 (JSL Dungeon_LoadRoom : JSL Dungeon_InitStarTileChr : JSL $00D6F9 : INC $B0)
Splicer: Splicer:
jsl GfxFixer jsl GfxFixer
lda $b1 : beq .done lda.b $b1 : beq .done
rts rts
nop #5 nop #5
.done .done
@@ -98,7 +98,7 @@ org $8ffd65 ;(PC: 07fd65)
Dungeon_LoadCustomTileAttr: Dungeon_LoadCustomTileAttr:
org $81feb0 org $81feb0
Dungeon_ApproachFixedColor: Dungeon_ApproachFixedColor:
;org $01fec1 ;org $81fec1
;Dungeon_ApproachFixedColor_variable: ;Dungeon_ApproachFixedColor_variable:
;org $a0f972 ; Rando version ;org $a0f972 ; Rando version
;LoadRoomHook: ;LoadRoomHook:
@@ -120,7 +120,7 @@ jsl MirrorCheckOverride
org $85ef47 org $85ef47
Sprite_HeartContainer_Override: ;sprite_heart_upgrades.asm : 96-100 (LDA $040C : CMP.b #$1A : BNE .not_in_ganons_tower) Sprite_HeartContainer_Override: ;sprite_heart_upgrades.asm : 96-100 (LDA $040C : CMP.b #$1A : BNE .not_in_ganons_tower)
jsl GtBossHeartCheckOverride : bcs .not_in_ganons_tower jsl GtBossHeartCheckOverride : bcs .not_in_ganons_tower
nop : stz $0dd0, X : rts nop : stz.w SpriteAITable, X : rts
.not_in_ganons_tower .not_in_ganons_tower
@@ -136,7 +136,7 @@ jsl EGFixOnMirror
org $82b82a org $82b82a
jsl FixShopCode jsl FixShopCode
org $9ddeea ; <- Bank1D.asm : 286 (JSL Sprite_LoadProperties) org $9ddeea ; <- Bank1D.asm : 286 (JSL SpritePrep_LoadProperties)
jsl VitreousKeyReset jsl VitreousKeyReset
org $9ed024 ; f5024 sprite_guruguru_bar.asm : 27 (LDA $040C : CMP.b #$12 : INY #2 org $9ed024 ; f5024 sprite_guruguru_bar.asm : 27 (LDA $040C : CMP.b #$12 : INY #2
@@ -170,7 +170,7 @@ org $8799de ; <- Bank07.asm : 4088 (LDA.b #$15 : STA $5D)
JSL StoreTempBunnyState JSL StoreTempBunnyState
; ;
org $88C450 ; <- ancilla_receive_item.asm : 146-148 (STY $5D : STZ $02D8) org $88C450 ; <- ancilla_receive_item.asm : 146-148 (STY $5D : STZ $02D8)
JSL RetrieveBunnyState : JMP.w $88C458 : NOP JSL RetrieveBunnyState : JMP.w + : NOP : +
org $82d9ce ; <- Bank02.asm : Dungeon_LoadEntrance 10829 (STA $A0 : STA $048E) org $82d9ce ; <- Bank02.asm : Dungeon_LoadEntrance 10829 (STA $A0 : STA $048E)
JSL CheckDarkWorldSpawn : NOP JSL CheckDarkWorldSpawn : NOP
@@ -188,7 +188,7 @@ Main_ShowTextMessage:
; Conditionally disable UW music changes in Door Rando ; Conditionally disable UW music changes in Door Rando
org $828ADB ; <- Bank02.asm:2088-2095 (LDX.b #$14 : LDA $A0 ...) org $828ADB ; <- Bank02.asm:2088-2095 (LDX.b #$14 : LDA $A0 ...)
JSL.l Underworld_DoorDown_Entry : CPX #$FF JSL Underworld_DoorDown_Entry : CPX.b #$FF
BEQ + : db $80, $1C ; BRA $028B04 BEQ + : db $80, $1C ; BRA $028B04
NOP #6 : + NOP #6 : +

View File

@@ -2,12 +2,12 @@
; Ram usage ; Ram usage
HorzEdge: HorzEdge:
cpy #$ff : beq + cpy.b #$ff : beq +
jsr DetectWestEdge : ldy #$02 : bra ++ jsr DetectWestEdge : ldy.b #$02 : bra ++
+ jsr DetectEastEdge + jsr DetectEastEdge
++ cmp #$ff : beq + ++ cmp.b #$ff : beq +
sta $00 : asl : !add $00 : tax sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
cpy #$ff : beq ++ cpy.b #$ff : beq ++
jsr LoadWestData : bra .main jsr LoadWestData : bra .main
++ jsr LoadEastData ++ jsr LoadEastData
.main .main
@@ -16,12 +16,12 @@ HorzEdge:
+ clc : rts + clc : rts
VertEdge: VertEdge:
cpy #$ff : beq + cpy.b #$ff : beq +
jsr DetectNorthEdge : bra ++ jsr DetectNorthEdge : bra ++
+ jsr DetectSouthEdge + jsr DetectSouthEdge
++ cmp #$ff : beq + ++ cmp.b #$ff : beq +
sta $00 : asl : !add $00 : tax sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
cpy #$ff : beq ++ cpy.b #$ff : beq ++
jsr LoadNorthData : bra .main jsr LoadNorthData : bra .main
++ jsr LoadSouthData ++ jsr LoadSouthData
.main .main
@@ -30,20 +30,20 @@ VertEdge:
+ clc : rts + clc : rts
LoadEdgeRoomHorz: LoadEdgeRoomHorz:
lda $03 : sta $a0 lda.b Scrap03 : sta.b RoomIndex
sty $06 sty.b Scrap06
and.b #$0f : asl a : !sub $23 : !add $06 : sta $02 and.b #$0f : asl a : !SUB.b LinkPosX+1 : !ADD.b Scrap06 : sta.b Scrap02
ldy #$00 : jsr ShiftVariablesMainDir ldy.b #$00 : jsr ShiftVariablesMainDir
lda $04 : and #$80 : bne .edge lda.b Scrap04 : and.b #$80 : bne .edge
lda $04 : sta $01 ; load up flags in $01 lda.b Scrap04 : sta.b Scrap01 ; load up flags in $01
jsr PrepScrollToNormal jsr PrepScrollToNormal
bra .scroll bra .scroll
.edge .edge
lda $04 : and #$10 : beq + lda.b Scrap04 : and.b #$10 : beq +
lda #$01 lda.b #$01
+ sta $ee ; layer stuff + sta.b LinkLayer ; layer stuff
jsr MathHorz jsr MathHorz
@@ -52,14 +52,14 @@ LoadEdgeRoomHorz:
rts rts
LoadEdgeRoomVert: LoadEdgeRoomVert:
lda $03 : sta $a0 lda.b Scrap03 : sta.b RoomIndex
sty $06 sty.b Scrap06
and.b #$f0 : lsr #3 : !sub $21 : !add $06 : sta $02 and.b #$f0 : lsr #3 : !SUB.b LinkPosY+1 : !ADD.b Scrap06 : sta.b Scrap02
lda $04 : and #$80 : bne .edge lda.b Scrap04 : and.b #$80 : bne .edge
lda $04 : sta $01 ; load up flags in $01 lda.b Scrap04 : sta.b Scrap01 ; load up flags in $01
and #$03 : cmp #$03 : beq .inroom and.b #$03 : cmp.b #$03 : beq .inroom
ldy #$01 : jsr ShiftVariablesMainDir ldy.b #$01 : jsr ShiftVariablesMainDir
jsr PrepScrollToNormal jsr PrepScrollToNormal
bra .scroll bra .scroll
@@ -68,13 +68,13 @@ LoadEdgeRoomVert:
rts rts
.edge .edge
ldy #$01 : jsr ShiftVariablesMainDir ldy.b #$01 : jsr ShiftVariablesMainDir
lda $04 : and #$10 : beq + lda.b Scrap04 : and.b #$10 : beq +
lda #$01 lda.b #$01
+ sta $ee ; layer stuff + sta.b LinkLayer ; layer stuff
jsr MathVert jsr MathVert
lda $03 lda.b Scrap03
.scroll .scroll
jsr ScrollX jsr ScrollX
@@ -82,220 +82,220 @@ LoadEdgeRoomVert:
MathHorz: MathHorz:
jsr MathStart : lda $20 jsr MathStart : lda.b LinkPosY
jsr MathMid : and #$0040 jsr MathMid : and.w #$0040
jsr MathEnd jsr MathEnd
rts rts
MathVert: MathVert:
jsr MathStart : lda $22 jsr MathStart : lda.b LinkPosX
jsr MathMid : and #$0020 jsr MathMid : and.w #$0020
jsr MathEnd jsr MathEnd
rts rts
MathStart: MathStart:
rep #$30 rep #$30
lda $08 : and #$00ff : sta $00 lda.b Scrap08 : and.w #$00ff : sta.b Scrap00
rts rts
MathMid: MathMid:
and #$01ff : !sub $00 : and #$00ff : sta $00 and.w #$01ff : !SUB.b Scrap00 : and.w #$00ff : sta.b Scrap00
; nothing should be bigger than $a0 at this point ; nothing should be bigger than $a0 at this point
lda $05 : and #$00f0 : lsr #4 : tax lda.b Scrap05 : and.w #$00f0 : lsr #4 : tax
lda MultDivInfo, x : and #$00ff : tay lda.w MultDivInfo, x : and.w #$00ff : tay
lda $00 : jsr MultiplyByY : sta $02 lda.b Scrap00 : jsr MultiplyByY : sta.b Scrap02
lda $07 : and #$00ff : jsr MultiplyByY : tax lda.b Scrap07 : and.w #$00ff : jsr MultiplyByY : tax
lda $05 : and #$000f : tay lda.b Scrap05 : and.w #$000f : tay
lda MultDivInfo, y : and #$00ff : tay lda.w MultDivInfo, y : and.w #$00ff : tay
lda $02 : jsr DivideByY : sta $00 lda.b Scrap02 : jsr DivideByY : sta.b Scrap00
lda $0c : and #$00ff : sta $02 lda.b Scrap0C : and.w #$00ff : sta.b Scrap02
lda $04 lda.b Scrap04
rts rts
MathEnd: MathEnd:
beq + beq +
lda #$0100 lda.w #$0100
+ !add $02 : !add $00 + !ADD.b Scrap02 : !ADD.b Scrap00
sta $04 sta.b Scrap04
sep #$30 sep #$30
rts rts
; don't need midpoint of edge Link is leaving (formerly in $06 - used by dir indicator) ; don't need midpoint of edge Link is leaving (formerly in $06 - used by dir indicator)
; don't need width of edge Link is going to (currently in $0b) ; don't need width of edge Link is going to (currently in $0b)
LoadNorthData: LoadNorthData:
lda NorthOpenEdge, x : sta $03 : inx ; target room lda.w NorthOpenEdge, x : sta.b Scrap03 : inx ; target room
lda NorthEdgeInfo, x : sta $07 ; needed for maths - (divide by 2 anyway) lda.w NorthEdgeInfo, x : sta.b Scrap07 ; needed for maths - (divide by 2 anyway)
lda NorthOpenEdge, x : sta $04 : inx ; bit field lda.w NorthOpenEdge, x : sta.b Scrap04 : inx ; bit field
lda NorthEdgeInfo, x : sta $08 ; needed for maths lda.w NorthEdgeInfo, x : sta.b Scrap08 ; needed for maths
lda NorthOpenEdge, x : sta $05 ; ratio lda.w NorthOpenEdge, x : sta.b Scrap05 ; ratio
lda $04 : jsr LoadSouthMidpoint : inx ; needed now, and for nrml transition lda.b Scrap04 : jsr LoadSouthMidpoint : inx ; needed now, and for nrml transition
lda SouthEdgeInfo, x : sta $0b : inx ; probably not needed todo: remove lda.w SouthEdgeInfo, x : sta.b Scrap0B : inx ; probably not needed todo: remove
lda SouthEdgeInfo, x : sta $0c ; needed for maths lda.w SouthEdgeInfo, x : sta.b Scrap0C ; needed for maths
rts rts
LoadSouthMidpoint: LoadSouthMidpoint:
and #$0f : sta $00 : asl : !add $00 : tax and.b #$0f : sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
lda SouthEdgeInfo, x : sta $0a ; needed now, and for nrml transition lda.w SouthEdgeInfo, x : sta.b Scrap0A ; needed now, and for nrml transition
rts rts
LoadSouthData: LoadSouthData:
lda SouthOpenEdge, x : sta $03 : inx lda.w SouthOpenEdge, x : sta.b Scrap03 : inx
lda SouthEdgeInfo, x : sta $07 lda.w SouthEdgeInfo, x : sta.b Scrap07
lda SouthOpenEdge, x : sta $04 : inx lda.w SouthOpenEdge, x : sta.b Scrap04 : inx
lda SouthEdgeInfo, x : sta $08 lda.w SouthEdgeInfo, x : sta.b Scrap08
lda SouthOpenEdge, x : sta $05 lda.w SouthOpenEdge, x : sta.b Scrap05
lda $04 : jsr LoadNorthMidpoint : inx lda.b Scrap04 : jsr LoadNorthMidpoint : inx
lda NorthEdgeInfo, x : sta $0b : inx lda.w NorthEdgeInfo, x : sta.b Scrap0B : inx
lda NorthEdgeInfo, x : sta $0c lda.w NorthEdgeInfo, x : sta.b Scrap0C
rts rts
LoadNorthMidpoint: LoadNorthMidpoint:
and #$0f : sta $00 : asl : !add $00 : tax and.b #$0f : sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
lda NorthEdgeInfo, x : sta $0a ; needed now, and for nrml transition lda.w NorthEdgeInfo, x : sta.b Scrap0A ; needed now, and for nrml transition
rts rts
LoadWestData: LoadWestData:
lda WestOpenEdge, x : sta $03 : inx lda.w WestOpenEdge, x : sta.b Scrap03 : inx
lda WestEdgeInfo, x : sta $07 lda.w WestEdgeInfo, x : sta.b Scrap07
lda WestOpenEdge, x : sta $04 : inx lda.w WestOpenEdge, x : sta.b Scrap04 : inx
lda WestEdgeInfo, x : sta $08 lda.w WestEdgeInfo, x : sta.b Scrap08
lda WestOpenEdge, x : sta $05 lda.w WestOpenEdge, x : sta.b Scrap05
lda $04 : jsr LoadEastMidpoint : inx lda.b Scrap04 : jsr LoadEastMidpoint : inx
lda EastEdgeInfo, x : sta $0b : inx lda.w EastEdgeInfo, x : sta.b Scrap0B : inx
lda EastEdgeInfo, x : sta $0c lda.w EastEdgeInfo, x : sta.b Scrap0C
rts rts
LoadEastMidpoint: LoadEastMidpoint:
and #$0f : sta $00 : asl : !add $00 : tax and.b #$0f : sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
lda EastEdgeInfo, x : sta $0a ; needed now, and for nrml transition lda.w EastEdgeInfo, x : sta.b Scrap0A ; needed now, and for nrml transition
rts rts
LoadEastData: LoadEastData:
lda EastOpenEdge, x : sta $03 : inx lda.w EastOpenEdge, x : sta.b Scrap03 : inx
lda EastEdgeInfo, x : sta $07 lda.w EastEdgeInfo, x : sta.b Scrap07
lda EastOpenEdge, x : sta $04 : inx lda.w EastOpenEdge, x : sta.b Scrap04 : inx
lda EastEdgeInfo, x : sta $08 lda.w EastEdgeInfo, x : sta.b Scrap08
lda EastOpenEdge, x : sta $05 lda.w EastOpenEdge, x : sta.b Scrap05
lda $04 : jsr LoadWestMidpoint : inx lda.b Scrap04 : jsr LoadWestMidpoint : inx
lda WestEdgeInfo, x : sta $0b : inx lda.w WestEdgeInfo, x : sta.b Scrap0B : inx
lda WestEdgeInfo, x : sta $0c lda.w WestEdgeInfo, x : sta.b Scrap0C
LoadWestMidpoint: LoadWestMidpoint:
and #$0f : sta $00 : asl : !add $00 : tax and.b #$0f : sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
lda WestEdgeInfo, x : sta $0a ; needed now, and for nrml transition lda.w WestEdgeInfo, x : sta.b Scrap0A ; needed now, and for nrml transition
rts rts
DetectNorthEdge: DetectNorthEdge:
ldx #$ff ldx.b #$ff
lda $a2 lda.b PreviousRoom
cmp #$82 : bne + cmp.b #$82 : bne +
lda $22 : cmp #$50 : bcs ++ lda.b LinkPosX : cmp.b #$50 : bcs ++
ldx #$01 : bra .end ldx.b #$01 : bra .end
++ ldx #$00 : bra .end ++ ldx.b #$00 : bra .end
+ cmp #$83 : bne + + cmp.b #$83 : bne +
ldx #$02 : bra .end ldx.b #$02 : bra .end
+ cmp #$84 : bne + + cmp.b #$84 : bne +
lda $a9 : beq ++ lda.b $a9 : beq ++
lda $22 : cmp #$78 : bcs +++ lda.b LinkPosX : cmp.b #$78 : bcs +++
ldx #$04 : bra .end ldx.b #$04 : bra .end
+++ ldx #$05 : bra .end +++ ldx.b #$05 : bra .end
++ lda $22 : cmp #$78 : bcs ++ ++ lda.b LinkPosX : cmp.b #$78 : bcs ++
ldx #$03 : bra .end ldx.b #$03 : bra .end
++ ldx #$04 : bra .end ++ ldx.b #$04 : bra .end
+ cmp #$85 : bne + + cmp.b #$85 : bne +
ldx #$06 : bra .end ldx.b #$06 : bra .end
+ cmp #$db : bne + + cmp.b #$db : bne +
lda $a9 : beq ++ lda.b $a9 : beq ++
lda $22 : beq ++ lda.b LinkPosX : beq ++
ldx #$08 : bra .end ldx.b #$08 : bra .end
++ ldx #$07 : bra .end ++ ldx.b #$07 : bra .end
+ cmp #$dc : bne .end + cmp.b #$dc : bne .end
lda $a9 : bne ++ lda.b $a9 : bne ++
lda $22 : cmp #$b0 : bcs ++ lda.b LinkPosX : cmp.b #$b0 : bcs ++
ldx #$09 : bra .end ldx.b #$09 : bra .end
++ ldx #$0a ++ ldx.b #$0a
.end txa : rts .end txa : rts
DetectSouthEdge: DetectSouthEdge:
ldx #$ff ldx.b #$ff
lda $a2 lda.b PreviousRoom
cmp #$72 : bne + cmp.b #$72 : bne +
lda $22 : cmp #$50 : bcs ++ lda.b LinkPosX : cmp.b #$50 : bcs ++
ldx #$01 : bra .end ldx.b #$01 : bra .end
++ ldx #$00 : bra .end ++ ldx.b #$00 : bra .end
+ cmp #$73 : bne + + cmp.b #$73 : bne +
ldx #$02 : bra .end ldx.b #$02 : bra .end
+ cmp #$74 : bne + + cmp.b #$74 : bne +
lda $a9 : beq ++ lda.b $a9 : beq ++
lda $22 : cmp #$78 : bcs +++ lda.b LinkPosX : cmp.b #$78 : bcs +++
ldx #$04 : bra .end ldx.b #$04 : bra .end
+++ ldx #$05 : bra .end +++ ldx.b #$05 : bra .end
++ lda $22 : cmp #$78 : bcs ++ ++ lda.b LinkPosX : cmp.b #$78 : bcs ++
ldx #$03 : bra .end ldx.b #$03 : bra .end
++ ldx #$04 : bra .end ++ ldx.b #$04 : bra .end
+ cmp #$75 : bne + + cmp.b #$75 : bne +
ldx #$06 : bra .end ldx.b #$06 : bra .end
+ cmp #$cb : bne + + cmp.b #$cb : bne +
lda $a9 : beq ++ lda.b $a9 : beq ++
lda $22 : beq ++ lda.b LinkPosX : beq ++
ldx #$08 : bra .end ldx.b #$08 : bra .end
++ ldx #$07 : bra .end ++ ldx.b #$07 : bra .end
+ cmp #$cc : bne .end + cmp.b #$cc : bne .end
lda $a9 : bne ++ lda.b $a9 : bne ++
lda $22 : cmp #$b0 : bcs ++ lda.b LinkPosX : cmp.b #$b0 : bcs ++
ldx #$09 : bra .end ldx.b #$09 : bra .end
++ ldx #$0a ++ ldx.b #$0a
.end txa : rts .end txa : rts
DetectWestEdge: DetectWestEdge:
ldx #$ff ldx.b #$ff
lda $a2 lda.b PreviousRoom
cmp #$65 : bne + cmp.b #$65 : bne +
ldx #$00 : bra .end ldx.b #$00 : bra .end
+ cmp #$74 : bne + + cmp.b #$74 : bne +
ldx #$01 : bra .end ldx.b #$01 : bra .end
+ cmp #$75 : bne + + cmp.b #$75 : bne +
ldx #$02 : bra .end ldx.b #$02 : bra .end
+ cmp #$82 : bne + + cmp.b #$82 : bne +
lda $aa : beq ++ lda.b LinkQuadrantV : beq ++
ldx #$03 : bra .end ldx.b #$03 : bra .end
++ ldx #$04 : bra .end ++ ldx.b #$04 : bra .end
+ cmp #$85 : bne + + cmp.b #$85 : bne +
ldx #$05 : bra .end ldx.b #$05 : bra .end
+ cmp #$cc : bne + + cmp.b #$cc : bne +
lda $aa : beq ++ lda.b LinkQuadrantV : beq ++
ldx #$06 : bra .end ldx.b #$06 : bra .end
++ ldx #$07 : bra .end ++ ldx.b #$07 : bra .end
+ cmp #$dc : bne .end + cmp.b #$dc : bne .end
ldx #$08 ldx.b #$08
.end txa : rts .end txa : rts
DetectEastEdge: DetectEastEdge:
ldx #$ff ldx.b #$ff
lda $a2 lda.b PreviousRoom
cmp #$64 : bne + cmp.b #$64 : bne +
ldx #$00 : bra .end ldx.b #$00 : bra .end
+ cmp #$73 : bne + + cmp.b #$73 : bne +
ldx #$01 : bra .end ldx.b #$01 : bra .end
+ cmp #$74 : bne + + cmp.b #$74 : bne +
ldx #$02 : bra .end ldx.b #$02 : bra .end
+ cmp #$81 : bne + + cmp.b #$81 : bne +
lda $aa : beq ++ lda.b LinkQuadrantV : beq ++
ldx #$04 : bra .end ldx.b #$04 : bra .end
++ ldx #$03 : bra .end ++ ldx.b #$03 : bra .end
+ cmp #$84 : bne + + cmp.b #$84 : bne +
ldx #$05 : bra .end ldx.b #$05 : bra .end
+ cmp #$cb : bne + + cmp.b #$cb : bne +
lda $aa : beq ++ lda.b LinkQuadrantV : beq ++
ldx #$06 : bra .end ldx.b #$06 : bra .end
++ ldx #$07 : bra .end ++ ldx.b #$07 : bra .end
+ cmp #$db : bne .end + cmp.b #$db : bne .end
ldx #$08 ldx.b #$08
.end txa : rts .end txa : rts
AlwaysPushThroughFDoors: AlwaysPushThroughFDoors:

View File

@@ -20,10 +20,10 @@
;=================================================================================================== ;===================================================================================================
pushpc pushpc
org $01B0E6 org $81B0E6
JSL StoreDoorInfo JSL StoreDoorInfo
org $01892F org $81892F
DoorDrawJankMove: DoorDrawJankMove:
JML PrepDoorDraw JML PrepDoorDraw
@@ -33,12 +33,12 @@ DoorDrawJankMove:
; we don't want to overwrite the JMP ($000E) that's already there ; we don't want to overwrite the JMP ($000E) that's already there
; Well, we could, but we don't need to ; Well, we could, but we don't need to
warnpc $018939 warnpc $818939
org $01BF43 org $81BF43
JSL AdjustEscapeDoorCollision JSL AdjustEscapeDoorCollision
org $01C132 ; ADC.w #$0040 : TAX : LDA.b $00 org $81C132 ; ADC.w #$0040 : TAX : LDA.b $00
JSL AdjustEscapeDoorCollision_LowEntrance : NOP #2 JSL AdjustEscapeDoorCollision_LowEntrance : NOP #2
pullpc pullpc
@@ -46,7 +46,7 @@ pullpc
;=================================================================================================== ;===================================================================================================
StoreDoorInfo: StoreDoorInfo:
STA.w $1980,X STA.w $1980,X
LDA.b $00 : STA.w $19F0,X LDA.b Scrap00 : STA.w $19F0,X
TXA TXA
RTL RTL
@@ -59,18 +59,18 @@ PrepDoorDraw:
; Much easier to just tell you to look at $01890D in the disassembly ; Much easier to just tell you to look at $01890D in the disassembly
; and you should understand the vanilla program flow we need to reject ; and you should understand the vanilla program flow we need to reject
PEA.w DoorDrawJankMove_return-1 PEA.w DoorDrawJankMove_return-1
LDA.b $00 LDA.b Scrap00
STA.w $19EE ; for current routine STA.w $19EE ; for current routine
; copy vanilla code (but fast rom) ; copy vanilla code (but fast rom)
LDA.l $8186F0,X LDA.l $8186F0,X
STA.b $0E STA.b Scrap0E
LDX.b $02 LDX.b Scrap02
LDA.b $04 LDA.b Scrap04
; and to execute the jump, we'll use the JMP ($000E) we carefully avoided overwriting ; and to execute the jump, we'll use the JMP ($000E) we carefully avoided overwriting
JML.l $818939 JML $818939
;=================================================================================================== ;===================================================================================================
@@ -106,20 +106,20 @@ AdjustEscapeDoorGraphics:
; row 1 ; row 1
LDA.w #$8838 LDA.w #$8838
STA.l $7E2000+$080,X STA.l TileMapA+$080,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$086,X STA.l TileMapA+$086,X
; row 2 ; row 2
LDA.w #$8828 LDA.w #$8828
STA.l $7E2000+$100,X STA.l TileMapA+$100,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$106,X STA.l TileMapA+$106,X
LDA.w #$8829 LDA.w #$8829
STA.l $7E2000+$102,X STA.l TileMapA+$102,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X STA.l TileMapA+$104,X
JSR IdentifySwampEntrance JSR IdentifySwampEntrance
BCS .fix_swamp_entrance_alternate BCS .fix_swamp_entrance_alternate
@@ -134,26 +134,26 @@ AdjustEscapeDoorGraphics:
; row 0 ; row 0
LDA.w #$14C4 LDA.w #$14C4
STA.l $7E2000+$000,X ; sanity check = should calculate to 7e3bbc STA.l TileMapA+$000,X ; sanity check = should calculate to 7e3bbc
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$006,X STA.l TileMapA+$006,X
LDA.w #$14C5 LDA.w #$14C5
STA.l $7E2000+$002,X STA.l TileMapA+$002,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$004,X STA.l TileMapA+$004,X
; row 1 ; row 1
LDA.w #$14E8 LDA.w #$14E8
STA.l $7E2000+$082,X STA.l TileMapA+$082,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$084,X STA.l TileMapA+$084,X
; row 2 ; row 2
LDA.w #$14F8 LDA.w #$14F8
STA.l $7E2000+$102,X STA.l TileMapA+$102,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X STA.l TileMapA+$104,X
RTL RTL
.fix_swamp_entrance .fix_swamp_entrance
@@ -162,56 +162,56 @@ AdjustEscapeDoorGraphics:
; row 1 - outer section ; row 1 - outer section
LDA.w #$0908 LDA.w #$0908
STA.l $7E2000+$080,X STA.l TileMapA+$080,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$086,X STA.l TileMapA+$086,X
; row 2 ; row 2
LDA.w #$0918 LDA.w #$0918
STA.l $7E2000+$100,X STA.l TileMapA+$100,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$106,X STA.l TileMapA+$106,X
LDA.w #$14F8 LDA.w #$14F8
STA.l $7E2000+$102,X STA.l TileMapA+$102,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X STA.l TileMapA+$104,X
.fix_swamp_entrance_alternate .fix_swamp_entrance_alternate
; row 0 ; row 0
LDA.w #$9DFC LDA.w #$9DFC
STA.l $7E2000+$000,X STA.l TileMapA+$000,X
STA.l $7E2000+$002,X STA.l TileMapA+$002,X
STA.l $7E2000+$004,X STA.l TileMapA+$004,X
STA.l $7E2000+$006,X STA.l TileMapA+$006,X
; row 1 - mid section ; row 1 - mid section
LDA.w #$14E8 LDA.w #$14E8
STA.l $7E2000+$082,X STA.l TileMapA+$082,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$084,X STA.l TileMapA+$084,X
; row 3 ; row 3
LDA.w #$A82C LDA.w #$A82C
STA.l $7E2000+$180,X STA.l TileMapA+$180,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$186,X STA.l TileMapA+$186,X
LDA.w #$A82D LDA.w #$A82D
STA.l $7E2000+$182,X STA.l TileMapA+$182,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$184,X STA.l TileMapA+$184,X
RTL RTL
IdentifySancEntrance: IdentifySancEntrance:
LDA.b $A0 : CMP.w #$0012 : BNE + LDA.b RoomIndex : CMP.w #$0012 : BNE +
LDA.b $0A : CMP.w #$0010 : BNE + LDA.b Scrap0A : CMP.w #$0010 : BNE +
SEC : RTS SEC : RTS
+ CLC : RTS + CLC : RTS
IdentifySwampEntrance: IdentifySwampEntrance:
LDA.b $A0 : CMP.w #$0036 : BNE + LDA.b RoomIndex : CMP.w #$0036 : BNE +
LDA.b $0A : CMP.w #$0010 : BNE + LDA.b Scrap0A : CMP.w #$0010 : BNE +
SEC : RTS SEC : RTS
+ CLC : RTS + CLC : RTS
@@ -250,7 +250,7 @@ AdjustEscapeDoorCollisionShared:
BCS .block_entrance BCS .block_entrance
; vanilla value ; vanilla value
LDA.b $00 LDA.b Scrap00
RTL RTL
@@ -274,21 +274,21 @@ IdentifyBlockedEntrance:
LDA.l ProgressIndicator : AND.w #$00FF : CMP.w #$0002 : BCS .leave_alone ; only in rain states (0 or 1) LDA.l ProgressIndicator : AND.w #$00FF : CMP.w #$0002 : BCS .leave_alone ; only in rain states (0 or 1)
LDA.l ProgressFlags : AND.w #$0004 : BNE .leave_alone ; zelda's been rescued LDA.l ProgressFlags : AND.w #$0004 : BNE .leave_alone ; zelda's been rescued
LDA.l BlockSanctuaryDoorInRain : BEQ + ;flagged LDA.l BlockSanctuaryDoorInRain : BEQ + ;flagged
LDA.b $A0 : CMP.w #$0012 : BNE + LDA.b RoomIndex : CMP.w #$0012 : BNE +
; we're in the sanctuary ; we're in the sanctuary
; this code could be removed because you can't reach sanc without zelda currently ; this code could be removed because you can't reach sanc without zelda currently
; but that's enforced in the logic, so this is to catch that case in case some mode allows it ; but that's enforced in the logic, so this is to catch that case in case some mode allows it
LDA.l FollowerIndicator : AND.w #$00FF : CMP.w #$0001 : BEQ .leave_alone ; zelda is following LDA.l FollowerIndicator : AND.w #$00FF : CMP.w #$0001 : BEQ .leave_alone ; zelda is following
LDA.b $0A LDA.b Scrap0A
CMP.w #$000A : BCC .leave_alone CMP.w #$000A : BCC .leave_alone
CMP.w #$0014 : BCS .leave_alone CMP.w #$0014 : BCS .leave_alone
.block_door .block_door
SEC : RTS SEC : RTS
+ LDA.l BlockCastleDoorsInRain : AND.w #$00FF : BEQ .leave_alone + LDA.l BlockCastleDoorsInRain : AND.w #$00FF : BEQ .leave_alone
LDX #$FFFE LDX.w #$FFFE
- INX #2 - INX #2
LDA.l RemoveRainDoorsRoom, X : CMP.w #$FFFF : BEQ .leave_alone LDA.l RemoveRainDoorsRoom, X : CMP.w #$FFFF : BEQ .leave_alone
CMP $A0 : BNE - CMP.b RoomIndex : BNE -
LDA.l RainDoorMatch, X LDA.l RainDoorMatch, X
CMP.w $19EE : BNE .leave_alone CMP.w $19EE : BNE .leave_alone
BRA .block_door BRA .block_door

View File

@@ -4,60 +4,60 @@ GfxFixer:
jsl LoadRoomHook ;this is the code we overwrote jsl LoadRoomHook ;this is the code we overwrote
jsl Dungeon_InitStarTileCh jsl Dungeon_InitStarTileCh
jsl LoadTransAuxGfx_Alt jsl LoadTransAuxGfx_Alt
inc $b0 inc.b SubSubModule
rtl rtl
+ lda $b1 : bne .stage2 + lda.b $b1 : bne .stage2
jsl LoadRoomHook ; this is the rando version - let's only call this guy once - may fix star tiles and slower loads jsl LoadRoomHook ; this is the rando version - let's only call this guy once - may fix star tiles and slower loads
jsl Dungeon_InitStarTileCh jsl Dungeon_InitStarTileCh
jsl LoadTransAuxGfx jsl LoadTransAuxGfx
jsl Dungeon_LoadCustomTileAttr jsl Dungeon_LoadCustomTileAttr
jsl PrepTransAuxGfx jsl PrepTransAuxGfx
lda.l DRMode : cmp #$02 : bne + ; only do this in crossed mode lda.l DRMode : cmp.b #$02 : bne + ; only do this in crossed mode
ldx $a0 : lda.l TilesetTable, x ldx.b RoomIndex : lda.l TilesetTable, x
cmp $0aa1 : beq + ; already eq no need to decomp cmp.w $0aa1 : beq + ; already eq no need to decomp
sta $0aa1 sta.w $0aa1
tax : lda $02802e, x : tay tax : lda.l AnimatedTileSheets, x : tay
jsl DecompDungAnimatedTiles jsl DecompDungAnimatedTiles
+ +
lda #$09 : sta $17 : sta $0710 lda.b #$09 : sta.b NMIINCR : sta.w SkipOAM
jsl Palette_SpriteAux3 jsl Palette_SpriteAux3
jsl Palette_SpriteAux2 jsl Palette_SpriteAux2
jsl Palette_SpriteAux1 jsl Palette_SpriteAux1
jsl Palette_DungBgMain jsl Palette_DungBgMain
jsr CgramAuxToMain jsr CgramAuxToMain
inc $b1 inc.b $b1
rtl rtl
.stage2 .stage2
lda #$0a : sta $17 : sta $0710 lda.b #$0a : sta.b NMIINCR : sta.w SkipOAM
stz $b1 : inc $b0 stz.b $b1 : inc.b SubSubModule
rtl rtl
} }
FixAnimatedTiles: FixAnimatedTiles:
LDA.L DRMode : CMP #$02 : BNE + LDA.l DRMode : CMP.b #$02 : BNE +
LDA $040C : CMP.b #$FF : BEQ + LDA.w DungeonID : CMP.b #$FF : BEQ +
PHX PHX
LDX $A0 : LDA.l TilesetTable, x LDX.b RoomIndex : LDA.l TilesetTable, x
CMP $0AA1 : beq ++ CMP.w $0AA1 : beq ++
TAX : PLA : BRA + TAX : PLA : BRA +
++ ++
PLX PLX
+ LDA $02802E, X ; what we wrote over + LDA.l AnimatedTileSheets, X ; what we wrote over
RTL RTL
FixCloseDungeonMap: FixCloseDungeonMap:
LDA.l DRMode : CMP #$02 : BNE .vanilla LDA.l DRMode : CMP.b #$02 : BNE .vanilla
LDA $040C : BMI .vanilla LDA.w DungeonID : BMI .vanilla
LSR : TAX LSR : TAX
LDA.l DungeonTilesets,x LDA.l DungeonTilesets,x
RTL RTL
.vanilla .vanilla
LDA $7EC20E LDA.l $7EC20E
RTL RTL
FixWallmasterLamp: FixWallmasterLamp:
ORA $0458 ORA.w $0458
STY $1C : STA $1D : RTL ; what we wrote over STY.b MAINDESQ : STA.b SUBDESQ : RTL ; what we wrote over
CgramAuxToMain: ; ripped this from bank02 because it ended with rts CgramAuxToMain: ; ripped this from bank02 because it ended with rts
@@ -66,30 +66,30 @@ CgramAuxToMain: ; ripped this from bank02 because it ended with rts
ldx.b #$00 ldx.b #$00
.loop .loop
lda $7EC300, X : sta $7EC500, x lda.l $7EC300, X : sta.l $7EC500, x
lda $7EC340, x : sta $7EC540, x lda.l $7EC340, x : sta.l $7EC540, x
lda $7EC380, x : sta $7EC580, x lda.l $7EC380, x : sta.l $7EC580, x
lda $7EC3C0, x : sta $7EC5C0, x lda.l $7EC3C0, x : sta.l $7EC5C0, x
lda $7EC400, x : sta $7EC600, x lda.l $7EC400, x : sta.l $7EC600, x
lda $7EC440, x : sta $7EC640, x lda.l $7EC440, x : sta.l $7EC640, x
lda $7EC480, x : sta $7EC680, x lda.l $7EC480, x : sta.l $7EC680, x
lda $7EC4C0, x : sta $7EC6C0, x lda.l $7EC4C0, x : sta.l $7EC6C0, x
inx #2 : cpx.b #$40 : bne .loop inx #2 : cpx.b #$40 : bne .loop
sep #$20 sep #$20
; tell NMI to upload new CGRAM data ; tell NMI to upload new CGRAM data
inc $15 inc.b NMICGRAM
rts rts
} }
OverridePaletteHeader: OverridePaletteHeader:
lda.l DRMode : cmp #$02 : bne + lda.l DRMode : cmp.b #$02 : bne +
lda.l DRFlags : and #$20 : bne + lda.l DRFlags : and.b #$20 : bne +
cpx #$01c2 : !bge + cpx.w #$01c2 : !BGE +
rep #$20 rep #$20
txa : lsr : tax txa : lsr : tax
lda.l PaletteTable, x lda.l PaletteTable, x
iny : rtl iny : rtl
+ rep #$20 : iny : lda [$0D], Y ; what we wrote over + rep #$20 : iny : lda.b [Scrap0D], Y ; what we wrote over
rtl rtl

View File

@@ -6,15 +6,6 @@
!RedSquare = $345E !RedSquare = $345E
!BlueSquare = $2C5E !BlueSquare = $2C5E
!DungeonMask = $8098C0
!EnemyDropIndicator = $7E072A
!IndicatorAddress = $7EC790 ; used for both boss nearness and enemy drops
!CurrentDungeonIndicator = $7EC702
!KeysObtained = $7EC7A2
!KeysSlash = $7EC7A4
!KeysTotal = $7EC7A6
DrHudOverride: DrHudOverride:
PHB PHB
SEP #$30 SEP #$30
@@ -32,19 +23,19 @@ DRHUD_DrawItemCounter:
SEP #$30 SEP #$30
DRHUD_DrawIndicators: DRHUD_DrawIndicators:
LDA.b $1B : BNE .continue LDA.b IndoorsFlag : BNE .continue
JMP DRHUD_Finished JMP DRHUD_Finished
.continue .continue
LDA.b $1A : AND.b #$10 : BEQ DRHUD_EnemyDropIndicator LDA.b FrameCounter : AND.b #$10 : BEQ DRHUD_EnemyDropIndicator
DRHUD_BossIndicator: DRHUD_BossIndicator:
LDA.l DRMode : BNE .continue LDA.l DRMode : BNE .continue
.early_exit .early_exit
REP #$10 REP #$10
LDY.w #!BlankTile : STY.w !IndicatorAddress LDY.w #!BlankTile : STY.w HUDMultiIndicator
JMP DRHUD_Finished JMP DRHUD_Finished
.continue .continue
LDA.w $040C : CMP.b #$1B : BCS .early_exit LDA.w DungeonID : CMP.b #$1B : BCS .early_exit
SEP #$10 ; clears the high byte of X and prevents it from getting B register SEP #$10 ; clears the high byte of X and prevents it from getting B register
TAX TAX
@@ -54,17 +45,17 @@ DRHUD_BossIndicator:
LDA.w CompassField : AND.l DungeonMask, x LDA.w CompassField : AND.l DungeonMask, x
SEP #$20 SEP #$20
BEQ .draw_indicator BEQ .draw_indicator
LDA.l CompassBossIndicator, x : CMP.b $A0 : BNE .draw_indicator LDA.l CompassBossIndicator, x : CMP.b RoomIndex : BNE .draw_indicator
LDY.w #!RedSquare LDY.w #!RedSquare
.draw_indicator .draw_indicator
STY.w !IndicatorAddress STY.w HUDMultiIndicator
BRA DRHUD_DrawCurrentDungeonIndicator BRA DRHUD_DrawCurrentDungeonIndicator
DRHUD_EnemyDropIndicator: DRHUD_EnemyDropIndicator:
REP #$30 REP #$30
LDA.w !EnemyDropIndicator : STA.w !IndicatorAddress LDA.w EnemyDropIndicator : STA.w HUDMultiIndicator
SEP #$20 SEP #$20
LDA.w $040C : CMP.b #$1B : BCS DRHUD_Finished LDA.w DungeonID : CMP.b #$1B : BCS DRHUD_Finished
SEP #$10 : TAX : REP #$10 SEP #$10 : TAX : REP #$10
DRHUD_DrawCurrentDungeonIndicator: ; mX DRHUD_DrawCurrentDungeonIndicator: ; mX
@@ -75,7 +66,7 @@ DRHUD_DrawCurrentDungeonIndicator: ; mX
REP #$20 : LDA.l DungeonReminderTable,X : TAY REP #$20 : LDA.l DungeonReminderTable,X : TAY
SEP #$20 SEP #$20
.draw_indicator .draw_indicator
STY.w !CurrentDungeonIndicator STY.w HUDCurrentDungeonWorld
DRHUD_DrawKeyCounter: DRHUD_DrawKeyCounter:
LDA.l DRFlags : AND.b #$04 : BEQ DRHUD_Finished LDA.l DRFlags : AND.b #$04 : BEQ DRHUD_Finished
@@ -83,10 +74,10 @@ DRHUD_DrawKeyCounter:
LDA.w MapField : AND.l DungeonMask, X : BEQ DRHUD_Finished LDA.w MapField : AND.l DungeonMask, X : BEQ DRHUD_Finished
TXA : LSR : TAX TXA : LSR : TAX
LDA.l GenericKeys : AND.w #$00FF : BNE .total_only LDA.l GenericKeys : AND.w #$00FF : BNE .total_only
LDA.l DungeonCollectedKeys, X : JSR ConvertToDisplay : STA.w !KeysObtained LDA.l DungeonCollectedKeys, X : JSR ConvertToDisplay : STA.w HUDKeysObtained
LDA #!SlashTile : STA.w !KeysSlash LDA.w #!SlashTile : STA.w HUDKeysSlash
.total_only .total_only
LDA.l ChestKeys, x : JSR ConvertToDisplay : STA.w !KeysTotal LDA.l ChestKeys, x : JSR ConvertToDisplay : STA.w HUDKeysTotal
DRHUD_Finished: DRHUD_Finished:
PLB : RTL PLB : RTL
@@ -109,94 +100,94 @@ dw $0000, $0000, $0000, $0000, $000a, $000a, $000a, $0014, $000a, $0014, $0000,
DrHudDungeonItemsAdditions: DrHudDungeonItemsAdditions:
{ {
jsl DrawHUDDungeonItems jsl DrawHUDDungeonItems
lda.l HUDDungeonItems : and #$ff : bne + : rtl : + lda.l HUDDungeonItems : and.b #$ff : bne + : rtl : +
lda.l DRMode : cmp #$02 : beq + : rtl : + lda.l DRMode : cmp.b #$02 : beq + : rtl : +
phx : phy : php phx : phy : php
rep #$30 rep #$30
lda.w #$24f5 : sta $1606 : sta $1610 : sta $161a : sta $1624 lda.w #$24f5 : sta.w $1606 : sta.w $1610 : sta.w $161a : sta.w $1624
sta $1644 : sta $164a : sta $1652 : sta $1662 : sta $1684 : sta $16c4 sta.w $1644 : sta.w $164a : sta.w $1652 : sta.w $1662 : sta.w $1684 : sta.w $16c4
ldx #$0000 ldx.w #$0000
- sta $1704, x : sta $170e, x : sta $1718, x - sta.w $1704, x : sta.w $170e, x : sta.w $1718, x
inx #2 : cpx #$0008 : !blt - inx #2 : cpx.w #$0008 : !BLT -
lda HudFlag : and.w #$0020 : beq + : JMP ++ : + lda.l HudFlag : and.w #$0020 : beq + : JMP ++ : +
lda HUDDungeonItems : and.w #$0007 : bne + : JMP ++ : + lda.l HUDDungeonItems : and.w #$0007 : bne + : JMP ++ : +
; bk symbols ; bk symbols
lda.w #$2811 : sta $1606 : sta $1610 : sta $161a : sta $1624 lda.w #$2811 : sta.w $1606 : sta.w $1610 : sta.w $161a : sta.w $1624
; sm symbols ; sm symbols
lda.w #$2810 : sta $160a : sta $1614 : sta $161e : sta $16e4 lda.w #$2810 : sta.w $160a : sta.w $1614 : sta.w $161e : sta.w $16e4
; blank out stuff ; blank out stuff
lda.w #$24f5 : sta $1724 lda.w #$24f5 : sta.w $1724
ldx #$0002 ldx.w #$0002
- lda #$0000 : !addl RowOffsets,x : !addl ColumnOffsets, x : tay - lda.w #$0000 : !ADD.l RowOffsets,x : !ADD.l ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta $1644, y : iny #2 lda.l DungeonReminderTable, x : sta.w $1644, y : iny #2
lda.w #$24f5 : sta $1644, y lda.w #$24f5 : sta.w $1644, y
lda MapField : and.l $0098c0, x : beq + ; must have map lda.l MapField : and.l DungeonMask, x : beq + ; must have map
jsr BkStatus : sta $1644, y : bra .smallKey ; big key status jsr BkStatus : sta.w $1644, y : bra .smallKey ; big key status
+ lda BigKeyField : and.l $0098c0, x : beq .smallKey + lda.l BigKeyField : and.l DungeonMask, x : beq .smallKey
lda.w #$2826 : sta $1644, y lda.w #$2826 : sta.w $1644, y
.smallKey .smallKey
+ iny #2 + iny #2
cpx #$001a : bne + cpx.w #$001a : bne +
tya : !add #$003c : tay tya : !ADD.w #$003c : tay
+ stx $00 + stx.b Scrap00
txa : lsr : tax txa : lsr : tax
lda.w #$24f5 : sta $1644, y lda.w #$24f5 : sta.w $1644, y
lda.l GenericKeys : and #$00FF : bne + lda.l GenericKeys : and.w #$00FF : bne +
lda.l DungeonKeys, x : and #$00FF : beq + lda.l DungeonKeys, x : and.w #$00FF : beq +
jsr ConvertToDisplay2 : sta $1644, y jsr ConvertToDisplay2 : sta.w $1644, y
+ iny #2 : lda.w #$24f5 : sta $1644, y + iny #2 : lda.w #$24f5 : sta.w $1644, y
phx : ldx $00 phx : ldx.b Scrap00
lda MapField : and.l $0098c0, x : beq + ; must have map lda.l MapField : and.l DungeonMask, x : beq + ; must have map
plx : sep #$30 : lda.l ChestKeys, x : sta $02 plx : sep #$30 : lda.l ChestKeys, x : sta.b Scrap02
lda.l GenericKeys : bne +++ lda.l GenericKeys : bne +++
lda $02 : !sub DungeonCollectedKeys, x : sta $02 lda.b Scrap02 : !SUB.l DungeonCollectedKeys, x : sta.b Scrap02
+++ lda $02 +++ lda.b Scrap02
rep #$30 rep #$30
jsr ConvertToDisplay2 : sta $1644, y ; small key totals jsr ConvertToDisplay2 : sta.w $1644, y ; small key totals
bra .skipStack bra .skipStack
+ plx + plx
.skipStack iny #2 .skipStack iny #2
cpx #$000d : beq + cpx.w #$000d : beq +
lda.w #$24f5 : sta $1644, y lda.w #$24f5 : sta.w $1644, y
+ +
ldx $00 ldx.b Scrap00
+ inx #2 : cpx #$001b : bcs ++ : JMP - + inx #2 : cpx.w #$001b : bcs ++ : JMP -
++ ++
lda HudFlag : and.w #$0020 : bne + : JMP ++ : + lda.l HudFlag : and.w #$0020 : bne + : JMP ++ : +
lda HUDDungeonItems : and.w #$000c : bne + : JMP ++ : + lda.l HUDDungeonItems : and.w #$000c : bne + : JMP ++ : +
; map symbols (do I want these) ; note compass symbol is 2c20 ; map symbols (do I want these) ; note compass symbol is 2c20
lda.w #$2821 : sta $1606 : sta $1610 : sta $161a : sta $1624 lda.w #$2821 : sta.w $1606 : sta.w $1610 : sta.w $161a : sta.w $1624
; blank out a couple thing from old hud ; blank out a couple thing from old hud
lda.w #$24f5 : sta $16e4 : sta $1724 lda.w #$24f5 : sta.w $16e4 : sta.w $1724
sta $160a : sta $1614 : sta $161e ; blank out sm key indicators sta.w $160a : sta.w $1614 : sta.w $161e ; blank out sm key indicators
ldx #$0002 ldx.w #$0002
- lda #$0000 ; start of hud area - lda.w #$0000 ; start of hud area
!addl RowOffsets, x : !addl ColumnOffsets, x : tay !ADD.l RowOffsets, x : !ADD.l ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta $1644, y lda.l DungeonReminderTable, x : sta.w $1644, y
iny #2 iny #2
lda.w #$24f5 : sta $1644, y ; blank out map spot lda.w #$24f5 : sta.w $1644, y ; blank out map spot
lda MapField : and.l $0098c0, x : beq + ; must have map lda.l MapField : and.l DungeonMask, x : beq + ; must have map
JSR MapIndicatorShort : STA $1644, Y JSR MapIndicatorShort : STA.w $1644, Y
+ iny #2 + iny #2
cpx #$001a : bne + cpx.w #$001a : bne +
tya : !add #$003c : tay tya : !ADD.w #$003c : tay
+ lda CompassField : and.l $0098c0, x : beq + ; must have compass + lda.l CompassField : and.l DungeonMask, x : beq + ; must have compass
phx ; total chest counts phx ; total chest counts
LDA.l CompassTotalsWRAM, x : !sub DungeonLocationsChecked, x LDA.l CompassTotalsWRAM, x : !SUB.l DungeonLocationsChecked, x
SEP #$30 : JSR HudHexToDec2DigitCopy : REP #$30 SEP #$30 : JSR HudHexToDec2DigitCopy : REP #$30
lda $06 : jsr ConvertToDisplay2 : sta $1644, y : iny #2 lda.b Scrap06 : jsr ConvertToDisplay2 : sta.w $1644, y : iny #2
lda $07 : jsr ConvertToDisplay2 : sta $1644, y lda.b Scrap07 : jsr ConvertToDisplay2 : sta.w $1644, y
plx plx
bra .skipBlanks bra .skipBlanks
+ lda.w #$24f5 : sta $1644, y : iny #2 : sta $1644, y + lda.w #$24f5 : sta.w $1644, y : iny #2 : sta.w $1644, y
.skipBlanks iny #2 .skipBlanks iny #2
cpx #$001a : beq + cpx.w #$001a : beq +
lda.w #$24f5 : sta $1644, y ; blank out spot lda.w #$24f5 : sta.w $1644, y ; blank out spot
+ inx #2 : cpx #$001b : !bge ++ : JMP - + inx #2 : cpx.w #$001b : !BGE ++ : JMP -
++ ++
plp : ply : plx : rtl plp : ply : plx : rtl
} }
@@ -223,32 +214,32 @@ IndicatorCharacters:
dw $2426, $2817, $2818, $2819, $281A, $281B, $281C, $281D, $2590, $258B, $259B dw $2426, $2817, $2818, $2819, $281A, $281B, $281C, $281D, $2590, $258B, $259B
MapIndicator: MapIndicator:
LDA.l CrystalPendantFlags_3, X : AND #$00FF LDA.l CrystalPendantFlags_3, X : AND.w #$00FF
PHX PHX
ASL : TAX : LDA.l IndicatorCharacters, X ASL : TAX : LDA.l IndicatorCharacters, X
PLX PLX
RTS RTS
BkStatus: BkStatus:
lda BigKeyField : and.l $0098c0, x : bne +++ ; has the bk already lda.l BigKeyField : and.l DungeonMask, x : bne +++ ; has the bk already
lda.l BigKeyStatus, x : bne ++ lda.l BigKeyStatus, x : bne ++
lda #$2827 : rts ; 0/O for no BK lda.w #$2827 : rts ; 0/O for no BK
++ cmp #$0002 : bne + ++ cmp.w #$0002 : bne +
lda #$2420 : rts ; symbol for BnC lda.w #$2420 : rts ; symbol for BnC
+ lda #$24f5 : rts ; black otherwise + lda.w #$24f5 : rts ; black otherwise
+++ lda #$2826 : rts ; check mark +++ lda.w #$2826 : rts ; check mark
ConvertToDisplay: ConvertToDisplay:
and.w #$00ff : cmp #$000a : !blt + and.w #$00ff : cmp.w #$000a : !BLT +
!add #$2553 : rts !ADD.w #$2553 : rts
+ !add #$2490 : rts + !ADD.w #$2490 : rts
ConvertToDisplay2: ConvertToDisplay2:
and.w #$00ff : beq ++ and.w #$00ff : beq ++
cmp #$000a : !blt + cmp.w #$000a : !BLT +
!add #$2553 : rts ; 2580 with 258A as "A" for non transparent digits !ADD.w #$2553 : rts ; 2580 with 258A as "A" for non transparent digits
+ !add #$2816 : rts + !ADD.w #$2816 : rts
++ lda #$2827 : rts ; 0/O for 0 or placeholder digit ;2483 ++ lda.w #$2827 : rts ; 0/O for 0 or placeholder digit ;2483
CountAbsorbedKeys: CountAbsorbedKeys:
JML IncrementSmallKeysNoPrimary JML IncrementSmallKeysNoPrimary
@@ -266,12 +257,12 @@ HudHexToDec2DigitCopy: ; modified
INY INY
SBC.b #10 : BRA - SBC.b #10 : BRA -
+ +
STY $06 : LDY #$00 ; Store 10s digit and reset Y STY.b Scrap06 : LDY.b #$00 ; Store 10s digit and reset Y
CMP.b #1 : !BLT + CMP.b #1 : !BLT +
- -
INY INY
DEC : BNE - DEC : BNE -
+ +
STY $07 ; Store 1s digit STY.b Scrap07 ; Store 1s digit
PLY PLY
RTS RTS

View File

@@ -13,24 +13,24 @@ CheckIfDoorsOpen: {
jsr TrapDoorFixer ; see normal.asm jsr TrapDoorFixer ; see normal.asm
; note we are 16bit mode right now ; note we are 16bit mode right now
lda.l DRMode : beq + lda.l DRMode : beq +
lda $040c : cmp #$00ff : bne .gtg lda.w DungeonID : cmp.w #$00ff : bne .gtg
+ lda $a0 : dec : tax : and #$000f ; hijacked code + lda.b RoomIndex : dec : tax : and.w #$000f ; hijacked code
sec : rtl ; set carry to indicate normal behavior sec : rtl ; set carry to indicate normal behavior
.gtg .gtg
phb : phk : plb phb : phk : plb
stx $00 : ldy #$0000 stx.b Scrap00 : ldy.w #$0000
.nextDoor .nextDoor
lda $a0 : asl : tax lda.b RoomIndex : asl : tax
lda.w KeyDoorOffset, x : beq .skipDoor lda.w KeyDoorOffset, x : beq .skipDoor
asl : sty $05 : !add $05 : tax asl : sty.b Scrap05 : !ADD.b Scrap05 : tax
lda.w PairedDoorTable, x : beq .skipDoor lda.w PairedDoorTable, x : beq .skipDoor
sta $02 : and #$00ff : asl a : tax sta.b Scrap02 : and.w #$00ff : asl a : tax
lda $02 : and #$ff00 : sta $03 lda.b Scrap02 : and.w #$ff00 : sta.b Scrap03
lda RoomDataWRAM.l, X : and #$f000 : and $03 : beq .skipDoor lda.l RoomDataWRAM.l, X : and.w #$f000 : and.b Scrap03 : beq .skipDoor
tyx : lda $068c : ora $0098c0,x : sta $068c tyx : lda.w $068c : ora.l DungeonMask,x : sta.w $068c
.skipDoor .skipDoor
iny #2 : cpy $00 : bne .nextDoor iny #2 : cpy.b Scrap00 : bne .nextDoor
plb : clc : rtl plb : clc : rtl
} }

View File

@@ -7,60 +7,60 @@
;00 00 01 01 01 02 02 02 03 03 03 04 04 04 05 05 05 06 06 06 07 07 07 08 08 ;00 00 01 01 01 02 02 02 03 03 03 04 04 04 05 05 05 06 06 06 07 07 07 08 08
MultiplyByY: MultiplyByY:
.loop cpy #$0001 : beq .done .loop cpy.w #$0001 : beq .done
cpy #$0003 : bne ++ cpy.w #$0003 : bne ++
jsr MultiBy3 : bra .done jsr MultiBy3 : bra .done
++ cpy #$0005 : bne ++ ++ cpy.w #$0005 : bne ++
jsr MultiBy5 : bra .done jsr MultiBy5 : bra .done
++ asl : sta $00 : tya : lsr : tay : lda $00 : bra .loop ++ asl : sta.b Scrap00 : tya : lsr : tay : lda.b Scrap00 : bra .loop
.done rts .done rts
;Divisor in Y. Width of division is in X for rounding toward middle ;Divisor in Y. Width of division is in X for rounding toward middle
DivideByY: DivideByY:
.loop .loop
cpy #$0000 : beq .done cpy.w #$0000 : beq .done
cpy #$0001 : beq .done cpy.w #$0001 : beq .done
cpy #$0003 : bne ++ cpy.w #$0003 : bne ++
jsr DivideBy3 : bra .done jsr DivideBy3 : bra .done
++ cpy #$0005 : bne ++ ++ cpy.w #$0005 : bne ++
jsr DivideBy5 : bra .done jsr DivideBy5 : bra .done
++ jsr DivideBy2 : sta $00 ++ jsr DivideBy2 : sta.b Scrap00
tya : lsr : tay tya : lsr : tay
txa : lsr : tax txa : lsr : tax
lda $00 : bra .loop lda.b Scrap00 : bra .loop
.done rts .done rts
MultiBy3: MultiBy3:
sta $00 : asl : !add $00 sta.b Scrap00 : asl : !ADD.b Scrap00
rts rts
MultiBy5: MultiBy5:
sta $00 : asl #2 : !add $00 sta.b Scrap00 : asl #2 : !ADD.b Scrap00
rts rts
;width of divison in x: rounds toward X/2 ;width of divison in x: rounds toward X/2
DivideBy2: DivideBy2:
sta $00 sta.b Scrap00
lsr : bcc .done lsr : bcc .done
sta $02 : txa : lsr : cmp $00 : !blt + sta.b Scrap02 : txa : lsr : cmp.b Scrap00 : !BLT +
lda $02 : inc : bra .done lda.b Scrap02 : inc : bra .done
+ lda $02 + lda.b Scrap02
.done rts .done rts
DivideBy3: DivideBy3:
sta $00 sta.b Scrap00
ldx #$0000 ldx.w #$0000
lda #$0002 lda.w #$0002
.loop cmp $00 : !bge .store .loop cmp.b Scrap00 : !BGE .store
inx : !add #$0003 : bra .loop inx : !ADD.w #$0003 : bra .loop
.store txa .store txa
rts rts
DivideBy5: DivideBy5:
sta $00 sta.b Scrap00
ldx #$0000 ldx.w #$0000
lda #$0003 lda.w #$0003
.loop cmp $00 : !bge .store .loop cmp.b Scrap00 : !BGE .store
inx : !add #$0005 : bra .loop inx : !ADD.w #$0005 : bra .loop
.store txa .store txa
rts rts

View File

@@ -1,9 +1,9 @@
WarpLeft: WarpLeft:
lda.l DRMode : beq .end lda.l DRMode : beq .end
JSR CheckIfCave : BCS .end JSR CheckIfCave : BCS .end
lda $20 : ldx $aa lda.b LinkPosY : ldx.b LinkQuadrantV
jsr CalcIndex jsr CalcIndex
!add #$06 : ldy #$01 ; offsets in A, Y !ADD.b #$06 : ldy.b #$01 ; offsets in A, Y
jsr LoadRoomHorz jsr LoadRoomHorz
.end .end
jsr Cleanup jsr Cleanup
@@ -12,9 +12,9 @@ WarpLeft:
WarpRight: WarpRight:
lda.l DRMode : beq .end lda.l DRMode : beq .end
JSR CheckIfCave : BCS .end JSR CheckIfCave : BCS .end
lda $20 : ldx $aa lda.b LinkPosY : ldx.b LinkQuadrantV
jsr CalcIndex jsr CalcIndex
!add #$12 : ldy #$ff ; offsets in A, Y !ADD.b #$12 : ldy.b #$ff ; offsets in A, Y
jsr LoadRoomHorz jsr LoadRoomHorz
.end .end
jsr Cleanup jsr Cleanup
@@ -23,9 +23,9 @@ WarpRight:
WarpUp: WarpUp:
lda.l DRMode : beq .end lda.l DRMode : beq .end
JSR CheckIfCave : BCS .end JSR CheckIfCave : BCS .end
lda $22 : ldx $a9 lda.b LinkPosX : ldx.b LinkQuadrantH
jsr CalcIndex jsr CalcIndex
ldy #$02 ; offsets in A, Y ldy.b #$02 ; offsets in A, Y
jsr LoadRoomVert jsr LoadRoomVert
.end .end
jsr Cleanup jsr Cleanup
@@ -33,17 +33,17 @@ WarpUp:
; Checks if $a0 is equal to <Room>. If it is, opens its stonewall if it's there ; Checks if $a0 is equal to <Room>. If it is, opens its stonewall if it's there
macro StonewallCheck(Room) macro StonewallCheck(Room)
lda $a0 : cmp.b #<Room> : bne ?end lda.b RoomIndex : cmp.b #<Room> : bne ?end
lda.l <Room>*2+$7ef000 : ora #$80 : sta.l <Room>*2+$7ef000 lda.l <Room>*2+$7ef000 : ora.b #$80 : sta.l <Room>*2+$7ef000
?end ?end
endmacro endmacro
WarpDown: WarpDown:
lda.l DRMode : beq .end lda.l DRMode : beq .end
JSR CheckIfCave : BCS .end JSR CheckIfCave : BCS .end
lda $22 : ldx $a9 lda.b LinkPosX : ldx.b LinkQuadrantH
jsr CalcIndex jsr CalcIndex
!add #$0c : ldy #$ff ; offsets in A, Y !ADD.b #$0c : ldy.b #$ff ; offsets in A, Y
jsr LoadRoomVert jsr LoadRoomVert
%StonewallCheck($43) %StonewallCheck($43)
.end .end
@@ -54,35 +54,35 @@ WarpDown:
; carry clear = we are in dr mode, never use linking doors ; carry clear = we are in dr mode, never use linking doors
CheckLinkDoorR: CheckLinkDoorR:
lda.l DRMode : bne + lda.l DRMode : bne +
lda $7ec004 : sta $a0 ; what we wrote over lda.l $7ec004 : sta.b RoomIndex ; what we wrote over
sec : rtl sec : rtl
+ clc : rtl + clc : rtl
CheckLinkDoorL: CheckLinkDoorL:
lda.l DRMode : bne + lda.l DRMode : bne +
lda $7ec003 : sta $a0 ; what we wrote over lda.l $7ec003 : sta.b RoomIndex ; what we wrote over
sec : rtl sec : rtl
+ clc : rtl + clc : rtl
TrapDoorFixer: TrapDoorFixer:
lda $fe : and #$0038 : beq .end lda.b $fe : and.w #$0038 : beq .end
xba : asl #2 : sta $00 xba : asl #2 : sta.b Scrap00
stz $0468 : lda $068c : ora $00 : sta $068c stz.w TrapDoorFlag : lda.w $068c : ora.b Scrap00 : sta.w $068c
.end .end
stz $fe ; clear our fe here because we don't need it anymore stz.b $fe ; clear our fe here because we don't need it anymore
rts rts
Cleanup: Cleanup:
lda.l DRFlags : and #$10 : beq + lda.l DRFlags : and.b #$10 : beq +
stz $047a stz.w LayerAdjustment
+ inc $11 + inc.b GameSubMode
lda $ef lda.b $ef
rts rts
; carry set if cave, clear otherwise ; carry set if cave, clear otherwise
CheckIfCave: CheckIfCave:
REP #$30 REP #$30
LDA.b $A2 : CMP.w #$00E1 : BCS .invalid LDA.b PreviousRoom : CMP.w #$00E1 : BCS .invalid
SEP #$30 : CLC : RTS SEP #$30 : CLC : RTS
.invalid .invalid
SEP #$30 : SEC : RTS SEP #$30 : SEC : RTS
@@ -92,11 +92,11 @@ CheckIfCave:
CalcIndex: ; A->low byte of Link's Coord, X-> Link's quadrant, DoorOffset x 2 -> A, DoorOffset -> $04 (vert/horz agnostic) CalcIndex: ; A->low byte of Link's Coord, X-> Link's quadrant, DoorOffset x 2 -> A, DoorOffset -> $04 (vert/horz agnostic)
cpx.b #00 : bne .largeDoor cpx.b #00 : bne .largeDoor
cmp.b #$d0 : bcc .smallDoor cmp.b #$d0 : bcc .smallDoor
lda #$01 : bra .done ; Middle Door lda.b #$01 : bra .done ; Middle Door
.smallDoor lda #$00 : bra .done .smallDoor lda.b #$00 : bra .done
.largeDoor lda #$02 .largeDoor lda.b #$02
.done .done
sta $04 sta.b Scrap04
asl asl
rts rts
@@ -105,30 +105,30 @@ CalcIndex: ; A->low byte of Link's Coord, X-> Link's quadrant, DoorOffset x 2 ->
LoadRoomHorz: LoadRoomHorz:
{ {
phb : phk : plb phb : phk : plb
sty $06 : sta $07 : lda $a0 : pha ; Store normal room on stack sty.b Scrap06 : sta.b Scrap07 : lda.b RoomIndex : pha ; Store normal room on stack
lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01 lda.b Scrap07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01
lda $00 : cmp #$03 : bne .gtg lda.b Scrap00 : cmp.b #$03 : bne .gtg
jsr HorzEdge : pla : bcs .end jsr HorzEdge : pla : bcs .end
sta $a0 : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine) sta.b RoomIndex : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
.gtg ;Good to Go! .gtg ;Good to Go!
pla ; Throw away normal room (don't fill up the stack) pla ; Throw away normal room (don't fill up the stack)
lda $a0 : and.b #$0F : asl a : !sub $23 : !add $06 : sta $02 lda.b RoomIndex : and.b #$0F : asl a : !SUB.b LinkPosX+1 : !ADD.b Scrap06 : sta.b Scrap02
ldy #$00 : jsr ShiftVariablesMainDir ldy.b #$00 : jsr ShiftVariablesMainDir
lda $01 : and #$80 : beq .normal lda.b Scrap01 : and.b #$80 : beq .normal
ldy $06 : cpy #$ff : beq + ldy.b Scrap06 : cpy.b #$ff : beq +
lda $01 : jsr LoadEastMidpoint : bra ++ lda.b Scrap01 : jsr LoadEastMidpoint : bra ++
+ lda $01 : jsr LoadWestMidpoint + lda.b Scrap01 : jsr LoadWestMidpoint
++ jsr PrepScrollToEdge : bra .scroll ++ jsr PrepScrollToEdge : bra .scroll
.normal .normal
jsr PrepScrollToNormal jsr PrepScrollToNormal
.scroll .scroll
lda $01 : and #$40 : pha lda.b Scrap01 : and.b #$40 : pha
jsr ScrollY jsr ScrollY
pla : beq .end pla : beq .end
ldy #$06 : jsr ApplyScroll ldy.b #$06 : jsr ApplyScroll
.end .end
plb ; restore db register plb ; restore db register
rts rts
@@ -139,32 +139,32 @@ LoadRoomHorz:
LoadRoomVert: LoadRoomVert:
{ {
phb : phk : plb phb : phk : plb
sty $06 : sta $07 : lda $a0 : pha ; Store normal room on stack sty.b Scrap06 : sta.b Scrap07 : lda.b RoomIndex : pha ; Store normal room on stack
lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01 lda.b Scrap07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01
lda $00 : cmp #$03 : bne .gtg lda.b Scrap00 : cmp.b #$03 : bne .gtg
jsr VertEdge : pla : bcs .end jsr VertEdge : pla : bcs .end
sta $a0 : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine) sta.b RoomIndex : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
.gtg ;Good to Go! .gtg ;Good to Go!
pla ; Throw away normal room (don't fill up the stack) pla ; Throw away normal room (don't fill up the stack)
lda $a0 : and.b #$F0 : lsr #3 : !sub $21 : !add $06 : sta $02 lda.b RoomIndex : and.b #$F0 : lsr #3 : !SUB.b LinkPosY+1 : !ADD.b Scrap06 : sta.b Scrap02
lda $01 : and #$80 : beq .notEdge lda.b Scrap01 : and.b #$80 : beq .notEdge
ldy #$01 : jsr ShiftVariablesMainDir ldy.b #$01 : jsr ShiftVariablesMainDir
ldy $06 : cpy #$ff : beq + ldy.b Scrap06 : cpy.b #$ff : beq +
lda $01 : jsr LoadSouthMidpoint : bra ++ lda.b Scrap01 : jsr LoadSouthMidpoint : bra ++
+ lda $01 : jsr LoadNorthMidpoint + lda.b Scrap01 : jsr LoadNorthMidpoint
++ jsr PrepScrollToEdge : bra .scroll ++ jsr PrepScrollToEdge : bra .scroll
.notEdge .notEdge
lda $01 : and #$03 : cmp #$03 : bne .normal lda.b Scrap01 : and.b #$03 : cmp.b #$03 : bne .normal
jsr ScrollToInroomStairs jsr ScrollToInroomStairs
stz $046d stz.w $046d
bra .end bra .end
.normal .normal
ldy #$01 : jsr ShiftVariablesMainDir ldy.b #$01 : jsr ShiftVariablesMainDir
jsr PrepScrollToNormal jsr PrepScrollToNormal
.scroll .scroll
lda $01 : and #$40 : sta $046d lda.b Scrap01 : and.b #$40 : sta.w $046d
jsr ScrollX jsr ScrollX
.end .end
plb ; restore db register plb ; restore db register
@@ -173,14 +173,14 @@ LoadRoomVert:
LookupNewRoom: ; expects data offset to be in A LookupNewRoom: ; expects data offset to be in A
{ {
rep #$30 : and #$00FF ;sanitize A reg (who knows what is in the high byte) rep #$30 : and.w #$00FF ;sanitize A reg (who knows what is in the high byte)
sta $00 ; offset in 00 sta.b Scrap00 ; offset in 00
lda $a2 : tax ; probably okay loading $a3 in the high byte lda.b PreviousRoom : tax ; probably okay loading $a3 in the high byte
lda.w DoorOffset,x : and #$00FF ;we only want the low byte lda.w DoorOffset,x : and.w #$00FF ;we only want the low byte
asl #3 : sta $02 : !add $02 : !add $02 ;multiply by 24 (data size) asl #3 : sta.b Scrap02 : !ADD.b Scrap02 : !ADD.b Scrap02 ;multiply by 24 (data size)
!add $00 ; should now have the offset of the address I want to load !ADD.b Scrap00 ; should now have the offset of the address I want to load
tax : lda.w DoorTable,x : sta $00 tax : lda.w DoorTable,x : sta.b Scrap00
and #$00FF : sta $a0 ; assign new room and.w #$00FF : sta.b RoomIndex ; assign new room
sep #$30 sep #$30
rts rts
} }
@@ -190,14 +190,14 @@ LookupNewRoom: ; expects data offset to be in A
ShiftVariablesMainDir: ShiftVariablesMainDir:
{ {
lda.w CoordIndex,y : tax lda.w CoordIndex,y : tax
lda $21,x : !add $02 : sta $21,x ; coordinate update lda.b LinkPosY+1,x : !ADD.b Scrap02 : sta.b LinkPosY+1,x ; coordinate update
lda.w CameraIndex,y : tax lda.w CameraIndex,y : tax
lda $e3,x : !add $02 : sta $e3,x ; scroll register high byte lda.b $e3,x : !ADD.b Scrap02 : sta.b $e3,x ; scroll register high byte
lda.w CamQuadIndex,y : tax lda.w CamQuadIndex,y : tax
lda $0605,x : !add $02 : sta $0605,x ; high bytes of these guys lda.w $0605,x : !ADD.b Scrap02 : sta.w $0605,x ; high bytes of these guys
lda $0607,x : !add $02 : sta $0607,x lda.w $0607,x : !ADD.b Scrap02 : sta.w $0607,x
lda $0601,x : !add $02 : sta $0601,x lda.w $0601,x : !ADD.b Scrap02 : sta.w $0601,x
lda $0603,x : !add $02 : sta $0603,x lda.w $0603,x : !ADD.b Scrap02 : sta.w $0603,x
rts rts
} }
@@ -205,12 +205,12 @@ ShiftVariablesMainDir:
ScrollToInroomStairs: ScrollToInroomStairs:
{ {
jsr PrepScrollToInroomStairs jsr PrepScrollToInroomStairs
ldy #$01 : jsr ShiftVariablesMainDir ldy.b #$01 : jsr ShiftVariablesMainDir
jsr ScrollX jsr ScrollX
ldy #$00 : jsr ApplyScroll ldy.b #$00 : jsr ApplyScroll
lda $a0 : and #$0f : cmp #$0f : bne + lda.b RoomIndex : and.b #$0f : cmp.b #$0f : bne +
stz $e0 : stz $e2 ; special case camera fix stz.b BG1H : stz.b BG2H ; special case camera fix
lda #$1f : sta $e1 : sta $e3 lda.b #$1f : sta.b BG1H+1 : sta.b BG2H+1
+ +
rts rts
} }
@@ -219,48 +219,48 @@ ScrollToInroomStairs:
; Sets $02, $04, $05, $ee, $045e, $045f and things related to Y coordinate ; Sets $02, $04, $05, $ee, $045e, $045f and things related to Y coordinate
PrepScrollToInroomStairs: PrepScrollToInroomStairs:
{ {
lda $01 : and #$30 : lsr #3 : tay lda.b Scrap01 : and.b #$30 : lsr #3 : tay
lda.w InroomStairsX,y : sta $04 lda.w InroomStairsX,y : sta.b Scrap04
lda.w InroomStairsX+1,y : sta $05 lda.w InroomStairsX+1,y : sta.b Scrap05
lda $06 : cmp #$ff : beq .south lda.b Scrap06 : cmp.b #$ff : beq .south
lda.w InroomStairsY+1,y : bne + lda.w InroomStairsY+1,y : bne +
inc $045f ; flag indicating special screen transition inc.w $045f ; flag indicating special screen transition
dec $02 ; shift variables further dec.b Scrap02 ; shift variables further
stz $aa stz.b LinkQuadrantV
lda $a8 : and #%11111101 : sta $a8 lda.b $a8 : and.b #%11111101 : sta.b $a8
stz $0613 ; North scroll target stz.w CameraTargetS+1 ; North scroll target
inc $0603 : inc $0607 inc.w $0603 : inc.w $0607
dec $0619 : dec $061b dec.w CameraScrollN+1 : dec.w CameraScrollS+1
+ +
lda.w InroomStairsY,y : !add #$20 : sta $20 lda.w InroomStairsY,y : !ADD.b #$20 : sta.b LinkPosY
!sub #$38 : sta $045e !SUB.b #$38 : sta.w $045e
lda $01 : and #$40 : beq + lda.b Scrap01 : and.b #$40 : beq +
lda $20 : !add #$20 : sta $20 lda.b LinkPosY : !ADD.b #$20 : sta.b LinkPosY
stz $045f stz.w $045f
+ +
dec $21 dec.b LinkPosY+1
%StonewallCheck($1b) %StonewallCheck($1b)
bra ++ bra ++
.south .south
lda.w InroomStairsY+1,y : beq + lda.w InroomStairsY+1,y : beq +
inc $045f ; flag indicating special screen transition inc.w $045f ; flag indicating special screen transition
inc $02 ; shift variables further inc.b Scrap02 ; shift variables further
lda #$02 : sta $aa lda.b #$02 : sta.b LinkQuadrantV
lda $a8 : ora #%00000010 : sta $a8 lda.b $a8 : ora.b #%00000010 : sta.b $a8
inc $0611 ; South scroll target inc.w CameraTargetN+1 ; South scroll target
dec $0603 : dec $0607 dec.w $0603 : dec.w $0607
inc $0619 : inc $061b inc.w CameraScrollN+1 : inc.w CameraScrollS+1
+ +
lda.w InroomStairsY,y : !sub #$20 : sta $20 lda.w InroomStairsY,y : !SUB.b #$20 : sta.b LinkPosY
!add #$38 : sta $045e !ADD.b #$38 : sta.w $045e
lda $01 : and #$40 : beq + lda.b Scrap01 : and.b #$40 : beq +
lda $20 : !sub #$20 : sta $20 lda.b LinkPosY : !SUB.b #$20 : sta.b LinkPosY
stz $045f stz.w $045f
+ +
inc $21 inc.b LinkPosY+1
++ ++
lda $01 : and #$04 : lsr #2 : sta $ee : bne + lda.b Scrap01 : and.b #$04 : lsr #2 : sta.b LinkLayer : bne +
stz $0476 stz.w $0476
+ rts + rts
} }
@@ -268,13 +268,13 @@ PrepScrollToInroomStairs:
; Sets $04 $05 and $ee ; Sets $04 $05 and $ee
PrepScrollToEdge: PrepScrollToEdge:
{ {
sta $04 : lda $01 : and #$20 : beq + sta.b Scrap04 : lda.b Scrap01 : and.b #$20 : beq +
lda #01 lda.b #01
+ sta $05 + sta.b Scrap05
lda $01 : and #$10 : beq + lda.b Scrap01 : and.b #$10 : beq +
lda #01 lda.b #01
+ sta $ee : bne + + sta.b LinkLayer : bne +
stz $0476 stz.w $0476
+ rts + rts
} }
@@ -282,56 +282,56 @@ PrepScrollToEdge:
; Sets $04 $05 and $ee, and $fe ; Sets $04 $05 and $ee, and $fe
PrepScrollToNormal: PrepScrollToNormal:
{ {
lda $01 : sta $fe : and #$04 : lsr #2 : sta $ee ; trap door and layer lda.b Scrap01 : sta.b $fe : and.b #$04 : lsr #2 : sta.b LinkLayer ; trap door and layer
bne + bne +
stz $0476 stz.w $0476
+ stz $05 : lda #$78 : sta $04 + stz.b Scrap05 : lda.b #$78 : sta.b Scrap04
lda $01 : and #$03 : beq .end lda.b Scrap01 : and.b #$03 : beq .end
cmp #$02 : !bge + cmp.b #$02 : !BGE +
lda #$f8 : sta $04 : bra .end lda.b #$f8 : sta.b Scrap04 : bra .end
+ inc $05 + inc.b Scrap05
.end rts .end rts
} }
StraightStairsAdj: StraightStairsAdj:
{ {
stx $0464 : sty $012e ; what we wrote over stx.w $0464 : sty.w SFX2 ; what we wrote over
lda.l DRMode : beq + lda.l DRMode : beq +
lda $045e : bne .toInroom lda.w $045e : bne .toInroom
lda $046d : beq .noScroll lda.w $046d : beq .noScroll
sta $22 sta.b LinkPosX
ldy #$00 : jsr ApplyScroll ldy.b #$00 : jsr ApplyScroll
stz $046d stz.w $046d
.noScroll .noScroll
jsr GetTileAttribute : tax jsr GetTileAttribute : tax
lda $11 : cmp #$12 : beq .goingNorth lda.b GameSubMode : cmp.b #$12 : beq .goingNorth
lda $a2 : cmp #$51 : bne ++ lda.b PreviousRoom : cmp.b #$51 : bne ++
rep #$20 : lda #$0018 : !add $20 : sta $20 : sep #$20 ; special fix for throne room rep #$20 : lda.w #$0018 : !ADD.b LinkPosY : sta.b LinkPosY : sep #$20 ; special fix for throne room
jsr GetTileAttribute : tax jsr GetTileAttribute : tax
++ lda.l StepAdjustmentDown, X : bra .end ++ lda.l StepAdjustmentDown, X : bra .end
; lda $ee : beq .end ; lda.b LinkLayer : beq .end
; rep #$20 : lda #$ffe0 : !add $20 : sta $20 : sep #$20 ; rep #$20 : lda.w #$ffe0 : !ADD.b LinkPosY : sta.b LinkPosY : sep #$20
.goingNorth .goingNorth
cpx #$00 : bne ++ cpx.b #$00 : bne ++
lda $a0 : cmp #$51 : bne ++ lda.b RoomIndex : cmp.b #$51 : bne ++
lda #$36 : bra .end ; special fix for throne room lda.b #$36 : bra .end ; special fix for throne room
++ ldy $ee : cpy #$00 : beq ++ ++ ldy.b LinkLayer : cpy.b #$00 : beq ++
inx inx
++ lda.l StepAdjustmentUp, X ++ lda.l StepAdjustmentUp, X
.end .end
pha : lda $0462 : and #$04 : bne ++ pha : lda.w $0462 : and.b #$04 : bne ++
pla : !add #$f6 : pha pla : !ADD.b #$f6 : pha
++ pla : !add $0464 : sta $0464 ++ pla : !ADD.w $0464 : sta.w $0464
+ rtl + rtl
.toInroom .toInroom
lda #$32 : sta $0464 : stz $045e lda.b #$32 : sta.w $0464 : stz.w $045e
rtl rtl
} }
GetTileAttribute: GetTileAttribute:
{ {
phk : pea.w .jslrtsreturn-1 phk : pea.w .jslrtsreturn-1
pea.w $02802c pea.w $82802c
jml CalculateTransitionLanding ; mucks with x/y sets a to Tile Attribute, I think jml CalculateTransitionLanding ; mucks with x/y sets a to Tile Attribute, I think
.jslrtsreturn .jslrtsreturn
rts rts
@@ -352,15 +352,15 @@ StraightStairsFix:
{ {
pha pha
lda.l DRMode : bne + lda.l DRMode : bne +
pla : !add $20 : sta $20 : rtl ;what we wrote over pla : !ADD.b LinkPosY : sta.b LinkPosY : rtl ;what we wrote over
+ pla : rtl + pla : rtl
} }
StraightStairLayerFix: StraightStairLayerFix:
{ {
lda.l DRMode : beq + lda.l DRMode : beq +
lda $ee : rtl lda.b LinkLayer : rtl
+ lda $01c322, x : rtl ; what we wrote over + lda.l LayerOfDestination+3, x : rtl ; what we wrote over
} }
DoorToStraight: DoorToStraight:
@@ -369,61 +369,61 @@ DoorToStraight:
lda.l DRMode : beq .skip lda.l DRMode : beq .skip
pla : bne .end pla : bne .end
pha pha
lda $a0 : cmp #$51 : bne .skip lda.b RoomIndex : cmp.b #$51 : bne .skip
lda #$04 : sta $4e lda.b #$04 : sta.b $4e
.skip pla .skip pla
.end LDX.w $0418 : CMP.b #$02 ; what we wrote over .end LDX.w TransitionDirection : CMP.b #$02 ; what we wrote over
rtl rtl
} }
DoorToInroom: DoorToInroom:
{ {
ldx $045e : bne .end ldx.w $045e : bne .end
sta $0020, y ; what we wrote over sta.w $0020, y ; what we wrote over
.end .end
ldx #$00 ; what we wrote over ldx.b #$00 ; what we wrote over
rtl rtl
} }
DoorToInroomEnd: DoorToInroomEnd:
{ {
ldy $045e : beq .vanilla ldy.w $045e : beq .vanilla
cmp $045e : bne .return cmp.w $045e : bne .return
stz $045e ; clear stz.w $045e ; clear
.return .return
rtl rtl
.vanilla .vanilla
cmp $02c034, x ; what we wrote over cmp.l UnderworldTransitionLandingCoordinate, x ; what we wrote over
rtl rtl
} }
StraightStairsTrapDoor: StraightStairsTrapDoor:
{ {
lda $0464 : bne + lda.w $0464 : bne +
; reset function ; reset function
.reset phk : pea.w .jslrtsreturn-1 .reset phk : pea.w .jslrtsreturn-1
pea.w $02802c pea.w $82802c
jml $028c73 ; $10D71 .reset label of Bank02 jml ResetThenCacheRoomEntryProperties ; $10D71 .reset label of Bank02
.jslrtsreturn .jslrtsreturn
lda $0468 : bne ++ lda.w TrapDoorFlag : bne ++
lda $a0 : cmp.b #$ac : bne .animateTraps lda.b RoomIndex : cmp.b #$ac : bne .animateTraps
lda $0403 : and.b #$20 : bne .animateTraps lda.w $0403 : and.b #$20 : bne .animateTraps
lda $0403 : and.b #$10 : beq ++ lda.w $0403 : and.b #$10 : beq ++
.animateTraps .animateTraps
lda #$05 : sta $11 lda.b #$05 : sta.b GameSubMode
inc $0468 : stz $068e : stz $0690 inc.w TrapDoorFlag : stz.w TileMapDoorPos : stz.w DoorTimer
++ JML Underworld_SetBossOrSancMusicUponEntry_long ++ JML Underworld_SetBossOrSancMusicUponEntry_long
+ JML Dungeon_ApproachFixedColor ; what we wrote over + JML Dungeon_ApproachFixedColor ; what we wrote over
} }
InroomStairsTrapDoor: InroomStairsTrapDoor:
{ {
lda $0200 : cmp #$05 : beq .reset lda.w SubModuleInterface : cmp.b #$05 : beq .reset
lda $b0 : jml $008781 ; what we wrote over (essentially) lda.b SubSubModule : jml JumpTableLocal ; what we wrote over (essentially)
.reset .reset
pla : pla : pla pla : pla : pla
jsl StraightStairsTrapDoor_reset jsl StraightStairsTrapDoor_reset
jml $028b15 ; just some RTS in bank 02 jml $828b15 ; just some RTS in bank 02
} }
HandleSpecialDoorLanding: { HandleSpecialDoorLanding: {
@@ -436,7 +436,7 @@ HandleSpecialDoorLanding: {
PLA : PHA : AND.b #$FA : CMP.b #$80 : bne .noDoor PLA : PHA : AND.b #$FA : CMP.b #$80 : bne .noDoor
.setDoorState .setDoorState
LDA.w $0418 : AND.b #$02 : BNE + : INC LDA.w TransitionDirection : AND.b #$02 : BNE + : INC
+ STA.b $6C + STA.b $6C
.noDoor .noDoor

View File

@@ -1,9 +1,9 @@
GtBossHeartCheckOverride: GtBossHeartCheckOverride:
lda $a0 : cmp #$1c : beq ++ lda.b RoomIndex : cmp.b #$1c : beq ++
cmp #$6c : beq ++ cmp.b #$6c : beq ++
cmp #$4d : bne + cmp.b #$4d : bne +
++ lda.l DRFlags : and #$01 : bne ++ ;skip if flag on ++ lda.l DRFlags : and.b #$01 : bne ++ ;skip if flag on
lda $403 : ora #$80 : sta $403 lda.w RoomItemsTaken : ora.b #$80 : sta.w RoomItemsTaken
++ clc ++ clc
rtl rtl
+ sec + sec
@@ -11,92 +11,92 @@ rtl
OnFileLoadOverride: OnFileLoadOverride:
jsl OnFileLoad ; what I wrote over jsl OnFileLoad ; what I wrote over
+ lda.l DRFlags : and #$02 : beq + ; Mirror Scroll + lda.l DRFlags : and.b #$02 : beq + ; Mirror Scroll
lda MirrorEquipment : bne + lda.l MirrorEquipment : bne +
lda #$01 : sta MirrorEquipment lda.b #$01 : sta.l MirrorEquipment
+ rtl + rtl
MirrorCheckOverride: MirrorCheckOverride:
lda.l DRFlags : and #$02 : beq ++ lda.l DRFlags : and.b #$02 : beq ++
lda MirrorEquipment : cmp #$01 : beq + lda.l MirrorEquipment : cmp.b #$01 : beq +
++ lda $8A : and #$40 ; what I wrote over ++ lda.b OverworldIndex : and.b #$40 ; what I wrote over
rtl rtl
+ lda.l DRScroll : rtl + lda.l DRScroll : rtl
EGFixOnMirror: EGFixOnMirror:
lda.l DRFlags : and #$10 : beq + lda.l DRFlags : and.b #$10 : beq +
stz $047a stz.w LayerAdjustment
+ jsl Mirror_SaveRoomData + jsl Mirror_SaveRoomData
rtl rtl
BlockEraseFix: BlockEraseFix:
lda MirrorEquipment : and #$02 : beq + lda.l MirrorEquipment : and.b #$02 : beq +
stz $05fc : stz $05fd stz.w $05fc : stz.w $05fd
+ rtl + rtl
FixShopCode: FixShopCode:
cpx #$300 : !bge + cpx.w #$0300 : !BGE +
sta RoomDataWRAM[$00].l, x sta.l RoomDataWRAM[$00].l, x
+ rtl + rtl
VitreousKeyReset: VitreousKeyReset:
LDA.l FixPrizeOnTheEyes : BEQ + LDA.l FixPrizeOnTheEyes : BEQ +
STZ.w $0CBA, X STZ.w SpriteForceDrop, X
+ JML $0DB818 ;restore old code - SpritePrep_LoadProperties + JML SpritePrep_LoadProperties ; what we wrote over
GuruguruFix: GuruguruFix:
lda $a0 : cmp #$df : !bge + lda.b RoomIndex : cmp.b #$df : !BGE +
and #$0f : cmp #$0e : !blt + and.b #$0f : cmp.b #$0e : !BLT +
iny #2 iny #2
+ rtl + rtl
BlindAtticFix: BlindAtticFix:
lda.l DRMode : beq + lda.l DRMode : beq +
lda #$01 : rtl lda.b #$01 : rtl
+ lda FollowerIndicator : cmp.b #$06 + lda.l FollowerIndicator : cmp.b #$06
rtl rtl
SuctionOverworldFix: SuctionOverworldFix:
stz $50 : stz $5e stz.b LinkStrafe : stz.b LinkSpeed
lda.l DRMode : beq + lda.l DRMode : beq +
stz $49 stz.b ForceMove
+ rtl + rtl
!CutoffTable = "$A7E000"
CutoffEntranceRug: CutoffEntranceRug:
PHA : PHX PHA : PHX
LDA.l DRMode : BEQ .norm LDA.l DRMode : BEQ .norm
LDA $04 : cmp #$000A : BEQ + ; only affect A & C objects LDA.b Scrap04 : CMP.w #$000A : BEQ + ; only affect A & C objects
cmp #$000C : BNE .norm CMP.w #$000C : BNE .norm
+ LDX #$0000 : LDA !CutoffTable, x + LDX.w #$0000 : LDA.l CutoffRooms, x
- CMP.b $A0 : BEQ .check - CMP.b RoomIndex : BEQ .check
INX #2 : LDA !CutoffTable, x : CMP.w #$FFFF : BNE - INX #2 : LDA.l CutoffRooms, x : CMP.w #$FFFF : BNE -
.norm PLX : PLA : LDA $9B52, y : STA $7E2000, x ; what we wrote over .norm
RTL PLX : PLA : LDA.w $9B52, Y : STA.l TileMapA, X ; what we wrote over
.check RTL
LDA $0c : CMP #$0004 : !BGE .skip .check
LDA $0e : CMP #$0008 : !BGE .skip LDA.b Scrap0C : CMP.w #$0004 : !BGE .skip
CMP.w #$0004 : !BLT .skip LDA.b Scrap0E : CMP.w #$0008 : !BGE .skip
BRA .norm CMP.w #$0004 : !BLT .skip
.skip PLX : PLA : RTL BRA .norm
.skip
PLX : PLA : RTL
StoreTempBunnyState: StoreTempBunnyState:
LDA $5D : CMP #$1C : BNE + LDA.b LinkState : CMP.b #$1C : BNE +
STA $5F STA.b ManipTileField
+ LDA #$15 : STA $5D ; what we wrote over + LDA.b #$15 : STA.b LinkState ; what we wrote over
RTL RTL
RetrieveBunnyState: RetrieveBunnyState:
STY $5D : STZ $02D8 ; what we wrote over STY.b LinkState : STZ.w ItemReceiptID ; what we wrote over
LDA $5F : BEQ + LDA.b ManipTileField : BEQ +
STA $5D STA.b LinkState
+ JML MaybeKeepLootID + JML MaybeKeepLootID
; A should be how much dmg to do to Aga when leaving this function, 0 if prevented ; A should be how much dmg to do to Aga when leaving this function, 0 if prevented
StandardAgaDmg: StandardAgaDmg:
LDX.b #$00 ; part of what we wrote over LDX.b #$00 ; part of what we wrote over
LDA.l ProgressFlags : AND #$04 : BNE .enableDamage ; zelda's been rescued, no further checks needed LDA.l ProgressFlags : AND.b #$04 : BNE .enableDamage ; zelda's been rescued, no further checks needed
; zelda's not been rescued ; zelda's not been rescued
LDA.l AllowAgaDamageBeforeZeldaRescued : BEQ + ; zelda needs to be rescued if not allowed LDA.l AllowAgaDamageBeforeZeldaRescued : BEQ + ; zelda needs to be rescued if not allowed
.enableDamage .enableDamage
@@ -104,8 +104,8 @@ StandardAgaDmg:
+ RTL + RTL
StandardSaveAndQuit: StandardSaveAndQuit:
LDA.b #$0F : STA.b $95 ; what we wrote over LDA.b #$0F : STA.b MOSAICQ ; what we wrote over
LDA.l ProgressFlags : AND #$04 : BNE + LDA.l ProgressFlags : AND.b #$04 : BNE +
LDA.l DRMode : BEQ + LDA.l DRMode : BEQ +
LDA.l StartingEntrance : CMP.b #$02 : BCC + LDA.l StartingEntrance : CMP.b #$02 : BCC +
LDA.b #$03 : STA.l StartingEntrance ; set spawn to uncle if >= LDA.b #$03 : STA.l StartingEntrance ; set spawn to uncle if >=
@@ -115,20 +115,20 @@ StandardSaveAndQuit:
BlindsAtticHint: BlindsAtticHint:
REP #$20 REP #$20
CMP.w #$0122 : BNE + CMP.w #$0122 : BNE +
LDA RoomDataWRAM[$65].low : AND.w #$0100 : BEQ + LDA.l RoomDataWRAM[$65].low : AND.w #$0100 : BEQ +
SEP #$20 : RTL ; skip the dialog box if the hole is already open SEP #$20 : RTL ; skip the dialog box if the hole is already open
+ SEP #$20 : JML Main_ShowTextMessage + SEP #$20 : JML Main_ShowTextMessage
BlindZeldaDespawnFix: BlindZeldaDespawnFix:
CMP.b #06 : BEQ + CMP.b #06 : BEQ +
LDA.w $0D00,X : BEQ + ; don't despawn follower if maiden isn't "present" LDA.w SpritePosYLow,X : BEQ + ; don't despawn follower if maiden isn't "present"
PLA : PLA : PEA.w SpritePrep_BlindMaiden_despawn_follower-1 : RTL PLA : PLA : PEA.w SpritePrep_BlindMaiden_despawn_follower-1 : RTL
+ PLA : PLA : PEA.w SpritePrep_BlindMaiden_kill_the_girl-1 : RTL + PLA : PLA : PEA.w SpritePrep_BlindMaiden_kill_the_girl-1 : RTL
BigKeyDoorCheck: BigKeyDoorCheck:
CPY.w #$001E : BNE + ; skip if it isn't a BK door CPY.w #$001E : BNE + ; skip if it isn't a BK door
LDA.l DRFlags : AND #$0400 : BNE + ; skip if the flag is set - bk doors can be double-sided LDA.l DRFlags : AND.w #$0400 : BNE + ; skip if the flag is set - bk doors can be double-sided
PLA : PEA.w RoomDraw_OneSidedShutters_South_onesided_shutter_or_big_key_door-1 PLA : PEA.w RoomDraw_OneSidedShutters_South_onesided_shutter_or_big_key_door-1
+ LDA.w #$0000 : RTL + LDA.w #$0000 : RTL
FixOvalFadeOutMirror: FixOvalFadeOutMirror:

View File

@@ -1,98 +1,98 @@
AdjustTransition: AdjustTransition:
{ {
lda $ab : and #$01ff : beq .reset lda.b $ab : and.w #$01ff : beq .reset
phy : ldy #$06 ; operating on vertical registers during horizontal trans phy : ldy.b #$06 ; operating on vertical registers during horizontal trans
cpx.b #$02 : bcs .horizontalScrolling cpx.b #$02 : bcs .horizontalScrolling
ldy #$00 ; operate on horizontal regs during vert trans ldy.b #$00 ; operate on horizontal regs during vert trans
.horizontalScrolling .horizontalScrolling
cmp #$0008 : bcs + cmp.w #$0008 : bcs +
pha : lda $ab : and #$0200 : beq ++ pha : lda.b $ab : and.w #$0200 : beq ++
pla : bra .add pla : bra .add
++ pla : eor #$ffff : inc ; convert to negative ++ pla : eor.w #$ffff : inc ; convert to negative
.add jsr AdjustCamAdd : ply : bra .reset .add jsr AdjustCamAdd : ply : bra .reset
+ lda $ab : and #$0200 : xba : tax + lda.b $ab : and.w #$0200 : xba : tax
lda.l OffsetTable,x : jsr AdjustCamAdd lda.l OffsetTable,x : jsr AdjustCamAdd
lda $ab : !sub #$0008 : sta $ab lda.b $ab : !SUB.w #$0008 : sta.b $ab
ply : bra .done ply : bra .done
.reset ; clear the $ab variable so to not disturb intra-tile doors .reset ; clear the $ab variable so to not disturb intra-tile doors
stz $ab stz.b $ab
.done .done
lda $00 : and #$01fc lda.b Scrap00 : and.w #$01fc
rtl rtl
} }
AdjustCamAdd: AdjustCamAdd:
!add $00E2,y : pha !ADD.w $00E2,y : pha
and #$01ff : cmp #$0111 : !blt + and.w #$01ff : cmp.w #$0111 : !BLT +
cmp #$01f8 : !bge ++ cmp.w #$01f8 : !BGE ++
pla : and #$ff10 : pha : bra + pla : and.w #$ff10 : pha : bra +
++ pla : and #$ff00 : !add #$0100 : pha ++ pla : and.w #$ff00 : !ADD.w #$0100 : pha
+ pla : sta $00E2,y : sta $00E0,y : rts + pla : sta.w $00E2,y : sta.w $00E0,y : rts
; expects target quad in $05 (either 0 or 1) and target pixel in $04, target room should be in $a0 ; expects target quad in $05 (either 0 or 1) and target pixel in $04, target room should be in $a0
; $06 is either $ff or $01/02 ; $06 is either $ff or $01/02
; uses $00-$03 and $0e for calculation ; uses $00-$03 and $0e for calculation
; also set up $ac ; also set up $ac
ScrollY: ;change the Y offset variables ScrollY: ;change the Y offset variables
lda $a0 : and.b #$f0 : lsr #3 : sta $0603 : inc : sta $0607 lda.b RoomIndex : and.b #$f0 : lsr #3 : sta.w $0603 : inc : sta.w $0607
lda $05 : bne + lda.b Scrap05 : bne +
lda $603 : sta $00 : stz $01 : bra ++ lda.w $0603 : sta.b Scrap00 : stz.b Scrap01 : bra ++
+ lda $607 : sta $00 : lda #$02 : sta $01 + lda.w $0607 : sta.b Scrap00 : lda.b #$02 : sta.b Scrap01
++ ; $01 now contains 0 or 2 and $00 contains the correct lat ++ ; $01 now contains 0 or 2 and $00 contains the correct lat
stz $0e stz.b Scrap0E
rep #$30 rep #$30
lda $00 : pha lda.b Scrap00 : pha
lda $e8 : and #$01ff : sta $02 lda.b BG2V : and.w #$01ff : sta.b Scrap02
lda $04 : jsr LimitYCamera : sta $00 lda.b Scrap04 : jsr LimitYCamera : sta.b Scrap00
jsr CheckRoomLayoutY : bcc + jsr CheckRoomLayoutY : bcc +
lda $00 : cmp #$0080 : !bge ++ lda.b Scrap00 : cmp.w #$0080 : !BGE ++
cmp #$0010 : !blt .cmpSrll cmp.w #$0010 : !BLT .cmpSrll
lda #$0010 : bra .cmpSrll lda.w #$0010 : bra .cmpSrll
++ cmp #$0100 : !bge .cmpSrll ++ cmp.w #$0100 : !BGE .cmpSrll
lda #$0100 lda.w #$0100
.cmpSrll sta $00 .cmpSrll sta.b Scrap00
; figures out scroll amt ; figures out scroll amt
+ lda $00 : cmp $02 : bne + + lda.b Scrap00 : cmp.b Scrap02 : bne +
lda #$0000 : bra .next lda.w #$0000 : bra .next
+ !blt + + !BLT +
!sub $02 : inc $0e : bra .next !SUB.b Scrap02 : inc.b Scrap0E : bra .next
+ lda $02 : !sub $00 + lda.b Scrap02 : !SUB.b Scrap00
.next .next
sta $ab sta.b $ab
jsr AdjustCameraBoundsY jsr AdjustCameraBoundsY
pla : sta $00 pla : sta.b Scrap00
sep #$30 sep #$30
lda $04 : sta $20 lda.b Scrap04 : sta.b $20
lda $00 : sta $21 : sta $0601 : sta $0605 lda.b Scrap00 : sta.b $21 : sta.w $0601 : sta.w $0605
lda $01 : sta $aa lda.b Scrap01 : sta.b $aa
lda $0e : asl : ora $ac : sta $ac lda.b Scrap0E : asl : ora.b $ac : sta.b $ac
lda $e9 : and #$01 : asl #2 : tax : lda $0603, x : sta $e9 lda.b BG2V+1 : and.b #$01 : asl #2 : tax : lda.w $0603, x : sta.b BG2V+1
rts rts
LimitYCamera: LimitYCamera:
cmp #$006c : !bge + cmp.w #$006c : !BGE +
lda #$0000 : bra .end lda.w #$0000 : bra .end
+ cmp #$017d : !blt + + cmp.w #$017d : !BLT +
lda #$0110 : bra .end lda.w #$0110 : bra .end
+ !sub #$006c + !SUB.w #$006c
.end rts .end rts
CheckRoomLayoutY: CheckRoomLayoutY:
jsr LoadRoomLayout ;switches to 8-bit jsr LoadRoomLayout ;switches to 8-bit
cmp #$00 : beq .lock cmp.b #$00 : beq .lock
cmp #$07 : beq .free cmp.b #$07 : beq .free
cmp #$01 : beq .free cmp.b #$01 : beq .free
cmp #$04 : !bge .lock cmp.b #$04 : !BGE .lock
cmp #$02 : bne + cmp.b #$02 : bne +
lda $06 : cmp #$ff : beq .lock lda.b Scrap06 : cmp.b #$ff : beq .lock
+ cmp #$03 : bne .free + cmp.b #$03 : bne .free
lda $06 : cmp #$ff : bne .lock lda.b Scrap06 : cmp.b #$ff : bne .lock
.free rep #$30 : clc : rts .free rep #$30 : clc : rts
.lock rep #$30 : sec : rts .lock rep #$30 : sec : rts
@@ -100,123 +100,123 @@ AdjustCameraBoundsY:
jsr CheckRoomLayoutY : bcc .free jsr CheckRoomLayoutY : bcc .free
; layouts that are camera locked (quads only) ; layouts that are camera locked (quads only)
lda $04 : and #$00ff : cmp #$007d : !blt + lda.b Scrap04 : and.w #$00ff : cmp.w #$007d : !BLT +
lda #$0088 : bra ++ lda.w #$0088 : bra ++
+ cmp #$006d : !bge + + cmp.w #$006d : !BGE +
lda #$0078 : bra ++ lda.w #$0078 : bra ++
+ !add #$000b + !ADD.w #$000b
; I think we no longer need the $02 variable ; I think we no longer need the $02 variable
++ sta $02 : lda $04 : and #$0100 : !add $02 : bra .setBounds ++ sta.b Scrap02 : lda.b Scrap04 : and.w #$0100 : !ADD.b Scrap02 : bra .setBounds
; layouts where the camera is free ; layouts where the camera is free
.free lda $04 : cmp #$006c : !bge + .free lda.b Scrap04 : cmp.w #$006c : !BGE +
lda #$0077 : bra .setBounds lda.w #$0077 : bra .setBounds
+ cmp #$017c : !blt + + cmp.w #$017c : !BLT +
lda #$0187 : bra .setBounds lda.w #$0187 : bra .setBounds
+ !add #$000b + !ADD.w #$000b
.setBounds sta $0618 : inc #2 : sta $061a .setBounds sta.w $0618 : inc #2 : sta.w $061a
rts rts
LoadRoomLayout: LoadRoomLayout:
lda $a0 : asl : !add $a0 : tax lda.b RoomIndex : asl : !ADD.b RoomIndex : tax
lda $1f8001, x : sta $b8 lda.l RoomData_ObjectDataPointers+1, x : sta.b $b8
lda $1f8000, x : sta $b7 lda.l RoomData_ObjectDataPointers, x : sta.b $b7
sep #$30 sep #$30
ldy #$01 : lda [$b7], y : and #$1c : lsr #2 ldy.b #$01 : lda.b [$b7], y : and.b #$1c : lsr #2
rts rts
; expects target quad in $05 (either 0 or 1) and target pixel in $04, target room should be in $a0 ; expects target quad in $05 (either 0 or 1) and target pixel in $04, target room should be in $a0
; uses $00-$03 and $0e for calculation ; uses $00-$03 and $0e for calculation
; also set up $ac ; also set up $ac
ScrollX: ;change the X offset variables ScrollX: ;change the X offset variables
lda $a0 : and.b #$0f : asl : sta $060b : inc : sta $060f lda.b RoomIndex : and.b #$0f : asl : sta.w $060b : inc : sta.w $060f
lda $05 : bne + lda.b Scrap05 : bne +
lda $60b : sta $00 : stz $01 : bra ++ lda.w $060b : sta.b Scrap00 : stz.b Scrap01 : bra ++
+ lda $60f : sta $00 : lda #$01 : sta $01 + lda.w $060f : sta.b Scrap00 : lda.b #$01 : sta.b Scrap01
++ ; $01 now contains 0 or 1 and $00 contains the correct long ++ ; $01 now contains 0 or 1 and $00 contains the correct long
stz $0e ; pos/neg indicator stz.b Scrap0E ; pos/neg indicator
rep #$30 rep #$30
lda $00 : pha lda.b Scrap00 : pha
lda $e2 : and #$01ff : sta $02 lda.b BG2H : and.w #$01ff : sta.b Scrap02
lda $04 : jsr LimitXCamera : sta $00 lda.b Scrap04 : jsr LimitXCamera : sta.b Scrap00
jsr CheckRoomLayoutX : bcc + jsr CheckRoomLayoutX : bcc +
lda $00 : cmp #$0080 : !bge ++ lda.b Scrap00 : cmp.w #$0080 : !BGE ++
lda #$0000 : bra .cmpSrll lda.w #$0000 : bra .cmpSrll
++ lda #$0100 ++ lda.w #$0100
.cmpSrll sta $00 .cmpSrll sta.b Scrap00
;figures out scroll amt ;figures out scroll amt
+ lda $00 : cmp $02 : bne + + lda.b Scrap00 : cmp.b Scrap02 : bne +
lda #$0000 : bra .next lda.w #$0000 : bra .next
+ !blt + + !BLT +
!sub $02 : inc $0e : bra .next !SUB.b Scrap02 : inc.b Scrap0E : bra .next
+ lda $02 : !sub $00 + lda.b Scrap02 : !SUB.b Scrap00
.next .next
sta $ab : lda $04 sta.b $ab : lda.b Scrap04
cmp #$0078 : !bge + cmp.w #$0078 : !BGE +
lda #$007f : bra ++ lda.w #$007f : bra ++
+ cmp #$0178 : !blt + + cmp.w #$0178 : !BLT +
lda #$017f : bra ++ lda.w #$017f : bra ++
+ !add #$0007 + !ADD.w #$0007
++ sta $061c : inc #2 : sta $061e ++ sta.w $061c : inc #2 : sta.w $061e
pla : sta $00 pla : sta.b Scrap00
sep #$30 sep #$30
lda $04 : ldx $046d : bne .straight lda.b Scrap04 : ldx.w $046d : bne .straight
sta $22 : bra + sta.b LinkPosX : bra +
.straight .straight
sta $046d ; set X position later sta.w $046d ; set X position later
+ +
lda $00 : sta $23 : sta $0609 : sta $060d lda.b Scrap00 : sta.b LinkPosX+1 : sta.w $0609 : sta.w $060d
lda $01 : sta $a9 lda.b Scrap01 : sta.b LinkQuadrantH
lda $0e : asl : ora $ac : sta $ac lda.b Scrap0E : asl : ora.b $ac : sta.b $ac
lda $e3 : and #$01 : asl #2 : tax : lda $060b, x : sta $e3 lda.b BG2H+1 : and.b #$01 : asl #2 : tax : lda.w $060b, x : sta.b BG2H+1
rts rts
LimitXCamera: LimitXCamera:
cmp #$0079 : !bge + cmp.w #$0079 : !BGE +
lda #$0000 : bra .end lda.w #$0000 : bra .end
+ cmp #$0178 : !blt + + cmp.w #$0178 : !BLT +
lda #$0178 lda.w #$0178
+ !sub #$0078 + !SUB.w #$0078
.end rts .end rts
CheckRoomLayoutX: CheckRoomLayoutX:
jsr LoadRoomLayout ;switches to 8-bit jsr LoadRoomLayout ;switches to 8-bit
cmp #$04 : !blt .lock cmp.b #$04 : !BLT .lock
cmp #$05 : bne + cmp.b #$05 : bne +
lda $06 : cmp #$ff : beq .lock lda.b Scrap06 : cmp.b #$ff : beq .lock
+ cmp #$06 : bne .free + cmp.b #$06 : bne .free
lda $06 : cmp #$ff : bne .lock lda.b Scrap06 : cmp.b #$ff : bne .lock
.free rep #$30 : clc : rts .free rep #$30 : clc : rts
.lock rep #$30 : sec : rts .lock rep #$30 : sec : rts
ApplyScroll: ApplyScroll:
rep #$30 rep #$30
lda $ab : and #$01ff : sta $00 lda.b $ab : and.w #$01ff : sta.b Scrap00
lda $ab : and #$0200 : beq + lda.b $ab : and.w #$0200 : beq +
lda $00e2, y : !add $00 : bra .end lda.w $00e2, y : !ADD.b Scrap00 : bra .end
+ lda $00e2, y : !sub $00 + lda.w $00e2, y : !SUB.b Scrap00
.end .end
sta $00e2, y sta.w $00e2, y
sta $00e0, y sta.w $00e0, y
stz $ab : sep #$30 : rts stz.b $ab : sep #$30 : rts
QuadrantLoadOrderBeforeScroll: QuadrantLoadOrderBeforeScroll:
lda $045f : beq .end lda.w $045f : beq .end
lda #$08 : sta $045c ; start with opposite quadrant row lda.b #$08 : sta.w $045c ; start with opposite quadrant row
.end .end
JML $0091c4 ; what we overwrote JML WaterFlood_BuildOneQuadrantForVRAM ; what we overwrote
QuadrantLoadOrderAfterScroll: QuadrantLoadOrderAfterScroll:
lda $045f : beq .end lda.w $045f : beq .end
stz $045c : stz $045f ; draw other row and clear flag stz.w $045c : stz.w $045f ; draw other row and clear flag
.end .end
JML $0091c4 ; what we overwrote JML WaterFlood_BuildOneQuadrantForVRAM ; what we overwrote

View File

@@ -1,103 +1,103 @@
RecordStairType: { RecordStairType: {
pha pha
lda.l DRMode : beq .norm lda.l DRMode : beq .norm
REP #$30 : LDA.b $A2 : CMP.w #$00E1 : BCS .norm REP #$30 : LDA.b PreviousRoom : CMP.w #$00E1 : BCS .norm
CMP #$00DF : BEQ .norm CMP.w #$00DF : BEQ .norm
SEP #$30 SEP #$30
lda $0e lda.b Scrap0E
cmp #$25 : bcc ++ ; don't record straight staircases cmp.b #$25 : bcc ++ ; don't record straight staircases
sta $045e sta.w $045e
++ pla : bra + ++ pla : bra +
.norm SEP #$30 : pla : sta $a0 .norm SEP #$30 : pla : sta.b RoomIndex
+ lda $063d, x + lda.w $063d, x
rtl rtl
} }
SpiralWarp: { SpiralWarp: {
lda.l DRMode : beq .abort ; abort if not DR lda.l DRMode : beq .abort ; abort if not DR
REP #$30 : LDA.b $A2 : CMP.w #$00E1 : BCS .abort REP #$30 : LDA.b PreviousRoom : CMP.w #$00E1 : BCS .abort
CMP #$00DF : BEQ .abort CMP.w #$00DF : BEQ .abort
SEP #$30 SEP #$30
lda $045e : cmp #$5e : beq .gtg ; abort if not spiral - intended room is in A! lda.w $045e : cmp.b #$5e : beq .gtg ; abort if not spiral - intended room is in A!
cmp #$5f : beq .gtg cmp.b #$5f : beq .gtg
cmp #$26 : beq .inroom cmp.b #$26 : beq .inroom
.abort .abort
SEP #$30 : stz $045e : lda $a2 : and.b #$0f : rtl ; clear,run hijacked code and get out SEP #$30 : stz.w $045e : lda.b PreviousRoom : and.b #$0f : rtl ; clear,run hijacked code and get out
.inroom .inroom
jsr InroomStairsWarp jsr InroomStairsWarp
lda $a2 : and #$0f ; this is the code we are hijacking lda.b PreviousRoom : and.b #$0f ; this is the code we are hijacking
rtl rtl
.gtg .gtg
phb : phk : plb : phx : phy ; push stuff phb : phk : plb : phx : phy ; push stuff
jsr LookupSpiralOffset jsr LookupSpiralOffset
rep #$30 : and #$00FF : asl #2 : tax rep #$30 : and.w #$00FF : asl #2 : tax
lda.w SpiralTable, x : sta $00 lda.w SpiralTable, x : sta.b Scrap00
lda.w SpiralTable+2, x : sta $02 lda.w SpiralTable+2, x : sta.b Scrap02
sep #$30 sep #$30
lda $00 : sta $a0 lda.b Scrap00 : sta.b RoomIndex
; shift quadrant if necessary ; shift quadrant if necessary
stz $07 ; this is a x quad adjuster for those blasted staircase on the edges stz.b Scrap07 ; this is a x quad adjuster for those blasted staircase on the edges
lda $01 : and #$01 : !sub $a9 lda.b Scrap01 : and.b #$01 : !SUB.b LinkQuadrantH
bne .xQuad bne .xQuad
lda $0462 : and #$04 : bne .xqCont lda.w $0462 : and.b #$04 : bne .xqCont
inc $07 inc.b Scrap07
.xqCont lda $22 : bne .skipXQuad ; this is an edge case .xqCont lda.b LinkPosX : bne .skipXQuad ; this is an edge case
dec $23 : bra .skipXQuad ; need to -1 if $22 is 0 dec.b LinkPosX+1 : bra .skipXQuad ; need to -1 if $22 is 0
.xQuad sta $06 : !add $a9 : sta $a9 .xQuad sta.b Scrap06 : !ADD.b LinkQuadrantH : sta.b LinkQuadrantH
lda $0462 : and #$04 : bne .xCont lda.w $0462 : and.b #$04 : bne .xCont
inc $07 ; up stairs are going to -1 the quad anyway during transition, need to add this back inc.b Scrap07 ; up stairs are going to -1 the quad anyway during transition, need to add this back
.xCont ldy #$00 : jsr ShiftQuadSimple .xCont ldy.b #$00 : jsr ShiftQuadSimple
.skipXQuad .skipXQuad
lda $aa : lsr : sta $06 : lda $01 : and #$02 : lsr : !sub $06 lda.b LinkQuadrantV : lsr : sta.b Scrap06 : lda.b Scrap01 : and.b #$02 : lsr : !SUB.b Scrap06
beq .skipYQuad beq .skipYQuad
sta $06 : asl : !add $aa : sta $aa sta.b Scrap06 : asl : !ADD.b LinkQuadrantV : sta.b LinkQuadrantV
ldy #$01 : jsr ShiftQuadSimple ldy.b #$01 : jsr ShiftQuadSimple
.skipYQuad .skipYQuad
lda $01 : and #$04 : lsr : sta $048a ;fix layer calc 0->0 2->1 lda.b Scrap01 : and.b #$04 : lsr : sta.w $048a ;fix layer calc 0->0 2->1
lda $01 : and #$08 : lsr #2 : sta $0492 ;fix from layer calc 0->0 2->1 lda.b Scrap01 : and.b #$08 : lsr #2 : sta.w $0492 ;fix from layer calc 0->0 2->1
; shift lower coordinates ; shift lower coordinates
lda $02 : sta $22 : bne .adjY : lda $23 : !add $07 : sta $23 lda.b Scrap02 : sta.b LinkPosX : bne .adjY : lda.b LinkPosX+1 : !ADD.b Scrap07 : sta.b LinkPosX+1
.adjY lda $03 : sta $20 : bne .upDownAdj : inc $21 .adjY lda.b Scrap03 : sta.b LinkPosY : bne .upDownAdj : inc.b LinkPosY+1
.upDownAdj ldx #$08 .upDownAdj ldx.b #$08
lda $0462 : and #$04 : beq .upStairs lda.w $0462 : and.b #$04 : beq .upStairs
ldx #$fd ldx.b #$fd
lda $01 : and #$80 : bne .set53 lda.b Scrap01 : and.b #$80 : bne .set53
; if target is also down adjust by (6,-15) ; if target is also down adjust by (6,-15)
lda #$06 : !add $20 : sta $20 : lda #$eb : !add $22 : sta $22 : bra .set53 lda.b #$06 : !ADD.b LinkPosY : sta.b LinkPosY : lda.b #$eb : !ADD.b LinkPosX : sta.b LinkPosX : bra .set53
.upStairs .upStairs
lda $01 : and #$80 : beq .set53 lda.b Scrap01 : and.b #$80 : beq .set53
; if target is also up adjust by (-6, 14) ; if target is also up adjust by (-6, 14)
lda #$fa : !add $20 : sta $20 : lda #$14 : !add $22 : sta $22 lda.b #$fa : !ADD.b LinkPosY : sta.b LinkPosY : lda.b #$14 : !ADD.b LinkPosX : sta.b LinkPosX
bne .set53 : inc $23 bne .set53 : inc.b LinkPosX+1
.set53 .set53
txa : !add $22 : sta $53 txa : !ADD.b LinkPosX : sta.b $53
lda $01 : and #$10 : sta $07 ; zeroHzCam check lda.b Scrap01 : and.b #$10 : sta.b Scrap07 ; zeroHzCam check
ldy #$00 : jsr SetCamera ldy.b #$00 : jsr SetCamera
lda $01 : and #$20 : sta $07 ; zeroVtCam check lda.b Scrap01 : and.b #$20 : sta.b Scrap07 ; zeroVtCam check
ldy #$01 : jsr SetCamera ldy.b #$01 : jsr SetCamera
jsr StairCleanup jsr StairCleanup
ply : plx : plb ; pull the stuff we pushed ply : plx : plb ; pull the stuff we pushed
lda $a2 : and #$0f ; this is the code we are hijacking lda.b PreviousRoom : and.b #$0f ; this is the code we are hijacking
rtl rtl
} }
StairCleanup: { StairCleanup: {
stz $045e ; clear the staircase flag stz.w $045e ; clear the staircase flag
; animated tiles fix ; animated tiles fix
lda.l DRMode : cmp #$02 : bne + ; only do this in crossed mode lda.l DRMode : cmp.b #$02 : bne + ; only do this in crossed mode
ldx $a0 : lda.l TilesetTable, x ldx.b RoomIndex : lda.l TilesetTable, x
cmp $0aa1 : beq + ; already eq no need to decomp cmp.w $0aa1 : beq + ; already eq no need to decomp
sta $0aa1 sta.w $0aa1
tax : lda $02802e, x : tay tax : lda.l AnimatedTileSheets, x : tay
jsl DecompDungAnimatedTiles jsl DecompDungAnimatedTiles
+ +
stz $047a stz.w LayerAdjustment
rts rts
} }
@@ -110,58 +110,58 @@ LookupSpiralOffset_long:
LookupSpiralOffset: { LookupSpiralOffset: {
;where link currently is in $a2: quad in a8 & #$03 ;where link currently is in $a2: quad in a8 & #$03
;count doors ;count doors
stz $00 : ldx #$00 : stz $01 stz.b Scrap00 : ldx.b #$00 : stz.b Scrap01
.loop .loop
lda $047e, x : cmp $00 : bcc .continue lda.w $047e, x : cmp.b Scrap00 : bcc .continue
sta $00 sta.b Scrap00
.continue inx #2 .continue inx #2
cpx #$08 : bcc .loop cpx.b #$08 : bcc .loop
lda $00 : lsr lda.b Scrap00 : lsr
cmp #$01 : beq .done cmp.b #$01 : beq .done
; look up the quad ; look up the quad
lda $a9 : ora $aa : and #$03 : beq .quad0 lda.b LinkQuadrantH : ora.b LinkQuadrantV : and.b #$03 : beq .quad0
cmp #$01 : beq .quad1 cmp.b #$01 : beq .quad1
cmp #$02 : beq .quad2 cmp.b #$02 : beq .quad2
bra .quad3 bra .quad3
.quad0 .quad0
inc $01 : lda $a2 inc.b Scrap01 : lda.b PreviousRoom
cmp #$0c : beq .q0diff ;gt ent cmp.b #$0c : beq .q0diff ;gt ent
cmp #$70 : bne .done ;hc stairwell cmp.b #$70 : bne .done ;hc stairwell
.q0diff lda $22 : cmp #$00 : beq .secondDoor .q0diff lda.b LinkPosX : cmp.b #$00 : beq .secondDoor
cmp #$98 : bcc .done ;gt ent and hc stairwell cmp.b #$98 : bcc .done ;gt ent and hc stairwell
.secondDoor inc $01 : bra .done .secondDoor inc.b Scrap01 : bra .done
.quad1 .quad1
lda $a2 lda.b PreviousRoom
cmp #$1a : beq .q1diff ;pod compass cmp.b #$1a : beq .q1diff ;pod compass
cmp #$26 : beq .q1diff ;swamp elbows cmp.b #$26 : beq .q1diff ;swamp elbows
cmp #$6a : beq .q1diff ;pod dark basement cmp.b #$6a : beq .q1diff ;pod dark basement
cmp #$76 : bne .done ;swamp drain cmp.b #$76 : bne .done ;swamp drain
.q1diff lda $22 : cmp #$98 : bcc .done .q1diff lda.b LinkPosX : cmp.b #$98 : bcc .done
inc $01 : bra .done inc.b Scrap01 : bra .done
.quad2 .quad2
lda #$03 : sta $01 : lda $a2 lda.b #$03 : sta.b Scrap01 : lda.b PreviousRoom
cmp #$5f : beq .iceu ;ice u room cmp.b #$5f : beq .iceu ;ice u room
cmp #$3f : bne .done ;hammer ice exception cmp.b #$3f : bne .done ;hammer ice exception
stz $01 : bra .done stz.b Scrap01 : bra .done
.iceu lda $22 : cmp #$78 : bcc .done .iceu lda.b LinkPosX : cmp.b #$78 : bcc .done
inc $01 : bra .done inc.b Scrap01 : bra .done
.quad3 .quad3
lda $a2 : cmp #$40 : beq .done ; top of aga exception lda.b PreviousRoom : cmp.b #$40 : beq .done ; top of aga exception
lda #$02 : sta $01 ; always 2 lda.b #$02 : sta.b Scrap01 ; always 2
.done .done
lda $a2 : tax : lda.w SpiralOffset,x lda.b PreviousRoom : tax : lda.w SpiralOffset,x
!add $01 ;add a thing (0 in easy case) !ADD.b Scrap01 ;add a thing (0 in easy case)
rts rts
} }
InroomStairsWarp: { InroomStairsWarp: {
phb : phk : plb : phx : phy ; push stuff phb : phk : plb : phx : phy ; push stuff
; find stairs by room and store index in X ; find stairs by room and store index in X
lda $a0 : ldx #$07 lda.b RoomIndex : ldx.b #$07
.loop .loop
cmp.w InroomStairsRoom,x cmp.w InroomStairsRoom,x
beq .found beq .found
@@ -169,94 +169,94 @@ InroomStairsWarp: {
bne .loop bne .loop
.found .found
rep #$30 rep #$30
txa : and #$00ff : asl : tay txa : and.w #$00ff : asl : tay
lda.w InroomStairsTable,y : sta $00 lda.w InroomStairsTable,y : sta.b Scrap00
sep #$30 sep #$30
sta $a0 sta.b RoomIndex
; set position and everything else based on target door type ; set position and everything else based on target door type
txa : and #$01 : eor #$01 : sta $07 txa : and.b #$01 : eor.b #$01 : sta.b Scrap07
; should be the same as lda $0462 : and #$04 : lsr #2 : eor #$01 : sta $07 ; should be the same as lda $0462 : and #$04 : lsr #2 : eor #$01 : sta $07
lda $01 : and #$80 : beq .notEdge lda.b Scrap01 : and.b #$80 : beq .notEdge
lda $07 : sta $03 : beq + lda.b Scrap07 : sta.b Scrap03 : beq +
lda $01 : jsr LoadSouthMidpoint : sta $22 : lda #$f4 lda.b Scrap01 : jsr LoadSouthMidpoint : sta.b LinkPosX : lda.b #$f4
bra ++ bra ++
+ +
lda $01 : jsr LoadNorthMidpoint : sta $22 : dec $21 : lda #$f7 lda.b Scrap01 : jsr LoadNorthMidpoint : sta.b LinkPosX : dec.b LinkPosY+1 : lda.b #$f7
++ ++
sta $20 sta.b LinkPosY
lda $01 : and #$20 : beq + lda.b Scrap01 : and.b #$20 : beq +
lda #$01 lda.b #$01
+ +
sta $02 sta.b Scrap02
stz $07 stz.b Scrap07
lda $01 : and #$10 : lsr #4 lda.b Scrap01 : and.b #$10 : lsr #4
JMP .layer JMP .layer
.notEdge .notEdge
lda $01 : and #$03 : cmp #$03 : bne .normal lda.b Scrap01 : and.b #$03 : cmp.b #$03 : bne .normal
txa : and #$06 : sta $07 txa : and.b #$06 : sta.b Scrap07
lda $01 : and #$30 : lsr #3 : tay lda.b Scrap01 : and.b #$30 : lsr #3 : tay
lda.w InroomStairsX+1,y : sta $02 lda.w InroomStairsX+1,y : sta.b Scrap02
lda.w InroomStairsY+1,y : sta $03 lda.w InroomStairsY+1,y : sta.b Scrap03
cpy $07 : beq .vanillaTransition cpy.b Scrap07 : beq .vanillaTransition
lda.w InroomStairsX,y : sta $22 lda.w InroomStairsX,y : sta.b LinkPosX
lda.w InroomStairsY,y lda.w InroomStairsY,y
ldy $07 : beq + ldy.b Scrap07 : beq +
!add #$07 !ADD #$07
+ +
sta $20 sta.b LinkPosY
inc $07 inc.b Scrap07
bra ++ bra ++
.vanillaTransition .vanillaTransition
lda #$c0 : sta $07 ; leave camera lda.b #$c0 : sta.b Scrap07 ; leave camera
++ ++
%StonewallCheck($1b) %StonewallCheck($1b)
lda $01 : and #$04 : lsr #2 lda.b Scrap01 : and.b #$04 : lsr #2
bra .layer bra .layer
.normal .normal
lda $01 : sta $fe ; trap door lda.b Scrap01 : sta.b $fe ; trap door
lda $07 : sta $03 : beq + lda.b Scrap07 : sta.b Scrap03 : beq +
lda $01 : and #$04 : bne .specialFix lda.b Scrap01 : and.b #$04 : bne .specialFix
lda #$e0 : bra ++ lda.b #$e0 : bra ++
.specialFix .specialFix
lda #$c8 : bra ++ lda.b #$c8 : bra ++
+ +
%StonewallCheck($43) %StonewallCheck($43)
lda $01 : and #$04 : bne + lda.b Scrap01 : and.b #$04 : bne +
lda #$1b : bra ++ lda.b #$1b : bra ++
+ lda #$33 + lda.b #$33
++ sta $20 ++ sta.b LinkPosY
inc $07 : stz $02 : lda #$78 : sta $22 inc.b Scrap07 : stz.b Scrap02 : lda.b #$78 : sta.b LinkPosX
lda $01 : and #$03 : beq ++ lda.b Scrap01 : and.b #$03 : beq ++
cmp #$02 : !bge + cmp.b #$02 : !BGE +
lda #$f8 : sta $22 : stz $07 : bra ++ lda.b #$f8 : sta.b LinkPosX : stz.b Scrap07 : bra ++
+ inc $02 + inc.b Scrap02
++ ++
lda $01 : and #$04 : lsr #2 lda.b Scrap01 : and.b #$04 : lsr #2
.layer .layer
sta $ee sta.b LinkLayer
bne + bne +
stz $0476 stz.w $0476
+ +
lda $02 : !sub $a9 lda.b Scrap02 : !SUB.b LinkQuadrantH
beq .skipXQuad beq .skipXQuad
sta $06 : !add $a9 : sta $a9 sta.b Scrap06 : !ADD.b LinkQuadrantH : sta.b LinkQuadrantH
ldy #$00 : jsr ShiftQuadSimple ldy.b #$00 : jsr ShiftQuadSimple
.skipXQuad .skipXQuad
lda $aa : lsr : sta $06 : lda $03 : !sub $06 lda.b LinkQuadrantV : lsr : sta.b Scrap06 : lda.b Scrap03 : !SUB.b Scrap06
beq .skipYQuad beq .skipYQuad
sta $06 : asl : !add $aa : sta $aa sta.b Scrap06 : asl : !ADD.b LinkQuadrantV : sta.b LinkQuadrantV
ldy #$01 : jsr ShiftQuadSimple ldy.b #$01 : jsr ShiftQuadSimple
.skipYQuad .skipYQuad
lda $07 : bmi .skipCamera lda.b Scrap07 : bmi .skipCamera
ldy #$00 : jsr SetCamera ; horizontal camera ldy.b #$00 : jsr SetCamera ; horizontal camera
ldy #$01 : sty $07 : jsr SetCamera ; vertical camera ldy.b #$01 : sty.b Scrap07 : jsr SetCamera ; vertical camera
lda $20 : cmp #$e0 : bcc + lda.b LinkPosY : cmp.b #$e0 : bcc +
lda $e8 : bne + lda.b BG2V : bne +
lda #$10 : sta $e8 ; adjust vertical camera at bottom lda.b #$10 : sta.b BG2V ; adjust vertical camera at bottom
+ +
.skipCamera .skipCamera
@@ -267,72 +267,72 @@ InroomStairsWarp: {
ShiftQuadSimple: { ShiftQuadSimple: {
lda.w CoordIndex,y : tax lda.w CoordIndex,y : tax
lda $20,x : beq .skip lda.b LinkPosY,x : beq .skip
lda $21,x : !add $06 : sta $21,x ; coordinate update lda.b LinkPosY+1,x : !ADD.b Scrap06 : sta.b LinkPosY+1,x ; coordinate update
.skip .skip
lda.w CamQuadIndex,y : tax lda.w CamQuadIndex,y : tax
lda $0601,x : !add $06 : sta $0601,x lda.w $0601,x : !ADD.b Scrap06 : sta.w $0601,x
lda $0605,x : !add $06 : sta $0605,x ; high bytes of these guys lda.w $0605,x : !ADD.b Scrap06 : sta.w $0605,x ; high bytes of these guys
rts rts
} }
SetCamera: { SetCamera: {
stz $04 stz.b Scrap04
tyx : lda $a9,x : bne .nonZeroHalf tyx : lda.b LinkQuadrantH,x : bne .nonZeroHalf
lda.w CamQuadIndex,y : tax : lda $607,x : pha lda.w CamQuadIndex,y : tax : lda.w $0607,x : pha
lda.w CameraIndex,y : tax : pla : cmp $e3, x : bne .noQuadAdj lda.w CameraIndex,y : tax : pla : cmp.b BG2H+1, x : bne .noQuadAdj
dec $e3,x dec.b BG2H+1,x
.noQuadAdj .noQuadAdj
lda $07 : bne .adj0 lda.b Scrap07 : bne .adj0
lda.w CoordIndex,y : tax lda.w CoordIndex,y : tax
lda $20,x : beq .oddQuad lda.b LinkPosY,x : beq .oddQuad
cmp #$79 : bcc .adj0 cmp.b #$79 : bcc .adj0
!sub #$78 : sta $04 !SUB.b #$78 : sta.b Scrap04
tya : asl : !add #$04 : tax : jsr AdjCamBounds : bra .done tya : asl : !ADD.b #$04 : tax : jsr AdjCamBounds : bra .done
.oddQuad .oddQuad
lda #$80 : sta $04 : bra .adj1 ; this is such a weird case - quad cross boundary lda.b #$80 : sta.b Scrap04 : bra .adj1 ; this is such a weird case - quad cross boundary
.adj0 .adj0
tya : asl : tax : jsr AdjCamBounds : bra .done tya : asl : tax : jsr AdjCamBounds : bra .done
.nonZeroHalf ;meaning either right half or bottom half .nonZeroHalf ;meaning either right half or bottom half
lda $07 : bne .setQuad lda.b Scrap07 : bne .setQuad
lda.w CoordIndex,y : tax lda.w CoordIndex,y : tax
lda $20,x : cmp #$78 : bcs .setQuad lda.b LinkPosY,x : cmp.b #$78 : bcs .setQuad
!add #$78 : sta $04 !ADD.b #$78 : sta.b Scrap04
lda.w CamQuadIndex,y : tax : lda $0603, x : pha lda.w CamQuadIndex,y : tax : lda.w $0603, x : pha
lda.w CameraIndex,y : tax : pla : sta $e3, x lda.w CameraIndex,y : tax : pla : sta.b BG2H+1, x
.adj1 .adj1
tya : asl : !add #$08 : tax : jsr AdjCamBounds : bra .done tya : asl : !ADD.b #$08 : tax : jsr AdjCamBounds : bra .done
.setQuad .setQuad
lda.w CamQuadIndex,y : tax : lda $0607, x : pha lda.w CamQuadIndex,y : tax : lda.w $0607, x : pha
lda.w CameraIndex,y : tax : pla : sta $e3, x lda.w CameraIndex,y : tax : pla : sta.b BG2H+1, x
tya : asl : !add #$0c : tax : jsr AdjCamBounds : bra .done tya : asl : !ADD.b #$0c : tax : jsr AdjCamBounds : bra .done
.done .done
lda.w CameraIndex,y : tax lda.w CameraIndex,y : tax
lda $04 : sta $e2, x lda.b Scrap04 : sta.b BG2H, x
rts rts
} }
; input, expects X to be an appropriate offset into the CamBoundBaseLine table ; input, expects X to be an appropriate offset into the CamBoundBaseLine table
; when $04 is 0 no coordinate are added ; when $04 is 0 no coordinate are added
AdjCamBounds: { AdjCamBounds: {
rep #$20 : lda.w CamBoundBaseLine, x : sta $05 rep #$20 : lda.w CamBoundBaseLine, x : sta.b Scrap05
lda $04 : and #$00ff : beq .common lda.b Scrap04 : and.w #$00ff : beq .common
lda.w CoordIndex,y : tax lda.w CoordIndex,y : tax
lda $20, x : and #$00ff : !add $05 : sta $05 lda.b LinkPosY, x : and.w #$00ff : !ADD.b Scrap05 : sta.b Scrap05
.common .common
lda.w OppCamBoundIndex,y : tax lda.w OppCamBoundIndex,y : tax
lda $05 : sta $0618, x lda.b Scrap05 : sta.w CameraScrollN, x
inc #2 : sta $061A, x : sep #$20 inc #2 : sta.w CameraScrollS, x : sep #$20
rts rts
} }
SpiralPriorityHack: { SpiralPriorityHack: {
lda.l DRMode : beq + lda.l DRMode : beq +
lda #$01 : rtl ; always skip the priority code - until I figure out how to fix it lda.b #$01 : rtl ; always skip the priority code - until I figure out how to fix it
+ lda $0462 : and #$04 ; what we wrote over + lda.w $0462 : and.b #$04 ; what we wrote over
rtl rtl
} }

View File

@@ -3,17 +3,17 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SpawnDungeonPrize: SpawnDungeonPrize:
PHX : PHB PHX : PHB
JSL.l AttemptItemSubstitution JSL AttemptItemSubstitution
JSL.l ResolveLootIDLong JSL ResolveLootIDLong
STA.w ItemReceiptID STA.w ItemReceiptID
TAX TAX
LDA.b #$29 : LDY.b #$06 LDA.b #$29 : LDY.b #$06
JSL.l AddAncillaLong JSL AddAncillaLong
BCS .failed_spawn BCS .failed_spawn
LDA.w ItemReceiptID LDA.w ItemReceiptID
STA.w AncillaGet,X : STA.w SpriteID,X STA.w AncillaGet,X : STA.w SpriteID,X
JSR.w AddDungeonPrizeAncilla JSR AddDungeonPrizeAncilla
.failed_spawn .failed_spawn
PLB : PLX PLB : PLX
RTL RTL
@@ -22,21 +22,21 @@ AddDungeonPrizeAncilla:
LDY.w ItemReceiptID LDY.w ItemReceiptID
STZ.w AncillaVelocityY,X STZ.w AncillaVelocityY,X
STZ.w AncillaVelocityX,X STZ.w AncillaVelocityX,X
STZ.w AncillaGeneral,X STZ.w AncillaGeneralF,X
STZ.w $0385,X STZ.w AncillaGeneralA,X
STZ.w $0C54,X STZ.w AncillaGeneralN,X
LDA.b #$D0 : STA.w AncillaVelocityZ,X LDA.b #$D0 : STA.w AncillaVelocityZ,X
LDA.b #$80 : STA.w AncillaZCoord,X LDA.b #$80 : STA.w AncillaZCoord,X
LDA.b #$09 : STA.w AncillaTimer,X LDA.b #$09 : STA.w AncillaTimer,X
LDA.b #$00 : STA.w $0394,X LDA.b #$00 : STA.w AncillaGeneralD,X
LDA.w AncillaGet,X : STA.w ItemReceiptID LDA.w AncillaGet,X : STA.w ItemReceiptID
LDA.w DungeonID : CMP.b #$14 : BNE .not_hera LDA.w DungeonID : CMP.b #$14 : BNE .not_hera
LDA.b LinkAbsoluteY+1 : AND.b #$FE LDA.b LinkPosY+1 : AND.b #$FE
INC A INC A
STA.b Scrap01 STA.b Scrap01
STZ.b Scrap00 STZ.b Scrap00
LDA.b LinkAbsoluteX+1 : AND.b #$FE LDA.b LinkPosX+1 : AND.b #$FE
INC A INC A
STA.b Scrap03 STA.b Scrap03
STZ.b Scrap02 STZ.b Scrap02
@@ -62,10 +62,10 @@ RTS
PrepPrizeTile: PrepPrizeTile:
PHA : PHX : PHY PHA : PHX : PHY
LDA.w AncillaGet, X LDA.w AncillaGet, X
JSL.l AttemptItemSubstitution JSL AttemptItemSubstitution
JSL.l ResolveLootIDLong JSL ResolveLootIDLong
STA.w SpriteID,X STA.w SpriteID,X
JSL.l TransferItemReceiptToBuffer_using_ReceiptID JSL TransferItemReceiptToBuffer_using_ReceiptID
PLY : PLX : PLA PLY : PLX : PLA
RTL RTL
@@ -75,12 +75,12 @@ SetItemPose:
LDA.w RoomItemsTaken : BIT.b #$80 : BNE + LDA.w RoomItemsTaken : BIT.b #$80 : BNE +
.one_handed .one_handed
PLA PLA
JML $8799F2 JML Link_ReceiveItem_not_cool_pose
+ +
JSR.w CrystalOrPendantBehavior : BCC .one_handed JSR CrystalOrPendantBehavior : BCC .one_handed
.two_handed .two_handed
PLA PLA
JML $8799EE ; cool pose JML Link_ReceiveItem_cool_pose
SetPrizeCoords: SetPrizeCoords:
PHX : PHY PHX : PHY
@@ -91,7 +91,7 @@ SetPrizeCoords:
LDY.w AncillaGet,X LDY.w AncillaGet,X
RTL RTL
+ +
JSR.w CrystalOrPendantBehavior : BCC .regular_coords JSR CrystalOrPendantBehavior : BCC .regular_coords
PLY : PLX PLY : PLX
LDY.b #$20 ; Treat as crystal LDY.b #$20 ; Treat as crystal
RTL RTL
@@ -101,7 +101,7 @@ SetCutsceneFlag:
PHX PHX
LDY.b #$01 ; wrote over LDY.b #$01 ; wrote over
LDA.w DungeonID : BMI .no_cutscene LDA.w DungeonID : BMI .no_cutscene
LDA.w RoomItemsTaken : BIT #$80 : BNE .dungeon_prize LDA.w RoomItemsTaken : BIT.b #$80 : BNE .dungeon_prize
.no_cutscene .no_cutscene
SEP #$30 SEP #$30
PLX PLX
@@ -109,7 +109,7 @@ SetCutsceneFlag:
RTL RTL
.dungeon_prize .dungeon_prize
LDA.w ItemReceiptMethod : CMP.b #$03 : BCC .no_cutscene LDA.w ItemReceiptMethod : CMP.b #$03 : BCC .no_cutscene
JSR.w SetDungeonCompleted JSR SetDungeonCompleted
LDA.w ItemReceiptID LDA.w ItemReceiptID
REP #$30 REP #$30
AND.w #$00FF : ASL : TAX AND.w #$00FF : ASL : TAX
@@ -120,9 +120,9 @@ RTL
AnimatePrizeCutscene: AnimatePrizeCutscene:
LDA.w ItemReceiptMethod : CMP.b #$03 : BNE + LDA.w ItemReceiptMethod : CMP.b #$03 : BNE +
JSR.w CrystalOrPendantBehavior : BCC + JSR CrystalOrPendantBehavior : BCC +
LDA.w DungeonID : BMI + LDA.w DungeonID : BMI +
LDA.w RoomItemsTaken : BIT #$80 : BEQ + LDA.w RoomItemsTaken : BIT.b #$80 : BEQ +
SEC SEC
RTL RTL
+ +
@@ -131,7 +131,7 @@ RTL
PrizeDropSparkle: PrizeDropSparkle:
LDA.w AncillaID,X : CMP.b #$29 : BNE .no_sparkle LDA.w AncillaID,X : CMP.b #$29 : BNE .no_sparkle
JSR.w CrystalOrPendantBehavior : BCC .no_sparkle JSR CrystalOrPendantBehavior : BCC .no_sparkle
SEC SEC
RTL RTL
.no_sparkle .no_sparkle
@@ -139,8 +139,8 @@ PrizeDropSparkle:
RTL RTL
HandleDropSFX: HandleDropSFX:
LDA.w RoomItemsTaken : BIT #$80 : BEQ .no_sound LDA.w RoomItemsTaken : BIT.b #$80 : BEQ .no_sound
JSR.w CrystalOrPendantBehavior : BCC .no_sound JSR CrystalOrPendantBehavior : BCC .no_sound
SEC SEC
RTL RTL
.no_sound .no_sound
@@ -159,7 +159,7 @@ RTL
MaybeKeepLootID: MaybeKeepLootID:
PHA PHA
LDA.w DungeonID : BMI .no_prize LDA.w DungeonID : BMI .no_prize
LDA.w RoomItemsTaken : BIT #$80 : BNE .prize LDA.w RoomItemsTaken : BIT.b #$80 : BNE .prize
.no_prize .no_prize
STZ.w ItemReceiptID STZ.w ItemReceiptID
STZ.w ItemReceiptPose STZ.w ItemReceiptPose
@@ -231,15 +231,15 @@ PrepPrizeOAMCoordinates:
STA.b Scrap04 STA.b Scrap04
REP #$20 REP #$20
LDA.w $029E,X LDA.w AncillaZCoord,X
AND.w #$00FF AND.w #$00FF
STA.b $72 STA.b ScrapBuffer72
LDA.b $00 LDA.b Scrap00
STA.b $06 STA.b Scrap06
SEC SEC
SBC.b $72 SBC.b ScrapBuffer72
STA.b $00 STA.b Scrap00
SEP #$20 SEP #$20
TXY TXY

View File

@@ -18,14 +18,14 @@ DoDungeonMapBossIcon:
TAX TAX
; get sprite pointer for room ; get sprite pointer for room
LDA.l $89D62E,X LDA.l UWSpritesPointers,X
STA.b $00 ; pointer in $00 STA.b Scrap00 ; pointer in $00
LDA.w #$0028 : STA.b $02 ; set the bank to 28 for now LDA.w #$0028 : STA.b Scrap02 ; set the bank to 28 for now
LDY.w #$0001 ; to skip the "sort" LDY.w #$0001 ; to skip the "sort"
; get first byte to make sure it isn't an empty room ; get first byte to make sure it isn't an empty room
SEP #$20 SEP #$20
LDA.b [$00], Y LDA.b [Scrap00], Y
CMP.b #$FF CMP.b #$FF
BNE ++ BNE ++
@@ -34,7 +34,7 @@ DoDungeonMapBossIcon:
; check first sprite ; check first sprite
++ INY #2 ++ INY #2
LDA.b [$00], Y LDA.b [Scrap00], Y
SEP #$10 SEP #$10
; match boss id ; match boss id
@@ -99,13 +99,13 @@ DoDungeonMapBossIcon:
STA.w DAS1L STA.w DAS1L
LDX.b #$02 LDX.b #$02
STX.w MDMAEN STX.w DMAENABLE
STA.w DAS1L STA.w DAS1L
LDA.w #$A260>>1 LDA.w #$A260>>1
STA.w VMADDL STA.w VMADDL
STX.w MDMAEN STX.w DMAENABLE
; done ; done
SEP #$30 SEP #$30

View File

@@ -2,7 +2,7 @@ NewElderCode:
{ {
LDA.b OverworldIndex : CMP.b #$1B : BEQ .newCodeContinue LDA.b OverworldIndex : CMP.b #$1B : BEQ .newCodeContinue
;Restore Jump we can keep the RTL so JML ;Restore Jump we can keep the RTL so JML
JML $85F0CD JML Sprite_16_Elder
.newCodeContinue .newCodeContinue
PHB : PHK : PLB PHB : PHK : PLB
LDA.b #$07 : STA.w SpriteOAMProp, X ; Palette LDA.b #$07 : STA.w SpriteOAMProp, X ; Palette
@@ -12,11 +12,10 @@ JSR Elder_Code
PLB PLB
RTL RTL
}
Elder_Draw: Elder_Draw:
{ {
LDA.b #$02 : STA.b Scrap06 : STZ.b Scrap07 ;Number of Tiles LDA.b #$02 : STA.b Scrap06 : STZ.b Scrap07 ;Number of Tiles
LDA.w SpriteGFXControl, X : ASL #04 LDA.w SpriteGFXControl, X : ASL #04
@@ -60,7 +59,7 @@ RTL
LDA.l GoalCounter LDA.l GoalCounter
CMP.l GoalItemRequirement : !BLT + CMP.l GoalItemRequirement : !BLT +
SEP #$20 SEP #$20
JSL.l ActivateGoal JSL ActivateGoal
+ +
.dont_show .dont_show

View File

@@ -17,56 +17,56 @@
macro DMA_VRAM(VRAM_HIGH,VRAM_LOW,SRC_BANK,SRC_HIGH,SRC_LOW,LENGTH_HIGH,LENGTH_LOW) macro DMA_VRAM(VRAM_HIGH,VRAM_LOW,SRC_BANK,SRC_HIGH,SRC_LOW,LENGTH_HIGH,LENGTH_LOW)
PHA PHA
; --- preserve DMA registers ---------------------------------------------------- ; --- preserve DMA registers ----------------------------------------------------
LDA !DMA0_REG : PHA LDA.w !DMA0_REG : PHA
LDA !DMA0_DEST_REG : PHA LDA.w !DMA0_DEST_REG : PHA
LDA !DMA0_SRC_LOW_REG : PHA LDA.w !DMA0_SRC_LOW_REG : PHA
LDA !DMA0_SRC_HIGH_REG : PHA LDA.w !DMA0_SRC_HIGH_REG : PHA
LDA !DMA0_SRC_BANK_REG : PHA LDA.w !DMA0_SRC_BANK_REG : PHA
LDA !DMA0_SIZE_LOW_REG : PHA LDA.w !DMA0_SIZE_LOW_REG : PHA
LDA !DMA0_SIZE_HIGH_REG : PHA LDA.w !DMA0_SIZE_HIGH_REG : PHA
; ------------------------------------------------------------------------------- ; -------------------------------------------------------------------------------
;LDA.b #$80 : STA !DISP_REG ; force vblank ;LDA.b #$80 : STA.w !DISP_REG ; force vblank
LDA #$80 : STA !VMAIN_REG LDA.b #$80 : STA.w !VMAIN_REG
; write to vram at $<VRAM_HIGH><VRAM_LOW> ; write to vram at $<VRAM_HIGH><VRAM_LOW>
LDA <VRAM_LOW> : STA !VRAM_LOW_REG ; Set VRAM destination address low byte LDA.b <VRAM_LOW> : STA.w !VRAM_LOW_REG ; Set VRAM destination address low byte
LDA <VRAM_HIGH> : STA !VRAM_HIGH_REG ; Set VRAM destination address high byte LDA.b <VRAM_HIGH> : STA.w !VRAM_HIGH_REG ; Set VRAM destination address high byte
; Set DMA0 to write a word at a time. ; Set DMA0 to write a word at a time.
LDA #$01 LDA.b #$01
STA !DMA0_REG STA.w !DMA0_REG
; Write to $2118 & $2119 - VRAM Data Write Registers (Low) & VRAM Data Write Registers (High) ; Write to $2118 & $2119 - VRAM Data Write Registers (Low) & VRAM Data Write Registers (High)
; setting word write mode on DMA0_REG causes a write to $2118 and then $2119 ; setting word write mode on DMA0_REG causes a write to $2118 and then $2119
; $21xx is assumed ; $21xx is assumed
LDA #$18 LDA.b !VRAM_WRITE_REG
STA !DMA0_DEST_REG STA.w !DMA0_DEST_REG
; Read from $<SRC_BANK>:<SRC_HIGH><SRC_LOW>. ; Read from $<SRC_BANK>:<SRC_HIGH><SRC_LOW>.
LDA.b <SRC_LOW> LDA.b <SRC_LOW>
STA !DMA0_SRC_LOW_REG ; set src address low byte STA.w !DMA0_SRC_LOW_REG ; set src address low byte
LDA.b <SRC_HIGH> LDA.b <SRC_HIGH>
STA !DMA0_SRC_HIGH_REG ; set src address high byte STA.w !DMA0_SRC_HIGH_REG ; set src address high byte
LDA.b <SRC_BANK> LDA.b <SRC_BANK>
STA !DMA0_SRC_BANK_REG ; set src address bank byte STA.w !DMA0_SRC_BANK_REG ; set src address bank byte
; total bytes to copy: #$1000 bytes. ; total bytes to copy: #$1000 bytes.
LDA <LENGTH_LOW> : STA $4305 ; length low byte LDA.b <LENGTH_LOW> : STA.w !DMA0_SIZE_LOW_REG ; length low byte
LDA <LENGTH_HIGH> : STA $4306 ; length high byte LDA.b <LENGTH_HIGH> : STA.w !DMA0_SIZE_HIGH_REG ; length high byte
; start DMA on channel 0 ; start DMA on channel 0
LDA #$01 ; channel select bitmask LDA.b #$01 ; channel select bitmask
STA !DMA_ENABLE_REG STA.w !DMA_ENABLE_REG
; --- restore DMA registers ----------------------------------------------------- ; --- restore DMA registers -----------------------------------------------------
PLA : STA !DMA0_SIZE_HIGH_REG PLA : STA.w !DMA0_SIZE_HIGH_REG
PLA : STA !DMA0_SIZE_LOW_REG PLA : STA.w !DMA0_SIZE_LOW_REG
PLA : STA !DMA0_SRC_BANK_REG PLA : STA.w !DMA0_SRC_BANK_REG
PLA : STA !DMA0_SRC_HIGH_REG PLA : STA.w !DMA0_SRC_HIGH_REG
PLA : STA !DMA0_SRC_LOW_REG PLA : STA.w !DMA0_SRC_LOW_REG
PLA : STA !DMA0_DEST_REG PLA : STA.w !DMA0_DEST_REG
PLA : STA !DMA0_REG PLA : STA.w !DMA0_REG
; ------------------------------------------------------------------------------- ; -------------------------------------------------------------------------------
PLA PLA
endmacro endmacro

View File

@@ -8,21 +8,21 @@ NMIHookActionEnemizer:
SEP #$20 ; get into 8-bit mode SEP #$20 ; get into 8-bit mode
LDA !SHELL_DMA_FLAG : BEQ .return ; check our draw flag LDA.l !SHELL_DMA_FLAG : BEQ .return ; check our draw flag
AND #$01 : BNE .loadKholdstare AND.b #$01 : BNE .loadKholdstare
LDA !SHELL_DMA_FLAG : AND #$02 : BNE .loadTrinexx LDA.l !SHELL_DMA_FLAG : AND.b #$02 : BNE .loadTrinexx
BRA .return ; just in case BRA .return ; just in case
;BIT #$01 : BEQ .loadKholdstare ;BIT.b #$01 : BEQ .loadKholdstare
;BIT #$02 : BEQ .loadTrinexx ;BIT.b #$02 : BEQ .loadTrinexx
.loadKholdstare .loadKholdstare
JSL DMAKholdstare JSL DMAKholdstare
LDA #$00 : STA !SHELL_DMA_FLAG ; clear our draw flag LDA.b #$00 : STA.l !SHELL_DMA_FLAG ; clear our draw flag
BRA .return BRA .return
.loadTrinexx .loadTrinexx
JSL DMATrinexx JSL DMATrinexx
LDA #$00 : STA !SHELL_DMA_FLAG ; clear our draw flag LDA.b #$00 : STA.l !SHELL_DMA_FLAG ; clear our draw flag
.return .return
PLP PLP
@@ -33,7 +33,7 @@ NMIHookActionEnemizer:
; Sets DP to $0000 ; Sets DP to $0000
LDA.w #$0000 : TCD LDA.w #$0000 : TCD
JML.l NMIHookReturnEnemizer JML NMIHookReturnEnemizer
} }
DMAKholdstare: DMAKholdstare:

View File

@@ -14,10 +14,10 @@ Initialize_Blind_Fight:
pullpc pullpc
check_blind_boss_room: check_blind_boss_room:
LDA $A0 ; load room index (low byte) LDA.b RoomIndex ; load room index (low byte)
CMP #172 : BNE + ; Is is Thieves Town Boss Room CMP.b #$AC : BNE + ; Is is Thieves Town Boss Room
LDA !BLIND_DOOR_FLAG : BNE + ; Blind maiden does not need rescuing LDA.l !BLIND_DOOR_FLAG : BNE + ; Blind maiden does not need rescuing
LDA FollowerIndicator : JML Check_for_Blind_Fight LDA.l FollowerIndicator : JML Check_for_Blind_Fight
+ +
JML Initialize_Blind_Fight JML Initialize_Blind_Fight

View File

@@ -5,15 +5,15 @@ change_heartcontainer_position:
{ {
PHA PHA
LDA.l !CENTER_BOSS_DROP_FLAG : BEQ .not_moldorm_room LDA.l !CENTER_BOSS_DROP_FLAG : BEQ .not_moldorm_room
LDA.b #$78 : STA $0D10, X LDA.b #$78 : STA.w SpritePosXLow, X
STA $0D00, X STA.w SpritePosYLow, X
LDA $23 : STA $0D30, X LDA.b LinkPosX+1 : STA.w SpritePosXHigh, X
LDA $21 : STA $0D20, X LDA.b LinkPosY+1 : STA.w SpritePosYHigh, X
LDA $A0 : CMP #$07 : BNE .not_moldorm_room ; not moldorm room LDA.b RoomIndex : CMP.b #$07 : BNE .not_moldorm_room ; not moldorm room
LDA $22 : STA $0D10, X LDA.b LinkPosX : STA.w SpritePosXLow, X
LDA $20 : STA $0D00, X LDA.b LinkPosY : STA.w SpritePosYLow, X
.not_moldorm_room .not_moldorm_room

View File

@@ -5,100 +5,100 @@ boss_move:
{ {
; TODO: should probably double check that we don't need to preserve registers (A,X)... ; TODO: should probably double check that we don't need to preserve registers (A,X)...
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
LDA $A0 ; load room index (low byte) LDA.b RoomIndex ; load room index (low byte)
LDX $A1 ; (high byte) LDX.b RoomIndex+1 ; (high byte)
CMP #7 : BNE + ; Is is Hera Tower Boss Room CMP.b #7 : BNE + ; Is it Hera Tower Boss Room
CPX #$00 : BNE + CPX.b #$00 : BNE +
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_middle BRL .move_to_middle
+ +
CMP #200 : BNE + ; Is is Eastern Palace Boss Room CMP.b #200 : BNE + ; Is it Eastern Palace Boss Room
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_bottom_right BRL .move_to_bottom_right
+ +
CMP #41 : BNE + ; Is is Skull Woods Boss Room CMP.b #41 : BNE + ; Is it Skull Woods Boss Room
; TODO: Add moving floor sprite ; TODO: Add moving floor sprite
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
LDA #$07 : STA $0B00;Spawn the moving floor sprite LDA.b #$07 : STA.w $0B00 ;Spawn the moving floor sprite
STZ $0B28 STZ.w $0B28
INC $0B08 INC.w OverlordXLow
BRL .move_to_bottom_right BRL .move_to_bottom_right
+ +
CMP #51 : BNE + ; Is is Desert Palace Boss Room CMP.b #51 : BNE + ; Is it Desert Palace Boss Room
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_bottom_left BRL .move_to_bottom_left
+ +
CMP #90 : BNE + ; Is is Palace of darkness Boss Room CMP.b #90 : BNE + ; Is it Palace of darkness Boss Room
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_bottom_right BRL .move_to_bottom_right
+ +
CMP #144 : BNE + ; Is is Misery Mire Boss Room CMP.b #144 : BNE + ; Is it Misery Mire Boss Room
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_bottom_left BRL .move_to_bottom_left
+ +
CMP #172 : BNE + ; Is is Thieve Town Boss Room CMP.b #172 : BNE + ; Is it Thieve Town Boss Room
; IF MAIDEN IS NOT RESCUED -> DO NOTHING ; IF MAIDEN IS NOT RESCUED -> DO NOTHING
; IF MAIDEN IS ALREADY RESCUED -> spawn sprites normally ; IF MAIDEN IS ALREADY RESCUED -> spawn sprites normally
JSL Sprite_ResetAll ; removes sprites in thieve town boss room JSL Sprite_ResetAll ; removes sprites in thieve town boss room
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
;Close the door if !BLIND_DOOR_FLAG == 1 ;Close the door if !BLIND_DOOR_FLAG == 1
LDA !BLIND_DOOR_FLAG : BEQ .no_blind_door LDA.l !BLIND_DOOR_FLAG : BEQ .no_blind_door
INC $0468 ; $0468[0x02] - Flag that is set when trap doors are down. INC.w TrapDoorFlag
STZ $068E ; $068E[0x02] - (Dungeon) ???? related to trap doors and if they are open ; possibly bomb doors too? Update: module 0x07.0x4 probably uses this to know whether it's a key door or big key door to open. STZ.w TileMapDoorPos
STZ $0690 ; $0690[0x02] - (Overworld) Generally is used as an animation step indicator, only for doors that animate when they open, such as the Santuary and Hyrule Castle doors. This variable is incremented up to a value of 3, at which point a logic check kicks in and stops animating the opening of a door. STZ.w DoorTimer
INC $0CF3 ; $0CF3[0x01] - free ram INC.w BossSpecialAction
; ;That must be called after the room load! ; ;That must be called after the room load!
.no_blind_door .no_blind_door
BRL .move_to_bottom_right BRL .move_to_bottom_right
+ +
CMP #6 : BNE + ; Is is Swamp Palace Boss Room CMP.b #6 : BNE + ; Is it Swamp Palace Boss Room
CPX #$00 : BNE + CPX.b #$00 : BNE +
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_bottom_left BRL .move_to_bottom_left
+ +
CMP #222 : BNE + ; Is is Ice Palace Boss Room CMP.b #222 : BNE + ; Is it Ice Palace Boss Room
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_top_right BRL .move_to_top_right
+ +
CMP #164 : BNE + ; Is is Turtle Rock Boss Room CMP.b #164 : BNE + ; Is it Turtle Rock Boss Room
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_bottom_left BRL .move_to_bottom_left
+ +
CMP #28 : BNE + ; Is is Gtower (Armos2) Boss Room CMP.b #28 : BNE + ; Is it Gtower (Armos2) Boss Room
CPX #$00 : BNE + CPX.b #$00 : BNE +
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_bottom_right BRL .move_to_bottom_right
+ +
CMP #108 : BNE + ; Is is Gtower (Lanmo2) Boss Room CMP.b #108 : BNE + ; Is it Gtower (Lanmo2) Boss Room
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_bottom_left BRL .move_to_bottom_left
+ +
CMP #77 : BNE + ; Is is Gtower (Moldorm2) Boss Room CMP.b #77 : BNE + ; Is it Gtower (Moldorm2) Boss Room
JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare)
JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites
BRL .move_to_middle BRL .move_to_middle
@@ -120,106 +120,106 @@ boss_move:
.move_to_middle .move_to_middle
;load all sprite of that room and overlord ;load all sprite of that room and overlord
LDX #$00 LDX.b #$00
.loop_middle ; move sprites .loop_middle ; move sprites
LDA $0E20, X LDA.w SpriteTypeTable, X
JSR ShouldMoveSprite : BCC .no_change JSR ShouldMoveSprite : BCC .no_change
LDA $0D10, X : !ADD #$68 : STA $0D10, X LDA.w SpritePosXLow, X : !ADD.b #$68 : STA.w SpritePosXLow, X
LDA $0D00, X : !ADD #$68 : STA $0D00, X LDA.w SpritePosYLow, X : !ADD.b #$68 : STA.w SpritePosYLow, X
.no_change .no_change
INX : CPX #$10 : BNE .loop_middle INX : CPX.b #$10 : BNE .loop_middle
LDX #$00 LDX.b #$00
.loop_middle2 ; move overlords .loop_middle2 ; move overlords
LDA $0B00, X LDA.w $0B00, X
CMP #$E3 : BNE + ;is it moving floor? CMP.b #$E3 : BNE + ;is it moving floor?
BRA .no_change_ov BRA .no_change_ov
+ +
LDA $0B08, X : !ADD #$68 : STA $0B08, X LDA.w OverlordXLow, X : !ADD.b #$68 : STA.w OverlordXLow, X
LDA $0B18, X : !ADD #$68 : STA $0B18, X LDA.w OverlordYLow, X : !ADD.b #$68 : STA.w OverlordYLow, X
.no_change_ov .no_change_ov
INX : CPX #$08 : BNE .loop_middle2 INX : CPX.b #$08 : BNE .loop_middle2
BRL .return BRL .return
.move_to_top_right .move_to_top_right
LDX #$00 LDX.b #$00
.loop_top_right ; move sprites .loop_top_right ; move sprites
LDA $0E20, X LDA.w SpriteTypeTable, X
JSR ShouldMoveSprite : BCC .no_change2 JSR ShouldMoveSprite : BCC .no_change2
LDA $0D20, X : !ADD #$00 : STA $0D20, X LDA.w SpritePosYHigh, X : !ADD.b #$00 : STA.w SpritePosYHigh, X
LDA $0D30, X : !ADD #$01 : STA $0D30, X LDA.w SpritePosXHigh, X : !ADD.b #$01 : STA.w SpritePosXHigh, X
.no_change2 .no_change2
INX : CPX #$10 : BNE .loop_top_right INX : CPX.b #$10 : BNE .loop_top_right
LDX #$00 LDX.b #$00
.loop_top_right2 ; move overlords .loop_top_right2 ; move overlords
LDA $0B00, X LDA.w $0B00, X
CMP #$E3 : BNE + ;is it moving floor? CMP.b #$E3 : BNE + ;is it moving floor?
BRA .no_change_ov2 BRA .no_change_ov2
+ +
LDA $0B10, X : !ADD #$01 : STA $0B10, X LDA.w OverlordXHigh, X : !ADD.b #$01 : STA.w OverlordXHigh, X
LDA $0B20, X : !ADD #$00 : STA $0B20, X LDA.w OverlordYHigh, X : !ADD.b #$00 : STA.w OverlordYHigh, X
.no_change_ov2 .no_change_ov2
INX : CPX #$08 : BNE .loop_top_right2 INX : CPX.b #$08 : BNE .loop_top_right2
BRL .return BRL .return
.move_to_bottom_right .move_to_bottom_right
LDX #$00 LDX.b #$00
.loop_bottom_right ; move sprites .loop_bottom_right ; move sprites
LDA $0E20, X LDA.w SpriteTypeTable, X
JSR ShouldMoveSprite : BCC .no_change3 JSR ShouldMoveSprite : BCC .no_change3
LDA $0D20, X : !ADD #$01 : STA $0D20, X LDA.w SpritePosYHigh, X : !ADD.b #$01 : STA.w SpritePosYHigh, X
LDA $0D30, X : !ADD #$01 : STA $0D30, X LDA.w SpritePosXHigh, X : !ADD.b #$01 : STA.w SpritePosXHigh, X
.no_change3 .no_change3
INX : CPX #$10 : BNE .loop_bottom_right INX : CPX.b #$10 : BNE .loop_bottom_right
LDX #$00 LDX.b #$00
.loop_bottom_right2 ; move overlords .loop_bottom_right2 ; move overlords
LDA $0B00, X LDA.w $0B00, X
CMP #$E3 : BNE + ;is it moving floor? CMP.b #$E3 : BNE + ;is it moving floor?
BRA .no_change_ov3 BRA .no_change_ov3
+ +
LDA $0B10, X : !ADD #$01 : STA $0B10, X LDA.w OverlordXHigh, X : !ADD.b #$01 : STA.w OverlordXHigh, X
LDA $0B20, X : !ADD #$01 : STA $0B20, X LDA.w OverlordYHigh, X : !ADD.b #$01 : STA.w OverlordYHigh, X
.no_change_ov3 .no_change_ov3
INX : CPX #$08 : BNE .loop_bottom_right2 INX : CPX.b #$08 : BNE .loop_bottom_right2
BRL .return BRL .return
.move_to_bottom_left .move_to_bottom_left
LDX #$00 LDX.b #$00
.loop_bottom_left ; move sprites .loop_bottom_left ; move sprites
LDA $0E20, X LDA.w SpriteTypeTable, X
JSR ShouldMoveSprite : BCC .no_change4 JSR ShouldMoveSprite : BCC .no_change4
LDA $0D20, X : !ADD #$01 : STA $0D20, X LDA.w SpritePosYHigh, X : !ADD.b #$01 : STA.w SpritePosYHigh, X
LDA $0D30, X : !ADD #$00 : STA $0D30, X LDA.w SpritePosXHigh, X : !ADD.b #$00 : STA.w SpritePosXHigh, X
.no_change4 .no_change4
INX : CPX #$10 : BNE .loop_bottom_left INX : CPX.b #$10 : BNE .loop_bottom_left
LDX #$00 LDX.b #$00
.loop_bottom_left2 ; move overlords .loop_bottom_left2 ; move overlords
LDA $0B00, X LDA.w $0B00, X
CMP #$E3 : BNE + ;is it moving floor? CMP.b #$E3 : BNE + ;is it moving floor?
BRA .no_change_ov4 BRA .no_change_ov4
+ +
LDA $0B10, X : !ADD #$00 : STA $0B10, X LDA.w OverlordXHigh, X : !ADD.b #$00 : STA.w OverlordXHigh, X
LDA $0B20, X : !ADD #$01 : STA $0B20, X LDA.w OverlordYHigh, X : !ADD.b #$01 : STA.w OverlordYHigh, X
.no_change_ov4 .no_change_ov4
INX : CPX #$08 : BNE .loop_bottom_left2 INX : CPX.b #$08 : BNE .loop_bottom_left2
BRL .return BRL .return
@@ -232,7 +232,7 @@ boss_move:
; sets or clears carry flag, set if sprite should be moved ; sets or clears carry flag, set if sprite should be moved
ShouldMoveSprite: ShouldMoveSprite:
PHX PHX
LDX #$FF LDX.b #$FF
- INX : CPX.b #$0F : BCS .done - INX : CPX.b #$0F : BCS .done
CMP.l BossIds, X : BNE - CMP.l BossIds, X : BNE -
; match found, move it ; match found, move it
@@ -248,12 +248,12 @@ db $a2, $a3, $a4, $bd, $cb, $cc, $cd, $ff
; Fix the gibdo key drop in skull woods before the boss room - USELESS CODE ; Fix the gibdo key drop in skull woods before the boss room - USELESS CODE
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;gibdo_drop_key: ;gibdo_drop_key:
; LDA $A0 : CMP #$39 : BNE .no_key_drop ; Check if the room id is skullwoods before boss ; LDA.b RoomIndex : CMP.b #$39 : BNE .no_key_drop ; Check if the room id is skullwoods before boss
; LDA $0DD0, X : CMP #$09 : BNE .no_key_drop ; Check if the sprite is alive ; LDA.w SpriteAITable, X : CMP.b #$09 : BNE .no_key_drop ; Check if the sprite is alive
; LDA #$01 : STA $0CBA, X;set key ; LDA.b #$01 : STA.w SpriteForceDrop, X;set key
; ;
;.no_key_drop ;.no_key_drop
; JSL $06DC5C ;Restore draw shadow ; JSL $86DC5C ;Restore draw shadow
; RTL ; RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -261,10 +261,10 @@ db $a2, $a3, $a4, $bd, $cb, $cc, $cd, $ff
; Set a flag to draw kholdstare shell on next NMI ; Set a flag to draw kholdstare shell on next NMI
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
new_kholdstare_code: new_kholdstare_code:
LDA $0CBA : BNE .already_iced LDA.w SpriteForceDrop : BNE .already_iced
LDA #$01 : STA $0CBA LDA.b #$01 : STA.w SpriteForceDrop
LDA #$01 : STA !SHELL_DMA_FLAG ; tell our NMI to draw the shell LDA.b #$01 : STA.l !SHELL_DMA_FLAG ; tell our NMI to draw the shell
.already_iced .already_iced
; restore code ; restore code
@@ -276,14 +276,14 @@ new_kholdstare_code:
; Set a flag to draw trinexx shell on next NMI ; Set a flag to draw trinexx shell on next NMI
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
new_trinexx_code: new_trinexx_code:
LDA $0CBA : BNE .already_rocked LDA.w SpriteForceDrop : BNE .already_rocked
LDA #$01 : STA $0CBA LDA.b #$01 : STA.w SpriteForceDrop
LDA #$02 : STA !SHELL_DMA_FLAG ; tell our NMI to draw the shell LDA.b #$02 : STA.l !SHELL_DMA_FLAG ; tell our NMI to draw the shell
.already_rocked .already_rocked
; restore code ; restore code
LDA.b #$03 : STA $0DC0, X ; sprite_trinexx.asm (62) : LDA.b #$03 : STA $0DC0, X LDA.b #$03 : STA.w SpriteGFXControl, X ; sprite_trinexx.asm (62) : LDA.b #$03 : STA $0DC0, X
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -1,32 +1,13 @@
; this is set inside randomizer application
; org $1AFBBB ;Increases chance of getting enemies under random bush
; db $01, $0F, $0F, $0F, $0F, $0F, $0F, $12
; db $0F, $01, $0F, $0F, $11, $0F, $0F, $03
; sprite_bush_spawn_table:
; {
; ; SPRITE DATA TABLE GENERATED BY ENEMIZER
; .overworld
; ; Skip 0x80(overworld) + 0x128 (dungeons)
; skip #$80
; .dungeons
; skip #$128
; ;Old sprite table - Could be changed as well (for the item id 04)
; .random_sprites ; if item == 04
; db #$00, #$D8, #$E3, #$D8
; }
sprite_bush_spawn: sprite_bush_spawn:
{ {
STY $0D ; restored code STY.b Scrap0D ; restored code
LDA !BUSHES_FLAG ; That byte is the flag to activate random enemies under bush LDA.l !BUSHES_FLAG ; That byte is the flag to activate random enemies under bush
BNE .continue BNE .continue
CPY.b #$04 : BNE .not_random_old CPY.b #$04 : BNE .not_random_old
JSL GetRandomInt : AND.b #$03 : !ADD.b #$13 : TAY JSL GetRandomInt : AND.b #$03 : !ADD.b #$13 : TAY
.not_random_old .not_random_old
LDA $81F3, Y;restored code LDA.w $81F3, Y;restored code
RTL RTL
.continue .continue
@@ -49,13 +30,13 @@ sprite_bush_spawn:
BRA .return BRA .return
.newSpriteSpawn .newSpriteSpawn
LDA $7E040A : TAY ; load the area ID LDA.l OverworldIndexMirror : TAY ; load the area ID
LDA $7EF3C5 : CMP.b #$03 : !BLT .dontGoPhase2 ; check if agahnim 1 is alive LDA.l ProgressIndicator : CMP.b #$03 : !BLT .dontGoPhase2 ; check if agahnim 1 is alive
; aga1 is dead ; aga1 is dead
LDA $7E040A : CMP.b #$40 : !BGE .dontGoPhase2 ; check if we are in DW, if so we can skip shifting table index LDA.l OverworldIndexMirror : CMP.b #$40 : !BGE .dontGoPhase2 ; check if we are in DW, if so we can skip shifting table index
!ADD #$90 : TAY ; agahnim 1 is dead, so we need to go to the 2nd phase table for LW !ADD.b #$90 : TAY ; agahnim 1 is dead, so we need to go to the 2nd phase table for LW
.dontGoPhase2 .dontGoPhase2
LDA sprite_bush_spawn_table_overworld, Y ;LDA 408000 + area id LDA.w sprite_bush_spawn_table_overworld, Y ;LDA 408000 + area id
.return .return
PLB ; restore bank to where it was PLB ; restore bank to where it was

View File

@@ -2,10 +2,10 @@ CheckIfLinkShouldDie:
; before this we should have: ; before this we should have:
; LDA $7EF36D - this gets hooked, but we should have LDA at the end of it ; LDA $7EF36D - this gets hooked, but we should have LDA at the end of it
CMP $00 : BCC .dead CMP.b Scrap00 : BCC .dead
SEC : SBC $00 SEC : SBC.b Scrap00
BRA .done BRA .done
.dead .dead
LDA #$00 LDA.b #$00
.done .done
RTL RTL

View File

@@ -6,13 +6,11 @@ JSL CheckFallingDeathFlag
org $86FBF8 org $86FBF8
JSL CheckFallingDeathFlag JSL CheckFallingDeathFlag
Sprite_ManuallySetDeathFlagUW = $89C2F5
pullpc pullpc
CheckFallingDeathFlag: CheckFallingDeathFlag:
LDA.l !ENEMY_FALLING_STAY_ALIVE LDA.l !ENEMY_FALLING_STAY_ALIVE
BEQ + BEQ +
RTL RTL
+ JML.l Sprite_ManuallySetDeathFlagUW ; original code + JML Sprite_ManuallySetDeathFlagUW ; original code

View File

@@ -2,8 +2,8 @@
; NMI Hook ; NMI Hook
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; rando already hooks the Bank00.asm : 164 (PHA : PHX : PHY : PHD : PHB) so we have to hook after that ; rando already hooks the Bank00.asm : 164 (PHA : PHX : PHY : PHD : PHB) so we have to hook after that
org $0080D0 ; <- D0 - Bank00.asm : 164-167 (PHB, LDA.w #$0000) org $8080D0 ; <- D0 - Bank00.asm : 164-167 (PHB, LDA.w #$0000)
JML.l NMIHookActionEnemizer JML NMIHookActionEnemizer
org $0080D5 ; <- D5 - Bank00.asm : 164-167 (PHB, LDA.w #$0000) org $8080D5 ; <- D5 - Bank00.asm : 164-167 (PHB, LDA.w #$0000)
NMIHookReturnEnemizer: NMIHookReturnEnemizer:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -2,10 +2,10 @@
; Blind door close ; Blind door close
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; ;
org $028849 ; Bank02.asm(1588) - original code : JSL $078000 //Hook on player main when transition are over execute player code org $828849 ; Bank02.asm(1588) - original code : JSL $078000 //Hook on player main when transition are over execute player code
JSL check_special_action ;using the variable 7E0CF3 if it not 00 then trap the player in that room JSL check_special_action ;using the variable 7E0CF3 if it not 00 then trap the player in that room
;could be changed easily to support more than only 1 function ;could be changed easily to support more than only 1 function
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $078000 org $878000
Player_Main: Player_Main:

View File

@@ -1,6 +1,6 @@
;================================================================================ ;================================================================================
; Change heart container drop location ; Change heart container drop location
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $05EF62 org $85EF62
JSL change_heartcontainer_position JSL change_heartcontainer_position
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -1,31 +1,9 @@
; ;================================================================================
; ; insert kholdstare & trinexx shell gfx file
; ;--------------------------------------------------------------------------------
; ; pc file address = 0x123000
; org $24B000
; GFX_Kholdstare_Shell:
; incbin shell.gfx
; warnpc $24C001 ; should have written 0x1000 bytes and apparently we need to go 1 past that or it'll yell at us
; org $24C000
; GFX_Trinexx_Shell:
; incbin rocks.gfx
; warnpc $24C801
; GFX_Trinexx_Shell2:
; incbin rocks2.gfx
; warnpc $24C8C1
; ;--------------------------------------------------------------------------------
; ; *$4C290-$4C2D4 LOCAL
; Dungeon_LoadSprites:
; *$4C114-$4C174 LONG ; *$4C114-$4C174 LONG
org $9C114 org $89C114
Dungeon_ResetSprites: ; Bank09.asm(822) Dungeon_ResetSprites: ; Bank09.asm(822)
; *$4C44E-$4C498 LONG ; *$4C44E-$4C498 LONG
org $9C44E org $89C44E
Sprite_ResetAll: ; Bank09.asm(1344) Sprite_ResetAll: ; Bank09.asm(1344)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -33,13 +11,13 @@ Sprite_ResetAll: ; Bank09.asm(1344)
;================================================================================ ;================================================================================
; On Room Transition -> Move Sprite depending on the room loaded ; On Room Transition -> Move Sprite depending on the room loaded
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $028979 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114 org $828979 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
JSL boss_move JSL boss_move
org $028C16 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114 org $828C16 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
JSL boss_move JSL boss_move
org $029338 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114 org $829338 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
JSL boss_move JSL boss_move
org $028256 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114 org $828256 ; JSL Dungeon_ResetSprites ; REPLACE THAT (Sprite initialization) original jsl : $09C114
JSL boss_move JSL boss_move
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -48,10 +26,10 @@ JSL boss_move
;================================================================================ ;================================================================================
; Draw kholdstare shell ; Draw kholdstare shell
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $0DD97F ; jump point org $8DD97F ; jump point
Kholdstare_Draw: Kholdstare_Draw:
org $1E9518 ; sprite_kholdstare.asm (154) : JSL Kholdstare_Draw org $9E9518 ; sprite_kholdstare.asm (154) : JSL Kholdstare_Draw
JSL new_kholdstare_code ; Write new gfx in the vram JSL new_kholdstare_code ; Write new gfx in the vram
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -1,7 +1,7 @@
;================================================================================ ;================================================================================
; New bush mob randomization ; New bush mob randomization
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $068279 org $868279
NOP #$0A NOP #$0A
JSL sprite_bush_spawn JSL sprite_bush_spawn
NOP ; we keep the branch NOP ; we keep the branch

View File

@@ -1,12 +1,12 @@
org $780CA ; Bank07.asm(179) org $8780CA ; Bank07.asm(179)
JSL CheckIfLinkShouldDie : NOP : NOP : NOP JSL CheckIfLinkShouldDie : NOP : NOP : NOP
;SEC : SBC.b $00 : CMP #$00 : BEQ .linkIsDead ; Bank07.asm(179) - ;SEC : SBC.b Scrap00 : CMP.b #$00 : BEQ .linkIsDead ; Bank07.asm(179) -
org $780D1 org $8780D1
BNE linkNotDead : NOP : NOP ; Bank07.asm(183) - CMP.b #$A8 : BCC .linkNotDead BNE linkNotDead : NOP : NOP ; Bank07.asm(183) - CMP.b #$A8 : BCC .linkNotDead
org $780D5 org $8780D5
linkIsDead: linkIsDead:
org $780F7 org $8780F7
linkNotDead: linkNotDead:

View File

@@ -1,17 +1,17 @@
; adjust oam position after drawing eyes ; adjust oam position after drawing eyes
;ED88E ;ED88E
org $1DD88E org $9DD88E
{ {
; original: GiantMoldorm_Draw+5lines (sprite_giant_moldorm.asm) ; original: GiantMoldorm_Draw+5lines (sprite_giant_moldorm.asm)
; lda $90 : add.w #$0008 : sta $90 ; lda.b $90 : add.w #$0008 : sta.b $90
; INC $92 : INC $92 ; INC.b $92 : INC.b $92
JSL Moldorm_UpdateOamPosition JSL Moldorm_UpdateOamPosition
NOP #08 NOP #08
} }
; set number of eyes ; set number of eyes
;org $1DDBB2 ;$0EDBB2 ;org $9DDBB2 ;$0EDBB2
;{ ;{
; LDX.b #$01 ; LDX.b #$01
; number of eyes (-1) ; number of eyes (-1)

View File

@@ -1,45 +1,45 @@
org $9C50B ; 0x4C50B org $89C50B ; 0x4C50B
{ {
; .loadData ; .loadData
; ; $4C50B- ; ; $4C50B-
; STA $01 ; 85 01 ; STA.b Scrap01 ; 85 01
; ; $4C50D- ; ; $4C50D-
; LDY.w #$0000 ; A0 00 00 ; LDY.w #$0000 ; A0 00 00
JSL LoadOverworldSprites JSL LoadOverworldSprites
NOP NOP
} }
org $9C510 ; 0x4C510 org $89C510 ; 0x4C510
LDA [$00], Y ; replace LDA ($00), Y LDA.b [Scrap00], Y ; replace LDA ($00), Y
; CMP.b #$FF : BEQ .stopLoading ; CMP.b #$FF : BEQ .stopLoading
; INY #2 ; INY #2
org $9C518 ; 0x4C518 org $89C518 ; 0x4C518
LDA [$00], Y ; replace LDA ($00), Y LDA.b [Scrap00], Y ; replace LDA ($00), Y
; DEY #2 : CMP.b #$F4 : BNE .notFallingRocks ; DEY #2 : CMP.b #$F4 : BNE .notFallingRocks
; INC $0FFD ; INC.w $0FFD
; INY #3 ; INY #3
; BRA .nextSprite ; BRA .nextSprite
; .notFallingRocks ; Anything other than falling rocks. ; .notFallingRocks ; Anything other than falling rocks.
org $9C528 ; 0x4C528 org $89C528 ; 0x4C528
LDA [$00], Y ; replace LDA ($00), Y LDA.b [Scrap00], Y ; replace LDA ($00), Y
; PHA : LSR #4 : ASL #2 : ; PHA : LSR #4 : ASL #2 :
org $9C531 ; 0x4C531 org $89C531 ; 0x4C531
STA $0A ; STA $02 STA.b Scrap0A ; STA.b $02
; INY ; INY
org $9C534 ; 0x4C534 org $89C534 ; 0x4C534
LDA [$00], Y ; replace LDA ($00), Y LDA.b [Scrap00], Y ; replace LDA ($00), Y
; LSR #4 : CLC ; LSR #4 : CLC
org $9C53B ; 0x4C53B org $89C53B ; 0x4C53B
ADC $0A ; ADC $02 ADC.b Scrap0A ; ADC.b $02
; STA $06 ; STA.b $06
; PLA : ASL #4 : STA $07 ; PLA : ASL #4 : STA.b $07
org $9C546 ; 0x4C546 org $89C546 ; 0x4C546
LDA [$00], Y ; replace LDA ($00), Y LDA.b [Scrap00], Y ; replace LDA ($00), Y
; AND.b #$0F : ORA $07 : STA $05 ; AND.b #$0F : ORA.b $07 : STA.b $05
; INY ; INY
org $9C54F ; 0x4C54F org $89C54F ; 0x4C54F
LDA [$00], Y ; replace LDA ($00), Y LDA.b [Scrap00], Y ; replace LDA ($00), Y
; LDX $05 : INC A : STA $7FDF80, X ; LDX.b Scrap05 : INC A : STA.l $7FDF80, X
; ; $4C558- ; ; $4C558-
; ; Move on to the next sprite / overlord. ; ; Move on to the next sprite / overlord.

View File

@@ -1,66 +1,66 @@
org $09C29A org $89C29A
JSL LoadUnderworldSprites : NOP JSL LoadUnderworldSprites : NOP
; these hooks change the LDA.b ($00) commands to use LDA.b [$00] commands ; these hooks change the LDA.b ($00) commands to use LDA.b [$00] commands
; so we can store the sprites in a different bank ; so we can store the sprites in a different bank
; also needs to change the use of $02 to $03 for slot index to make that possible ; also needs to change the use of $02 to $03 for slot index to make that possible
org $09C2B2 org $89C2B2
LDA.b [$00] LDA.b [Scrap00]
org $09C2C1 org $89C2C1
LDA.b [$00],Y LDA.b [Scrap00],Y
org $09C2CA org $89C2CA
INC.b $03 ; change slot variable to $03 INC.b Scrap03 ; change slot variable to $03
;org $09C329 standing items overwrote this one ;org $09C329 standing items overwrote this one
;LDA.b [$00],Y ;LDA.b [Scrap00],Y
org $09C332 org $89C332
LDA.b [$00],Y LDA.b [Scrap00],Y
org $09C345 org $89C345
DEC.b $03 : LDX.b $03 DEC.b Scrap03 : LDX.b Scrap03
org $09C350 org $89C350
LDA.b [$00],Y LDA.b [Scrap00],Y
org $09C35A org $89C35A
DEC.b $03 DEC.b Scrap03
org $09C36E org $89C36E
JSL GetSpriteSlot16Bit ; depended on high bit being zero, which it isn't anymore JSL GetSpriteSlot16Bit ; depended on high bit being zero, which it isn't anymore
org $09C383 org $89C383
LDX.b $03 LDX.b Scrap03
org $09C38C org $89C38C
LDA.b [$00],Y LDA.b [Scrap00],Y
org $09C398 org $89C398
LDA.b [$00],Y LDA.b [Scrap00],Y
org $09C3AA org $89C3AA
LDA.b [$00],Y LDA.b [Scrap00],Y
org $09C3BF org $89C3BF
LDA.b [$00],Y LDA.b [Scrap00],Y
org $09C3DF org $89C3DF
LDA.b $03 LDA.b Scrap03
org $09C3F3 org $89C3F3
LDA.b [$00],Y LDA.b [Scrap00],Y
org $09C3FB org $89C3FB
LDA.b [$00],Y LDA.b [Scrap00],Y
org $09C404 org $89C404
LDA.b [$00],Y LDA.b [Scrap00],Y
org $09C416 org $89C416
LDA.b [$00],Y LDA.b [Scrap00],Y

View File

@@ -2,7 +2,7 @@ pushpc
org $9EC147 org $9EC147
JSL NewKodongoCollision JSL NewKodongoCollision
JMP.w .continue : NOP #2 JMP .continue : NOP #2
.continue .continue
org $9EC152 org $9EC152
@@ -11,9 +11,9 @@ Kodongo_SetDirection:
pullpc pullpc
NewKodongoCollision: NewKodongoCollision:
LDA $0DE0, X : INC A : AND.b #$03 : STA $0DE0, X LDA.w SpriteMoveDirection, X : INC A : AND.b #$03 : STA.w SpriteMoveDirection, X
;If they collide more than 4 times just set direction ;If they collide more than 4 times just set direction
LDA $0DA0, X : INC A : STA $0DA0, X : CMP #$04 : BCC .continue LDA.w SpriteAuxTable, X : INC A : STA.w SpriteAuxTable, X : CMP.b #$04 : BCC .continue
PLA : PLA : PEA.w Kodongo_SetDirection-1 PLA : PLA : PEA.w Kodongo_SetDirection-1
.continue .continue
RTL RTL

View File

@@ -2,13 +2,6 @@
lorom lorom
;================================================================================
!ADD = "CLC : ADC"
!SUB = "SEC : SBC"
!BLT = "BCC"
!BGE = "BCS"
;=Constants====================================================================== ;=Constants======================================================================
!BUSHES_FLAG = "$368100" !BUSHES_FLAG = "$368100"
@@ -59,8 +52,8 @@ incsrc falling_death.asm
incsrc shell_gfx.asm incsrc shell_gfx.asm
warnpc $B6FFFF ;if we hit this we need to split stuff by bank warnpc $B6FFFF ;if we hit this we need to split stuff by bank
org $0684BD org $8684BD
Sprite_Get16BitCoords_long: Sprite_Get16BitCoords_long:
org $1EC6FA ;F46FA org $9EC6FA ;F46FA
SpritePrep_Eyegore: SpritePrep_Eyegore:

View File

@@ -1,36 +1,34 @@
pushpc pushpc
org $0691B6 org $8691B6
SpritePrep_Eyegore_bounce:
JSL SpritePrep_EyegoreNew JSL SpritePrep_EyegoreNew
org $068839 ; 0xEF org $868839 ; 0xEF
dw #$91B6 ; New sprite_prep dw SpritePrep_Eyegore_bounce
dw #$91B6 ; New sprite_prep dw SpritePrep_Eyegore_bounce
;org $069468 ; These need to go else where ;org $869468 ; These need to go else where
;dw #$BFF7 ; SpriteModule_Active_Bank1E_bounce ;dw #$BFF7 ; SpriteModule_Active_Bank1E_bounce
;dw #$BFF7 ; SpriteModule_Active_Bank1E_bounce ;dw #$BFF7 ; SpriteModule_Active_Bank1E_bounce
;org $1E8B21 ;org $9E8B21
;JSL FixVectorForMimics ;JSL FixVectorForMimics
;org $1E8BBB ; New vectors for mimics ;org $9E8BBB ; New vectors for mimics
;dw #$C795 ;dw #$C795
;dw #$C795 ;dw #$C795
org $0DB818 org $9EC70D
SpritePrep_LoadProperties:
org $1EC70D
SpritePrep_Eyegore_become_mimic: SpritePrep_Eyegore_become_mimic:
;org $06EC08 ; Sprite_AttemptZapDamage ;org $86EC08 ; Sprite_AttemptZapDamage
;JSL resetSprite_Mimic : NOP ;JSL resetSprite_Mimic : NOP
org $06ED9E ; Sprite_ApplyCalculatedDamage, skip high sprite id early exit org $86ED9E ; Sprite_ApplyCalculatedDamage, skip high sprite id early exit
JSL IsItReallyAMimic : NOP JSL IsItReallyAMimic : NOP
org $06EDA6 ; Sprite_ApplyCalculatedDamage .not_absorbable org $86EDA6 ; Sprite_ApplyCalculatedDamage .not_absorbable
JSL notItemSprite_Mimic JSL notItemSprite_Mimic
pullpc pullpc
@@ -47,65 +45,65 @@ pullpc
; replace SpritePrep_Eyegore if flag is on ; replace SpritePrep_Eyegore if flag is on
SpritePrep_EyegoreNew: SpritePrep_EyegoreNew:
{ {
LDA !ENABLE_MIMIC_OVERRIDE : BNE .new LDA.l !ENABLE_MIMIC_OVERRIDE : BNE .new
; old ; old
JSL SpritePrep_Eyegore JSL SpritePrep_Eyegore
RTL RTL
.new .new
LDA $0E20, X : CMP.b #$EF : BCS .mimic ;If sprite id >= EF (unused somaria platform) LDA.w SpriteTypeTable, X : CMP.b #$EF : BCS .mimic ;If sprite id >= EF (unused somaria platform)
; seems unnecessary it's just an rtl? ; seems unnecessary it's just an rtl?
; JSL $1EC71A ; 0xF471A set eyegore to be only eyegore (.not_goriya?) ; JSL $9EC71A ; 0xF471A set eyegore to be only eyegore (.not_goriya?)
RTL RTL
.mimic .mimic
SBC.b #$6C : STA $0E20, X : JSL SpritePrep_LoadProperties ; pretending to be $83 or $84 SBC.b #$6C : STA.w SpriteTypeTable, X : JSL SpritePrep_LoadProperties ; pretending to be $83 or $84
JSL SpritePrep_Eyegore_become_mimic JSL SpritePrep_Eyegore_become_mimic
; LDA.w $0E20, X : ADC #$6C : STA $0E20, X ; set the sprite back to special mimic ; LDA.w SpriteTypeTable, X : ADC.b #$6C : STA.w SpriteTypeTable, X ; set the sprite back to special mimic
; todo? unsure about this code - seems unnecessary ; todo? unsure about this code - seems unnecessary
; LDA $0CAA, X : AND #$FB : ORA #$80 : STA $0CAA, X ; STZ $0CAA, X ; LDA.w $0CAA, X : AND.b #$FB : ORA.b #$80 : STA.w $0CAA, X ; STZ.w $0CAA, X
RTL RTL
} }
;resetSprite_Mimic: ;resetSprite_Mimic:
; LDA !ENABLE_MIMIC_OVERRIDE : BEQ .notMimic ; skip to what it would have done normally ; LDA.l !ENABLE_MIMIC_OVERRIDE : BEQ .notMimic ; skip to what it would have done normally
; ;
; LDA $0E20, X ; LDA.w SpriteTypeTable, X
; CMP.b #$EF : BCC .notMimic ; CMP.b #$EF : BCC .notMimic
; LDA $0E20, X : SBC.b #$6C : STA $0E20, X ; overwrite the sprite id with eyegore id ; LDA.w SpriteTypeTable, X : SBC.b #$6C : STA.w SpriteTypeTable, X ; overwrite the sprite id with eyegore id
; ;
;.notMimic ;.notMimic
; restore code ; restore code
; LDA $0E20, X : CMP.b #$7A ; LDA.w SpriteTypeTable, X : CMP.b #$7A
;RTL ;RTL
IsItReallyAMimic: IsItReallyAMimic:
LDA !ENABLE_MIMIC_OVERRIDE : BEQ .continue LDA.l !ENABLE_MIMIC_OVERRIDE : BEQ .continue
LDA.w $0E20,X : CMP.b #$EF : BEQ .is_mimic LDA.w SpriteTypeTable,X : CMP.b #$EF : BEQ .is_mimic
CMP.b #$F0 : BNE .continue CMP.b #$F0 : BNE .continue
.is_mimic .is_mimic
CLC : RTL CLC : RTL
.continue ; code we hijacked .continue ; code we hijacked
LDA.w $0E20,X LDA.w SpriteTypeTable,X
CMP.b #$D8 CMP.b #$D8
RTL RTL
; this is just for killable thieves now ; this is just for killable thieves now
notItemSprite_Mimic: notItemSprite_Mimic:
; if we set killable thief we want to update the sprite id so it can be killed ; if we set killable thief we want to update the sprite id so it can be killed
LDA $0E20, X LDA.w SpriteTypeTable, X
CMP.l !KILLABLE_THIEVES_ID : BNE .continue ; thief #$C4 (default is B8/dialog tester) CMP.l !KILLABLE_THIEVES_ID : BNE .continue ; thief #$C4 (default is B8/dialog tester)
; if we don't have mimic code turned on we want to skip, but we also need to reload the sprite id because we just smoked it with this LDA ; if we don't have mimic code turned on we want to skip, but we also need to reload the sprite id because we just smoked it with this LDA
; LDA !ENABLE_MIMIC_OVERRIDE : BEQ .reloadSpriteIdAndSkipMimic ; skip to what it would have done normally ; LDA.l !ENABLE_MIMIC_OVERRIDE : BEQ .reloadSpriteIdAndSkipMimic ; skip to what it would have done normally
; LDA $0E20, X ; I hate assembly ; LDA.w SpriteTypeTable, X ; I hate assembly
; CMP.b #$EF : BCC .continue ; CMP.b #$EF : BCC .continue
; SBC.b #$6C : BRA .continue ; SBC.b #$6C : BRA .continue
.changeSpriteId .changeSpriteId
LDA #$83 ; load green eyegore sprite id so we can kill the thing LDA.b #$83 ; load green eyegore sprite id so we can kill the thing
.continue .continue
; restore code ; restore code

View File

@@ -2,10 +2,10 @@ Moldorm_UpdateOamPosition:
{ {
PHX PHX
LDA !MOLDORM_EYES_FLAG : TAX LDA.l !MOLDORM_EYES_FLAG : TAX
.more_eyes .more_eyes
LDA $90 : CLC : ADC.w #$0004 : STA $90 LDA.b $90 : CLC : ADC.w #$0004 : STA.b $90
LDA $92 : CLC : ADC.w #$0001 : STA $92 LDA.b $92 : CLC : ADC.w #$0001 : STA.b $92
DEX : BPL .more_eyes ; X >= 0 DEX : BPL .more_eyes ; X >= 0
PLX PLX

View File

@@ -1,8 +1,8 @@
LoadOverworldSprites: LoadOverworldSprites:
; restore code ; restore code
STA $01 ; 85 01 STA.b Scrap01 ; 85 01
LDY.w #$0000 ; A0 00 00 LDY.w #$0000 ; A0 00 00
; set bank ; set bank
LDA #$09 : STA $02 ; default is bank 9 LDA.b #$09 : STA.b Scrap02 ; default is bank 9
RTL RTL

View File

@@ -3,9 +3,9 @@
;================================================================================ ;================================================================================
check_special_action: check_special_action:
{ {
LDA $7E0CF3 : BEQ .no_special_action LDA.l BossSpecialAction : BEQ .no_special_action
LDA.b #$05 : STA $11 ; $11[0x01] - (Main) Submodule Index (See $B0) LDA.b #$05 : STA.b GameSubMode
STZ $0CF3 ; $0CF3[0x01] - free ram STZ.w BossSpecialAction
.no_special_action .no_special_action
JSL Player_Main JSL Player_Main
RTL RTL

View File

@@ -1,11 +1,11 @@
LoadUnderworldSprites: LoadUnderworldSprites:
STA.b $00 ; part one of what we replaced STA.b Scrap00 ; part one of what we replaced
LDA.w #$0028 : STA.b $02 ; set the bank to 28 for now LDA.w #UWSpritesData>>16 : STA.b Scrap02 ; set the bank to 28 for now
LDA.w $048E LDA.w $048E
RTL RTL
GetSpriteSlot16Bit: GetSpriteSlot16Bit:
LDA.b $03 : AND #$00FF LDA.b Scrap03 : AND.w #$00FF
ASL A ASL A
TAY TAY
RTL RTL

View File

@@ -9,12 +9,12 @@ LockAgahnimDoors:
LDA.w #$0000 : RTL LDA.w #$0000 : RTL
+ : CMP.w #$0001 : BNE + + : CMP.w #$0001 : BNE +
LDA.l ProgressIndicator : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip LDA.l ProgressIndicator : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip
JSR.w LockAgahnimDoorsCore : RTL JSR LockAgahnimDoorsCore : RTL
+ : CMP.w #$0002 : BNE + + : CMP.w #$0002 : BNE +
JSR.w LockAgahnimDoorsCore : BEQ .unlock JSR LockAgahnimDoorsCore : BEQ .unlock
PHX : PHY PHX : PHY
SEP #$30 SEP #$30
JSL.l CheckTowerOpen JSL CheckTowerOpen
REP #$30 REP #$30
PLY : PLX PLY : PLX
!BGE .crystalOrUnlock !BGE .crystalOrUnlock
@@ -29,7 +29,7 @@ LockAgahnimDoors:
LDA.w #$0001 : RTL ;Keep the door locked LDA.w #$0001 : RTL ;Keep the door locked
++ ++
SEP #$30 SEP #$30
JSL $899B6F ;Add tower break seal JSL AncillaAdd_GTCutscene ;Add tower break seal
REP #$30 REP #$30
LDA.w #$0001 ;Prevent door from opening that frame otherwise it glitchy LDA.w #$0001 ;Prevent door from opening that frame otherwise it glitchy
RTL RTL
@@ -65,14 +65,14 @@ RTS
SmithDoorCheck: SmithDoorCheck:
LDA.l SmithTravelsFreely : AND.w #$00FF : BEQ .orig LDA.l SmithTravelsFreely : AND.w #$00FF : BEQ .orig
;If SmithTravelsFreely is set Frog/Smith can enter multi-entrance overworld doors ;If SmithTravelsFreely is set Frog/Smith can enter multi-entrance overworld doors
JML.l Overworld_Entrance_BRANCH_RHO JML Overworld_Entrance_BRANCH_RHO
.orig ; The rest is equivlent to what we overwrote .orig ; The rest is equivlent to what we overwrote
CPX.w #$0076 : !BGE + CPX.w #$0076 : !BGE +
JML.l Overworld_Entrance_BRANCH_LAMBDA JML Overworld_Entrance_BRANCH_LAMBDA
+ +
JML.l Overworld_Entrance_BRANCH_RHO JML Overworld_Entrance_BRANCH_RHO
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
AllowStartFromSingleEntranceCave: AllowStartFromSingleEntranceCave:
; 16 Bit A, 16 bit XY ; 16 Bit A, 16 bit XY
@@ -80,15 +80,14 @@ AllowStartFromSingleEntranceCave:
LDA.l StartingEntrance : AND.w #$00FF ; What we wrote over LDA.l StartingEntrance : AND.w #$00FF ; What we wrote over
PHA PHA
TAX TAX
LDA.l StartingAreaExitOffset, X LDA.l StartingAreaExitOffset, X : AND.w #$00FF
AND.w #$00FF
BNE + BNE +
JMP .done JMP .done
+ +
DEC DEC
STA.b Scrap00 STA.b Scrap00
ASL #2 : !ADD Scrap00 : ASL #2 ; mult by 20 ASL #2 : !ADD.l Scrap00 : ASL #2 ; mult by 20
TAX TAX
LDA.w #$0016 : STA.l EN_MAINDESQ ; Cache the main screen designation LDA.w #$0016 : STA.l EN_MAINDESQ ; Cache the main screen designation
@@ -126,7 +125,7 @@ AllowStartFromSingleEntranceCave:
LDA.l StartingEntrance : TAX LDA.l StartingEntrance : TAX
LDA.l StartingAreaOverworldDoor, X : STA.l PreviousOverworldDoor ;Load overworld door LDA.l StartingAreaOverworldDoor, X : STA.l PreviousOverworldDoor ;Load overworld door
REP #$20 ; reset 16-bit accumulator REP #$20 ; reset 16-bit accumulator
JSL.l CacheDoorFrameData JSL CacheDoorFrameData
.done .done
PLA PLA
@@ -138,15 +137,15 @@ AllowStartFromExit:
LDA.l ShouldStartatExit, X : BNE .doStart LDA.l ShouldStartatExit, X : BNE .doStart
LDA.l StartingEntrance ; what we wrote over LDA.l StartingEntrance ; what we wrote over
JML.l AllowStartFromExitReturn JML AllowStartFromExitReturn
.doStart .doStart
LDA.l $828481, X ;Module_LocationMenu_starting_points LDA.l Module1B_SpawnSelect_spawns, X
ASL : TAX ASL : TAX
LDA.l $82D8D2, X : STA.b RoomIndex LDA.l SpawnPointData_room_id, X : STA.b RoomIndex
LDA.l $82D8D3, X : STA.b RoomIndex+1 LDA.l SpawnPointData_room_id+1, X : STA.b RoomIndex+1
; Go to pre-overworld mode ; Go to pre-overworld mode
LDA.b #$08 : STA.b GameMode LDA.b #$08 : STA.b GameMode
@@ -158,7 +157,7 @@ JML.l AllowStartFromExitReturn
INC.w UpdateHUDFlag INC.w UpdateHUDFlag
JSL Equipment_SearchForEquippedItemLong JSL Equipment_SearchForEquippedItemLong
JSL HUD_RebuildLong2 JSL HUD_RebuildIndoor_Palace
JSL Equipment_UpdateEquippedItemLong JSL Equipment_UpdateEquippedItemLong
RTL RTL
@@ -166,9 +165,9 @@ RTL
CheckHole: CheckHole:
LDX.w #$0024 LDX.w #$0024
.nextHoleClassic .nextHoleClassic
LDA.b Scrap00 : CMP.l $9BB800, X LDA.b Scrap00 : CMP.l Overworld_GetPitDestination_map16, X
BNE .wrongMap16Classic BNE .wrongMap16Classic
LDA.b OverworldIndex : CMP.l $9BB826, X LDA.b OverworldIndex : CMP.l Overworld_GetPitDestination_screen, X
BEQ .matchedHoleClassic BEQ .matchedHoleClassic
.wrongMap16Classic .wrongMap16Classic
DEX #2 : BPL .nextHoleClassic DEX #2 : BPL .nextHoleClassic
@@ -198,11 +197,11 @@ PreventEnterOnBonk:
LDA.b OverworldIndex : AND.w #$0040 : CMP.b WorldCache : BEQ .done ; Are we bonking, or doing the superbunny glitch? LDA.b OverworldIndex : AND.w #$0040 : CMP.b WorldCache : BEQ .done ; Are we bonking, or doing the superbunny glitch?
; If in inverted, are in mirror mode, and are bonking then do not enter ; If in inverted, are in mirror mode, and are bonking then do not enter
JML.l PreventEnterOnBonk_BRANCH_IX JML PreventEnterOnBonk_BRANCH_IX
.done .done
LDX.w #$0102 ; rest of what we wrote over LDX.w #$0102 ; rest of what we wrote over
JML.l PreventEnterOnBonk_return JML PreventEnterOnBonk_return
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
TurtleRockEntranceFix: TurtleRockEntranceFix:
LDA.l TurtleRockAutoOpenFix : BEQ .done LDA.l TurtleRockAutoOpenFix : BEQ .done

View File

@@ -5,20 +5,20 @@ OnPrepFileSelect:
+ +
PHA : PHX PHA : PHX
REP #$10 REP #$10
JSL.l LoadAlphabetTilemap JSL LoadAlphabetTilemap
JSL.l LoadFullItemTiles JSL LoadFullItemTiles
SEP #$10 SEP #$10
PLX : PLA PLX : PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnDrawHud: OnDrawHud:
JSL.l DrawChallengeTimer ; this has to come before NewDrawHud because the timer overwrites the compass counter JSL DrawChallengeTimer ; this has to come before NewDrawHud because the timer overwrites the compass counter
JSL.l NewDrawHud JSL NewDrawHud
JSL.l DrHudOverride JSL DrHudOverride
JSL.l SwapSpriteIfNecessary JSL SwapSpriteIfNecessary
JSL.l CuccoStorm JSL CuccoStorm
JSL.l PollService JSL PollService
JML.l ReturnFromOnDrawHud JML ReturnFromOnDrawHud
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnDungeonEntrance: OnDungeonEntrance:
STA.l PegColor ; thing we wrote over STA.l PegColor ; thing we wrote over
@@ -27,35 +27,35 @@ OnDungeonEntrance:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnDungeonBossExit: OnDungeonBossExit:
JSL.l StatTransitionCounter JSL StatTransitionCounter
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnPlayerDead: OnPlayerDead:
PHA PHA
JSL.l SetDeathWorldChecked JSL SetDeathWorldChecked
JSL.l SetSilverBowMode JSL SetSilverBowMode
JSL.l RefreshRainAmmo JSL RefreshRainAmmo
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnDungeonExit: OnDungeonExit:
PHA : PHP PHA : PHP
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
JSL.l SQEGFix JSL SQEGFix
PLP : PLA PLP : PLA
STA.w DungeonID : STZ.w Map16ChangeIndex ; thing we wrote over STA.w DungeonID : STZ.w Map16ChangeIndex ; thing we wrote over
PHA : PHP PHA : PHP
INC.w UpdateHUDFlag INC.w UpdateHUDFlag
JSL.l HUD_RebuildLong JSL HUD_RebuildLong
JSL.l FloodGateResetInner JSL FloodGateResetInner
JSL.l SetSilverBowMode JSL SetSilverBowMode
PLP : PLA PLP : PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnQuit: OnQuit:
JSL.l SQEGFix JSL SQEGFix
LDA.b #$00 : STA.l AltTextFlag ; bandaid patch bug with mirroring away from text LDA.b #$00 : STA.l AltTextFlag ; bandaid patch bug with mirroring away from text
LDA.b #$10 : STA.b MAINDESQ ; thing we wrote over LDA.b #$10 : STA.b MAINDESQ ; thing we wrote over
RTL RTL
@@ -68,9 +68,9 @@ OnUncleItemGet:
BIT.b #$02 : BEQ + : STA.l InfiniteBombs : + BIT.b #$02 : BEQ + : STA.l InfiniteBombs : +
BIT.b #$01 : BEQ + : STA.l InfiniteArrows : + BIT.b #$01 : BEQ + : STA.l InfiniteArrows : +
LDA UncleItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID LDA.l UncleItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLA PLA
JSL.l Link_ReceiveItem JSL Link_ReceiveItem
LDA.l UncleRefill : BIT.b #$04 : BEQ + : LDA.b #$80 : STA.l MagicFiller : + ; refill magic LDA.l UncleRefill : BIT.b #$04 : BEQ + : LDA.b #$80 : STA.l MagicFiller : + ; refill magic
LDA.l UncleRefill : BIT.b #$02 : BEQ + : LDA.b #50 : STA.l BombsFiller : + ; refill bombs LDA.l UncleRefill : BIT.b #$02 : BEQ + : LDA.b #50 : STA.l BombsFiller : + ; refill bombs
@@ -104,13 +104,13 @@ OnAga1Defeated:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnAga2Defeated: OnAga2Defeated:
JSL.l Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first JSL Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first
LDA.b #$01 : STA.l Aga2Duck LDA.b #$01 : STA.l Aga2Duck
LDA.w DungeonID : CMP.b #$1A : BNE + LDA.w DungeonID : CMP.b #$1A : BNE +
LDA.l DungeonsCompleted : ORA.b #$04 : STA.l DungeonsCompleted LDA.l DungeonsCompleted : ORA.b #$04 : STA.l DungeonsCompleted
+ +
LDA.b #$FF : STA.w DungeonID LDA.b #$FF : STA.w DungeonID
JML.l IncrementAgahnim2Sword JML IncrementAgahnim2Sword
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnFileCreation: OnFileCreation:
PHB PHB
@@ -135,37 +135,37 @@ OnFileCreation:
; Set validity value and do some cleanup. Jump to checksum done. ; Set validity value and do some cleanup. Jump to checksum done.
LDA.w #$55AA : STA.l FileValiditySRAM LDA.w #$55AA : STA.l FileValiditySRAM
JSL.l WriteSaveChecksumAndBackup JSL WriteSaveChecksumAndBackup
STZ.b Scrap00 STZ.b Scrap00
STZ.b Scrap01 STZ.b Scrap01
JML.l InitializeSaveFile_checksum_done JML InitializeSaveFile_checksum_done
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnFileLoad: OnFileLoad:
REP #$10 ; set 16 bit index registers REP #$10 ; set 16 bit index registers
JSL.l EnableForceBlank ; what we wrote over JSL EnableForceBlank ; what we wrote over
REP #$20 : LDA.l TotalItemCount : STA.l MultiClientFlagsWRAM+1 : SEP #$20 REP #$20 : LDA.l TotalItemCount : STA.l MultiClientFlagsWRAM+1 : SEP #$20
LDA MultiClientFlagsROM : STA.l MultiClientFlagsWRAM LDA.l MultiClientFlagsROM : STA.l MultiClientFlagsWRAM
LDA.b #$07 : STA.w BG34NBA ; Restore screen 3 to normal tile area LDA.b #$07 : STA.w BG34NBA ; Restore screen 3 to normal tile area
LDA.l FileMarker : BNE + LDA.l FileMarker : BNE +
JSL.l OnNewFile JSL OnNewFile
LDA.b #$FF : STA.l FileMarker LDA.b #$FF : STA.l FileMarker
+ +
LDA.w DeathReloadFlag : BNE + ; don't adjust the worlds for "continue" or "save-continue" LDA.w DeathReloadFlag : BNE + ; don't adjust the worlds for "continue" or "save-continue"
LDA.l MosaicLevel : BNE + ; don't adjust worlds if mosiac is enabled (Read: mirroring in dungeon) LDA.l MosaicLevel : BNE + ; don't adjust worlds if mosiac is enabled (Read: mirroring in dungeon)
JSL.l DoWorldFix JSL DoWorldFix
+ +
JSL.l MasterSwordFollowerClear JSL MasterSwordFollowerClear
LDA.b #$FF : STA.l RNGLockIn ; reset rng item lock-in LDA.b #$FF : STA.l RNGLockIn ; reset rng item lock-in
LDA.l GenericKeys : BEQ + LDA.l GenericKeys : BEQ +
LDA.l CurrentGenericKeys : STA.l CurrentSmallKeys ; copy generic keys to key counter LDA.l CurrentGenericKeys : STA.l CurrentSmallKeys ; copy generic keys to key counter
+ +
JSL.l SetSilverBowMode JSL SetSilverBowMode
JSL.l RefreshRainAmmo JSL RefreshRainAmmo
JSL.l SetEscapeAssist JSL SetEscapeAssist
LDA.l IsEncrypted : CMP.b #01 : BNE + LDA.l IsEncrypted : CMP.b #01 : BNE +
JSL LoadStaticDecryptionKey JSL LoadStaticDecryptionKey
@@ -196,19 +196,19 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnInitFileSelect: OnInitFileSelect:
LDA.b #$51 : STA.w $0AA2 ;<-- Line missing from JP1.0, needed to ensure "extra" copy of naming screen graphics are loaded. LDA.b #$51 : STA.w $0AA2 ;<-- Line missing from JP1.0, needed to ensure "extra" copy of naming screen graphics are loaded.
JSL.l EnableForceBlank JSL EnableForceBlank
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnLinkDamaged: OnLinkDamaged:
JSL.l IncrementDamageTakenCounter_Arb JSL IncrementDamageTakenCounter_Arb
JML.l OHKOTimer JML OHKOTimer
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;OnEnterWater: ;OnEnterWater:
; JSL.l UnequipCapeQuiet ; what we wrote over ; JSL UnequipCapeQuiet ; what we wrote over
;RTL ;RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnLinkDamagedFromPit: OnLinkDamagedFromPit:
JSL.l OHKOTimer JSL OHKOTimer
LDA.l AllowAccidentalMajorGlitch LDA.l AllowAccidentalMajorGlitch
BEQ ++ BEQ ++
@@ -222,11 +222,11 @@ OnLinkDamagedFromPit:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnLinkDamagedFromPitOutdoors: OnLinkDamagedFromPitOutdoors:
JML.l OHKOTimer ; make sure this is last JML OHKOTimer ; make sure this is last
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnOWTransition: OnOWTransition:
JSL.l FloodGateReset JSL FloodGateReset
JSL.l StatTransitionCounter JSL StatTransitionCounter
PHP PHP
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
LDA.b #$FF : STA.l RNGLockIn ; clear lock-in LDA.b #$FF : STA.l RNGLockIn ; clear lock-in
@@ -261,25 +261,25 @@ PostItemAnimation:
LDA.b #$00 : STA.l BusyItem ; mark item as finished LDA.b #$00 : STA.l BusyItem ; mark item as finished
LDA.l TextBoxDefer : BEQ + LDA.l TextBoxDefer : BEQ +
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
JSL.l Main_ShowTextMessage_Alt JSL Main_ShowTextMessage_Alt
LDA.b #$00 : STA.l TextBoxDefer LDA.b #$00 : STA.l TextBoxDefer
+ +
LDA $1B : BEQ + LDA.b IndoorsFlag : BEQ +
REP #$20 : LDA $A0 : STA !MULTIWORLD_ROOMID : SEP #$20 REP #$20 : LDA.b RoomIndex : STA.l !MULTIWORLD_ROOMID : SEP #$20
LDA $0403 : STA !MULTIWORLD_ROOMDATA LDA.w RoomItemsTaken : STA.l !MULTIWORLD_ROOMDATA
+ +
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ + LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
STZ $02E9 STZ.w ItemReceiptMethod
LDA #$00 : STA !MULTIWORLD_ITEM_PLAYER_ID LDA.b #$00 : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLB PLB
JML.l Ancilla_ReceiveItem_objectFinished JML Ancilla_ReceiveItem_objectFinished
+ +
LDA.w ItemReceiptMethod : CMP.b #$01 : BNE + LDA.w ItemReceiptMethod : CMP.b #$01 : BNE +
LDA.b LinkDirection : BEQ + LDA.b LinkDirection : BEQ +
JSL.l IncrementChestTurnCounter JSL IncrementChestTurnCounter
+ +
REP #$20 REP #$20
PEA.w $7E00 PEA.w $7E00

View File

@@ -27,7 +27,7 @@ DontUseZSNES:
LDA.b #$00 LDA.b #$00
STA.l NMITIMEN ; disable NMI and IRQ STA.l NMITIMEN ; disable NMI and IRQ
STA.l HDMAEN ; disable HDMA STA.l HDMAENABLE ; disable HDMA
ROR ; A = 0x80 from carry ROR ; A = 0x80 from carry
STA.l INIDISP STA.l INIDISP
@@ -48,7 +48,7 @@ DontUseZSNES:
STA.l DAS0L STA.l DAS0L
LDA.w #$0001 LDA.w #$0001
STA.l MDMAEN STA.l DMAENABLE
JSR ConfigurePPUForFailureReport JSR ConfigurePPUForFailureReport
JSR ConfigureBSODVWF JSR ConfigureBSODVWF
@@ -93,7 +93,7 @@ Crashed:
LDA.b #$00 LDA.b #$00
STA.l NMITIMEN ; disable NMI and IRQ STA.l NMITIMEN ; disable NMI and IRQ
STA.l HDMAEN ; disable HDMA STA.l HDMAENABLE ; disable HDMA
ROR ; A = 0x80 from carry ROR ; A = 0x80 from carry
STA.l INIDISP STA.l INIDISP
@@ -114,7 +114,7 @@ Crashed:
STA.l DAS0L STA.l DAS0L
LDA.w #$0001 LDA.w #$0001
STA.l MDMAEN STA.l DMAENABLE
;=================================================================================================== ;===================================================================================================
@@ -312,7 +312,7 @@ DrawVWFMessage:
STZ.w A1B0 STZ.w A1B0
LDA.b #$01 LDA.b #$01
STA.w MDMAEN STA.w DMAENABLE
REP #$20 REP #$20
@@ -376,7 +376,7 @@ DrawFailureVWFChar:
LDY.w #$0000 LDY.w #$0000
.next_row .next_row
LDA.b ($08),Y LDA.b (Scrap08),Y
AND.w #$00FF AND.w #$00FF
XBA XBA
LDX.w VWFS LDX.w VWFS
@@ -427,7 +427,7 @@ LoadBSODHexFont:
STA.w A1B0 STA.w A1B0
LDA.b #$01 LDA.b #$01
STA.w MDMAEN STA.w DMAENABLE
REP #$30 REP #$30
@@ -467,7 +467,7 @@ ConfigureBSODVWF:
PEA.w $0001 PEA.w $0001
LDA.w #15 LDA.w #15
STA.w $28 STA.w LinkRecoilX
LDA.w #$0042>>1 LDA.w #$0042>>1
BRA .start BRA .start
@@ -475,13 +475,13 @@ ConfigureBSODVWF:
.next_row .next_row
PHA PHA
LDA.w $20 LDA.w LinkPosY
CLC CLC
LDA.w $20 LDA.w LinkPosY
ADC.w #32 ADC.w #32
.start .start
STA.w $20 STA.w LinkPosY
STA.b VMADDL STA.b VMADDL
PLA PLA
@@ -494,7 +494,7 @@ ConfigureBSODVWF:
DEY DEY
BNE .next_char BNE .next_char
DEC.w $28 DEC.w LinkRecoilX
BNE .next_row BNE .next_row
LDA.w #$0000 LDA.w #$0000

View File

@@ -27,9 +27,9 @@ RTL
FairyPond_Init: FairyPond_Init:
LDA.l Restrict_Ponds : BNE + LDA.l Restrict_Ponds : BNE +
LDA.b #$48 LDA.b #$48
JML.l Sprite_ShowMessageFromPlayerContact JML Sprite_ShowMessageFromPlayerContact
+ +
PHY : JSL.l Sprite_CheckDamageToPlayerSameLayerLong : BCC + PHY : JSL Sprite_CheckDamageToPlayerSameLayerLong : BCC +
LDA.l BottleContentsOne : CMP.b #$02 : BNE ++ : LDA.b #$1C : PHA : BRA .emptyBottle : ++ LDA.l BottleContentsOne : CMP.b #$02 : BNE ++ : LDA.b #$1C : PHA : BRA .emptyBottle : ++
LDA.l BottleContentsTwo : CMP.b #$02 : BNE ++ : LDA.b #$1D : PHA : BRA .emptyBottle : ++ LDA.l BottleContentsTwo : CMP.b #$02 : BNE ++ : LDA.b #$1D : PHA : BRA .emptyBottle : ++
LDA.l BottleContentsThree : CMP.b #$02 : BNE ++ : LDA.b #$1E : PHA : BRA .emptyBottle : ++ LDA.l BottleContentsThree : CMP.b #$02 : BNE ++ : LDA.b #$1E : PHA : BRA .emptyBottle : ++
@@ -38,7 +38,7 @@ FairyPond_Init:
LDA.b #$0A : STA.w SpriteActivity, X LDA.b #$0A : STA.w SpriteActivity, X
LDA.b #$51 LDA.b #$51
LDY.b #$01 LDY.b #$01
JSL.l Sprite_ShowMessageFromPlayerContact JSL Sprite_ShowMessageFromPlayerContact
JMP .cleanup JMP .cleanup
.emptyBottle .emptyBottle

View File

@@ -23,7 +23,7 @@ FlagFastCredits:
TSB.b FastCreditsActive TSB.b FastCreditsActive
.slow .slow
LDA.b $11 LDA.b GameSubMode
ASL ASL
TAX TAX
@@ -79,10 +79,10 @@ FastCreditsCutsceneScrollY:
FastCreditsCutsceneScroll: FastCreditsCutsceneScroll:
LDA.w $00E2,Y LDA.w $00E2,Y
CMP.l $8EC308,X ; compare to target CMP.l Credits_ScrollScene_target_y,X ; compare to target
ROL.b Scrap00 ; put carry in here ROL.b Scrap00 ; put carry in here
LDA.l $8EC348,X ; get movement LDA.l Credits_ScrollScene_movement_y,X ; get movement
BPL ++ ; if positive, leave saved carry alone BPL ++ ; if positive, leave saved carry alone
INC.b Scrap00 ; otherwise, flip it INC.b Scrap00 ; otherwise, flip it
++ ROR.b Scrap00 ; recover carry ++ ROR.b Scrap00 ; recover carry

View File

@@ -12,10 +12,10 @@ TitleCardFix:
BNE .exit BNE .exit
LDA.b #$14 LDA.b #$14
STA.b $10 STA.b GameMode
STZ.b $11 STZ.b GameSubMode
STZ.b $22 STZ.b LinkPosX
.exit .exit
JML $8CC3D2 JML $8CC3D2

View File

@@ -23,12 +23,12 @@ macro fs_draw16x8(screenrow,screencol)
endmacro endmacro
macro fs_draw8x16(screenrow,screencol) macro fs_draw8x16(screenrow,screencol)
%fs_draw8x8(<screenrow>,<screencol>) %fs_draw8x8(<screenrow>,<screencol>)
!ADD #$0010 !ADD.w #$0010
%fs_draw8x8(<screenrow>+1,<screencol>) %fs_draw8x8(<screenrow>+1,<screencol>)
endmacro endmacro
macro fs_draw16x16(screenrow,screencol) macro fs_draw16x16(screenrow,screencol)
%fs_draw16x8(<screenrow>,<screencol>) %fs_draw16x8(<screenrow>,<screencol>)
!ADD #$000F !ADD.w #$000F
%fs_draw16x8(<screenrow>+1,<screencol>) %fs_draw16x8(<screenrow>+1,<screencol>)
endmacro endmacro
@@ -385,7 +385,7 @@ DrawPlayerFileShared:
++ ++
LDA.l EquipmentSRAM+$0130 : AND.w #$00FF LDA.l EquipmentSRAM+$0130 : AND.w #$00FF
JSL.l HexToDec JSL HexToDec
LDA.l HexToDecDigit4 : AND.w #$00FF : ORA.w #!FS_COLOR_BW|$02E0 : %fs_draw8x8(11,26) LDA.l HexToDecDigit4 : AND.w #$00FF : ORA.w #!FS_COLOR_BW|$02E0 : %fs_draw8x8(11,26)
LDA.l HexToDecDigit5 : AND.w #$00FF : ORA.w #!FS_COLOR_BW|$02E0 : %fs_draw8x8(11,27) LDA.l HexToDecDigit5 : AND.w #$00FF : ORA.w #!FS_COLOR_BW|$02E0 : %fs_draw8x8(11,27)
@@ -608,7 +608,7 @@ FileSelectItems:
FileSelectDrawHudBar: FileSelectDrawHudBar:
LDA.w #$02DB|!FS_COLOR_GREEN : %fs_draw16x8(0,10) LDA.w #$02DB|!FS_COLOR_GREEN : %fs_draw16x8(0,10)
LDA.l DisplayRupeesSRAM LDA.l DisplayRupeesSRAM
JSL.l HUDHex4Digit_Long JSL HUDHex4Digit_Long
LDA.b Scrap04 : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,9) LDA.b Scrap04 : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,9)
LDA.b Scrap05 : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,10) LDA.b Scrap05 : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,10)
LDA.b Scrap06 : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,11) LDA.b Scrap06 : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,11)
@@ -616,7 +616,7 @@ FileSelectDrawHudBar:
LDA.w #$02CB|!FS_COLOR_BLUE : %fs_draw16x8(0,14) LDA.w #$02CB|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
LDA.l BombsEquipmentSRAM : AND.w #$00FF LDA.l BombsEquipmentSRAM : AND.w #$00FF
JSL.l HUDHex2Digit_Long JSL HUDHex2Digit_Long
TYA : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,14) TYA : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,14)
TXA : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,15) TXA : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,15)
@@ -627,7 +627,7 @@ FileSelectDrawHudBar:
LDA.w #$02C9|!FS_COLOR_BROWN : %fs_draw16x8(0,17) LDA.w #$02C9|!FS_COLOR_BROWN : %fs_draw16x8(0,17)
++ ++
LDA.l CurrentArrowsSRAM : AND.w #$00FF LDA.l CurrentArrowsSRAM : AND.w #$00FF
JSL.l HUDHex2Digit_Long JSL HUDHex2Digit_Long
TYA : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,17) TYA : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,17)
TXA : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,18) TXA : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,18)
RTS RTS
@@ -771,7 +771,7 @@ LoadFullItemTiles:
LDA.b #FileSelectNewGraphics>>16 : STA.w A1B0 LDA.b #FileSelectNewGraphics>>16 : STA.w A1B0
LDX.w #FileSelectNewGraphics : STX.w A1T0L LDX.w #FileSelectNewGraphics : STX.w A1T0L
LDX.w #$0C00 : STX.w DAS0L LDX.w #$0C00 : STX.w DAS0L
LDA.b #$01 : STA.w MDMAEN LDA.b #$01 : STA.w DMAENABLE
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; z colon @ ; z colon @
@@ -788,7 +788,7 @@ LoadLowerCaseLettersSymbols:
LDX.w #NewFont+$400 : STX.w A1T0L LDX.w #NewFont+$400 : STX.w A1T0L
LDX.w #$0400 : STX.w DAS0L LDX.w #$0400 : STX.w DAS0L
LDX.w #$2D00 : STX.w VMADDL LDX.w #$2D00 : STX.w VMADDL
LDA.b #$01 : STA.w MDMAEN LDA.b #$01 : STA.w DMAENABLE
; : @ # ; : @ #
LDA.b #NewFont>>16 : STA.w A1B0 LDA.b #NewFont>>16 : STA.w A1B0
@@ -798,9 +798,9 @@ LoadLowerCaseLettersSymbols:
LDX.w #$0030 : STX.w DAS0L : STX.w DAS1L LDX.w #$0030 : STX.w DAS0L : STX.w DAS1L
LDX.w #$2E50 : STX.w VMADDL LDX.w #$2E50 : STX.w VMADDL
LDA.b #$01 : STA.w MDMAEN LDA.b #$01 : STA.w DMAENABLE
LDX.w #$2ED0 : STX.w VMADDL LDX.w #$2ED0 : STX.w VMADDL
LDA.b #$02 : STA.w MDMAEN LDA.b #$02 : STA.w DMAENABLE
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LoadFileSelectVanillaItems: LoadFileSelectVanillaItems:
@@ -814,7 +814,7 @@ LoadFileSelectVanillaItems:
LDX.w #DecompBuffer2 : STX.w A1T0L LDX.w #DecompBuffer2 : STX.w A1T0L
LDX.w #$0600 : STX.w DAS0L LDX.w #$0600 : STX.w DAS0L
LDX.w #$2F00 : STX.w VMADDL LDX.w #$2F00 : STX.w VMADDL
LDA.b #$01 : STA.w MDMAEN LDA.b #$01 : STA.w DMAENABLE
SEP #$10 SEP #$10
RTL RTL
@@ -823,10 +823,10 @@ SetFileSelectPalette:
LDA.b GameMode : CMP.b #$04 : BNE + LDA.b GameMode : CMP.b #$04 : BNE +
; load the vanilla file select screen BG3 palette for naming screen ; load the vanilla file select screen BG3 palette for naming screen
LDA.b #$01 : STA.w $0AB2 LDA.b #$01 : STA.w $0AB2
JSL.l Palette_Hud JSL Palette_Hud
BRA .done BRA .done
+ +
JSL.l LoadCustomHudPalette JSL LoadCustomHudPalette
.done .done
JML Palette_SelectScreen ; Jump to the subroutine whose call we wrote over JML Palette_SelectScreen ; Jump to the subroutine whose call we wrote over
@@ -859,7 +859,7 @@ DrawPlayerFile_credits:
%fs_draw8x16(3,7) %fs_draw8x16(3,7)
LDA.l EquipmentSRAM+$9F : ORA.w #!FS_COLOR_BW LDA.l EquipmentSRAM+$9F : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,8) %fs_draw8x16(3,8)
LDA.l EquipmentSRAM+$2C : AND.w #$00FF : LSR #3 : STA.b Scrap02 LDA.l EquipmentSRAM+$2C : AND.w #$00FF : LSR #3 : STA.b Scrap02
%fs_LDY_screenpos(0,20) %fs_LDY_screenpos(0,20)
LDA.l HUDHeartColors_index : ASL : TAX LDA.l HUDHeartColors_index : ASL : TAX
@@ -944,8 +944,8 @@ MaybeForceFileName:
BRA - BRA -
.done .done
SEP #$20 SEP #$20
JML.l InitializeSaveFile JML InitializeSaveFile
+ +
JML.l NameFile_MakeScreenVisible JML NameFile_MakeScreenVisible
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -43,7 +43,7 @@ protectff:
BMI .special_overworld BMI .special_overworld
AND.b #$3F AND.b #$3F
CMP.l $82A4E3,X CMP.l Overworld_ActualScreenID,X
BEQ ++ BEQ ++
.protect .protect

View File

@@ -2,7 +2,7 @@
; Floodgate Softlock Fix ; Floodgate Softlock Fix
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FloodGateAndMasterSwordFollowerReset: FloodGateAndMasterSwordFollowerReset:
JSL.l MasterSwordFollowerClear JSL MasterSwordFollowerClear
FloodGateReset: FloodGateReset:
LDA.l PersistentFloodgate : BNE + LDA.l PersistentFloodgate : BNE +
LDA.l OverworldEventDataWRAM+$3B : AND.b #$DF : STA.l OverworldEventDataWRAM+$3B ; reset water outside floodgate LDA.l OverworldEventDataWRAM+$3B : AND.b #$DF : STA.l OverworldEventDataWRAM+$3B ; reset water outside floodgate
@@ -15,13 +15,13 @@ FloodGateReset:
FloodGateResetInner: FloodGateResetInner:
LDA.l Bugfix_SwampWaterLevel : BEQ .done LDA.l Bugfix_SwampWaterLevel : BEQ .done
LDA DRMode : BEQ .check_room_35; Only do the check for room 37 if on door rando LDA.l DRMode : BEQ .check_room_35; Only do the check for room 37 if on door rando
LDA.l SwampDrain1HasItem : BEQ .flipper_check LDA.l SwampDrain1HasItem : BEQ .flipper_check
LDA.l $7F666F : AND.b #$80 : BEQ .drain_room_37 ; Check if key in room 37 has been collected. LDA.l $7F666F : AND.b #$80 : BEQ .drain_room_37 ; Check if key in room 37 has been collected.
.flipper_check .flipper_check
LDA FlippersEquipment : AND.b #$01 : BNE .check_room_35 ; Check for flippers. This can otherwise softlock doors if flooded without flippers and no way to reset. LDA.l FlippersEquipment : AND.b #$01 : BNE .check_room_35 ; Check for flippers. This can otherwise softlock doors if flooded without flippers and no way to reset.
.drain_room_37 .drain_room_37
LDA RoomDataWRAM[$37].low : AND.b #$7F : STA RoomDataWRAM[$37].low ; clear water room 37 - outer room you shouldn't be able to softlock except in major glitches LDA.l RoomDataWRAM[$37].low : AND.b #$7F : STA.l RoomDataWRAM[$37].low ; clear water room 37 - outer room you shouldn't be able to softlock except in major glitches
.check_room_35 .check_room_35
LDA.l SwampDrain2HasItem : BEQ .done LDA.l SwampDrain2HasItem : BEQ .done
LDA.l $7F666B : AND.b #$80 : BNE .done ; Check if key in room 35 has been collected. LDA.l $7F666B : AND.b #$80 : BNE .done ; Check if key in room 35 has been collected.

View File

@@ -6,7 +6,7 @@ SpawnHauntedGroveItem:
LDA.b IndoorsFlag : BEQ + : RTL : + ; Skip if indoors LDA.b IndoorsFlag : BEQ + : RTL : + ; Skip if indoors
; todo - how does this work now? ; todo - how does this work now?
LDA.l HauntedGroveItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID LDA.l HauntedGroveItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.b #$EB LDA.b #$EB
STA.l MiniGameTime STA.l MiniGameTime
@@ -54,10 +54,10 @@ RTL
FluteBoy: FluteBoy:
LDA.b GameMode : CMP.b #$1A : BEQ + LDA.b GameMode : CMP.b #$1A : BEQ +
LDA.b #$01 : STA.w $0FDD LDA.b #$01 : STA.w $0FDD
JML.l FluteBoy_Abort JML FluteBoy_Abort
+ +
LDA.w SpriteActivity, X : CMP.b #$03 ; thing we wrote over LDA.w SpriteActivity, X : CMP.b #$03 ; thing we wrote over
JML.l FluteBoy_Continue JML FluteBoy_Continue
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FreeDuckCheck: FreeDuckCheck:
LDA.l InvertedMode : BEQ .done LDA.l InvertedMode : BEQ .done

View File

@@ -2,7 +2,7 @@
; Frame Hook ; Frame Hook
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FrameHookAction: FrameHookAction:
JSL $8080B5 ; Module_MainRouting JSL Module_MainRouting
JSL CheckMusicLoadRequest JSL CheckMusicLoadRequest
PHP : REP #$30 : PHA PHP : REP #$30 : PHA
SEP #$20 SEP #$20
@@ -24,16 +24,16 @@ RTL
NMIHookAction: NMIHookAction:
PHA : PHX : PHY : PHD ; thing we wrote over, push stuff PHA : PHX : PHY : PHD ; thing we wrote over, push stuff
LDA !NMI_MW : BEQ ++ LDA.l !NMI_MW : BEQ ++
PHP PHP
SEP #$30 SEP #$30
LDA #$00 : STA !NMI_MW LDA.b #$00 : STA.l !NMI_MW
; Multiworld text ; Multiworld text
LDA !NMI_MW+1 : BEQ + LDA.l !NMI_MW+1 : BEQ +
LDA #$00 : STA !NMI_MW+1 LDA.b #$00 : STA.l !NMI_MW+1
JSL.l WriteText JSL WriteText
+ +
PLP PLP
++ ++
@@ -43,7 +43,7 @@ NMIHookAction:
LDA.l NMIFrames+2 : INC : STA.l NMIFrames+2 LDA.l NMIFrames+2 : INC : STA.l NMIFrames+2
+ +
JML.l NMIHookReturn JML NMIHookReturn
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
PostNMIHookAction: PostNMIHookAction:
@@ -53,23 +53,23 @@ PostNMIHookAction:
.return .return
STZ.w NMIAux ; zero bank byte of NMI hook pointer STZ.w NMIAux ; zero bank byte of NMI hook pointer
+ +
JSR.w TransferItemGFX JSR TransferItemGFX
LDA.b INIDISPQ : STA.w INIDISP ; thing we wrote over, turn screen back on LDA.b INIDISPQ : STA.w INIDISP ; thing we wrote over, turn screen back on
JML.l PostNMIHookReturn JML PostNMIHookReturn
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
TransferItemGFX: TransferItemGFX:
; Only used for shops now but could be used for anything. We should look at how door rando does this ; Only used for shops now but could be used for anything. We should look at how door rando does this
; and try to unify one approach. ; and try to unify one approach.
REP #$30 REP #$30
LDX.w ItemStackPtr : BEQ .done LDX.w ItemStackPtr : BEQ .done
TXA : BIT #$0040 : BNE .fail ; Crash if we have more than 16 queued (should never happen.) TXA : BIT.w #$0040 : BNE .fail ; Crash if we have more than 16 queued (should never happen.)
DEX #2 DEX #2
- -
LDA.l ItemGFXStack,X : STA.w ItemGFXPtr LDA.l ItemGFXStack,X : STA.w ItemGFXPtr
LDA.l ItemTargetStack,X : STA.w ItemGFXTarget LDA.l ItemTargetStack,X : STA.w ItemGFXTarget
PHX PHX
JSL.l TransferItemToVRAM JSL TransferItemToVRAM
REP #$10 REP #$10
PLX PLX
DEX #2 DEX #2

View File

@@ -11,7 +11,7 @@ GetAgahnimPalette:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
GetAgahnimDeath: GetAgahnimDeath:
STA.w $0BA0, X ; thing we wrote over STA.w SpriteAncillaInteract, X ; thing we wrote over
LDA.b RoomIndex ; get room id LDA.b RoomIndex ; get room id
CMP.b #13 : BNE + ; Agahnim 2 room CMP.b #13 : BNE + ; Agahnim 2 room
LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++ LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++
@@ -51,10 +51,10 @@ GetAgahnimSlot:
LDA.b RoomIndex ; get room id LDA.b RoomIndex ; get room id
CMP.b #13 : BNE + ; Agahnim 2 room CMP.b #13 : BNE + ; Agahnim 2 room
LDA.b #$01 ; Use Agahnim 2 LDA.b #$01 ; Use Agahnim 2
JML.l GetAgahnimSlotReturn JML GetAgahnimSlotReturn
+ ; Elsewhere + ; Elsewhere
LDA.b #$00 ; Use Agahnim 1 LDA.b #$00 ; Use Agahnim 1
JML.l GetAgahnimSlotReturn JML GetAgahnimSlotReturn
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
GetAgahnimLightning: GetAgahnimLightning:
INC.w SpriteAux, X ; thing we wrote over INC.w SpriteAux, X ; thing we wrote over

View File

@@ -1,6 +1,6 @@
GoalItemGanonCheck: GoalItemGanonCheck:
LDA.w SpriteTypeTable, X : CMP.b #$D6 : BNE .success ; skip if not ganon LDA.w SpriteTypeTable, X : CMP.b #$D6 : BNE .success ; skip if not ganon
JSL.l CheckGanonVulnerability JSL CheckGanonVulnerability
BCS .success BCS .success
.fail .fail
@@ -128,30 +128,30 @@ GTCutscene_ConditionalAnimateCrystals:
PLX : BCC .skip_crystal PLX : BCC .skip_crystal
.draw_crystal .draw_crystal
LDA.b $11 : BEQ + : JML.l GTCutscene_AnimateCrystals_NoRotate ; what we wrote over LDA.b GameSubMode : BEQ + : JML GTCutscene_AnimateCrystals_NoRotate ; what we wrote over
+ JML.l GTCutscene_AnimateCrystals_NextCrystal+4 + JML GTCutscene_AnimateCrystals_NextCrystal+4
.skip_crystal .skip_crystal
JML.l GTCutscene_DrawSingleCrystal-3 JML GTCutscene_DrawSingleCrystal-3
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
GTCutscene_ConditionalDrawSingleCrystal: GTCutscene_ConditionalDrawSingleCrystal:
LDA.w $06FA : BEQ .draw_crystal : STZ.w $06FA LDA.w RandoOverworldTargetEdge : BEQ .draw_crystal : STZ.w RandoOverworldTargetEdge
JSR GTCutscene_NumberOfCrystals : TAX JSR GTCutscene_NumberOfCrystals : TAX
LDA.l GTCutscene_CrystalMasks,X : AND.b #$80 : BEQ .skip_crystal LDA.l GTCutscene_CrystalMasks,X : AND.b #$80 : BEQ .skip_crystal
.draw_crystal .draw_crystal
LDX.w $0FA0 : PHY ; what we wrote over LDX.w CurrentSpriteSlot : PHY ; what we wrote over
JML.l GTCutscene_DrawSingleCrystal+4 JML GTCutscene_DrawSingleCrystal+4
.skip_crystal .skip_crystal
JML.l GTCutscene_DrawSingleCrystal_SkipCrystal JML GTCutscene_DrawSingleCrystal_SkipCrystal
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
GTCutscene_AnimateCrystals_Prep: GTCutscene_AnimateCrystals_Prep:
BEQ + : JSL.l GTCutscene_SparkleALot : + ; thing we wrote over BEQ + : JSL GTCutscene_SparkleALot : + ; thing we wrote over
JSR GTCutscene_NumberOfCrystals : BNE + JSR GTCutscene_NumberOfCrystals : BNE +
JML.l GTCutscene_DrawSingleCrystal_SkipSparkle JML GTCutscene_DrawSingleCrystal_SkipSparkle
+ CMP.b #$01 : BNE + + CMP.b #$01 : BNE +
JML.l GTCutscene_DrawSingleCrystal JML GTCutscene_DrawSingleCrystal
+ INC.w $06FA ; some free ram OWR also uses + INC.w RandoOverworldTargetEdge ; some free ram OWR also uses
JML.l GTCutscene_AnimateCrystals_NextCrystal-2 JML GTCutscene_AnimateCrystals_NextCrystal-2
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
GTCutscene_ActivateSparkle_SelectCrystal: GTCutscene_ActivateSparkle_SelectCrystal:
JSR GTCutscene_NumberOfCrystals : BNE + JSR GTCutscene_NumberOfCrystals : BNE +
@@ -189,7 +189,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CheckTowerOpen: CheckTowerOpen:
LDA.l GanonsTowerOpenMode : ASL : TAX LDA.l GanonsTowerOpenMode : ASL : TAX
JSR.w (.tower_open_modes,X) JSR (.tower_open_modes,X)
RTL RTL
.tower_open_modes .tower_open_modes
dw .vanilla dw .vanilla
@@ -279,7 +279,7 @@ CheckPedestalPull:
; Out: c - Successful ped pull if set, do nothing if unset. ; Out: c - Successful ped pull if set, do nothing if unset.
PHX PHX
LDA.l PedCheckMode : ASL : TAX LDA.l PedCheckMode : ASL : TAX
JSR.w (.pedestal_modes,X) JSR (.pedestal_modes,X)
PLX PLX
RTL RTL

View File

@@ -2,13 +2,13 @@
; Randomize Half Magic Bat ; Randomize Half Magic Bat
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
GetMagicBatItem: GetMagicBatItem:
JSL.l ItemSet_MagicBat JSL ItemSet_MagicBat
%GetPossiblyEncryptedItem(MagicBatItem, SpriteItemValues) %GetPossiblyEncryptedItem(MagicBatItem, SpriteItemValues)
CMP.b #$FF : BEQ .normalLogic CMP.b #$FF : BEQ .normalLogic
TAY TAY
PHA : LDA MagicBatItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA PHA : LDA.l MagicBatItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID : PLA
STZ.b ItemReceiptMethod ; 0 = Receiving item from an NPC or message STZ.b ItemReceiptMethod ; 0 = Receiving item from an NPC or message
JML.l Link_ReceiveItem JML Link_ReceiveItem
.normalLogic .normalLogic
LDA.l HalfMagic LDA.l HalfMagic
STA.l MagicConsumption STA.l MagicConsumption

View File

@@ -81,7 +81,7 @@ GetItemDamageValue:
CPX.b #$3d : BEQ .hookshot CPX.b #$3d : BEQ .hookshot
.normal .normal
LDA.l $8DB8F1,x ;what we wrote over LDA.l DamageSubclassValue,x ;what we wrote over
RTL RTL
.boomerang .boomerang
LDA.l StunItemAction : AND.b #$01 : BNE .normal LDA.l StunItemAction : AND.b #$01 : BNE .normal
@@ -100,7 +100,7 @@ SearchAncilla:
LDX.b #$00 LDX.b #$00
.loop .loop
LDA.w AncillaID, X LDA.w AncillaID, X
INX : CPX #$0A : BEQ .notFound INX : CPX.b #$0A : BEQ .notFound
CMP.b Scrap05 : BNE .loop CMP.b Scrap05 : BNE .loop
LDA.b #$01 LDA.b #$01
BRA .return BRA .return

View File

@@ -78,7 +78,7 @@ DMAAlphabetTilemap:
LDA.b #BigRAM>>16 : STA.w A1B0 LDA.b #BigRAM>>16 : STA.w A1B0
LDX.w #BigRAM : STX.w A1T0L LDX.w #BigRAM : STX.w A1T0L
LDX.w #$0080 : STX.w DAS0L LDX.w #$0080 : STX.w DAS0L
LDA.b #$01 : STA.w MDMAEN LDA.b #$01 : STA.w DMAENABLE
SEP #$10 SEP #$10
PLX : PLA PLX : PLA
RTS RTS

View File

@@ -3,39 +3,37 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
HeartPieceGet: HeartPieceGet:
PHX : PHY PHX : PHY
JSL.l LoadHeartPieceRoomValue
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
TAY TAY
JSL.l MaybeMarkDigSpotCollected
.skipLoad .skipLoad
JSL HeartPieceGetPlayer : STA.l !MULTIWORLD_ITEM_PLAYER_ID JSL HeartPieceGetPlayer : STA.l !MULTIWORLD_ITEM_PLAYER_ID
CPY.b #$26 : BNE .not_heart ; don't add a 1/4 heart if it's not a heart piece CPY.b #$26 : BNE .not_heart ; don't add a 1/4 heart if it's not a heart piece
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .not_heart LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .not_heart
LDA.l HeartPieceQuarter : INC A : AND.b #$03 : STA.l HeartPieceQuarter LDA.l HeartPieceQuarter : INC A : AND.b #$03 : STA.l HeartPieceQuarter
.not_heart .not_heart
JSL.l $8791B3 ; Player_HaltDashAttackLong
STZ.w ItemReceiptMethod ; 0 = Receiving item from an NPC or message STZ.w ItemReceiptMethod ; 0 = Receiving item from an NPC or message
JSL.l Link_ReceiveItem
JSL MaybeUnlockTabletAnimation JSL MaybeUnlockTabletAnimation
JSL LoadHeartPieceRoomValue
JSL AttemptItemSubstitution
JSL ResolveLootIDLong
JSL MaybeMarkDigSpotCollected
JSL Player_HaltDashAttackLong
JSL Link_ReceiveItem
PLY : PLX PLY : PLX
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
HeartContainerGet: HeartContainerGet:
PHX : PHY PHX : PHY
JSL.l IncrementBossSword
LDY.w SpriteID, X : BNE + LDY.w SpriteID, X : BNE +
JSL.l LoadHeartContainerRoomValue : TAY
+ +
BRA HeartPieceGet_skipLoad BRA HeartPieceGet_skipLoad
JSL IncrementBossSword
JSL LoadHeartContainerRoomValue : TAY
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DrawHeartPieceGFX: DrawHeartPieceGFX:
PHP PHP
JSL.l Sprite_IsOnscreen : BCC .offscreen
PHA : PHY PHA : PHY
LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready
JSL.l HeartPieceSpritePrep
JMP .done ; don't draw on the init frame JMP .done ; don't draw on the init frame
.skipInit .skipInit
LDA.w SpriteID, X ; Retrieve stored item type LDA.w SpriteID, X ; Retrieve stored item type
@@ -46,30 +44,32 @@ DrawHeartPieceGFX:
PLX PLX
LDA.w SpriteControl, X : ORA.b #$20 : STA.w SpriteControl, X LDA.w SpriteControl, X : ORA.b #$20 : STA.w SpriteControl, X
PLA PLA
JSL.l DrawDynamicTile
LDA.b Scrap00 LDA.b Scrap00
CLC : ADC.b #$04 CLC : ADC.b #$04
STA.b Scrap00 STA.b Scrap00
JSL.l Sprite_DrawShadowLong
BRA .done BRA .done
+ +
PLX PLX
PLA PLA
JSL.l DrawDynamicTile
JSL.l Sprite_DrawShadowLong
.done .done
PLY : PLA PLY : PLA
.offscreen .offscreen
PLP PLP
JSL Sprite_IsOnscreen : BCC .offscreen
JSL HeartPieceSpritePrep
JSL DrawDynamicTile
JSL Sprite_DrawShadowLong
JSL DrawDynamicTile
JSL Sprite_DrawShadowLong
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DrawHeartContainerGFX: DrawHeartContainerGFX:
PHP PHP
JSL.l Sprite_IsOnscreen : BCC DrawHeartPieceGFX_offscreen JSL Sprite_IsOnscreen : BCC DrawHeartPieceGFX_offscreen
PHA : PHY PHA : PHY
LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready
JSL.l HeartContainerSpritePrep JSL HeartContainerSpritePrep
BRA DrawHeartPieceGFX_done ; don't draw on the init frame BRA DrawHeartPieceGFX_done ; don't draw on the init frame
.skipInit .skipInit
@@ -80,12 +80,12 @@ DrawHeartContainerGFX:
HeartContainerSound: HeartContainerSound:
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE + LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE +
LDA.w ItemReceiptMethod : CMP.b #$03 : BEQ + LDA.w ItemReceiptMethod : CMP.b #$03 : BEQ +
JSL.l CheckIfBossRoom : BCC + ; Skip if not in a boss room
LDA.b #$2E LDA.b #$2E
SEC SEC
RTL RTL
+ +
CLC CLC
JSL CheckIfBossRoom : BCC + ; Skip if not in a boss room
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
NormalItemSkipSound: NormalItemSkipSound:
@@ -117,11 +117,11 @@ HeartPieceSpritePrep:
LDA.b #$00 : STA.l RedrawFlag LDA.b #$00 : STA.l RedrawFlag
JSL HeartPieceGetPlayer : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID JSL HeartPieceGetPlayer : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSL.l LoadHeartPieceRoomValue
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID, X STA.w SpriteID, X
JSL.l PrepDynamicTile_loot_resolved JSL LoadHeartPieceRoomValue
JSL AttemptItemSubstitution
JSL ResolveLootIDLong
JSL PrepDynamicTile_loot_resolved
.skip .skip
PLA PLA
@@ -132,11 +132,11 @@ HeartContainerSpritePrep:
LDA.b #$00 : STA.l RedrawFlag LDA.b #$00 : STA.l RedrawFlag
JSL HeartPieceGetPlayer : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID JSL HeartPieceGetPlayer : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSL.l LoadHeartContainerRoomValue ; load item type
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID, X STA.w SpriteID, X
JSL.l PrepDynamicTile_loot_resolved JSL LoadHeartContainerRoomValue ; load item type
JSL AttemptItemSubstitution
JSL ResolveLootIDLong
JSL PrepDynamicTile_loot_resolved
PLA PLA
RTL RTL
@@ -144,23 +144,23 @@ RTL
LoadHeartPieceRoomValue: LoadHeartPieceRoomValue:
LDA.b IndoorsFlag : BEQ .outdoors ; check if we're indoors or outdoors LDA.b IndoorsFlag : BEQ .outdoors ; check if we're indoors or outdoors
.indoors .indoors
JSL.l LoadIndoorValue
JMP .done JMP .done
.outdoors .outdoors
JSL.l LoadOutdoorValue
.done .done
JSL LoadIndoorValue
JSL LoadOutdoorValue
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
HPItemReset: HPItemReset:
PHA PHA
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .skip LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .skip
PLA PLA
JSL $89AD58 ; GiveRupeeGift - thing we wrote over
BRA .done BRA .done
.skip .skip
PLA PLA
.done .done
PHA : LDA.b #$01 : STA.l RedrawFlag : PLA PHA : LDA.b #$01 : STA.l RedrawFlag : PLA
JSL GiveRupeeGift ; thing we wrote over
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
MaybeMarkDigSpotCollected: MaybeMarkDigSpotCollected:
@@ -397,68 +397,68 @@ RTL
HeartPieceGetPlayer: HeartPieceGetPlayer:
{ {
PHY PHY
LDA $1B : BNE + LDA.b IndoorsFlag : BNE +
BRL .outdoors BRL .outdoors
+ +
PHP PHP
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA $A0 ; these are all decimal because i got them that way LDA.b RoomIndex ; these are all decimal because i got them that way
CMP.w #135 : BNE + CMP.w #135 : BNE +
LDA StandingKey_Hera_Player LDA.l StandingKey_Hera_Player
BRL .done BRL .done
+ CMP.w #200 : BNE + + CMP.w #200 : BNE +
LDA HeartContainer_ArmosKnights_Player LDA.l HeartContainer_ArmosKnights_Player
BRL .done BRL .done
+ CMP.w #51 : BNE + + CMP.w #51 : BNE +
LDA HeartContainer_Lanmolas_Player LDA.l HeartContainer_Lanmolas_Player
BRL .done BRL .done
+ CMP.w #7 : BNE + + CMP.w #7 : BNE +
LDA HeartContainer_Moldorm_Player LDA.l HeartContainer_Moldorm_Player
BRL .done BRL .done
+ CMP.w #90 : BNE + + CMP.w #90 : BNE +
LDA HeartContainer_HelmasaurKing_Player LDA.l HeartContainer_HelmasaurKing_Player
BRL .done BRL .done
+ CMP.w #6 : BNE + + CMP.w #6 : BNE +
LDA HeartContainer_Arrghus_Player LDA.l HeartContainer_Arrghus_Player
BRL .done BRL .done
+ CMP.w #41 : BNE + + CMP.w #41 : BNE +
LDA HeartContainer_Mothula_Player LDA.l HeartContainer_Mothula_Player
BRL .done BRL .done
+ CMP.w #172 : BNE + + CMP.w #172 : BNE +
LDA HeartContainer_Blind_Player LDA.l HeartContainer_Blind_Player
BRL .done BRL .done
+ CMP.w #222 : BNE + + CMP.w #222 : BNE +
LDA HeartContainer_Kholdstare_Player LDA.l HeartContainer_Kholdstare_Player
BRL .done BRL .done
+ CMP.w #144 : BNE + + CMP.w #144 : BNE +
LDA HeartContainer_Vitreous_Player LDA.l HeartContainer_Vitreous_Player
BRL .done BRL .done
+ CMP.w #164 : BNE + + CMP.w #164 : BNE +
LDA HeartContainer_Trinexx_Player LDA.l HeartContainer_Trinexx_Player
BRL .done BRL .done
+ CMP.w #225 : BNE + + CMP.w #225 : BNE +
LDA HeartPiece_Forest_Thieves_Player LDA.l HeartPiece_Forest_Thieves_Player
BRL .done BRL .done
+ CMP.w #226 : BNE + + CMP.w #226 : BNE +
LDA HeartPiece_Lumberjack_Tree_Player LDA.l HeartPiece_Lumberjack_Tree_Player
BRL .done BRL .done
+ CMP.w #234 : BNE + + CMP.w #234 : BNE +
LDA HeartPiece_Spectacle_Cave_Player LDA.l HeartPiece_Spectacle_Cave_Player
BRL .done BRL .done
+ CMP.w #283 : BNE + + CMP.w #283 : BNE +
LDA $22 : XBA : AND.w #$0001 ; figure out where link is LDA.b LinkPosX : XBA : AND.w #$0001 ; figure out where link is
BNE ++ BNE ++
LDA HeartPiece_Circle_Bushes_Player LDA.l HeartPiece_Circle_Bushes_Player
BRL .done BRL .done
++ ++
LDA HeartPiece_Graveyard_Warp_Player LDA.l HeartPiece_Graveyard_Warp_Player
BRL .done BRL .done
+ CMP.w #294 : BNE + + CMP.w #294 : BNE +
LDA HeartPiece_Mire_Warp_Player LDA.l HeartPiece_Mire_Warp_Player
BRL .done BRL .done
+ CMP.w #295 : BNE + + CMP.w #295 : BNE +
LDA HeartPiece_Smith_Pegs_Player LDA.l HeartPiece_Smith_Pegs_Player
BRL .done BRL .done
LDA.w #$0000 LDA.w #$0000
BRL .done BRL .done
@@ -466,50 +466,50 @@ HeartPieceGetPlayer:
.outdoors .outdoors
PHP PHP
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA $8A LDA.b OverworldIndex
CMP.w #$03 : BNE + CMP.w #$03 : BNE +
LDA $22 : CMP.w #1890 : !BLT ++ LDA.b LinkPosX : CMP.w #1890 : !BLT ++
LDA HeartPiece_Spectacle_Player LDA.l HeartPiece_Spectacle_Player
BRL .done BRL .done
++ ++
LDA EtherItem_Player LDA.l EtherItem_Player
BRL .done BRL .done
+ CMP.w #$05 : BNE + + CMP.w #$05 : BNE +
LDA HeartPiece_Mountain_Warp_Player LDA.l HeartPiece_Mountain_Warp_Player
BRL .done BRL .done
+ CMP.w #$28 : BNE + + CMP.w #$28 : BNE +
LDA HeartPiece_Maze_Player LDA.l HeartPiece_Maze_Player
BRL .done BRL .done
+ CMP.w #$2A : BNE + + CMP.w #$2A : BNE +
LDA HauntedGroveItem_Player LDA.l HauntedGroveItem_Player
BRL .done BRL .done
+ CMP.w #$30 : BNE + + CMP.w #$30 : BNE +
LDA $22 : CMP.w #512 : !BGE ++ LDA.b LinkPosX : CMP.w #512 : !BGE ++
LDA HeartPiece_Desert_Player LDA.l HeartPiece_Desert_Player
BRL .done BRL .done
++ ++
LDA BombosItem_Player LDA.l BombosItem_Player
BRL .done BRL .done
+ CMP.w #$35 : BNE + + CMP.w #$35 : BNE +
LDA HeartPiece_Lake_Player LDA.l HeartPiece_Lake_Player
BRL .done BRL .done
+ CMP.w #$3B : BNE + + CMP.w #$3B : BNE +
LDA HeartPiece_Swamp_Player LDA.l HeartPiece_Swamp_Player
BRL .done BRL .done
+ CMP.w #$42 : BNE + + CMP.w #$42 : BNE +
LDA HeartPiece_Cliffside_Player LDA.l HeartPiece_Cliffside_Player
BRL .done BRL .done
+ CMP.w #$4A : BNE + + CMP.w #$4A : BNE +
LDA HeartPiece_Cliffside_Player LDA.l HeartPiece_Cliffside_Player
BRL .done BRL .done
+ CMP.w #$5B : BNE + + CMP.w #$5B : BNE +
LDA HeartPiece_Pyramid_Player LDA.l HeartPiece_Pyramid_Player
BRL .done BRL .done
+ CMP.w #$68 : BNE + + CMP.w #$68 : BNE +
LDA HeartPiece_Digging_Player LDA.l HeartPiece_Digging_Player
BRL .done BRL .done
+ CMP.w #$81 : BNE + + CMP.w #$81 : BNE +
LDA HeartPiece_Zora_Player LDA.l HeartPiece_Zora_Player
BRL .done BRL .done
+ +
LDA.w #$0000 LDA.w #$0000

209
hooks.asm
View File

@@ -66,8 +66,8 @@ org $00FFEA : dw NMIBounce
org $00FFEE : dw IRQBounce org $00FFEE : dw IRQBounce
org $8098AB org $8098AB
NMIBounce: JML.l $8080C9 NMIBounce: JML Interrupt_NMI
IRQBounce: JML.l $8082D8 IRQBounce: JML Interrupt_IRQ
warnpc $8098C0 warnpc $8098C0
;================================================================================ ;================================================================================
@@ -221,7 +221,7 @@ LDA.w #$2000 ; Load file select screen graphics to VRAM word addres 0x2000 inste
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $80E568 : LDX.w #$0EFF ; Load full decompressed character set into VRAM org $80E568 : LDX.w #$0EFF ; Load full decompressed character set into VRAM
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $80E581 : JSL.l LoadFileSelectVanillaItems : BRA + : NOP #13 : + org $80E581 : JSL LoadFileSelectVanillaItems : BRA + : NOP #13 : +
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $80833A ; <- 0033A - Bank00.asm : 481 (LDA.w #$007F) org $80833A ; <- 0033A - Bank00.asm : 481 (LDA.w #$007F)
LDA.w #$0180 ; change which character is used as the blank character for the select screen LDA.w #$0180 ; change which character is used as the blank character for the select screen
@@ -245,7 +245,7 @@ db $3D
org $8CD6BD ; <- Y position table for Death Counts org $8CD6BD ; <- Y position table for Death Counts
db $51 db $51
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $8CD55F : JSL.l CheckHeartPaletteFileSelect : NOP #2 org $8CD55F : JSL CheckHeartPaletteFileSelect : NOP #2
;================================================================================ ;================================================================================
; Name Entry Screen ; Name Entry Screen
@@ -447,7 +447,7 @@ AllowStartFromExitReturn:
org $9BC2A7 ; <- DC2A7 - Bank1B.asm : 1143 (Overworld_CreatePyramidHole:) org $9BC2A7 ; <- DC2A7 - Bank1B.asm : 1143 (Overworld_CreatePyramidHole:)
JSL Overworld_CreatePyramidHoleModified : RTL JSL Overworld_CreatePyramidHoleModified : RTL
C9DE_LONG: C9DE_LONG:
JSR.w $1BC9DE : RTL ; surprisingly same address as US JSR Overworld_AlterTileHardcore : RTL ; surprisingly same address as US
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $87FF5F ; <- 3ff5f - Bank0E.asm : 5252 (LDA.w #$0E3F : STA $23BC) org $87FF5F ; <- 3ff5f - Bank0E.asm : 5252 (LDA.w #$0E3F : STA $23BC)
JSL Draw_PyramidOverlay : RTS JSL Draw_PyramidOverlay : RTS
@@ -469,7 +469,7 @@ org $84E7AE ; <- bank0E.asm : 4230 (LDA $7EF287 : AND.w #$0020)
JSL TurtleRockPegSolved JSL TurtleRockPegSolved
org $84E7B9 ; <- bank0E.asm : 4237 (LDX $04C8) org $84E7B9 ; <- bank0E.asm : 4237 (LDX $04C8)
JMP.w TurtleRockTrollPegs JMP TurtleRockTrollPegs
TurtleRockPegCheck: TurtleRockPegCheck:
org $84E7C9 org $84E7C9
@@ -488,11 +488,11 @@ JSL GetRandomInt
LDA.l PegProbability : BEQ .vanilla : CMP.l $7E0FA1 LDA.l PegProbability : BEQ .vanilla : CMP.l $7E0FA1
REP #$20 : !BGE .succeed REP #$20 : !BGE .succeed
.fail .fail
JMP.w TurtleRockPegFail JMP TurtleRockPegFail
.succeed .succeed
JMP.w TurtleRockPegSuccess JMP TurtleRockPegSuccess
.vanilla .vanilla
REP #$20 : JMP.w TurtleRockPegCheck REP #$20 : JMP TurtleRockPegCheck
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $9BBD05 ; <- bank1B.asm : 261 (TYA : STA $00) ; hook starts at the STA org $9BBD05 ; <- bank1B.asm : 261 (TYA : STA $00) ; hook starts at the STA
JML PreventEnterOnBonk : NOP JML PreventEnterOnBonk : NOP
@@ -504,23 +504,21 @@ PreventEnterOnBonk_BRANCH_IX:
;================================================================================ ;================================================================================
; Crystals Mode ; Crystals Mode
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $899B6D
AncillaAdd_GTCutscene_Exit:
org $899B7F ; <- ancilla_init.asm : 4136 (LDA $7EF37A : AND.b #$7F : CMP.b #$7F) org $899B7F ; <- ancilla_init.asm : 4136 (LDA $7EF37A : AND.b #$7F : CMP.b #$7F)
JSL CheckTowerOpen : BCC AncillaAdd_GTCutscene_Exit JSL CheckTowerOpen : BCC AncillaAdd_GTCutscene-2
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $88CE0C ; <- 44E0C - ancilla_break_tower_seal.asm : 168 (BEQ #$03 : JSR GTCutscene_SparkleALot : LDX.b #$06) org $88CE0C ; <- 44E0C - ancilla_break_tower_seal.asm : 168 (BEQ #$03 : JSR GTCutscene_SparkleALot : LDX.b #$06)
JML.l GTCutscene_AnimateCrystals_Prep : NOP JML GTCutscene_AnimateCrystals_Prep : NOP
LDX.b #$05 LDX.b #$05
GTCutscene_AnimateCrystals_NextCrystal: GTCutscene_AnimateCrystals_NextCrystal:
JML.l GTCutscene_ConditionalAnimateCrystals JML GTCutscene_ConditionalAnimateCrystals
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $88CE93 org $88CE93
GTCutscene_DrawSingleCrystal: GTCutscene_DrawSingleCrystal:
JML.l GTCutscene_ConditionalDrawSingleCrystal JML GTCutscene_ConditionalDrawSingleCrystal
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $88CF19 ; <- 44F19 - ancilla_break_tower_seal.asm : 336 (TXA : AND.b #$07 : TAX) org $88CF19 ; <- 44F19 - ancilla_break_tower_seal.asm : 336 (TXA : AND.b #$07 : TAX)
JSL.l GTCutscene_ActivateSparkle_SelectCrystal JSL GTCutscene_ActivateSparkle_SelectCrystal
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $88CFC9 ; <- 44FC9 - ancilla_break_tower_seal.asm : 414 (RTS) org $88CFC9 ; <- 44FC9 - ancilla_break_tower_seal.asm : 414 (RTS)
RTL RTL
@@ -561,7 +559,7 @@ org $86F2EA ; <- 372EA - Bank06.asm : 5791 (LDA $0E20, X : CMP.b #$D6 : BCS .no_
JSL CheckGanonHammerDamage : NOP JSL CheckGanonHammerDamage : NOP
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $858922 org $858922
JSL.l CheckPedestalPull : BCC MasterSword_InPedestal_exit JSL CheckPedestalPull : BCC MasterSword_InPedestal_exit
;================================================================================ ;================================================================================
; Stat Hooks ; Stat Hooks
@@ -826,11 +824,6 @@ db $B1, $C6, $F9, $C9, $C6, $F9 ; data insert - 2 chests, fat fairy room
org $81E97E org $81E97E
dw $0116 : db $08 dw $0116 : db $08
dw $0116 : db $25 dw $0116 : db $25
;--------------------------------------------------------------------------------
PyramidFairy_BRANCH_IOTA = $86C936
PyramidFairy_BRANCH_GAMMA = $86C948
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $9EE16E ; <- F616E - sprite_bomb_shop_entity.asm : 73 org $9EE16E ; <- F616E - sprite_bomb_shop_entity.asm : 73
NOP #8 ; fix bomb shop dialog for dwarfless big bomb NOP #8 ; fix bomb shop dialog for dwarfless big bomb
@@ -934,7 +927,7 @@ org $898769 ; 48769 - ancilla_init.asm:1005 (LDA .item_graphics_indices, Y)
LDA.w ItemReceipts_graphics, Y LDA.w ItemReceipts_graphics, Y
org $898811 org $898811
JSL.l SetItemRiseTimer JSL SetItemRiseTimer
org $89884D ; 4884D - ancilla_init.asm:1137 (LDA $836C, Y) org $89884D ; 4884D - ancilla_init.asm:1137 (LDA $836C, Y)
LDA.w ItemReceipts_offset_y, Y LDA.w ItemReceipts_offset_y, Y
@@ -953,7 +946,7 @@ org $88C6C8 ; 446C8 - ancilla_receive_item.asm:538 (LDA AddReceiveItem.propertie
JSL CheckReceivedItemPropertiesBeforeLoad JSL CheckReceivedItemPropertiesBeforeLoad
org $88C6DE ; 446DE - ancilla_receive_item.asm:550 (LDA .wide_item_flag, X) org $88C6DE ; 446DE - ancilla_receive_item.asm:550 (LDA .wide_item_flag, X)
JSL.l ItemReceiptWidthCheck JSL ItemReceiptWidthCheck
org $88C6F9 ; 446F9 - ancilla_receive_item.asm:570 (LDA AddReceiveItem.properties, X) org $88C6F9 ; 446F9 - ancilla_receive_item.asm:570 (LDA AddReceiveItem.properties, X)
JSL CheckReceivedItemPropertiesBeforeLoad JSL CheckReceivedItemPropertiesBeforeLoad
@@ -1022,29 +1015,29 @@ Overworld_Entrance_BRANCH_EPSILON: ; go here to lock doors
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Dungeon Drops ; Dungeon Drops
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $81C50D : JSL.l CheckDungeonWorld org $81C50D : JSL CheckDungeonWorld
org $81C517 : JSL.l CheckDungeonCompletion org $81C517 : JSL CheckDungeonCompletion
org $81C523 : JSL.l CheckDungeonCompletion org $81C523 : JSL CheckDungeonCompletion
org $81C710 : JSL.l CheckSpawnPrize org $81C710 : JSL CheckSpawnPrize
BCS RoomTag_GetHeartForPrize_spawn_prize : BRA RoomTag_GetHeartForPrize_delete_tag BCS RoomTag_GetHeartForPrize_spawn_prize : BRA RoomTag_GetHeartForPrize_delete_tag
org $81C742 : JSL.l SpawnDungeonPrize org $81C742 : JSL SpawnDungeonPrize
org $8799EA : JML.l SetItemPose org $8799EA : JML SetItemPose
org $88C415 : JSL.l PendantMusicCheck org $88C415 : JSL PendantMusicCheck
BCS Ancilla22_ItemReceipt_is_pendant : BRA Ancilla22_ItemReceipt_wait_for_music BCS Ancilla22_ItemReceipt_is_pendant : BRA Ancilla22_ItemReceipt_wait_for_music
;org $88C452 : JSL.l MaybeKeepLootID : NOP #2 DR overwrote hook see RetrieveBunnyState ;org $88C452 : JSL MaybeKeepLootID : NOP #2 DR overwrote hook see RetrieveBunnyState
org $88C61D : JSL.l AnimatePrizeCutscene : NOP org $88C61D : JSL AnimatePrizeCutscene : NOP
org $88C622 : BCC ItemReceipt_Animate_continue org $88C622 : BCC ItemReceipt_Animate_continue
org $88C6BA : JSL.l CheckPoseItemCoordinates org $88C6BA : JSL CheckPoseItemCoordinates
org $88CAD6 : JSL.l HandleDropSFX : NOP #2 org $88CAD6 : JSL HandleDropSFX : NOP #2
org $88CADC : BCC Ancilla29_MilestoneItemReceipt_skip_crystal_sfx org $88CADC : BCC Ancilla29_MilestoneItemReceipt_skip_crystal_sfx
org $88CAE9 : JSL.l PrepPrizeTile org $88CAE9 : JSL PrepPrizeTile
org $88CB23 : JSL.l PrizeDropSparkle : BCC Ancilla29_MilestoneItemReceipt_no_sparkle : NOP #2 org $88CB23 : JSL PrizeDropSparkle : BCC Ancilla29_MilestoneItemReceipt_no_sparkle : NOP #2
org $88CB97 : JSL.l PrepPrizeOAMCoordinates : BRA + : NOP #$12 : + org $88CB97 : JSL PrepPrizeOAMCoordinates : BRA + : NOP #$12 : +
org $88CBFF : JSL.l PrepPrizeShadow org $88CBFF : JSL PrepPrizeShadow
org $88CC6C : JSL.l HandleCrystalsField org $88CC6C : JSL HandleCrystalsField
org $88CCA6 : JSL.l PrepPrizeOAMCoordinates : NOP org $88CCA6 : JSL PrepPrizeOAMCoordinates : NOP
org $8985FA : JSL.l SetCutsceneFlag : NOP #3 : BCC AncillaAdd_ItemReceipt_not_crystal org $8985FA : JSL SetCutsceneFlag : NOP #3 : BCC AddReceivedItem_notCrystal
org $8988B2 : JSL.l SetPrizeCoords : NOP org $8988B2 : JSL SetPrizeCoords : NOP
;================================================================================ ;================================================================================
@@ -1114,9 +1107,9 @@ JSL ItemCheck_Library
org $8DDF38 ; <- 6DF38 - equipment.asm : 480 org $8DDF38 ; <- 6DF38 - equipment.asm : 480
JSL ProcessMenuButtons JSL ProcessMenuButtons
BCC _equipment_497 BCC _equipment_497
JMP.w _equipment_544 JMP _equipment_544
ResetEquipment: ResetEquipment:
JSR.w RestoreNormalMenu ; (short) JSR RestoreNormalMenu ; (short)
RTL RTL
NOP #3 NOP #3
@@ -1127,9 +1120,9 @@ org $8DDF88 ; <- 6DF88 - equipment.asm : 544
_equipment_544: _equipment_544:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $8DEB98 ; <- 6EB98 - equipment.asm : 1803 org $8DEB98 ; <- 6EB98 - equipment.asm : 1803
LDA.w #$3C60 : STA $FFBE, Y LDA.w #$3C60 : STA.w $FFBE, Y
ORA.w #$8000 : STA $007E, Y ORA.w #$8000 : STA.w $007E, Y
ORA.w #$4000 : STA $0084, Y ORA.w #$4000 : STA.w $0084, Y
JSL AddYMarker : NOP #2 JSL AddYMarker : NOP #2
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $8DF789+6 ; <- 6F789+6 (not in disassembly) - red bottle hud tile, lower right org $8DF789+6 ; <- 6F789+6 (not in disassembly) - red bottle hud tile, lower right
@@ -1171,21 +1164,21 @@ JSL CheckCloseItemMenu
org $8DEE70 ; <- 6EE70 - equipment.asm : 2137 org $8DEE70 ; <- 6EE70 - equipment.asm : 2137
JSL PrepItemScreenBigKey : NOP JSL PrepItemScreenBigKey : NOP
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $0DDEA5 ; LDA.b Joy1A_New : BEQ .wait_for_button org $8DDEA5 ; LDA.b Joy1A_New : BEQ .wait_for_button
JSL.l HandleEmptyMenu : RTS JSL HandleEmptyMenu : RTS
org $0DEB3C ; LDA.w ItemCursor : AND.w #$00FF org $8DEB3C ; LDA.w ItemCursor : AND.w #$00FF
JML.l MaybeDrawEquippedItem : NOP #2 JML MaybeDrawEquippedItem : NOP #2
org $0DE363 ; LDA.b #$04 : STA.w SubModuleInterface org $8DE363 ; LDA.b #$04 : STA.w SubModuleInterface
JSL.l RestoreMenu_SetSubModule : NOP JSL RestoreMenu_SetSubModule : NOP
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $88D395 ; <- 45395 - ancilla_bird_travel_intro.asm : 253 org $88D395 ; <- 45395 - ancilla_bird_travel_intro.asm : 253
JSL.l UpgradeFlute : NOP #2 JSL UpgradeFlute : NOP #2
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $87A408 ; LDA.l $7EF34C org $87A408 ; LDA.l $7EF34C
JSL.l FluteCallForDuck JSL FluteCallForDuck
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $85E4D7 ; <- 2E4D7 - sprite_witch.asm : 213 org $85E4D7 ; <- 2E4D7 - sprite_witch.asm : 213
JSL.l RemoveMushroom : NOP #2 JSL RemoveMushroom : NOP #2
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $85F55F ; <- 2F55F - sprite_potion_shop.asm : 59 org $85F55F ; <- 2F55F - sprite_potion_shop.asm : 59
JSL LoadPowder JSL LoadPowder
@@ -1206,33 +1199,20 @@ JSL DrawMushroom
org $85EE97 ; <- 2EE97 - sprite_mushroom.asm : 81 org $85EE97 ; <- 2EE97 - sprite_mushroom.asm : 81
NOP #14 NOP #14
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $86C09C ; <- - bank06.asm : 1885 (JSL SpritePrep_PotionShopLong) org $86C09C ; <- - bank06.asm : 1885 (JSL SpritePrep_MagicShopAssistant)
JSL SpritePrep_ShopKeeper_PotionShop JSL SpritePrep_ShopKeeper_PotionShop
org $85F521
SpritePrep_PotionShopLong:
org $85F539
SpawnMagicPowder:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $85F568 ; <- 2F568 - sprite_potion_shop.asm org $85F568 ; <- 2F568 - sprite_potion_shop.asm
LDA #$b0 : STA $0D00, Y : LDA #$90 : STA $0D10, Y ; manually set position of powder item LDA.b #$B0 : STA.w SpritePosYLow, Y : LDA.b #$90 : STA.w SpritePosXLow, Y ; manually set position of powder item
LDA #$21 : STA $0D20, Y : LDA #$12 : STA $0D30, Y LDA.b #$21 : STA.w SpritePosYHigh, Y : LDA.b #$12 : STA.w SpritePosXHigh, Y
JMP $F61D JMP MagicShopAssistant_SpawnObject
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $85F633 ; <- 2F633 - sprite_potion_shop.asm org $85F633 ; <- 2F633 - sprite_potion_shop.asm
JSL Sprite_ShopKeeperPotion : RTS : NOP ;; TODO: i don't remember prices being set on top of the player JSL Sprite_ShopKeeperPotion : RTS : NOP ;; TODO: i don't remember prices being set on top of the player
PotionShopkeeperJumpTable: PotionShopkeeperJumpTable:
org $85F893 ; <- witch behavior here
Sprite_WitchAssistant:
org $85F644 ; <- powder behavior here
Sprite_MagicPowderItem:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $85EB1D ; <- 2EB1D - sprite_bottle_vendor.asm : 158 org $85EB1D ; <- 2EB1D - sprite_bottle_vendor.asm : 158
JSL.l Multiworld_BottleVendor_GiveBottle JSL Multiworld_BottleVendor_GiveBottle
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $87A36F ; <- 3A36F - Bank07.asm : 5679 org $87A36F ; <- 3A36F - Bank07.asm : 5679
NOP #5 NOP #5
@@ -1435,7 +1415,7 @@ JSL RNG_Enemy_Drops
org $8DFDCB org $8DFDCB
JSL UpdateHearts JSL UpdateHearts
RTS RTS
org $8DF191 : JSL.l ColorAnimatedHearts : BRA + : NOP #7 : + org $8DF191 : JSL ColorAnimatedHearts : BRA + : NOP #7 : +
org $8DFC4C ; <- 6FC4C - headsup_display.asm : 836 (LDA $7EF36E : AND.w #$00FF : ADD.w #$0007 : AND.w #$FFF8 : TAX) org $8DFC4C ; <- 6FC4C - headsup_display.asm : 836 (LDA $7EF36E : AND.w #$00FF : ADD.w #$0007 : AND.w #$FFF8 : TAX)
JML OnDrawHud : NOP #197 ; why? it's not hurting anyone lol JML OnDrawHud : NOP #197 ; why? it's not hurting anyone lol
@@ -1462,30 +1442,30 @@ MVN $A17E
org $8DFB1F : JSL CheckHUDSilverArrows org $8DFB1F : JSL CheckHUDSilverArrows
org $8DFB29 : BRA UpdateHUDBuffer_update_item_check_arrows org $8DFB29 : BRA UpdateHUDBuffer_update_item_check_arrows
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $8DF1AB : JSR.w RebuildHUD_update org $8DF1AB : JSR RebuildHUD_update
org $8DDFC8 : JSR.w RebuildHUD_update org $8DDFC8 : JSR RebuildHUD_update
org $8DDB85 : JSR.w RefreshIcon_UpdateHUD : BRA + : NOP : + org $8DDB85 : JSR RefreshIcon_UpdateHUD : BRA + : NOP : +
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $87A205 : JSL.l RebuildHUD_update_long org $87A205 : JSL RebuildHUD_update_long
org $87A1A4 : JSL.l RebuildHUD_update_long org $87A1A4 : JSL RebuildHUD_update_long
org $87A1CF : JSL.l RebuildHUD_update_long org $87A1CF : JSL RebuildHUD_update_long
org $87A21D : JSL.l RebuildHUD_update_long org $87A21D : JSL RebuildHUD_update_long
org $87A235 : JSL.l RebuildHUD_update_long org $87A235 : JSL RebuildHUD_update_long
org $8AEF62 : JSL.l RebuildHUD_update_long org $8AEF62 : JSL RebuildHUD_update_long
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $8DFFE1 org $8DFFE1
RebuildHUD_update_long: RebuildHUD_update_long:
JSR.w RebuildHUD_update : RTL JSR RebuildHUD_update : RTL
RefreshIcon_UpdateHUD: RefreshIcon_UpdateHUD:
INC.w UpdateHUDFlag INC.w UpdateHUDFlag
JSR.w RebuildHUD JSR RebuildHUD
JSR.w UpdateEquippedItem JSR UpdateEquippedItem
RTS RTS
warnpc $8E8000 warnpc $8E8000
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $8DEDE8 org $8DEDE8
JSL.l DrawHeartPiecesMenu : BRA DrawEquipment_in_a_dungeon JSL DrawHeartPiecesMenu : BRA DrawEquipment_in_a_dungeon
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;================================================================================ ;================================================================================
@@ -1655,14 +1635,11 @@ JSL HUDRebuildIndoorHole
;================================================================================ ;================================================================================
; Skull Woods back entrance fire fix ; Skull Woods back entrance fire fix
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $099C42 ; ancilla_init.asm:4264 - (LDA $8A : AND.b #$40 : BEQ AddDoorDebris.spawn_failed) org $899C42 ; ancilla_init.asm:4264 - (LDA $8A : AND.b #$40 : BEQ AddDoorDebris.spawn_failed)
JML.l Multiworld_ConsumingFire_TransmuteToSkullWoodsFire JML Multiworld_ConsumingFire_TransmuteToSkullWoodsFire
NOP #2 NOP #2
ConsumingFire_TransmuteToSkullWoodsFire_continue: ConsumingFire_TransmuteToSkullWoodsFire_continue:
org $099C39
AddDoorDebris_spawn_failed:
;================================================================================ ;================================================================================
; Pendant / Crystal Fixes ; Pendant / Crystal Fixes
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -1894,7 +1871,7 @@ Ancilla_ReceiveItem_optimus:
JML PostItemAnimation : NOP #2 JML PostItemAnimation : NOP #2
org $88C548 ; <- 44548 - ancilla_recieve_item.asm:297 (CMP.b #$28 : BNE .dontGiveRupees) org $88C548 ; <- 44548 - ancilla_recieve_item.asm:297 (CMP.b #$28 : BNE .dontGiveRupees)
JML.l Multiworld_Ancilla_ReceiveItem_stillInMotion JML Multiworld_Ancilla_ReceiveItem_stillInMotion
Ancilla_ReceiveItem_stillInMotion_moveon: Ancilla_ReceiveItem_stillInMotion_moveon:
org $88C560 ; <- 44548 - ancilla_recieve_item.asm:307 org $88C560 ; <- 44548 - ancilla_recieve_item.asm:307
@@ -1913,7 +1890,7 @@ org $868F16 ; <- 30F16
JSL ItemCheck_ZoraKing JSL ItemCheck_ZoraKing
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $859ACA ; <- 29ACA org $859ACA ; <- 29ACA
JSL $9DE1AA ; Sprite_SpawnFlippersItem JSL Zora_RegurgitateFlippers
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $9DE1E4 ; <- EE1E4 - sprite_great_catfish.asm : 489 org $9DE1E4 ; <- EE1E4 - sprite_great_catfish.asm : 489
JSL LoadZoraKingItemGFX : NOP #2 JSL LoadZoraKingItemGFX : NOP #2
@@ -1937,7 +1914,7 @@ org $8690BD ; <- 310BD - SpritePrep_FluteBoy : 2202
JSL ItemCheck_TreeKid2 JSL ItemCheck_TreeKid2
org $86AF9B ; <- 32F9B - FluteBoy_Chillin : 73 : LDA $7EF34C : CMP.b #$02 : BCS .player_has_flute org $86AF9B ; <- 32F9B - FluteBoy_Chillin : 73 : LDA $7EF34C : CMP.b #$02 : BCS .player_has_flute
LDA HasGroveItem : AND.b #$01 LDA.l HasGroveItem : AND.b #$01
db $D0 ; BNE db $D0 ; BNE
org $86B062 ; <- 33062 - FluteAardvark_InitialStateFromFluteState : 225 : LDA $7EF34C : AND.b #$03 : !BGE #$05 org $86B062 ; <- 33062 - FluteAardvark_InitialStateFromFluteState : 225 : LDA $7EF34C : AND.b #$03 : !BGE #$05
@@ -2070,7 +2047,7 @@ dw FakeFlipperProtection
org $82FFC7 org $82FFC7
FakeFlipperProtection: FakeFlipperProtection:
JSR.w $029485 JSR RecoverPositionAfterDrowning
JSL protectff JSL protectff
RTS RTS
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -2130,7 +2107,7 @@ JSL BeepLogic : NOP #6
; Item Downgrade Fix ; Item Downgrade Fix
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $89865E ; <- 4865E org $89865E ; <- 4865E
JSL $9BEE1B ; fix something i wrote over i shouldn't have JSL Palettes_Load_LinkGloves ; fix something i wrote over i shouldn't have
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $898638 ; <- 48638 - ancilla_init.asm:737 - LDA .item_values, Y : BMI .dontWrite (BMI) org $898638 ; <- 48638 - ancilla_init.asm:737 - LDA .item_values, Y : BMI .dontWrite (BMI)
JSL ItemDowngradeFix JSL ItemDowngradeFix
@@ -2146,7 +2123,7 @@ org $9AFC55 ; <- D7C55 - sprite_movable_mantle.asm:34 (LDA $7EF34A : BEQ .return
NOP #6 ; remove check NOP #6 ; remove check
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $868841 ; <- 30841 - sprite_prep.asm:269 (LDA $0D00, X : ADD.b #$03 : STA $0D00, X) org $868841 ; <- 30841 - sprite_prep.asm:269 (LDA $0D00, X : ADD.b #$03 : STA $0D00, X)
JSL.l Mantle_CorrectPosition : NOP #2 JSL Mantle_CorrectPosition : NOP #2
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $8297FD ; <- bank02 : Module07_19_MirrorFade (STZ.b $11 : STZ.b $14) org $8297FD ; <- bank02 : Module07_19_MirrorFade (STZ.b $11 : STZ.b $14)
JSL MirrorScrollSpawnZelda JSL MirrorScrollSpawnZelda
@@ -2312,7 +2289,7 @@ Overworld_Entrance_BRANCH_RHO: ; branch here to continue into door
;================================================================================ ;================================================================================
; Paradox Cave Shopkeeper Fixes ; Paradox Cave Shopkeeper Fixes
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $808C19 ; Bank00.asm 1633 (LDA.b #$01 : STA MDMAEN) org $808C19 ; Bank00.asm 1633 (LDA.b #$01 : STA DMAENABLE)
JSL ParadoxCaveGfxFix : NOP JSL ParadoxCaveGfxFix : NOP
;================================================================================ ;================================================================================
@@ -2347,7 +2324,7 @@ JSL LoadActualGearPalettesWithGloves : RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Bunny Palette/Overworld Map Bugfix ; Bunny Palette/Overworld Map Bugfix
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $82FDF0 ; <- 017df0 - bank0E (LDA [$00] : STA $7EC300, X : STA $7EC500, X) org $82FDF0 ; <- 017df0 - bank0E (LDA [Scrap00] : STA $7EC300, X : STA $7EC500, X)
JSL LoadGearPalette_safe_for_bunny : RTS JSL LoadGearPalette_safe_for_bunny : RTS
;================================================================================ ;================================================================================
@@ -2458,18 +2435,18 @@ dw 37, 11 : db $FB, $40, $00, $00
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $87839E ; bunny BAGE check org $87839E ; bunny BAGE check
BunnyRead: BunnyRead:
JSR.w $07B5A9 ; check A button JSR Link_CheckNewAPress
BCC .noA BCC .noA
JSR.w CheckIfReading JSR CheckIfReading
BNE .noread BNE .noread
JSR.w $07B4DB JSR Link_PerformRead
NOP NOP
.noread .noread
.noA .noA
org $87FFF4 org $87FFF4
CheckIfReading: CheckIfReading:
JSR.w $07D36C ; check action JSR Link_HandleLiftables
LDA.b #$80 : TRB.b $3B LDA.b #$80 : TRB.b $3B
CPX.b #$04 CPX.b #$04
RTS RTS
@@ -2502,13 +2479,13 @@ org $8EE828 : JSL PreparePointer : LDA.b [CreditsPtr],Y : NOP
org $8EE83F : LDA.b [CreditsPtr],Y : NOP org $8EE83F : LDA.b [CreditsPtr],Y : NOP
org $8EE853 org $8EE853
LDA.b [CreditsPtr],Y : NOP : AND.w #$00FF : ASL A : JSL CheckFontTable LDA.b [CreditsPtr],Y : NOP : AND.w #$00FF : ASL A : JSL CheckFontTable
org $8EE86D : JSL RenderCreditsStatCounter : JMP.w AfterDeathCounterOutput org $8EE86D : JSL RenderCreditsStatCounter : JMP AfterDeathCounterOutput
org $82857D : JSL LoadOverworldCreditsTiles org $82857D : JSL LoadOverworldCreditsTiles
;================================================================================ ;================================================================================
; Fast credits ; Fast credits
org $8EC2B1 : JSL FlagFastCredits org $8EC2B1 : JSL FlagFastCredits
org $82A096 : JSL DumbFlagForMSU org $82A096 : JSL DumbFlagForMSU
org $8EC3AF : JSL FastCreditsScrollOW : JMP.w $0EC3C7 org $8EC3AF : JSL FastCreditsScrollOW : JMP Credits_ScrollScene_Overworld_no_scroll
org $8EC41F : JSL FastCreditsCutsceneUnderworldY org $8EC41F : JSL FastCreditsCutsceneUnderworldY
org $8EC42C : JSL FastCreditsCutsceneUnderworldX org $8EC42C : JSL FastCreditsCutsceneUnderworldX
org $8EC488 : JSL FastCreditsCutsceneTimer org $8EC488 : JSL FastCreditsCutsceneTimer
@@ -2573,8 +2550,8 @@ org $8EF285 : JSL RenderCharSetColorExtended_close : NOP
;================================================================================ ;================================================================================
; VRAM ; VRAM
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $008BE5 ; hijack stripes org $808BE5 ; hijack stripes
JSL.l TransferVRAMStripes JSL TransferVRAMStripes
;=================================================================================================== ;===================================================================================================
; Fix fairy palette on file select ; Fix fairy palette on file select
@@ -2617,14 +2594,14 @@ org $899BBE : JSL TransferItemReceiptToBuffer_using_GraphicsID
;=================================================================================================== ;===================================================================================================
org $1D8E75 : RTS org $1D8E75 : RTS
org $1DB5D8 : JML.l $9DB5DF org $1DB5D8 : JML $9DB5DF
org $1DB605 : JML.l $9DB60C org $1DB605 : JML $9DB60C
org $1DBBF1 : JML.l $9DBBF8 org $1DBBF1 : JML $9DBBF8
org $1DBC19 : JML.l $9DBC20 org $1DBC19 : JML $9DBC20
org $1DC072 : JMP.w $9DC079 org $1DC072 : JMP.w $9DC079
org $1DC0A5 : JMP.w $9DC0AC org $1DC0A5 : JMP.w $9DC0AC
org $1DED3B : JML.l $9DED42 org $1DED3B : JML $9DED42
org $1DED7A : JML.l $9DED81 org $1DED7A : JML $9DED81
org $05B55E : JMP ++ : ++ org $05B55E : JMP ++ : ++
org $05B580 : JMP ++ : ++ org $05B580 : JMP ++ : ++

View File

@@ -17,7 +17,7 @@ PHP
LDX.b #$7E : STX.w A1B4 LDX.b #$7E : STX.w A1B4
LDA.w #$0040 : STA.w DAS4L LDA.w #$0040 : STA.w DAS4L
LDA.w #$1801 : STA.w DMAP4 LDA.w #$1801 : STA.w DMAP4
LDX.b #$10 : STX.w MDMAEN LDX.b #$10 : STX.w DMAENABLE
LDX.b #$0F : STX.w INIDISP LDX.b #$0F : STX.w INIDISP
PLP PLP
@@ -36,7 +36,7 @@ PHP
LDA.w #$0040 : STA.w DAS4L LDA.w #$0040 : STA.w DAS4L
LDA.w #$1801 : STA.w DMAP4 LDA.w #$1801 : STA.w DMAP4
LDX.b #$10 : STX.w MDMAEN LDX.b #$10 : STX.w DMAENABLE
LDX.b #$0F : STX.w INIDISP LDX.b #$0F : STX.w INIDISP
PLP PLP

View File

@@ -1,6 +1,6 @@
ShouldOverrideFileLoad: ShouldOverrideFileLoad:
; Y = Graphics file being loaded ; Y = Graphics file being loaded
CPY #$0A ; 0A = Ice/Mire floor file CPY.b #$0A ; 0A = Ice/Mire floor file
BNE .no BNE .no
LDA.w DungeonID ; Dungeon number LDA.w DungeonID ; Dungeon number
@@ -33,14 +33,14 @@ BgGraphicsLoading:
LDX.b #64*2 ; Tiles to load * 2 LDX.b #64*2 ; Tiles to load * 2
- -
; Unrolled loop to upload half a tile ; Unrolled loop to upload half a tile
LDA.b [$00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00 LDA.b [Scrap00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [$00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00 LDA.b [Scrap00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [$00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00 LDA.b [Scrap00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [$00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00 LDA.b [Scrap00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [$00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00 LDA.b [Scrap00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [$00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00 LDA.b [Scrap00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [$00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00 LDA.b [Scrap00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
LDA.b [$00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00 LDA.b [Scrap00] : STA.w VMDATAL : INC.b Scrap00 : INC.b Scrap00
DEX DEX
BNE - BNE -

View File

@@ -71,7 +71,7 @@ Init_PostRAMClear:
JSL DecompressAllItemGraphics JSL DecompressAllItemGraphics
JSR InitDungeonCounts JSR InitDungeonCounts
JML $80D463 ; The original target of the jump table that we hijacked JML Tagalong_LoadGfx ; The original target of the jump table that we hijacked
;=================================================================================================== ;===================================================================================================
InitDungeonCounts: InitDungeonCounts:
@@ -93,7 +93,7 @@ InitDungeonCounts:
PHA : PLB PHA : PLB
REP #$30 REP #$30
LDA.l TotalItemCount LDA.l TotalItemCount
JSL.l HUDHex4Digit_Long JSL HUDHex4Digit_Long
SEP #$20 SEP #$20
LDA.b Scrap04 : TAX : STX.w TotalItemCountTiles+$00 LDA.b Scrap04 : TAX : STX.w TotalItemCountTiles+$00
LDA.b Scrap05 : TAX : STX.w TotalItemCountTiles+$02 LDA.b Scrap05 : TAX : STX.w TotalItemCountTiles+$02

View File

@@ -12,9 +12,9 @@ ProcessMenuButtons:
.sel_unheld .sel_unheld
LDA.l HudFlag : AND.b #$60 : BEQ + LDA.l HudFlag : AND.b #$60 : BEQ +
LDA.b #$00 : STA.l HudFlag LDA.b #$00 : STA.l HudFlag
JSL.l MaybePlaySelectSFX JSL MaybePlaySelectSFX
+ +
JSL.l ResetEquipment JSL ResetEquipment
+ +
.sel_held .sel_held
CLC ; no buttons CLC ; no buttons
@@ -27,8 +27,8 @@ RTL
LDA.b #$60 LDA.b #$60
.store_flag .store_flag
STA.l HudFlag STA.l HudFlag
JSL.l MaybePlaySelectSFX JSL MaybePlaySelectSFX
JSL.l ResetEquipment JSL ResetEquipment
RTL RTL
.y_pressed ; Note: used as entry point by quickswap code. Must preserve X. .y_pressed ; Note: used as entry point by quickswap code. Must preserve X.
LDA.b #$10 : STA.w MenuBlink LDA.b #$10 : STA.w MenuBlink
@@ -49,10 +49,10 @@ RTL
PLX PLX
LDA.l SilverArrowsUseRestriction : BEQ ++ LDA.l SilverArrowsUseRestriction : BEQ ++
LDA.b RoomIndex : ORA.b RoomIndex+1 : BEQ ++ ; not in ganon's room in restricted mode LDA.b RoomIndex : ORA.b RoomIndex+1 : BEQ ++ ; not in ganon's room in restricted mode
LDA.l BowEquipment : CMP.b #$03 : !BLT .errorJump : !SUB #$02 : STA.l BowEquipment LDA.l BowEquipment : CMP.b #$03 : !BLT .errorJump : !SUB.b #$02 : STA.l BowEquipment
BRA .errorJump2 BRA .errorJump2
++ ++
LDA.l BowEquipment : !SUB #$01 : EOR.b #$02 : !ADD #$01 : STA.l BowEquipment ; swap bows LDA.l BowEquipment : !SUB.b #$01 : EOR.b #$02 : !ADD.b #$01 : STA.l BowEquipment ; swap bows
LDA.b #$20 : STA.w SFX3 ; menu select sound LDA.b #$20 : STA.w SFX3 ; menu select sound
JMP .captured JMP .captured
+ BRA + + BRA +
@@ -85,7 +85,7 @@ RTL
LDA.b #$20 : STA.w SFX3 ; menu select sound LDA.b #$20 : STA.w SFX3 ; menu select sound
BRA .captured BRA .captured
+ +
CMP.b #$10 : BNE .error : JSL.l ProcessBottleMenu : BRA .captured : + CMP.b #$10 : BNE .error : JSL ProcessBottleMenu : BRA .captured : +
CLC CLC
RTL RTL
.midShovel .midShovel
@@ -153,14 +153,14 @@ AddInventory:
TYA : AND.w #$00FF : ASL : TAX TYA : AND.w #$00FF : ASL : TAX
SEP #$20 SEP #$20
LDA.w InventoryTable_properties,X : BIT.b #$01 : BEQ .done LDA.w InventoryTable_properties,X : BIT.b #$01 : BEQ .done
JSR.w ShopCheck : BCS .done JSR ShopCheck : BCS .done
.countDungeonChecks .countDungeonChecks
JSR.w DungeonIncrement : BCS .done JSR DungeonIncrement : BCS .done
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .totalCount LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .totalCount
JSR.w IncrementByOne JSR IncrementByOne
JSR.w StampItem JSR StampItem
SEP #$20 SEP #$20
JSR.w IncrementYAItems JSR IncrementYAItems
.totalCount .totalCount
LDA.l !MULTIWORLD_RECEIVING_ITEM : BNE .done LDA.l !MULTIWORLD_RECEIVING_ITEM : BNE .done
REP #$30 REP #$30
@@ -197,11 +197,11 @@ ShopCheck:
CMP.w #284 : BEQ .nocount ; bomb shop CMP.w #284 : BEQ .nocount ; bomb shop
CMP.w #265 : BEQ .nocount ; potion shop - powder is flagged as "ShopEnableCount" in CollectPowder CMP.w #265 : BEQ .nocount ; potion shop - powder is flagged as "ShopEnableCount" in CollectPowder
; these room contain pots so you must check the quadrant as well for pottery lottery ; these room contain pots so you must check the quadrant as well for pottery lottery
CMP.w #287 : BNE + : LDA.b $A9 : CMP.w #$0201 : BEQ .nocount ; kakariko shop CMP.w #287 : BNE + : LDA.b LinkQuadrantH : CMP.w #$0201 : BEQ .nocount ; kakariko shop
LDA.b RoomIndex LDA.b RoomIndex
+ CMP.w #255 : BNE + : LDA.b $A9 : BEQ .nocount ; light world death mountain shop + CMP.w #255 : BNE + : LDA.b LinkQuadrantH : BEQ .nocount ; light world death mountain shop
LDA.b RoomIndex LDA.b RoomIndex
+ CMP.w #276 : BNE + : LDA.b $A9 : CMP.w #$0200 : BEQ .nocount ; waterfall fairy + CMP.w #276 : BNE + : LDA.b LinkQuadrantH : CMP.w #$0200 : BEQ .nocount ; waterfall fairy
LDA.b RoomIndex LDA.b RoomIndex
+ CMP.w #277 : BEQ .nocount ; upgrade fairy (shop) + CMP.w #277 : BEQ .nocount ; upgrade fairy (shop)
CMP.w #278 : BEQ .nocount ; pyramid fairy CMP.w #278 : BEQ .nocount ; pyramid fairy
@@ -220,7 +220,7 @@ DungeonIncrement:
REP #$10 REP #$10
PHX PHX
LDA.w InventoryTable_properties,X : BIT.b #$40 : BEQ + LDA.w InventoryTable_properties,X : BIT.b #$40 : BEQ +
JSL.l CountChestKeyLong JSL CountChestKeyLong
+ +
LDA.l !MULTIWORLD_RECEIVING_ITEM : BNE .done LDA.l !MULTIWORLD_RECEIVING_ITEM : BNE .done
SEP #$10 SEP #$10
@@ -269,7 +269,7 @@ IncrementYAItems:
BIT.b #$20 : BNE .bow_check BIT.b #$20 : BNE .bow_check
BIT.b #$04 : BEQ .not_y BIT.b #$04 : BEQ .not_y
.y_item .y_item
LDA.l YAItemCounter : !ADD #$08 : STA.l YAItemCounter LDA.l YAItemCounter : !ADD.b #$08 : STA.l YAItemCounter
BRA .done BRA .done
.not_y .not_y
BIT.b #$08 : BEQ .done BIT.b #$08 : BEQ .done
@@ -310,7 +310,7 @@ IncrementBossSword:
BRA .none BRA .none
+ +
ASL : TAX ASL : TAX
JMP.w (.vectors,X) JMP (.vectors,X)
.vectors .vectors
dw .none dw .none
@@ -359,7 +359,7 @@ IncrementFinalSword:
BRA IncrementBossSword_none BRA IncrementBossSword_none
+ +
ASL : TAX ASL : TAX
JMP.w (IncrementBossSword_vectors,X) JMP (IncrementBossSword_vectors,X)
.done .done
SEP #$20 SEP #$20
PLX PLX
@@ -373,9 +373,9 @@ Link_ReceiveItem_HUDRefresh:
LDA.b #$01 : STA.l BombsEquipment ; increase actual bomb count LDA.b #$01 : STA.l BombsEquipment ; increase actual bomb count
+ +
JSL.l HUD_RefreshIconLong ; thing we wrote over JSL HUD_RefreshIconLong ; thing we wrote over
INC.w UpdateHUDFlag INC.w UpdateHUDFlag
JSL.l PostItemGet JSL PostItemGet
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -388,7 +388,7 @@ HandleBombAbsorbtion:
LDA.l BombCapacity : BEQ + ; skip if we can't have bombs LDA.l BombCapacity : BEQ + ; skip if we can't have bombs
LDA.b #$04 : STA.w ItemCursor ; set selected item to bombs LDA.b #$04 : STA.w ItemCursor ; set selected item to bombs
LDA.b #$01 : STA.w CurrentYItem ; set selected item to bombs LDA.b #$01 : STA.w CurrentYItem ; set selected item to bombs
JSL.l HUD_RebuildLong JSL HUD_RebuildLong
INC.w UpdateHUDFlag INC.w UpdateHUDFlag
+ +
RTL RTL
@@ -462,6 +462,8 @@ UpgradeFlute:
LDA.l InventoryTracking : AND.b #$FC : ORA.b #$01 : STA.l InventoryTracking ; switch to the working flute LDA.l InventoryTracking : AND.b #$FC : ORA.b #$01 : STA.l InventoryTracking ; switch to the working flute
LDA.b #$03 : STA.l FluteEquipment ; upgrade primary inventory LDA.b #$03 : STA.l FluteEquipment ; upgrade primary inventory
RTL RTL
;--------------------------------------------------------------------------------
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; FluteCallForDuck: ; FluteCallForDuck:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -533,9 +535,9 @@ RTL
ClearOWKeys: ClearOWKeys:
PHA PHA
JSL.l TurtleRockEntranceFix JSL TurtleRockEntranceFix
JSL.l FakeWorldFix JSL FakeWorldFix
JSL.l FixBunnyOnExitToLightWorld JSL FixBunnyOnExitToLightWorld
LDA.l GenericKeys : BEQ + LDA.l GenericKeys : BEQ +
PLA : LDA.l CurrentGenericKeys : STA.l CurrentSmallKeys PLA : LDA.l CurrentGenericKeys : STA.l CurrentSmallKeys
RTL RTL
@@ -558,17 +560,17 @@ RTL
; LoadPowder: ; LoadPowder:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LoadPowder: LoadPowder:
PHX PHX
JSL.l Sprite_SpawnDynamically ; thing we wrote over JSL Sprite_SpawnDynamically ; thing we wrote over
LDA.l WitchItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID LDA.l WitchItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(WitchItem, SpriteItemValues) %GetPossiblyEncryptedItem(WitchItem, SpriteItemValues)
JSL.l AttemptItemSubstitution JSL AttemptItemSubstitution
JSL.l ResolveLootIDLong JSL ResolveLootIDLong
STA.w SpriteID, Y STA.w SpriteID, Y
STA.l PowderFlag STA.l PowderFlag
TYX TYX
JSL.l PrepDynamicTile_loot_resolved JSL PrepDynamicTile_loot_resolved
PLX PLX
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -591,16 +593,16 @@ RTL
DrawPowder: DrawPowder:
LDA.w ItemReceiptPose : BNE .defer ; defer if link is buying a potion LDA.w ItemReceiptPose : BNE .defer ; defer if link is buying a potion
LDA.l RedrawFlag : BEQ + LDA.l RedrawFlag : BEQ +
LDA.l WitchItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID LDA.l WitchItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA $0DA0, X ; Retrieve stored item type LDA.w $0DA0, X ; Retrieve stored item type
JSL.l PrepDynamicTile_loot_resolved JSL PrepDynamicTile_loot_resolved
LDA.b #$00 : STA.l RedrawFlag ; reset redraw flag LDA.b #$00 : STA.l RedrawFlag ; reset redraw flag
BRA .defer BRA .defer
+ +
; this fights with the shopkeep code, so had to move the powder draw there when potion shop is custom ; this fights with the shopkeep code, so had to move the powder draw there when potion shop is custom
LDA.l ShopType : CMP.b #$FF : BNE .defer LDA.l ShopType : CMP.b #$FF : BNE .defer
LDA.w SpriteID, X ; Retrieve stored item type LDA.w SpriteID, X ; Retrieve stored item type
JSL.l DrawDynamicTile JSL DrawDynamicTile
.defer .defer
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -618,12 +620,12 @@ LoadMushroom:
LDA.b LinkState : CMP.b #$14 : BEQ .skip ; skip if we're mid-mirror LDA.b LinkState : CMP.b #$14 : BEQ .skip ; skip if we're mid-mirror
LDA.b #$00 : STA.l RedrawFlag LDA.b #$00 : STA.l RedrawFlag
LDA.l MushroomItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID LDA.l MushroomItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues) %GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues)
JSL.l AttemptItemSubstitution JSL AttemptItemSubstitution
JSR.w ResolveLootID JSR ResolveLootID
STA.w SpriteID,X STA.w SpriteID,X
JSL.l PrepDynamicTile JSL PrepDynamicTile
.skip .skip
PLA PLA
@@ -636,12 +638,12 @@ RTL
DrawMushroom: DrawMushroom:
PHA : PHY PHA : PHY
LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready
JSL.l LoadMushroom_justGFX JSL LoadMushroom_justGFX
BRA .done ; don't draw on the init frame BRA .done ; don't draw on the init frame
.skipInit .skipInit
LDA.w SpriteID, X ; Retrieve stored item type LDA.w SpriteID, X ; Retrieve stored item type
JSL.l DrawDynamicTile JSL DrawDynamicTile
.done .done
PLY : PLA PLY : PLA
@@ -657,13 +659,13 @@ CollectPowder:
; if for any reason the item value is 0 reload it, just in case ; if for any reason the item value is 0 reload it, just in case
%GetPossiblyEncryptedItem(WitchItem, SpriteItemValues) : TAY %GetPossiblyEncryptedItem(WitchItem, SpriteItemValues) : TAY
+ PHA + PHA
LDA WitchItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID LDA.l WitchItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
LDA.b #$01 : STA.l ShopEnableCount LDA.b #$01 : STA.l ShopEnableCount
PLA PLA
STZ.w ItemReceiptMethod ; item from NPC STZ.w ItemReceiptMethod ; item from NPC
JSL.l Link_ReceiveItem JSL Link_ReceiveItem
PHA : LDA.b #$00 : STA.l ShopEnableCount : STA.l PowderFlag : PLA PHA : LDA.b #$00 : STA.l ShopEnableCount : STA.l PowderFlag : PLA
JSL.l ItemSet_Powder JSL ItemSet_Powder
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -810,18 +812,18 @@ RTL
; A = item id being collected ; A = item id being collected
ItemGetAlternateSFX: ItemGetAlternateSFX:
PEA.w $C567 ; SNES to RTS to in bank 08 PEA.w $C567 ; SNES to RTS to in bank 08
LDA.w $0C5E,X : CMP.b #$4A : BNE + LDA.w AncillaGet,X : CMP.b #$4A : BNE +
; collecting pre-activated flute ; collecting pre-activated flute
LDA.b #$13 : JML $088007 LDA.b #$13 : JML Ancilla_SFX2_Near
+ ; normal itemget sfx + ; normal itemget sfx
LDA.b #$0F : JML $08800E ; what we wrote over LDA.b #$0F : JML Ancilla_SFX3_Near ; what we wrote over
; A = item id being collected ; A = item id being collected
ItemGetOverworldAlternateSFX: ItemGetOverworldAlternateSFX:
CMP.b #$4A : BNE + CMP.b #$4A : BNE +
JSL Sound_SetSfxPanWithPlayerCoords : ORA.b #$13 : STA.w $012E JSL Sound_SetSfxPanWithPlayerCoords : ORA.b #$13 : STA.w SFX2
RTL RTL
+ ; normal itemget sfx + ; normal itemget sfx
JSL Sound_SetSfxPanWithPlayerCoords : ORA.b #$0F : STA.w $012F ; what we wrote over JSL Sound_SetSfxPanWithPlayerCoords : ORA.b #$0F : STA.w SFX3 ; what we wrote over
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -223,7 +223,6 @@ MirrorBonk:
PLB : PLP : PLX PLB : PLP : PLX
BRA .forceBonk BRA .forceBonk
++ ++
TXA : !ADD #$0008 : CMP.w #.tableEnd-.bonkRectanglesTable : BEQ .endLoop
TAX TAX
BRA .loop BRA .loop
.endbonkRectanglesTable .endbonkRectanglesTable
@@ -233,9 +232,10 @@ MirrorBonk:
.normal .normal
;Not forcing a bonk, so the vanilla bonk detection run. ;Not forcing a bonk, so the vanilla bonk detection run.
LDA.b Scrap0C : ORA.b Scrap0E LDA.b Scrap0C : ORA.b Scrap0E
JML.l MirrorBonk_NormalReturn TXA : !ADD.w #$0008 : CMP.w #.tableEnd-.bonkRectanglesTable : BEQ .endLoop
JML MirrorBonk_NormalReturn
.forceBonk .forceBonk
JML.l MirrorBonk_BranchGamma JML MirrorBonk_BranchGamma
.bonkRectanglesTable .bonkRectanglesTable
;X1 X2 Y1 Y2 ;X1 X2 Y1 Y2

View File

@@ -162,7 +162,7 @@ Overworld_LoadNewTiles:
INY INY
INY INY
JMP.w ($0000,X) JMP ($0000,X)
;--------------------------------------------------------------------------------------------------- ;---------------------------------------------------------------------------------------------------

View File

@@ -3,7 +3,7 @@ InvertedTileAttributeLookup:
SEP #$20 SEP #$20
LDA.b OverworldIndex : CMP.b #$47 : BEQ .turtleRock LDA.b OverworldIndex : CMP.b #$47 : BEQ .turtleRock
LDA.l Overworld_TileAttr, X LDA.l Overworld_TileAttr, X
JML.l Overworld_GetTileAttrAtLocation_continue JML Overworld_GetTileAttrAtLocation_continue
.turtleRock .turtleRock
LDA.l Inverted_TR_TileAttributes, X LDA.l Inverted_TR_TileAttributes, X
JML.l Overworld_GetTileAttrAtLocation_continue JML Overworld_GetTileAttrAtLocation_continue

View File

@@ -2,7 +2,7 @@
; Item Downgrade Fix ; Item Downgrade Fix
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ItemDowngradeFix: ItemDowngradeFix:
JSL.l AddInventory JSL AddInventory
BMI .dontWrite ; thing we wrote over part 1 BMI .dontWrite ; thing we wrote over part 1
CPY.b #$1B : BEQ .isPowerGloves ; Power Gloves CPY.b #$1B : BEQ .isPowerGloves ; Power Gloves
@@ -36,8 +36,8 @@ RTL
.isBlueBoomerang .isBlueBoomerang
.isBow .isBow
.isBowAndArrows .isBowAndArrows
CMP.b [$00] : !BGE .done ; finished if we're upgrading CMP.b [Scrap00] : !BGE .done ; finished if we're upgrading
LDA.b [$00] ; reload old value LDA.b [Scrap00] ; reload old value
RTL RTL
.isSilverArrowBow .isSilverArrowBow
.isRedBoomerang .isRedBoomerang

View File

@@ -57,8 +57,8 @@ FreeUWGraphics:
DrawPotItem: DrawPotItem:
PHX PHX
JSL.l AttemptItemSubstitution JSL AttemptItemSubstitution
JSL.l ResolveLootIDLong JSL ResolveLootIDLong
TAX TAX
LDA.l BeeTrapDisguise : BEQ + LDA.l BeeTrapDisguise : BEQ +
TAX TAX
@@ -66,18 +66,18 @@ DrawPotItem:
.full .full
PLX PLX
LDA.b #$01 : STA $06 LDA.b #$01 : STA.b Scrap06
LDA #$0C : JSL.l OAM_AllocateFromRegionC LDA.b #$0C : JSL OAM_AllocateFromRegionC
LDA #$02 : PHA LDA.b #$02 : PHA
REP #$20 REP #$20
LDA.w #DynamicOAMTile_full LDA.w #DynamicOAMTile_full
BRA .draw BRA .draw
.narrow .narrow
PLX PLX
LDA.b #$02 : STA $06 LDA.b #$02 : STA.b Scrap06
LDA #$10 : JSL.l OAM_AllocateFromRegionC LDA.b #$10 : JSL OAM_AllocateFromRegionC
LDA #$03 : PHA LDA.b #$03 : PHA
REP #$20 REP #$20
LDA.w #DynamicOAMTile_thin LDA.w #DynamicOAMTile_thin
.draw .draw

View File

@@ -43,13 +43,11 @@ org $86d180
org $86d18d ; <- 3518D - sprite_absorbable.asm : 274 (LDA $7EF36F : INC A : STA $7EF36F) org $86d18d ; <- 3518D - sprite_absorbable.asm : 274 (LDA $7EF36F : INC A : STA $7EF36F)
JSL KeyGet JSL KeyGet
org $86f9f3 ; bank06.asm : 6732 (JSL Sprite_LoadProperties) org $86f9f3 ; bank06.asm : 6732 (JSL SpritePrep_LoadProperties)
JSL LoadProperties_PreserveCertainProps JSL LoadProperties_PreserveCertainProps
;org $808BAA ; NMI hook
; JSL TransferPotGFX
org $86828A org $86828A
Sprite_SpawnSecret_SpriteSpawnDynamically:
JSL CheckSprite_Spawn JSL CheckSprite_Spawn
org $87B169 org $87B169
@@ -76,28 +74,20 @@ org $8681F4
Sprite_SpawnSecret_pool_ID: Sprite_SpawnSecret_pool_ID:
org $868283 org $868283
Sprite_SpawnSecret_NotRandomBush: Sprite_SpawnSecret_NotRandomBush:
org $86828A
Sprite_SpawnSecret_SpriteSpawnDynamically:
org $86d23a org $86d23a
Sprite_DrawAbsorbable: Sprite_DrawAbsorbable:
org $9eff81
Sprite_DrawRippleIfInWater:
org $8db818
Sprite_LoadProperties:
org $86D038 org $86D038
KeyRoomFlagMasks: KeyRoomFlagMasks:
org $80FDEE org $80FDEE
InitializeMirrorHDMA: InitializeMirrorHDMA:
org $80E3C4
LoadCommonSprites_long:
org $09D62E org $89D62E
UWSpritesPointers: ; 0x250 bytes for 0x128 rooms' 16-bit pointers UWSpritesPointers: ; 0x250 bytes for 0x128 rooms' 16-bit pointers
org $09D87E org $89D87E
UWPotsPointers: ; 0x250 bytes for 0x128 rooms' 16-bit pointers UWPotsPointers: ; 0x250 bytes for 0x128 rooms' 16-bit pointers
org $09DACE org $89DACE
UWPotsData: ; variable number of bytes (max 0x11D1) for all pots data UWPotsData: ; variable number of bytes (max 0x11D1) for all pots data
org $A88000 org $A88000
@@ -184,48 +174,48 @@ UWSpecialFlag:
org $A8B128 org $A8B128
RevealPotItem: RevealPotItem:
STA.b $04 ; save tilemap coordinates STA.b Scrap04 ; save tilemap coordinates
STZ.w SpawnedItemFlag STZ.w SpawnedItemFlag
STZ.w SpawnedItemMWPlayer STZ.w SpawnedItemMWPlayer
LDA.w $0B9C : AND.w #$FF00 : STA.w $0B9C LDA.w $0B9C : AND.w #$FF00 : STA.w $0B9C
LDA.b $A0 : ASL : TAX LDA.b RoomIndex : ASL : TAX
LDA.l UWPotsPointers,X : STA.b $00 ; we may move this LDA.l UWPotsPointers,X : STA.b Scrap00 ; we may move this
LDA.w #UWPotsPointers>>16 : STA.b $02 LDA.w #UWPotsPointers>>16 : STA.b Scrap02
LDY.w #$FFFD : LDX.w #$FFFF LDY.w #$FFFD : LDX.w #$FFFF
.next_pot .next_pot
INY : INY : INY INY : INY : INY
LDA.b [$00],Y LDA.b [Scrap00],Y
CMP.w #$FFFF : BEQ .exit CMP.w #$FFFF : BEQ .exit
INX INX
STA.w $08 ; remember the exact value STA.w Scrap08 ; remember the exact value
AND.w #$3FFF AND.w #$3FFF
CMP.b $04 : BNE .next_pot ; not the correct value CMP.b Scrap04 : BNE .next_pot ; not the correct value
STZ.w SpawnedItemIsMultiWorld STZ.w SpawnedItemIsMultiWorld
BIT.b $08 BIT.b Scrap08
BVS LoadMultiWorldPotItem BVS LoadMultiWorldPotItem
BMI LoadMajorPotItem BMI LoadMajorPotItem
.normal_secret .normal_secret
STA $08 STA.b Scrap08
PHX : PHY PHX : PHY
; set bit and count if first time lifting this pot ; set bit and count if first time lifting this pot
TXA : ASL : TAX : LDA.l BitFieldMasks, X : STA $0A TXA : ASL : TAX : LDA.l BitFieldMasks, X : STA.b Scrap0A
LDA.b $A0 : ASL : TAX LDA.b RoomIndex : ASL : TAX
JSR ShouldCountNormalPot : BCC .obtained JSR ShouldCountNormalPot : BCC .obtained
LDA.l RoomPotData, X : BIT $0A : BNE .obtained LDA.l RoomPotData, X : BIT.b Scrap0A : BNE .obtained
ORA $0A : STA RoomPotData, X ORA.b Scrap0A : STA.l RoomPotData, X
; increment dungeon counts ; increment dungeon counts
SEP #$10 SEP #$10
LDX.w $040C : CPX.b #$FF : BEQ + LDX.w DungeonID : CPX.b #$FF : BEQ +
CPX.b #$00 : BNE ++ CPX.b #$00 : BNE ++
INX #2 ; treat sewers as HC INX #2 ; treat sewers as HC
++ LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X ++ LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X
@@ -237,14 +227,14 @@ RevealPotItem:
PLY : PLX PLY : PLX
PLA ; remove the JSL return lower 16 bits PLA ; remove the JSL return lower 16 bits
LDA $08 LDA.b Scrap08
PEA.w $01E6E2-1 ; change return address to go back to the vanilla routine PEA.w RevealPotItem_found_match-1 ; return to vanilla routine
.exit .exit
RTL RTL
LoadMultiWorldPotItem: LoadMultiWorldPotItem:
INY : INY INY : INY
LDA.b [$00],Y : AND.w #$00FF LDA.b [Scrap00],Y : AND.w #$00FF
INC.w SpawnedItemIsMultiWorld INC.w SpawnedItemIsMultiWorld
PHX PHX
@@ -263,7 +253,7 @@ RTL
LoadMajorPotItem: LoadMajorPotItem:
INY : INY INY : INY
LDA.b [$00],Y : AND.w #$00FF LDA.b [Scrap00],Y : AND.w #$00FF
SaveMajorItemDrop: SaveMajorItemDrop:
; A currently holds the item receipt ID ; A currently holds the item receipt ID
@@ -286,24 +276,24 @@ SaveMajorItemDrop:
RTL RTL
.substitute .substitute
PHA PHA
TXA : ASL : STA.b $00 TXA : ASL : STA.b Scrap00
LDA.w #$001F : SBC $00 LDA.w #$001F : SBC.b Scrap00
TAX : LDA.l BitFieldMasks, X : STA $00 TAX : LDA.l BitFieldMasks, X : STA.b Scrap00
LDA.b $A0 : ASL : TAX LDA.b RoomIndex : ASL : TAX
LDA.l $7EF580, X LDA.l $7EF580, X
AND.b $00 AND.b Scrap00
BNE .exit BNE .exit
LDA.l $7EF580, X : ORA $00 : STA.l $7EF580, X LDA.l $7EF580, X : ORA.b Scrap00 : STA.l $7EF580, X
PLA : STA $0B9C PLA : STA.w $0B9C
RTL RTL
.exit .exit
PLA : STZ.w $0B9C PLA : STZ.w $0B9C
RTL RTL
ShouldCountNormalPot: ShouldCountNormalPot:
INY : INY : LDA [$00], Y : AND #$00FF : CMP #$0080 : BCS .clear INY : INY : LDA.b [Scrap00], Y : AND.w #$00FF : CMP.w #$0080 : BCS .clear
LDA.l PotCountMode : BEQ .clear LDA.l PotCountMode : BEQ .clear
LDA.l PotCollectionRateTable, X : BIT $0A : BEQ .clear ; don't count if clear LDA.l PotCollectionRateTable, X : BIT.b Scrap0A : BEQ .clear ; don't count if clear
.set .set
SEC SEC
RTS RTS
@@ -313,12 +303,12 @@ RTS
IncrementCountsForSubstitute: IncrementCountsForSubstitute:
PHX : REP #$30 PHX : REP #$30
LDA.w SpawnedItemIndex : ASL : TAX : LDA.l BitFieldMasks, X : STA $0A LDA.w SpawnedItemIndex : ASL : TAX : LDA.l BitFieldMasks, X : STA.b Scrap0A
LDA.b $A0 : ASL : TAX LDA.b RoomIndex : ASL : TAX
LDA.l RoomPotData, X : BIT $0A : BNE .obtained LDA.l RoomPotData, X : BIT.b Scrap0A : BNE .obtained
ORA $0A : STA RoomPotData, X ORA.b Scrap0A : STA.l RoomPotData, X
SEP #$10 SEP #$10
LDX.w $040C : CPX.b #$FF : BEQ + LDX.w DungeonID : CPX.b #$FF : BEQ +
CPX.b #$00 : BNE ++ CPX.b #$00 : BNE ++
INX #2 ; treat sewers as HC INX #2 ; treat sewers as HC
++ LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X ++ LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X
@@ -331,15 +321,15 @@ IncrementCountsForSubstitute:
RTS RTS
ClearSpriteData: ClearSpriteData:
STZ.b $03 ; what we overrode # we no longer need STZ $02 see underworld_sprite_hooks STZ.b Scrap03 ; what we overrode # we no longer need STZ $02 see underworld_sprite_hooks
.shared: .shared:
PHX PHX
LDA #$00 : LDX #$00 LDA.b #$00 : LDX.b #$00
.loop .loop
STA SprDropsItem, X : STA SprItemReceipt, X : STA SprItemIndex, X STA.l SprDropsItem, X : STA.l SprItemReceipt, X : STA.l SprItemIndex, X
STA SprItemMWPlayer, X : STA SprItemFlags, X STA.l SprItemMWPlayer, X : STA.l SprItemFlags, X
INX : CPX #$10 : BCC .loop INX : CPX.b #$10 : BCC .loop
JSR SetupEnemyDropIndicator JSR SetupEnemyDropIndicator
PLX PLX
RTL RTL
@@ -354,40 +344,40 @@ ClearSpriteData2:
; uses X register, assumes flags are (MX) but (mX) is fine ; uses X register, assumes flags are (MX) but (mX) is fine
SetupEnemyDropIndicator: SetupEnemyDropIndicator:
REP #$20 REP #$20
LDA.w #!BlankTile : STA.w !EnemyDropIndicator LDA.w #!BlankTile : STA.w EnemyDropIndicator
LDX.b $1B : BEQ .done LDX.b IndoorsFlag : BEQ .done
LDA.l DRFlags : BIT #$0800 : BEQ .done LDA.l DRFlags : BIT.w #$0800 : BEQ .done
; Skipping the compass checks, could make this a toggle later? ; Skipping the compass checks, could make this a toggle later?
; do we have a flag for enemy drops on? could check it here ; do we have a flag for enemy drops on? could check it here
; LDA.w $040C : AND.w #$00FF : CMP.w #$00FF : BEQ .skipCompassChecks ; LDA.w DungeonID : AND.w #$00FF : CMP.w #$00FF : BEQ .skipCompassChecks
; compass checks ; compass checks
; does compass for dungeon exist? ; does compass for dungeon exist?
; LSR : TAX : LDA.l ExistsTransfer, X : TAX : LDA.l CompassExists, X : BEQ .skipCompassChecks ; LSR : TAX : LDA.l ExistsTransfer, X : TAX : LDA.l CompassExists, X : BEQ .skipCompassChecks
; do we have the compass ; do we have the compass
; sewers? outstanding? ; sewers? outstanding?
; LDA.l CompassField : LDX.w $040C : AND.l DungeonMask, X : BEQ .done ; LDA.l CompassField : LDX.w DungeonID : AND.l DungeonMask, X : BEQ .done
;.skipCompassChecks ;.skipCompassChecks
; either we're in a cave ($040C: $FF), compass doesn't exist, or we have the compass ; either we're in a cave ($040C: $FF), compass doesn't exist, or we have the compass
; check if there are enemy drops ; check if there are enemy drops
LDA.b $02 : PHA : REP #$10 ; store 02/03 for later LDA.b Scrap02 : PHA : REP #$10 ; store 02/03 for later
LDX.b $A0 : LDA.l UWSpecialFlagIndex, X : AND.w #$00FF ; determine if special case or not LDX.b RoomIndex : LDA.l UWSpecialFlagIndex, X : AND.w #$00FF ; determine if special case or not
CMP.w #$00FF : BEQ .loadNormalFlags CMP.w #$00FF : BEQ .loadNormalFlags
JSR FetchBitmaskForSpecialCase JSR FetchBitmaskForSpecialCase
PHA : LDA $A0 : ASL : TAX : PLA PHA : LDA.b RoomIndex : ASL : TAX : PLA
BRA .testAgainstMask BRA .testAgainstMask
.loadNormalFlags .loadNormalFlags
TXA : ASL : TAX : LDA.l UWEnemyItemFlags, X TXA : ASL : TAX : LDA.l UWEnemyItemFlags, X
.testAgainstMask .testAgainstMask
STA.b $02 : LDA.l SpriteDropData, X : AND.b $02 : EOR.b $02 STA.b Scrap02 : LDA.l SpriteDropData, X : AND.b Scrap02 : EOR.b Scrap02
BEQ .cleanup BEQ .cleanup
LDA.w #!BlueSquare : STA.w !EnemyDropIndicator LDA.w #!BlueSquare : STA.w EnemyDropIndicator
.cleanup .cleanup
SEP #$10 : PLA : STA.b $02 SEP #$10 : PLA : STA.b Scrap02
.done .done
SEP #$20 SEP #$20
@@ -397,20 +387,20 @@ RTS
; Runs during sprite load of the room ; Runs during sprite load of the room
LoadSpriteData: LoadSpriteData:
INY : INY INY : INY
LDA.b [$00], Y LDA.b [Scrap00], Y
CMP #$F3 : BCC .normal CMP.b #$F3 : BCC .normal
PHA PHA
DEC.b $03 ; standing items shouldn't consume a sprite slot DEC.b Scrap03 ; standing items shouldn't consume a sprite slot
LDX.b $03 ; these were changed to $03, for moved sprites LDX.b Scrap03 ; these were changed to $03, for moved sprites
CMP #$F9 : BNE .not_multiworld CMP.b #$F9 : BNE .not_multiworld
DEY : LDA.b [$00], Y : STA.l SprItemMWPlayer, X DEY : LDA.b [Scrap00], Y : STA.l SprItemMWPlayer, X
LDA.b #$02 : STA.l SprDropsItem, X : BRA .common LDA.b #$02 : STA.l SprDropsItem, X : BRA .common
.not_multiworld .not_multiworld
LDA.b #$00 : STA.l SprItemMWPlayer, X LDA.b #$00 : STA.l SprItemMWPlayer, X
LDA.b #$01 : STA.l SprDropsItem, X LDA.b #$01 : STA.l SprDropsItem, X
DEY DEY
.common .common
DEY : LDA.b [$00], Y : STA.l SprItemReceipt, X DEY : LDA.b [Scrap00], Y : STA.l SprItemReceipt, X
STA.b Scrap0E STA.b Scrap0E
LDA.l SprItemMWPlayer, X : BNE + ; skip if multiworld LDA.l SprItemMWPlayer, X : BNE + ; skip if multiworld
PHX PHX
@@ -425,7 +415,7 @@ LoadSpriteData:
INY : INY INY : INY
PLA PLA
PLA : PLA ; remove the JSL return lower 16 bits PLA : PLA ; remove the JSL return lower 16 bits
PEA.w $09C344-1 ; change return address to exit from Underworld_LoadSingleSprite PEA.w $89C344-1 ; change return address to exit from Underworld_LoadSingleSprite
RTL RTL
.normal .normal
RTL RTL
@@ -440,10 +430,10 @@ CheckIfDropValid:
;This section sets up the drop ;This section sets up the drop
LDA.b #$02 : STA.l SpawnedItemFlag LDA.b #$02 : STA.l SpawnedItemFlag
STX.w SpawnedItemIndex STX.w SpawnedItemIndex
LDA.l SprItemReceipt, X : STA SpawnedItemID LDA.l SprItemReceipt, X : STA.l SpawnedItemID
LDA.l SprItemMWPlayer, X : STA SpawnedItemMWPlayer LDA.l SprItemMWPlayer, X : STA.l SpawnedItemMWPlayer
LDY.b #$01 ; trigger the small key routines LDY.b #$01 ; trigger the small key routines
LDA.w SpawnedItemID : STA.b $00 : CMP #$32 : BNE + LDA.w SpawnedItemID : STA.b Scrap00 : CMP.b #$32 : BNE +
LDA.l StandingItemsOn : BNE + LDA.l StandingItemsOn : BNE +
INY ; big key routine INY ; big key routine
+ +
@@ -452,33 +442,33 @@ CheckIfDropValid:
LDX.b #$00 ; see if the item should be replaced by an absorbable LDX.b #$00 ; see if the item should be replaced by an absorbable
- CPX.b #$1A : BCS .done - CPX.b #$1A : BCS .done
LDA.l MinorForcedDrops, X LDA.l MinorForcedDrops, X
CMP.b $00 : BNE + CMP.b Scrap00 : BNE +
INX : LDA.l MinorForcedDrops, X : STA.b $00 INX : LDA.l MinorForcedDrops, X : STA.b Scrap00
PLX : PLA : PLA : PEA.w PrepareEnemyDrop-1 ; change call stack for PrepareEnemyDrop PLX : PLA : PLA : PEA.w PrepareEnemyDrop-1 ; change call stack for PrepareEnemyDrop
JSR IncrementCountForMinor JSR IncrementCountForMinor
LDA.b $00 : RTL LDA.b Scrap00 : RTL
+ INX #2 : BRA - + INX #2 : BRA -
.done PLX .done PLX
RTL ; unstun if stunned RTL ; unstun if stunned
DoNormalDrop: DoNormalDrop:
SEP #$30 SEP #$30
LDY.w $0CBA, X : BEQ .no_forced_drop LDY.w SpriteForceDrop, X : BEQ .no_forced_drop
RTL RTL
.no_forced_drop .no_forced_drop
PLA : PLA ; remove the JSL reswamturn lower 16 bits PLA : PLA ; remove the JSL return lower 16 bits
PEA.w $06F996-1 ; change return address to .no_forced_drop of (Sprite_DoTheDeath) PEA.w $86F996-1 ; change return address to .no_forced_drop of (Sprite_DoTheDeath)
RTL RTL
RevealSpriteDrop2: RevealSpriteDrop2:
LDY.w SprDropsItem, X : BEQ .normal LDY.w SprDropsItem, X : BEQ .normal
BRA .no_forced_drop BRA .no_forced_drop
.normal .normal
LDY.w $0CBA, X : BEQ .no_forced_drop LDY.w SpriteForceDrop, X : BEQ .no_forced_drop
RTL RTL
.no_forced_drop .no_forced_drop
PLA : PLA ; remove the JSL return lower 16 bits PLA : PLA ; remove the JSL return lower 16 bits
PEA.w $06E3CE-1 ; change return address to .no_forced_drop of (Sprite_DoTheDeath) PEA.w $86E3CE-1 ; change return address to .no_forced_drop of (Sprite_DoTheDeath)
RTL RTL
PikitOverride: PikitOverride:
@@ -497,17 +487,17 @@ RTL
; output - carry clear if the enemy doesn't drop, set if it does ; output - carry clear if the enemy doesn't drop, set if it does
CheckIfDropsInThisLocation: CheckIfDropsInThisLocation:
REP #$30 : PHX ; save it for later REP #$30 : PHX ; save it for later
TXA : ASL : TAX : LDA.l BitFieldMasks, X : STA.b $00 ; stores the bitmask for the specific drop TXA : ASL : TAX : LDA.l BitFieldMasks, X : STA.b Scrap00 ; stores the bitmask for the specific drop
; check sram, if gotten, run normal ; check sram, if gotten, run normal
LDA.b $A0 : ASL : TAX : LDA.l SpriteDropData, X : PLX ; restore X in case we're done LDA.b RoomIndex : ASL : TAX : LDA.l SpriteDropData, X : PLX ; restore X in case we're done
BIT.b $00 : BNE .normal_drop ; zero indicates the item has not been obtained BIT.b Scrap00 : BNE .normal_drop ; zero indicates the item has not been obtained
PHX ; save it for later PHX ; save it for later
LDX.b $A0 : LDA.l UWSpecialFlagIndex, X : AND.w #$00FF LDX.b RoomIndex : LDA.l UWSpecialFlagIndex, X : AND.w #$00FF
CMP.w #$00FF : BEQ + ; $FF indicates the EnemyItemFlags are sufficient CMP.w #$00FF : BEQ + ; $FF indicates the EnemyItemFlags are sufficient
JSR FetchBitmaskForSpecialCase JSR FetchBitmaskForSpecialCase
BRA .test BRA .test
+ TXA : ASL : TAX : LDA.l UWEnemyItemFlags, X + TXA : ASL : TAX : LDA.l UWEnemyItemFlags, X
.test PLX : BIT.b $00 : BEQ .normal_drop ; zero indicates the enemy doesn't drop .test PLX : BIT.b Scrap00 : BEQ .normal_drop ; zero indicates the enemy doesn't drop
.valid .valid
SEP #$30 : SEC SEP #$30 : SEC
RTS RTS
@@ -520,15 +510,15 @@ RTS
; output - A the correct bitmask ; output - A the correct bitmask
FetchBitmaskForSpecialCase: FetchBitmaskForSpecialCase:
ASL : TAX ASL : TAX
LDA.w $040C : BNE + ; here and branch to different function? LDA.w DungeonID : BNE + ; here and branch to different function?
INC #2 ; move sewers to HC INC #2 ; move sewers to HC
+ CMP.w #$00FF : BNE + ; check if we are in a cave + CMP.w #$00FF : BNE + ; check if we are in a cave
LDA.l PreviousOverworldDoor : AND.w #$00FF ; use this instead of dungeon id LDA.l PreviousOverworldDoor : AND.w #$00FF ; use this instead of dungeon id
+ STA.b $02 + STA.b Scrap02
- LDA.l UWSpecialFlag, X : AND.w #$00FF - LDA.l UWSpecialFlag, X : AND.w #$00FF
CMP.w #$00FF : BNE + ; if the value is FF we are done, use 0 as bitmask CMP.w #$00FF : BNE + ; if the value is FF we are done, use 0 as bitmask
LDA.w #$0000 : RTS LDA.w #$0000 : RTS
+ CMP.b $02 : BNE + ; if the value matches the dungeon, use next 2 bytes as bitmask + CMP.b Scrap02 : BNE + ; if the value matches the dungeon, use next 2 bytes as bitmask
INX : LDA.l UWSpecialFlag, X : RTS INX : LDA.l UWSpecialFlag, X : RTS
+ INX #3 : BRA - ; else move to the next row + INX #3 : BRA - ; else move to the next row
@@ -551,14 +541,14 @@ db $D5, $E1 ; ARROW REFILL 5 (x$D5)
IncrementCountForMinor: IncrementCountForMinor:
PHX : REP #$30 PHX : REP #$30
LDA.w SpawnedItemIndex : ASL : TAX : LDA.l BitFieldMasks, X : STA $0A LDA.w SpawnedItemIndex : ASL : TAX : LDA.l BitFieldMasks, X : STA.b Scrap0A
LDA.b $A0 : ASL : TAX LDA.b RoomIndex : ASL : TAX
LDA.l SpriteDropData, X : BIT $0A : BNE .obtained LDA.l SpriteDropData, X : BIT.b Scrap0A : BNE .obtained
ORA $0A : STA SpriteDropData, X ORA.b Scrap0A : STA.l SpriteDropData, X
SEP #$10 SEP #$10
JSR SetupEnemyDropIndicator JSR SetupEnemyDropIndicator
REP #$20 REP #$20
LDX.w $040C : CPX.b #$FF : BEQ + LDX.w DungeonID : CPX.b #$FF : BEQ +
CPX.b #$00 : BNE ++ CPX.b #$00 : BNE ++
INX #2 ; treat sewers as HC INX #2 ; treat sewers as HC
++ LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X ++ LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X
@@ -574,73 +564,73 @@ BitFieldMasks:
dw $8000, $4000, $2000, $1000, $0800, $0400, $0200, $0100 dw $8000, $4000, $2000, $1000, $0800, $0400, $0200, $0100
dw $0080, $0040, $0020, $0010, $0008, $0004, $0002, $0001 dw $0080, $0040, $0020, $0010, $0008, $0004, $0002, $0001
; Runs during Sprite_E4_SmallKey and duning Sprite_E5_BigKey spawns ; Runs during Sprite_E4_SmallKey and during Sprite_E5_BigKey spawns
ShouldSpawnItem: ShouldSpawnItem:
LDA $048E : CMP.b #$87 : BNE + ; check for hera basement cage LDA.w RoomIndexMirror : CMP.b #$87 : BNE + ; check for hera basement cage
CPX #$0A : BNE + ; the hera basement key is always sprite 0x0A CPX.b #$0A : BNE + ; the hera basement key is always sprite 0x0A
LDA $A8 : AND.b #$03 : CMP.b #$02 : BNE + ; we're not in that quadrant LDA.b $A8 : AND.b #$03 : CMP.b #$02 : BNE + ; we're not in that quadrant
LDA.w $0403 : AND.w KeyRoomFlagMasks,Y : RTL LDA.w RoomItemsTaken : AND.w KeyRoomFlagMasks,Y : RTL
+ +
; checking our sram table ; checking our sram table
PHX : PHY PHX : PHY
REP #$30 REP #$30
LDA.b $A0 : ASL : TAY LDA.b RoomIndex : ASL : TAY
LDA.w SprItemIndex, X : AND #$00FF : ASL LDA.w SprItemIndex, X : AND.w #$00FF : ASL
PHX PHX
TAX : LDA.l BitFieldMasks, X : STA $00 TAX : LDA.l BitFieldMasks, X : STA.b Scrap00
PLX ; restore X again PLX ; restore X again
LDA.w SprItemFlags, X : BIT.w #$0001 : BNE + LDA.w SprItemFlags, X : BIT.w #$0001 : BNE +
TYX : LDA.l SpriteDropData, X : BIT $00 : BEQ .notObtained TYX : LDA.l SpriteDropData, X : BIT.b Scrap00 : BEQ .notObtained
BRA .obtained BRA .obtained
+ TYX : LDA.l RoomPotData, X : BIT $00 : BEQ .notObtained + TYX : LDA.l RoomPotData, X : BIT.b Scrap00 : BEQ .notObtained
.obtained .obtained
SEP #$30 : PLY : PLX : LDA #$01 : RTL ; already obtained SEP #$30 : PLY : PLX : LDA.b #$01 : RTL ; already obtained
.notObtained .notObtained
SEP #$30 : PLY : PLX SEP #$30 : PLY : PLX
LDA #$00 LDA.b #$00
RTL RTL
MarkSRAMForItem: MarkSRAMForItem:
LDA.b RoomIndex : CMP.b #$87 : BNE + ; check for hera basement cage LDA.b RoomIndex : CMP.b #$87 : BNE + ; check for hera basement cage
CPX #$0A : BNE + ; the hera basement key is always sprite 0x0A CPX.b #$0A : BNE + ; the hera basement key is always sprite 0x0A
LDA $A8 : AND.b #$03 : CMP.b #$02 : BNE + LDA.b $A8 : AND.b #$03 : CMP.b #$02 : BNE +
LDA.w $0403 : ORA.w KeyRoomFlagMasks, Y : RTL LDA.w RoomItemsTaken : ORA.w KeyRoomFlagMasks, Y : RTL
+ PHX : PHY : REP #$30 + PHX : PHY : REP #$30
LDA.b $A0 : ASL : TAY LDA.b RoomIndex : ASL : TAY
LDA.l SpawnedItemIndex : ASL LDA.l SpawnedItemIndex : ASL
TAX : LDA.l BitFieldMasks, X : STA $00 TAX : LDA.l BitFieldMasks, X : STA.b Scrap00
TYX TYX
LDA.w SpawnedItemFlag : CMP #$0001 : BEQ + LDA.w SpawnedItemFlag : CMP.w #$0001 : BEQ +
LDA SpriteDropData, X : ORA $00 : STA SpriteDropData, X LDA.l SpriteDropData, X : ORA.b Scrap00 : STA.l SpriteDropData, X
SEP #$10 : JSR SetupEnemyDropIndicator SEP #$10 : JSR SetupEnemyDropIndicator
BRA .end BRA .end
+ LDA RoomPotData, X : ORA $00 : STA RoomPotData, X + LDA.l RoomPotData, X : ORA.b Scrap00 : STA.l RoomPotData, X
.end .end
SEP #$30 : PLY : PLX SEP #$30 : PLY : PLX
LDA.w $0403 LDA.w RoomItemsTaken
RTL RTL
SpriteKeyPrep: SpriteKeyPrep:
LDA.w $0B9B : STA.w $0CBA, X ; what we wrote over LDA.w $0B9B : STA.w SpriteForceDrop, X ; what we wrote over
PHA PHA
LDA $A0 : CMP #$87 : BNE .continue LDA.b RoomIndex : CMP.b #$87 : BNE .continue
CPX #$0A : BNE .continue ; the hera basement key is always sprite 0x0A CPX.b #$0A : BNE .continue ; the hera basement key is always sprite 0x0A
LDA $A9 : ORA $AA : AND #$03 : CMP #$02 : BNE .continue LDA.b LinkQuadrantH : ORA.b LinkQuadrantV : AND.b #$03 : CMP.b #$02 : BNE .continue
LDA #$00 : STA.w SpawnedItemFlag : STA SprItemFlags, X LDA.b #$00 : STA.w SpawnedItemFlag : STA.l SprItemFlags, X
LDA #$24 : STA $0E80, X LDA.b #$24 : STA.w $0E80, X
BRA + BRA +
.continue .continue
LDA.w SpawnedItemIndex : STA SprItemIndex, X LDA.w SpawnedItemIndex : STA.l SprItemIndex, X
LDA.w SpawnedItemMWPlayer : STA SprItemMWPlayer, X : STA.w !MULTIWORLD_SPRITEITEM_PLAYER_ID LDA.w SpawnedItemMWPlayer : STA.l SprItemMWPlayer, X : STA.w !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.w SpawnedItemFlag : STA SprItemFlags, X : BEQ + LDA.w SpawnedItemFlag : STA.l SprItemFlags, X : BEQ +
LDA.l SpawnedItemID : STA $0E80, X LDA.l SpawnedItemID : STA.w $0E80, X
PHA : PHY : PHX PHA : PHY : PHX
JSL.l GetSpritePalette : PLX : STA $0F50, X ; setup the palette JSL GetSpritePalette : PLX : STA.w SpriteOAMProp, X ; setup the palette
PLY : PLA PLY : PLA
CMP #$24 : BNE ++ ; CMP.b #$24 : BNE ++ ;
LDA $A0 : CMP.b #$80 : BNE + LDA.b RoomIndex : CMP.b #$80 : BNE +
LDA SpawnedItemFlag : BNE + LDA.l SpawnedItemFlag : BNE +
LDA #$24 ; it's the big key drop? LDA.b #$24 ; it's the big key drop?
++ JSL RequestStandingItemVRAMSlot ++ JSL RequestStandingItemVRAMSlot
+ PLA + PLA
RTL RTL
@@ -651,55 +641,55 @@ SpriteKeyDrawGFX:
LDA.l SprItemMWPlayer, X : STA.w !MULTIWORLD_SPRITEITEM_PLAYER_ID LDA.l SprItemMWPlayer, X : STA.w !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.w $0E80, X LDA.w $0E80, X
CMP.b #$24 : BNE + CMP.b #$24 : BNE +
LDA $A0 : CMP #$80 : BNE ++ LDA.b RoomIndex : CMP.b #$80 : BNE ++
LDA SpawnedItemFlag : BNE ++ LDA.l SpawnedItemFlag : BNE ++
LDA #$24 : BRA + LDA.b #$24 : BRA +
++ PLA ++ PLA
PHK : PEA.w .jslrtsreturn-1 PHK : PEA.w .jslrtsreturn-1
PEA.w $068014 ; an rtl address - 1 in Bank06 PEA.w $868014 ; an rtl address - 1 in Bank06
JML Sprite_DrawAbsorbable JML Sprite_DrawAbsorbable
.jslrtsreturn .jslrtsreturn
RTL RTL
+ JSL DrawPotItem + JSL DrawPotItem
CMP #$03 : BNE + CMP.b #$03 : BNE +
PHA : LDA $0E60, X : ORA.b #$20 : STA $0E60, X : PLA PHA : LDA.w SpriteControl, X : ORA.b #$20 : STA.w SpriteControl, X : PLA
+ JSL.l Sprite_DrawShadowLong + JSL Sprite_DrawShadowLong
PLA : RTL PLA : RTL
KeyGet: KeyGet:
LDA CurrentSmallKeys ; what we wrote over LDA.l CurrentSmallKeys ; what we wrote over
PHA PHA
LDA.l StandingItemsOn : BNE + LDA.l StandingItemsOn : BNE +
PLA : RTL PLA : RTL
+ LDY $0E80, X + LDY.w $0E80, X
LDA SprItemIndex, X : STA SpawnedItemIndex LDA.l SprItemIndex, X : STA.l SpawnedItemIndex
LDA SprItemFlags, X : STA SpawnedItemFlag LDA.l SprItemFlags, X : STA.l SpawnedItemFlag
LDA $A0 : CMP #$87 : BNE + ;check for hera cage LDA.b RoomIndex : CMP.b #$87 : BNE + ;check for hera cage
LDA SpawnedItemFlag : BNE + ; if it came from a pot, it's fine LDA.l SpawnedItemFlag : BNE + ; if it came from a pot, it's fine
JSR ShouldKeyBeCountedForDungeon : BCC ++ JSR ShouldKeyBeCountedForDungeon : BCC ++
JSL CountChestKeyLong JSL CountChestKeyLong
++ PLA : RTL ++ PLA : RTL
+ STY $00 + STY.b Scrap00
LDA SprItemMWPlayer, X : STA !MULTIWORLD_ITEM_PLAYER_ID LDA.l SprItemMWPlayer, X : STA.l !MULTIWORLD_ITEM_PLAYER_ID
STA !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE .receive STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE .receive
PHX PHX
LDA $040C : CMP #$FF : BNE + LDA.w DungeonID : CMP.b #$FF : BNE +
LDA $00 : CMP.b #$AF : BNE .skip LDA.b Scrap00 : CMP.b #$AF : BNE .skip
LDA CurrentGenericKeys : INC : STA CurrentGenericKeys LDA.l CurrentGenericKeys : INC : STA.l CurrentGenericKeys
LDA $00 : BRA .countIt LDA.b Scrap00 : BRA .countIt
+ LSR : TAX + LSR : TAX
LDA $00 : CMP.l KeyTable, X : BNE + LDA.b Scrap00 : CMP.l KeyTable, X : BNE +
.countIt .countIt
LDA.l StandingItemCounterMask : AND SpawnedItemFlag : BEQ ++ LDA.l StandingItemCounterMask : AND SpawnedItemFlag : BEQ ++
JSL.l AddInventory JSL AddInventory
++ PLX : PLA : RTL ++ PLX : PLA : RTL
+ CMP.b #$AF : beq .countIt ; universal key + CMP.b #$AF : beq .countIt ; universal key
CMP.b #$24 : beq .countIt ; small key for this dungeon CMP.b #$24 : beq .countIt ; small key for this dungeon
.skip PLX .skip PLX
.receive .receive
JSL $0791b3 ; Player_HaltDashAttackLong JSL Player_HaltDashAttackLong
TYA : JSL.l AttemptItemSubstitution : JSL.l ResolveLootIDLong : TAY TYA : JSL AttemptItemSubstitution : JSL ResolveLootIDLong : TAY
JSL.l Link_ReceiveItem JSL Link_ReceiveItem
PLA : DEC : RTL PLA : DEC : RTL
KeyTable: KeyTable:
@@ -708,32 +698,32 @@ db $A0, $A0, $A2, $A3, $A4, $A5, $A6, $A7, $A8, $A9, $AA, $AB, $AC, $AD
; Input Y - the item type ; Input Y - the item type
ShouldKeyBeCountedForDungeon: ShouldKeyBeCountedForDungeon:
PHX PHX
LDA $040C : CMP #$FF : BEQ .done LDA.w DungeonID : CMP.b #$FF : BEQ .done
LSR : TAX LSR : TAX
TYA : cmp KeyTable, X : BNE + TYA : CMP.w KeyTable, X : BNE +
- PLX : SEC : RTS - PLX : SEC : RTS
+ CMP.B #$24 : BEQ - + CMP.b #$24 : BEQ -
.done .done
PLX : CLC : RTS PLX : CLC : RTS
BigKeyGet: BigKeyGet:
LDY $0E80, X LDY.w $0E80, X
CPY #$32 : BNE + CPY.b #$32 : BNE +
STZ $02E9 : LDY.b #$32 ; what we wrote over STZ.w ItemReceiptMethod : LDY.b #$32 ; what we wrote over
PHX : JSL Link_ReceiveItem : PLX ; what we wrote over PHX : JSL Link_ReceiveItem : PLX ; what we wrote over
CLC : RTL CLC : RTL
+ SEC : RTL + SEC : RTL
LoadProperties_PreserveCertainProps: LoadProperties_PreserveCertainProps:
LDA $0E20, X : CMP #$E4 : BEQ + LDA.w SpriteTypeTable, X : CMP.b #$E4 : BEQ +
CMP #$E5 : BEQ + CMP.b #$E5 : BEQ +
JML Sprite_LoadProperties JML SpritePrep_LoadProperties
+ LDA $0F50, X : PHA + LDA.w SpriteOAMProp, X : PHA
LDA $0E80, X : PHA LDA.w $0E80, X : PHA
JSL Sprite_LoadProperties JSL SpritePrep_LoadProperties
PLA : STA $0E80, X PLA : STA.w $0E80, X
PLA : STA $0F50, X PLA : STA.w SpriteOAMProp, X
RTL RTL
SubstitionFlow: SubstitionFlow:
@@ -750,7 +740,7 @@ SubstitionTable:
db $DB ; RED RUPEE - 0x16 db $DB ; RED RUPEE - 0x16
db $E2 ; ARROW REFILL 10 - 0x17 db $E2 ; ARROW REFILL 10 - 0x17
db $DD ; BOMB REFILL 4 - 0x18 db $DD ; BOMB REFILL 4 - 0x18
db $DE ; BOMB REFILL 8 - 0x19 db $DE ; BOMB REFILL 8 - 0x19
SubstituteSpriteId: SubstituteSpriteId:
@@ -759,7 +749,7 @@ SubstituteSpriteId:
+ LDA.b #$01 + LDA.b #$01
CPY.b #$18 : BCC + CPY.b #$18 : BCC +
LDA.b #$05 LDA.b #$05
+ STA.b $0D + STA.b Scrap0D
JSR IncrementCountsForSubstitute JSR IncrementCountsForSubstitute
PHB : PHK : PLB PHB : PHK : PLB
LDA.w SubstitionTable-$16, Y ; Do substitute LDA.w SubstitionTable-$16, Y ; Do substitute
@@ -772,35 +762,35 @@ CheckSprite_Spawn:
BMI .check BMI .check
RTL RTL
.check .check
LDA $0D : CMP #$08 : BNE + LDA.b Scrap0D : CMP.b #$08 : BNE +
LDA $0372 : BNE .error LDA.w LinkDashing : BNE .error
LDX #$0F LDX.b #$0F
; loop looking for a Sprite with state 0A (carried by the player) ; loop looking for a Sprite with state 0A (carried by the player)
- LDA $0DD0, X : CMP #$0A : BEQ .foundIt - LDA.w SpriteAITable, X : CMP.b #$0A : BEQ .foundIt
DEX : BMI .error : BRA - DEX : BMI .error : BRA -
.foundIt .foundIt
LDA #$00 : STZ $0DD0, X LDA.b #$00 : STZ.w SpriteAITable, X
LDA #$E4 : JSL Sprite_SpawnDynamically LDA.b #$E4 : JSL Sprite_SpawnDynamically
BMI .error BMI .error
LDA #$40 : TSB $0308 : RTL LDA.b #$40 : TSB.w AButtonAct : RTL
.error .error
LDA.b #$3C ; SFX2_3C - error beep LDA.b #$3C ; SFX2_3C - error beep
STA.w $012E STA.w SFX2
+ LDA #$FF + LDA.b #$FF
RTL RTL
PreventPotSpawn: PreventPotSpawn:
LDA #$40 : BIT $0308 : BEQ + LDA.b #$40 : BIT.w AButtonAct : BEQ +
STZ $0308 : RTL STZ.w AButtonAct : RTL
+ LDA.b #$80 : STA.w $0308 ; what we wrote over + LDA.b #$80 : STA.w AButtonAct ; what we wrote over
RTL RTL
PreventPotSpawn2: PreventPotSpawn2:
LDA $0308 : BEQ + LDA.w AButtonAct : BEQ +
LDA.b #$01 : TSB.b $50 ; what we wrote over LDA.b #$01 : TSB.b LinkStrafe ; what we wrote over
+ RTL + RTL
CheckIfPotIsSpecial: CheckIfPotIsSpecial:
@@ -809,7 +799,7 @@ CheckIfPotIsSpecial:
BEQ .specialpot BEQ .specialpot
; Normal pot, so run the vanilla code ; Normal pot, so run the vanilla code
LDA.l $7EF3CA ; check for dark world LDA.l CurrentWorld ; check for dark world
.specialpot ; zero flag already set, so gtg .specialpot ; zero flag already set, so gtg
RTL RTL

View File

@@ -13,7 +13,7 @@ LampCheck:
RTL RTL
;================================================================================ ;================================================================================
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Output: 0 locked, 1 openA ; Output: 0 locked, 1 open
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CheckForZelda: CheckForZelda:
LDA.l ProgressIndicator : CMP.b #$02 : !BLT + ; Skip if rain is falling LDA.l ProgressIndicator : CMP.b #$02 : !BLT + ; Skip if rain is falling
@@ -24,7 +24,7 @@ CheckForZelda:
RTL RTL
;================================================================================ ;================================================================================
SetOverlayIfLamp: SetOverlayIfLamp:
JSL.l LampCheck JSL LampCheck
STA.b SUBDESQ ; write it directly to the overlay, this isn't a terrible idea at all STA.b SUBDESQ ; write it directly to the overlay, this isn't a terrible idea at all
RTL RTL
;================================================================================ ;================================================================================
@@ -46,7 +46,7 @@ MirrorScrollSpawnZelda:
LDA.l MirrorEquipment : CMP.b #$01 : BNE + ;mirror scroll LDA.l MirrorEquipment : CMP.b #$01 : BNE + ;mirror scroll
LDA.l StartingEntrance : CMP.b #$02 : BEQ ++ ; zelda's cell LDA.l StartingEntrance : CMP.b #$02 : BEQ ++ ; zelda's cell
CMP.b #$04 : BNE + CMP.b #$04 : BNE +
++ INC $04AA ++ INC.w RespawnFlag
; what we replaced ; what we replaced
+ STZ.b $11 : STZ.b $14 + STZ.b GameSubMode : STZ.b NMISTRIPES
RTL RTL

View File

@@ -14,5 +14,5 @@ MaidenCrystalScript:
LDA.l CrystalsField : AND.b #$7F : CMP.b #$7F : BNE + ; check if we have all crystals LDA.l CrystalsField : AND.b #$7F : CMP.b #$7F : BNE + ; check if we have all crystals
LDA.b #$08 : STA.l MapIcons ; Update the map icon to just be Ganon's Tower LDA.b #$08 : STA.l MapIcons ; Update the map icon to just be Ganon's Tower
+ +
JML.l $9ECF35 ; <- F4F35 - sprite_crystal_maiden.asm : 426 JML CrystalMaiden_KickOutOfDungeon ; <- F4F35 - sprite_crystal_maiden.asm : 426
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -9,7 +9,7 @@ TryOpenMire:
LDA.l OverworldEventDataWRAM+$70 : AND.b #$20 : BNE .untriggered LDA.l OverworldEventDataWRAM+$70 : AND.b #$20 : BNE .untriggered
; You have to be in the trigger window. ; You have to be in the trigger window.
LDY.b #$02 : JSL.l Ancilla_CheckIfEntranceTriggered : BCC .untriggered LDY.b #$02 : JSL Ancilla_CheckIfEntranceTriggered : BCC .untriggered
; Do the 3rd animation for opening entrances ; Do the 3rd animation for opening entrances
LDA.b #$03 : STA.w OWEntranceCutscene LDA.b #$03 : STA.w OWEntranceCutscene
@@ -28,7 +28,7 @@ TryOpenTRock:
LDA.l OverworldEventDataWRAM+$47 : AND.b #$20 : BNE .untriggered LDA.l OverworldEventDataWRAM+$47 : AND.b #$20 : BNE .untriggered
; You have to be in the trigger window. ; You have to be in the trigger window.
LDY.b #$03 : JSL.l Ancilla_CheckIfEntranceTriggered : BCC .untriggered LDY.b #$03 : JSL Ancilla_CheckIfEntranceTriggered : BCC .untriggered
; Do the 4rd animation for opening entrances ; Do the 4rd animation for opening entrances
LDA.b #$04 : STA.w OWEntranceCutscene LDA.b #$04 : STA.w OWEntranceCutscene
@@ -40,14 +40,14 @@ TryOpenTRock:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
MedallionTrigger_Bombos: MedallionTrigger_Bombos:
STZ.b Strafe ; stuff we wrote over STZ.b LinkStrafe ; stuff we wrote over
STZ.w FreezeSprites STZ.w FreezeSprites
PHA PHA
LDA.l MireRequiredMedallion : BNE + LDA.l MireRequiredMedallion : BNE +
JSL.l TryOpenMire JSL TryOpenMire
+ LDA.l TRockRequiredMedallion : BNE + + LDA.l TRockRequiredMedallion : BNE +
JSL.l TryOpenTRock JSL TryOpenTRock
+ +
PLA PLA
RTL RTL
@@ -55,9 +55,9 @@ RTL
MedallionTrigger_Ether: MedallionTrigger_Ether:
PHA PHA
LDA.l MireRequiredMedallion : CMP.b #$01 : BNE + LDA.l MireRequiredMedallion : CMP.b #$01 : BNE +
JSL.l TryOpenMire JSL TryOpenMire
+ LDA.l TRockRequiredMedallion : CMP.b #$01 : BNE + + LDA.l TRockRequiredMedallion : CMP.b #$01 : BNE +
JSL.l TryOpenTRock JSL TryOpenTRock
+ +
PLA PLA
RTL RTL
@@ -65,9 +65,9 @@ RTL
MedallionTrigger_Quake: MedallionTrigger_Quake:
PHA PHA
LDA.l MireRequiredMedallion : CMP.b #$02 : BNE + LDA.l MireRequiredMedallion : CMP.b #$02 : BNE +
JSL.l TryOpenMire JSL TryOpenMire
+ LDA.l TRockRequiredMedallion : CMP.b #$02 : BNE + + LDA.l TRockRequiredMedallion : CMP.b #$02 : BNE +
JSL.l TryOpenTRock JSL TryOpenTRock
+ +
PLA PLA
RTL RTL

View File

@@ -1,8 +1,8 @@
OnMenuLoad: OnMenuLoad:
LDA.b #UploadMenuOnlyIcons>>0 : STA NMIAux LDA.b #UploadMenuOnlyIcons>>0 : STA.l NMIAux
LDA.b #UploadMenuOnlyIcons>>8 : STA NMIAux+1 LDA.b #UploadMenuOnlyIcons>>8 : STA.l NMIAux+1
LDA.b #UploadMenuOnlyIcons>>16 : STA NMIAux+2 LDA.b #UploadMenuOnlyIcons>>16 : STA.l NMIAux+2
LDA.b #$0E : STA.b $10 ; what we overwrote LDA.b #$0E : STA.b GameMode ; what we overwrote
RTL RTL
UploadMenuOnlyIcons: UploadMenuOnlyIcons:
@@ -15,7 +15,7 @@ UploadMenuOnlyIcons:
SEP #$20 SEP #$20
LDA.b #MenuOnlyIcons>>16 : STA.w $4344 LDA.b #MenuOnlyIcons>>16 : STA.w $4344
LDA.b #$80 : STA.w $2118 LDA.b #$80 : STA.w $2118
LDA.b #$10 : STA.w $420B LDA.b #$10 : STA.w DMAENABLE
RTL RTL

View File

@@ -11,7 +11,7 @@ LDX.b #$FF
TXA : ASL A : TAX TXA : ASL A : TAX
LDA.l MapCompassFlag LDA.l MapCompassFlag
AND #$01 : BNE + AND.b #$01 : BNE +
LDA.l WorldMapIcon_posx_vanilla+1, X : STA.l $7EC10B LDA.l WorldMapIcon_posx_vanilla+1, X : STA.l $7EC10B
LDA.l WorldMapIcon_posx_vanilla, X : STA.l $7EC10A LDA.l WorldMapIcon_posx_vanilla, X : STA.l $7EC10A
LDA.l WorldMapIcon_posy_vanilla+1, X : STA.l $7EC109 LDA.l WorldMapIcon_posy_vanilla+1, X : STA.l $7EC109
@@ -22,32 +22,32 @@ LDX.b #$FF
LDA.l WorldMapIcon_posy_located+1, X : STA.l $7EC109 LDA.l WorldMapIcon_posy_located+1, X : STA.l $7EC109
LDA.l WorldMapIcon_posy_located, X : STA.l $7EC108 LDA.l WorldMapIcon_posy_located, X : STA.l $7EC108
.adjustment .adjustment
LDA.l WorldMapIcon_tile, X : CMP #$FF : BEQ .skip_draw LDA.l WorldMapIcon_tile, X : CMP.b #$FF : BEQ .skip_draw
LDA.l WorldMapIcon_tile+1, X : BEQ .dont_adjust LDA.l WorldMapIcon_tile+1, X : BEQ .dont_adjust
CMP.b #$64 : BEQ .is_crystal CMP.b #$64 : BEQ .is_crystal
LDA.b $1A : AND.b #$10 : BNE .skip_draw LDA.b FrameCounter : AND.b #$10 : BNE .skip_draw
.is_crystal .is_crystal
JSR.w WorldMapIcon_AdjustCoordinate JSR WorldMapIcon_AdjustCoordinate
.dont_adjust .dont_adjust
JSR.w WorldMap_CalculateOAMCoordinates JSR WorldMap_CalculateOAMCoordinates
BCC .skip_draw BCC .skip_draw
PLX : PHX : TXA : ASL A : TAX PLX : PHX : TXA : ASL A : TAX
LDA.l WorldMapIcon_tile+1, X : BEQ .is_red_x LDA.l WorldMapIcon_tile+1, X : BEQ .is_red_x
LDA.l MapCompassFlag : CMP.b #$01 : BEQ .is_red_x LDA.l MapCompassFlag : CMP.b #$01 : BEQ .is_red_x
LDA.l WorldMapIcon_tile+1, X : STA.b $0D LDA.l WorldMapIcon_tile+1, X : STA.b Scrap0D
LDA.l WorldMapIcon_tile, X : STA.b $0C LDA.l WorldMapIcon_tile, X : STA.b Scrap0C
LDA.b #$02 : BRA .continue LDA.b #$02 : BRA .continue
.is_red_x .is_red_x
LDA.b $1A : LSR #3 : AND.b #$03 : TAX LDA.b FrameCounter : LSR #3 : AND.b #$03 : TAX
LDA.l WorldMap_RedXChars,X : STA.b $0D LDA.l WorldMap_RedXChars,X : STA.b Scrap0D
LDA.b #$32 : STA.b $0C : LDA.b #$00 LDA.b #$32 : STA.b Scrap0C : LDA.b #$00
.continue .continue
STA.b $0B STA.b Scrap0B
PLX : PHX PLX : PHX
INX : JSR.w WorldMap_HandleSpriteBlink INX : JSR WorldMap_HandleSpriteBlink
.skip_draw .skip_draw
; end of loop ; end of loop
PLX : CPX #12 : BCS + : JMP .loopStart : + PLX : CPX.b #12 : BCS + : JMP .loopStart : +
PLA : STA.l $7EC10B PLA : STA.l $7EC10B
PLA : STA.l $7EC10A PLA : STA.l $7EC10A
@@ -59,23 +59,23 @@ LDX.b #$FF
; X - the index of the prize marker ; X - the index of the prize marker
OverworldMap_CheckForPrize: OverworldMap_CheckForPrize:
PHX PHX
LDA #$00 : STA.l MapCompassFlag LDA.b #$00 : STA.l MapCompassFlag
JSR OverworldMap_CheckForCompass JSR OverworldMap_CheckForCompass
BCC + BCC +
LDA.l MapCompassFlag : ORA #$01 : STA.l MapCompassFlag LDA.l MapCompassFlag : ORA.b #$01 : STA.l MapCompassFlag
LDA CurrentWorld : AND #$40 : BNE ++ ; is the compass position on LW or DW? LDA.l CurrentWorld : AND.b #$40 : BNE ++ ; is the compass position on LW or DW?
LDA.l WorldCompassMask, X : BEQ + : JMP .fail LDA.l WorldCompassMask, X : BEQ + : JMP .fail
++ LDA.l WorldCompassMask, X : BNE + : JMP .fail ++ LDA.l WorldCompassMask, X : BNE + : JMP .fail
+ JSR OverworldMap_CheckForMap + JSR OverworldMap_CheckForMap
BCC + BCC +
LDA.l MapCompassFlag : ORA #$02 : STA.l MapCompassFlag LDA.l MapCompassFlag : ORA.b #$02 : STA.l MapCompassFlag
+ +
LDA.l MapCompassFlag : BEQ .fail LDA.l MapCompassFlag : BEQ .fail
CMP #$02 : BNE .checkIfObtained CMP.b #$02 : BNE .checkIfObtained
LDA CurrentWorld : AND #$40 : BNE + LDA.l CurrentWorld : AND.b #$40 : BNE +
CPX #3 : BCS .fail : BRA .checkIfObtained CPX.b #3 : BCS .fail : BRA .checkIfObtained
+ CPX #10 : BCS .fail + CPX.b #10 : BCS .fail
CPX #3 : BCC .fail CPX.b #3 : BCC .fail
.checkIfObtained .checkIfObtained
LDA.l MC_DungeonIdsForPrize, X LDA.l MC_DungeonIdsForPrize, X
@@ -105,14 +105,14 @@ RTS
; CLC - should not move indicator ; CLC - should not move indicator
; SEC - yep indicator can move ; SEC - yep indicator can move
OverworldMap_CheckForCompass: OverworldMap_CheckForCompass:
LDA.l CompassMode : AND #$80 : BEQ .unset ; should I check for compass logic LDA.l CompassMode : AND.b #$80 : BEQ .unset ; should I check for compass logic
LDA.l CompassMode : AND #$40 : BEQ .set ; compasses/maps aren't shuffled LDA.l CompassMode : AND.b #$40 : BEQ .set ; compasses/maps aren't shuffled
LDA.l CompassMode : AND #$20 : BNE + LDA.l CompassMode : AND.b #$20 : BNE +
JSR OverworldMap_CheckForMap : BCC .unset : BRA .set JSR OverworldMap_CheckForMap : BCC .unset : BRA .set
+ LDA.l CompassExists, X : BEQ .set ; compass doesn't exist + LDA.l CompassExists, X : BEQ .set ; compass doesn't exist
PHX PHX
LDA.l MC_SRAM_Offsets, X : TAX ; put compass offset into X LDA.l MC_SRAM_Offsets, X : TAX ; put compass offset into X
LDA CompassField, X : ORA MapOverlay, X LDA.l CompassField, X : ORA.l MapOverlay, X
PLX PLX
AND.l MC_Masks, X : BNE .set ; is the compass obtained AND.l MC_Masks, X : BNE .set ; is the compass obtained
.unset .unset
@@ -127,13 +127,13 @@ RTS
; SEC - yep should show exact prize ; SEC - yep should show exact prize
OverworldMap_CheckForMap: OverworldMap_CheckForMap:
LDA.l MapMode : BEQ .set ; obtaining map doesn't change anything LDA.l MapMode : BEQ .set ; obtaining map doesn't change anything
LDA CurrentWorld : AND #$40 : BNE + ; not really sure on this check LDA.l CurrentWorld : AND.b #$40 : BNE + ; not really sure on this check
LDA MapField : ORA MapOverlay : AND.b #$01 : BNE .set : BRA .continue LDA.l MapField : ORA.l MapOverlay : AND.b #$01 : BNE .set : BRA .continue
+ LDA MapField : ORA MapOverlay : AND.b #$02 : BNE .set + LDA.l MapField : ORA.l MapOverlay : AND.b #$02 : BNE .set
.continue .continue
PHX PHX
LDA.l MC_SRAM_Offsets, X : TAX ; put map offset into X LDA.l MC_SRAM_Offsets, X : TAX ; put map offset into X
LDA MapField, X : ORA MapOverlay, X LDA.l MapField, X : ORA.l MapOverlay, X
PLX PLX
AND.l MC_Masks, X : BNE .set ; is the map obtained? AND.l MC_Masks, X : BNE .set ; is the map obtained?
.unset .unset

32
msu.asm
View File

@@ -226,7 +226,7 @@ CheckMusicLoadRequest:
PHA PHA
LDA.l CrystalsField : CMP.b #$7F : BEQ - LDA.l CrystalsField : CMP.b #$7F : BEQ -
LDA.l CurrentWorld : BEQ -- LDA.l CurrentWorld : BEQ --
LDA.b OverworldIndex : CMP #$40 : BNE -- LDA.b OverworldIndex : CMP.b #$40 : BNE --
PLA PLA
LDA.b #15 : BRA .check_fallback-3 LDA.b #15 : BRA .check_fallback-3
.castle .castle
@@ -248,7 +248,7 @@ CheckMusicLoadRequest:
PLA : LSR #3 : TAX PLA : LSR #3 : TAX
LDA.w MSUFallbackTable,X : BEQ .secondary_fallback : CMP.b #$FF : BEQ .mute LDA.w MSUFallbackTable,X : BEQ .secondary_fallback : CMP.b #$FF : BEQ .mute
- : CPY #$00 : BEQ + - : CPY.b #$00 : BEQ +
LSR : DEY : BRA - LSR : DEY : BRA -
+ +
@@ -264,8 +264,8 @@ CheckMusicLoadRequest:
TAX : LDA.l MusicShuffleTable-1,X TAX : LDA.l MusicShuffleTable-1,X
PLX PLX
CMP.w MusicControlRequest : BEQ .unmute CMP.w MusicControlRequest : BEQ .unmute
CPX #35 : !BLT + CPX.b #35 : !BLT +
CPX #47 : !BLT .dungeon_fallback CPX.b #47 : !BLT .dungeon_fallback
+ +
STA.w MusicControlRequest STA.w MusicControlRequest
@@ -377,7 +377,7 @@ SpiralStairsPreCheck:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SpiralStairsPostCheck: SpiralStairsPostCheck:
LDA.l DRMode : BEQ + ; if door rando enabled LDA.l DRMode : BEQ + ; if door rando enabled
LDA.b $A2 : CMP.w #$0007 : BNE .done LDA.b PreviousRoom : CMP.w #$0007 : BNE .done
LDA.l Music_Hera : TAX : STX.w MusicControlRequest LDA.l Music_Hera : TAX : STX.w MusicControlRequest
BRA .done BRA .done
+ LDA.b RoomIndex + LDA.b RoomIndex
@@ -496,9 +496,9 @@ PHA : XBA : PHA
JSR IsResumableTrack : BCC + JSR IsResumableTrack : BCC +
; dont save if we already saved recently ; dont save if we already saved recently
REP #$20 REP #$20
LDA.w MSUResumeTrack : AND #$00FF : BEQ ++ LDA.w MSUResumeTrack : AND.w #$00FF : BEQ ++
LDA.l NMIFrames : !SUB MSUResumeTime : PHA LDA.l NMIFrames : !SUB.l MSUResumeTime : PHA
LDA.l NMIFrames+2 : SBC MSUResumeTime+2 : BNE +++ LDA.l NMIFrames+2 : SBC.l MSUResumeTime+2 : BNE +++
PLA : CMP.l MSUResumeTimer : !BLT .too_early PLA : CMP.l MSUResumeTimer : !BLT .too_early
BRA ++ BRA ++
+++ +++
@@ -571,7 +571,7 @@ MSUMain:
PLA : LSR #3 : TAX PLA : LSR #3 : TAX
LDA.w MSUFallbackTable,X : BEQ +++ : CMP.b #$FF : BEQ ++ LDA.w MSUFallbackTable,X : BEQ +++ : CMP.b #$FF : BEQ ++
- : CPY #$00 : BEQ + - : CPY.b #$00 : BEQ +
LSR : DEY : BRA - LSR : DEY : BRA -
+ +
@@ -663,8 +663,8 @@ MSUMain:
PLX PLX
TXA : CMP.w MSUResumeTrack : BNE + ; dont resume if too late TXA : CMP.w MSUResumeTrack : BNE + ; dont resume if too late
REP #$20 REP #$20
LDA.l NMIFrames : !SUB MSUResumeTime : PHA LDA.l NMIFrames : !SUB.l MSUResumeTime : PHA
LDA.l NMIFrames+2 : SBC MSUResumeTime+2 : BNE ++ LDA.l NMIFrames+2 : SBC.l MSUResumeTime+2 : BNE ++
PLA : CMP.l MSUResumeTimer : !BGE +++ PLA : CMP.l MSUResumeTimer : !BGE +++
SEP #$20 SEP #$20
LDA.b #!FLAG_RESUME_FADEIN : BRA .done_resume LDA.b #!FLAG_RESUME_FADEIN : BRA .done_resume
@@ -677,8 +677,8 @@ MSUMain:
STA.w MSUResumeControl STA.w MSUResumeControl
LDA.b #$00 : STA.w MSUResumeTrack LDA.b #$00 : STA.w MSUResumeTrack
+ +
CPX #07 : BNE + ; Kakariko Village CPX.b #07 : BNE + ; Kakariko Village
LDA.b GameMode : CMP #$07 : BNE + LDA.b GameMode : CMP.b #$07 : BNE +
; we're in link's house -> ignore ; we're in link's house -> ignore
LDA.b #$00 LDA.b #$00
BRA ++ BRA ++
@@ -687,7 +687,7 @@ MSUMain:
++ ++
STA.w MSULoadedTrack STA.w MSULoadedTrack
STX.w CurrentMSUTrack STX.w CurrentMSUTrack
LDA.w MSUPackCurrent : CMP #$FE : !BLT + LDA.w MSUPackCurrent : CMP.b #$FE : !BLT +
LDA.b #$00 : BRA ++ LDA.b #$00 : BRA ++
+ : LDA.l MSUTrackList-1,X + : LDA.l MSUTrackList-1,X
++ : STA.w MSUDelayedCommand ++ : STA.w MSUDelayedCommand
@@ -740,7 +740,7 @@ PendantFanfareWait:
LDA.w MSUID+2 : CMP.w #!VAL_MSU_ID_23 : BNE .spc LDA.w MSUID+2 : CMP.w #!VAL_MSU_ID_23 : BNE .spc
LDA.w MSUID+4 : CMP.w #!VAL_MSU_ID_45 : BNE .spc LDA.w MSUID+4 : CMP.w #!VAL_MSU_ID_45 : BNE .spc
SEP #$20 SEP #$20
LDA.w MSUPackCurrent : CMP #$FE : !BGE .spc LDA.w MSUPackCurrent : CMP.b #$FE : !BGE .spc
LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_TRACK_MISSING : BNE .spc LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_TRACK_MISSING : BNE .spc
LDA.w MSUDelayedCommand : BNE .continue LDA.w MSUDelayedCommand : BNE .continue
LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_PLAYING : BEQ .done LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_PLAYING : BEQ .done
@@ -799,7 +799,7 @@ EndingMusicWait:
LDA.w MSUID+4 : CMP.w #!VAL_MSU_ID_45 : BNE .done LDA.w MSUID+4 : CMP.w #!VAL_MSU_ID_45 : BNE .done
SEP #$20 SEP #$20
.wait .wait
LDA.b Strafe : BNE .done LDA.b LinkStrafe : BNE .done
LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_PLAYING : BNE .wait LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_PLAYING : BNE .wait
.done .done
SEP #$20 SEP #$20

View File

@@ -3,43 +3,43 @@
macro Print_Text(hdr, hdr_len, player_id) macro Print_Text(hdr, hdr_len, player_id)
PHX : PHY : PHP PHX : PHY : PHP
REP #$30 REP #$30
LDX #$0000 LDX.w #$0000
- -
CPX <hdr_len> : !BGE ++ CPX.w <hdr_len> : !BGE ++
LDA <hdr>, X LDA.l <hdr>, X
STA !MULTIWORLD_HUD_CHARACTER_DATA, X STA.l !MULTIWORLD_HUD_CHARACTER_DATA, X
INX #2 INX #2
BRA - BRA -
++ ++
LDY <hdr_len> LDY.w <hdr_len>
LDA <player_id> LDA.l <player_id>
AND #$00FF AND.w #$00FF
DEC DEC
CMP #$00FF : !BGE .textdone CMP.w #$00FF : !BGE .textdone
ASL #5 ASL #5
TAX TAX
- -
CPY <hdr_len>+$20 : !BGE ++ CPY.w <hdr_len>+$20 : !BGE ++
LDA PlayerNames, X LDA.l PlayerNames, X
PHX : TYX : STA !MULTIWORLD_HUD_CHARACTER_DATA, X : PLX PHX : TYX : STA.l !MULTIWORLD_HUD_CHARACTER_DATA, X : PLX
INX #2 : INY #2 INX #2 : INY #2
BRA - BRA -
++ ++
TYX TYX
- -
CPX #$0040 : !BGE ++ CPX.w #$0040 : !BGE ++
LDA #$007F LDA.w #$007F
STA !MULTIWORLD_HUD_CHARACTER_DATA, X STA.l !MULTIWORLD_HUD_CHARACTER_DATA, X
INX #2 INX #2
BRA - BRA -
++ ++
SEP #$20 SEP #$20
LDA #$01 : STA !NMI_MW+1 : STA !NMI_MW LDA.b #$01 : STA.l !NMI_MW+1 : STA.l !NMI_MW
LDA !MULTIWORLD_HUD_DELAY LDA.b !MULTIWORLD_HUD_DELAY
STA !MULTIWORLD_HUD_TIMER STA.l !MULTIWORLD_HUD_TIMER
.textdone .textdone
PLP : PLY : PLX PLP : PLY : PLX
endmacro endmacro
@@ -48,38 +48,38 @@ WriteText:
{ {
PHA : PHX : PHP PHA : PHX : PHP
SEP #$10 SEP #$10
LDX $4340 : PHX ; preserve DMA parameters LDX.w $4340 : PHX ; preserve DMA parameters
LDX $4341 : PHX ; preserve DMA parameters LDX.w $4341 : PHX ; preserve DMA parameters
LDX $4342 : PHX ; preserve DMA parameters LDX.w $4342 : PHX ; preserve DMA parameters
LDX $4343 : PHX ; preserve DMA parameters LDX.w $4343 : PHX ; preserve DMA parameters
LDX $4344 : PHX ; preserve DMA parameters LDX.w $4344 : PHX ; preserve DMA parameters
LDX $4345 : PHX ; preserve DMA parameters LDX.w $4345 : PHX ; preserve DMA parameters
LDX $4346 : PHX ; preserve DMA parameters LDX.w $4346 : PHX ; preserve DMA parameters
LDX $2115 : PHX ; preserve DMA parameters LDX.w $2115 : PHX ; preserve DMA parameters
LDX $2116 : PHX ; preserve DMA parameters LDX.w $2116 : PHX ; preserve DMA parameters
LDX $2117 : PHX ; preserve DMA parameters LDX.w $2117 : PHX ; preserve DMA parameters
LDX $2100 : PHX : LDX.b #$80 : STX $2100 ; save screen state & turn screen off LDX.w $2100 : PHX : LDX.b #$80 : STX.w $2100 ; save screen state & turn screen off
REP #$20 REP #$20
LDX #$80 : STX $2115 LDX.b #$80 : STX.w $2115
LDA #$6000+$0340 : STA $2116 LDA.w #$6000+$0340 : STA.w $2116
LDA.w #!MULTIWORLD_HUD_CHARACTER_DATA : STA $4342 LDA.w #!MULTIWORLD_HUD_CHARACTER_DATA : STA.w $4342
LDX.b #!MULTIWORLD_HUD_CHARACTER_DATA>>16 : STX $4344 LDX.b #!MULTIWORLD_HUD_CHARACTER_DATA>>16 : STX.w $4344
LDA #$0040 : STA $4345 LDA.w #$0040 : STA.w $4345
LDA #$1801 : STA $4340 LDA.w #$1801 : STA.w $4340
LDX #$10 : STX $420B LDX.b #$10 : STX.w DMAENABLE
PLX : STX $2100 ; put screen back however it was before PLX : STX.w $2100 ; put screen back however it was before
PLX : STX $2117 ; restore DMA parameters PLX : STX.w $2117 ; restore DMA parameters
PLX : STX $2116 ; restore DMA parameters PLX : STX.w $2116 ; restore DMA parameters
PLX : STX $2115 ; restore DMA parameters PLX : STX.w $2115 ; restore DMA parameters
PLX : STX $4346 ; restore DMA parameters PLX : STX.w $4346 ; restore DMA parameters
PLX : STX $4345 ; restore DMA parameters PLX : STX.w $4345 ; restore DMA parameters
PLX : STX $4344 ; restore DMA parameters PLX : STX.w $4344 ; restore DMA parameters
PLX : STX $4343 ; restore DMA parameters PLX : STX.w $4343 ; restore DMA parameters
PLX : STX $4342 ; restore DMA parameters PLX : STX.w $4342 ; restore DMA parameters
PLX : STX $4341 ; restore DMA parameters PLX : STX.w $4341 ; restore DMA parameters
PLX : STX $4340 ; restore DMA parameters PLX : STX.w $4340 ; restore DMA parameters
PLP : PLX : PLA PLP : PLX : PLA
RTL RTL
} }
@@ -87,49 +87,49 @@ RTL
GetMultiworldItem: GetMultiworldItem:
{ {
PHP PHP
LDA !MULTIWORLD_ITEM : BNE + LDA.l !MULTIWORLD_ITEM : BNE +
LDA !MULTIWORLD_HUD_TIMER : BNE + LDA.l !MULTIWORLD_HUD_TIMER : BNE +
BRL .return BRL .return
+ +
LDA $10 LDA.b GameMode
CMP #$07 : BEQ + CMP.b #$07 : BEQ +
CMP #$09 : BEQ + CMP.b #$09 : BEQ +
CMP #$0B : BEQ + CMP.b #$0B : BEQ +
BRL .return BRL .return
+ +
LDA !MULTIWORLD_HUD_TIMER : BEQ .textend LDA.l !MULTIWORLD_HUD_TIMER : BEQ .textend
DEC #$01 : STA !MULTIWORLD_HUD_TIMER DEC.b #$01 : STA.l !MULTIWORLD_HUD_TIMER
CMP #$00 : BNE .textend CMP.b #$00 : BNE .textend
; Clear text ; Clear text
PHP : REP #$30 PHP : REP #$30
LDX #$0000 LDX.w #$0000
- -
CPX #$0040 : !BGE ++ CPX.w #$0040 : !BGE ++
LDA #$007F LDA.w #$007F
STA !MULTIWORLD_HUD_CHARACTER_DATA, X STA.l !MULTIWORLD_HUD_CHARACTER_DATA, X
INX #2 INX #2
BRA - BRA -
++ ++
PLP PLP
LDA #$01 : STA !NMI_MW+1 : STA !NMI_MW LDA.b #$01 : STA.l !NMI_MW+1 : STA.l !NMI_MW
.textend .textend
LDA $5D LDA.b LinkState
CMP #$00 : BEQ + CMP.b #$00 : BEQ +
CMP #$04 : BEQ + CMP.b #$04 : BEQ +
CMP #$17 : BEQ + CMP.b #$17 : BEQ +
BRL .return BRL .return
+ +
LDA !MULTIWORLD_ITEM : BNE + LDA.l !MULTIWORLD_ITEM : BNE +
BRL .return BRL .return
+ +
PHA PHA
LDA #$22 LDA.b #$22
LDY #$04 LDY.b #$04
JSL Ancilla_CheckForAvailableSlot : BPL + JSL Ancilla_CheckForAvailableSlot : BPL +
PLA PLA
BRL .return BRL .return
@@ -137,55 +137,55 @@ GetMultiworldItem:
PLA PLA
; Check if we have a key for the dungeon we are currently in ; Check if we have a key for the dungeon we are currently in
LDX $040C LDX.w DungeonID
; Escape ; Escape
CMP #$A0 : BNE + : CPX #$00 : BEQ ++ : CPX #$02 : BEQ ++ : BRL .keyend : ++ : BRL .thisdungeon : + CMP.b #$A0 : BNE + : CPX.b #$00 : BEQ ++ : CPX.b #$02 : BEQ ++ : BRL .keyend : ++ : BRL .thisdungeon : +
; Eastern ; Eastern
CMP #$A2 : BNE + : CPX #$04 : BEQ .thisdungeon : BRA .keyend : + CMP.b #$A2 : BNE + : CPX.b #$04 : BEQ .thisdungeon : BRA .keyend : +
; Desert ; Desert
CMP #$A3 : BNE + : CPX #$06 : BEQ .thisdungeon : BRA .keyend : + CMP.b #$A3 : BNE + : CPX.b #$06 : BEQ .thisdungeon : BRA .keyend : +
; Hera ; Hera
CMP #$AA : BNE + : CPX #$14 : BEQ .thisdungeon : BRA .keyend : + CMP.b #$AA : BNE + : CPX.b #$14 : BEQ .thisdungeon : BRA .keyend : +
; Aga ; Aga
CMP #$A4 : BNE + : CPX #$08 : BEQ .thisdungeon : BRA .keyend : + CMP.b #$A4 : BNE + : CPX.b #$08 : BEQ .thisdungeon : BRA .keyend : +
; PoD ; PoD
CMP #$A6 : BNE + : CPX #$0C : BEQ .thisdungeon : BRA .keyend : + CMP.b #$A6 : BNE + : CPX.b #$0C : BEQ .thisdungeon : BRA .keyend : +
; Swamp ; Swamp
CMP #$A5 : BNE + : CPX #$0A : BEQ .thisdungeon : BRA .keyend : + CMP.b #$A5 : BNE + : CPX.b #$0A : BEQ .thisdungeon : BRA .keyend : +
; SW ; SW
CMP #$A8 : BNE + : CPX #$10 : BEQ .thisdungeon : BRA .keyend : + CMP.b #$A8 : BNE + : CPX.b #$10 : BEQ .thisdungeon : BRA .keyend : +
; TT ; TT
CMP #$AB : BNE + : CPX #$16 : BEQ .thisdungeon : BRA .keyend : + CMP.b #$AB : BNE + : CPX.b #$16 : BEQ .thisdungeon : BRA .keyend : +
; Ice ; Ice
CMP #$A9 : BNE + : CPX #$12 : BEQ .thisdungeon : BRA .keyend : + CMP.b #$A9 : BNE + : CPX.b #$12 : BEQ .thisdungeon : BRA .keyend : +
; Mire ; Mire
CMP #$A7 : BNE + : CPX #$0E : BEQ .thisdungeon : BRA .keyend : + CMP.b #$A7 : BNE + : CPX.b #$0E : BEQ .thisdungeon : BRA .keyend : +
; TR ; TR
CMP #$AC : BNE + : CPX #$18 : BEQ .thisdungeon : BRA .keyend : + CMP.b #$AC : BNE + : CPX.b #$18 : BEQ .thisdungeon : BRA .keyend : +
; GT ; GT
CMP #$AD : BNE + : CPX #$1A : BEQ .thisdungeon : BRA .keyend : + CMP.b #$AD : BNE + : CPX.b #$1A : BEQ .thisdungeon : BRA .keyend : +
; GT BK ; GT BK
CMP #$92 : BNE .keyend : CPX #$1A : BNE .keyend : LDA #$32 : BRA .keyend CMP.b #$92 : BNE .keyend : CPX.b #$1A : BNE .keyend : LDA.b #$32 : BRA .keyend
.thisdungeon .thisdungeon
LDA #$24 LDA.b #$24
.keyend .keyend
STA $02D8 ;Set Item to receive STA.w ItemReceiptID ;Set Item to receive
TAY TAY
LDA #$01 : STA !MULTIWORLD_RECEIVING_ITEM LDA.b #$01 : STA.l !MULTIWORLD_RECEIVING_ITEM
LDA #$00 : STA !MULTIWORLD_ITEM_PLAYER_ID LDA.b #$00 : STA.l !MULTIWORLD_ITEM_PLAYER_ID
STZ $02E9 STZ.w ItemReceiptMethod
JSL.l $0791B3 ; Player_HaltDashAttackLong JSL Player_HaltDashAttackLong
JSL Link_ReceiveItem JSL Link_ReceiveItem
LDA #$00 : STA !MULTIWORLD_ITEM : STA !MULTIWORLD_RECEIVING_ITEM LDA.b #$00 : STA.l !MULTIWORLD_ITEM : STA.l !MULTIWORLD_RECEIVING_ITEM
%Print_Text(HUD_ReceivedFrom, #$001C, !MULTIWORLD_ITEM_FROM) %Print_Text(HUD_ReceivedFrom, #$001C, !MULTIWORLD_ITEM_FROM)
.return .return
PLP PLP
LDA $5D : ASL A : TAX LDA.b LinkState : ASL A : TAX
RTL RTL
} }
@@ -193,10 +193,10 @@ Multiworld_OpenKeyedObject:
{ {
PHP PHP
SEP #$20 SEP #$20
LDA ChestData_Player+2, X : STA !MULTIWORLD_ITEM_PLAYER_ID LDA.l ChestData_Player+2, X : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLP PLP
LDA !Dungeon_ChestData+2, X ; thing we wrote over LDA.l !Dungeon_ChestData+2, X ; thing we wrote over
RTL RTL
} }
@@ -204,7 +204,7 @@ Multiworld_BottleVendor_GiveBottle:
{ {
PHA : PHP PHA : PHP
SEP #$20 SEP #$20
LDA BottleMerchant_Player : STA !MULTIWORLD_ITEM_PLAYER_ID LDA.l BottleMerchant_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLP : PLA PLP : PLA
JSL Link_ReceiveItem ; thing we wrote over JSL Link_ReceiveItem ; thing we wrote over
@@ -215,7 +215,7 @@ Multiworld_MiddleAgedMan_ReactToSecretKeepingResponse:
{ {
PHA : PHP PHA : PHP
SEP #$20 SEP #$20
LDA PurpleChest_Item_Player : STA !MULTIWORLD_ITEM_PLAYER_ID LDA.l PurpleChest_Item_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLP : PLA PLP : PLA
JSL Link_ReceiveItem ; thing we wrote over JSL Link_ReceiveItem ; thing we wrote over
@@ -226,7 +226,7 @@ Multiworld_Hobo_GrantBottle:
{ {
PHA : PHP PHA : PHP
SEP #$20 SEP #$20
LDA HoboItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID LDA.l HoboItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLP : PLA PLP : PLA
JSL Link_ReceiveItem ; thing we wrote over JSL Link_ReceiveItem ; thing we wrote over
@@ -237,7 +237,7 @@ Multiworld_MasterSword_GrantToPlayer:
{ {
PHA : PHP PHA : PHP
SEP #$20 SEP #$20
LDA PedestalSword_Player : STA !MULTIWORLD_ITEM_PLAYER_ID LDA.l PedestalSword_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLP : PLA PLP : PLA
JSL Link_ReceiveItem ; thing we wrote over JSL Link_ReceiveItem ; thing we wrote over
@@ -246,40 +246,40 @@ RTL
Multiworld_AddReceivedItem_notCrystal: Multiworld_AddReceivedItem_notCrystal:
{ {
TYA : STA $02E4 : PHX ; things we wrote over TYA : STA.w CutsceneFlag : PHX ; things we wrote over
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ + LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
PHY : LDY $02D8 : JSL AddInventory : PLY PHY : LDY.w ItemReceiptID : JSL AddInventory : PLY
%Print_Text(HUD_SentTo, #$0010, !MULTIWORLD_ITEM_PLAYER_ID) %Print_Text(HUD_SentTo, #$0010, !MULTIWORLD_ITEM_PLAYER_ID)
LDA #$33 : STA $012F LDA.b #$33 : STA.w SFX3
JML.l AddReceivedItem_gfxHandling JML AddReceivedItem_gfxHandling
+ +
JML.l AddReceivedItem_notCrystal+5 JML AddReceivedItem_notCrystal+5
} }
Multiworld_Ancilla_ReceiveItem_stillInMotion: Multiworld_Ancilla_ReceiveItem_stillInMotion:
{ {
CMP.b #$28 : BNE + ; thing we wrote over CMP.b #$28 : BNE + ; thing we wrote over
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE + LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE +
JML.l Ancilla_ReceiveItem_stillInMotion_moveon JML Ancilla_ReceiveItem_stillInMotion_moveon
+ +
JML.l Ancilla_ReceiveItem_dontGiveRupees JML Ancilla_ReceiveItem_dontGiveRupees
} }
Multiworld_ConsumingFire_TransmuteToSkullWoodsFire: Multiworld_ConsumingFire_TransmuteToSkullWoodsFire:
{ {
LDA $8A : AND.b #$40 : BEQ .failed ; things we wrote over LDA.b OverworldIndex : AND.b #$40 : BEQ .failed ; things we wrote over
LDA $0C4A : CMP #$22 : BEQ .failed LDA.w AncillaID : CMP.b #$22 : BEQ .failed
LDA $0C4B : CMP #$22 : BEQ .failed LDA.w AncillaID+1 : CMP.b #$22 : BEQ .failed
LDA $0C4C : CMP #$22 : BEQ .failed LDA.w AncillaID+2 : CMP.b #$22 : BEQ .failed
LDA $0C4D : CMP #$22 : BEQ .failed LDA.w AncillaID+3 : CMP.b #$22 : BEQ .failed
LDA $0C4E : CMP #$22 : BEQ .failed LDA.w AncillaID+4 : CMP.b #$22 : BEQ .failed
LDA $0C4F : CMP #$22 : BEQ .failed LDA.w AncillaID+5 : CMP.b #$22 : BEQ .failed
JML.l ConsumingFire_TransmuteToSkullWoodsFire_continue JML ConsumingFire_TransmuteToSkullWoodsFire_continue
.failed .failed
JML.l AddDoorDebris_spawn_failed JML AddDoorDebris_spawn_failed
} }

View File

@@ -3,7 +3,7 @@ PreOverworld_LoadProperties_ChooseMusic:
; A: scratch space (value never used) ; A: scratch space (value never used)
; Y: set to overworld animated tileset ; Y: set to overworld animated tileset
; X: set to music track/command id ; X: set to music track/command id
JSL.l FixFrogSmith ; Just a convenient spot to install this hook JSL FixFrogSmith ; Just a convenient spot to install this hook
LDY.b #$58 ; death mountain animated tileset. LDY.b #$58 ; death mountain animated tileset.
@@ -79,7 +79,7 @@ PreOverworld_LoadProperties_ChooseMusic:
LDX.b #$F3 LDX.b #$F3
+ +
JML.l PreOverworld_LoadProperties_SetSong JML PreOverworld_LoadProperties_SetSong
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -103,8 +103,8 @@ Overworld_FinishMirrorWarp:
LDA.w #$0000 : STA.l FadeTimer : STA.l FadeDirection LDA.w #$0000 : STA.l FadeTimer : STA.l FadeDirection
SEP #$20 SEP #$20
JSL $80D7C8 JSL ReloadPreviouslyLoadedSheets
LDA.b #$80 : STA.b HDMAENQ LDA.b #$80 : STA.b HDMAENABLEQ
LDX.b #$04 ; bunny theme LDX.b #$04 ; bunny theme
; if not inverted and light world, or inverted and dark world, skip moon pearl check ; if not inverted and light world, or inverted and dark world, skip moon pearl check
@@ -265,24 +265,24 @@ Overworld_MosaicDarkWorldChecks:
; ;
; On entry, A=16bit XY=8bit, A & X safe to mod, Y unknown ; On entry, A=16bit XY=8bit, A & X safe to mod, Y unknown
Underworld_DoorDown_Entry: Underworld_DoorDown_Entry:
LDX #$FF ; some junk value to be used later to determine if the below lines will change the track LDX.b #$FF ; some junk value to be used later to determine if the below lines will change the track
LDA.l ProgressIndicator : AND.w #$00FF : CMP.w #2 : !BLT .vanilla LDA.l ProgressIndicator : AND.w #$00FF : CMP.w #2 : !BLT .vanilla
LDA.l DRMode : BNE .done LDA.l DRMode : BNE .done
.vanilla ; thing we wrote over .vanilla ; thing we wrote over
LDA $A0 : CMP.w #$0012 : BNE + LDA.b RoomIndex : CMP.w #$0012 : BNE +
LDX.b #$14 ; value for Sanc music LDX.b #$14 ; value for Sanc music
BRA .done BRA .done
+ LDA $A2 : CMP.w #$0012 : BNE .done + LDA.b PreviousRoom : CMP.w #$0012 : BNE .done
LDX.b #$10 ; value for Hyrule Castle music LDX.b #$10 ; value for Hyrule Castle music
.done .done
LDA $A0 : RTL LDA.b RoomIndex : RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Check if the boss in ToH has been defeated (16-bit accumulator) ; Check if the boss in ToH has been defeated (16-bit accumulator)
CheckHeraBossDefeated: CheckHeraBossDefeated:
LDA RoomDataWRAM[$07].high : AND.w #$00FF : BEQ + LDA.l RoomDataWRAM[$07].high : AND.w #$00FF : BEQ +
SEC : RTL SEC : RTL
+ CLC : RTL + CLC : RTL

View File

@@ -129,7 +129,7 @@ NewHUD_DrawDungeonCounters:
LDA.w UpdateHUDFlag : BEQ NewHUD_DrawPrizeIcon LDA.w UpdateHUDFlag : BEQ NewHUD_DrawPrizeIcon
LDA.l CompassMode : ORA.l MapHUDMode : BIT.b #$03 : BEQ NewHUD_DrawPrizeIcon LDA.l CompassMode : ORA.l MapHUDMode : BIT.b #$03 : BEQ NewHUD_DrawPrizeIcon
LDX.b IndoorsFlag : BNE + LDX.b IndoorsFlag : BNE +
JMP.w NewHUD_DrawMagicMeter JMP NewHUD_DrawMagicMeter
+ +
SEP #$30 SEP #$30
; extra hard safeties for getting dungeon ID to prevent crashes ; extra hard safeties for getting dungeon ID to prevent crashes
@@ -139,10 +139,10 @@ NewHUD_DrawDungeonCounters:
LSR : TAY LSR : TAY
PHX : PHY PHX : PHY
JSR.w DrawCompassCounts JSR DrawCompassCounts
SEP #$10 SEP #$10
PLY : PLX PLY : PLX
JSR.w DrawMapCounts JSR DrawMapCounts
;================================================================================ ;================================================================================
NewHUD_DrawPrizeIcon: NewHUD_DrawPrizeIcon:
@@ -213,10 +213,10 @@ NewHUD_DrawItemCounter:
LDA.w TotalItemCountTiles+$06 : STA.w HUDGoalIndicator+$0E LDA.w TotalItemCountTiles+$06 : STA.w HUDGoalIndicator+$0E
LDA.w TotalItemCounter LDA.w TotalItemCounter
JSR.w HUDHex4Digit JSR HUDHex4Digit
LDA.b $05 : TAX : STX.w HUDGoalIndicator+$02 LDA.b Scrap05 : TAX : STX.w HUDGoalIndicator+$02
LDA.b $06 : TAX : STX.w HUDGoalIndicator+$04 LDA.b Scrap06 : TAX : STX.w HUDGoalIndicator+$04
LDA.b $07 : TAX : STX.w HUDGoalIndicator+$06 LDA.b Scrap07 : TAX : STX.w HUDGoalIndicator+$06
REP #$20 : LDA.w TotalItemCounter REP #$20 : LDA.w TotalItemCounter
LDX.w #!BlankTile LDX.w #!BlankTile
CMP.w #100 : BCS NewHUD_DrawMagicMeter : STX.w HUDGoalIndicator+$02 CMP.w #100 : BCS NewHUD_DrawMagicMeter : STX.w HUDGoalIndicator+$02
@@ -230,11 +230,11 @@ NewHUD_DrawItemCounter:
LDA.w TotalItemCountTiles+$06 : STA.w HUDGoalIndicator+$10 LDA.w TotalItemCountTiles+$06 : STA.w HUDGoalIndicator+$10
LDA.w TotalItemCounter LDA.w TotalItemCounter
JSR.w HUDHex4Digit JSR HUDHex4Digit
LDA.b $04 : TAX : STX.w HUDGoalIndicator+$00 LDA.b Scrap04 : TAX : STX.w HUDGoalIndicator+$00
LDA.b $05 : TAX : STX.w HUDGoalIndicator+$02 LDA.b Scrap05 : TAX : STX.w HUDGoalIndicator+$02
LDA.b $06 : TAX : STX.w HUDGoalIndicator+$04 LDA.b Scrap06 : TAX : STX.w HUDGoalIndicator+$04
LDA.b $07 : TAX : STX.w HUDGoalIndicator+$06 LDA.b Scrap07 : TAX : STX.w HUDGoalIndicator+$06
REP #$20 : LDA.w TotalItemCounter REP #$20 : LDA.w TotalItemCounter
LDX.w #!BlankTile LDX.w #!BlankTile
CMP.w #1000 : BCS NewHUD_DrawMagicMeter : STX.w HUDGoalIndicator+$00 CMP.w #1000 : BCS NewHUD_DrawMagicMeter : STX.w HUDGoalIndicator+$00
@@ -457,8 +457,8 @@ UpdateHearts:
TAY TAY
LDA.w #HUDTileMapBuffer+$068 LDA.w #HUDTileMapBuffer+$068
STA.b $07 STA.b Scrap07
STA.b $09 STA.b Scrap09
.next_filled_heart .next_filled_heart
CPX.b #$01 CPX.b #$01
@@ -477,12 +477,12 @@ UpdateHearts:
INC INC
.add_heart .add_heart
STA.b ($07) STA.b (Scrap07)
DEY DEY
DEX DEX
LDA.b $07 LDA.b Scrap07
INC INC
INC INC
CMP.w #HUDTileMapBuffer+$07C CMP.w #HUDTileMapBuffer+$07C
@@ -495,12 +495,12 @@ UpdateHearts:
ADC.w #$002B ADC.w #$002B
.fine .fine
STA.b $07 STA.b Scrap07
CPY.b #$00 CPY.b #$00
BNE .next_filled_heart BNE .next_filled_heart
STA.b $09 STA.b Scrap09
BRA .next_filled_heart BRA .next_filled_heart
.done_hearts .done_hearts
@@ -513,14 +513,14 @@ UpdateHearts:
LDA.l HUDHeartColors_index : ASL : TAX LDA.l HUDHeartColors_index : ASL : TAX
LDA.l HUDHeartColors_masks_game_hud,X LDA.l HUDHeartColors_masks_game_hud,X
ORA.w #$20A1 ORA.w #$20A1
STA.b ($09) STA.b (Scrap09)
BRA .skip_partial BRA .skip_partial
.more_than_half .more_than_half
LDA.l HUDHeartColors_index : ASL : TAX LDA.l HUDHeartColors_index : ASL : TAX
LDA.l HUDHeartColors_masks_game_hud,X LDA.l HUDHeartColors_masks_game_hud,X
ORA.w #$20A0 ORA.w #$20A0
STA.b ($09) STA.b (Scrap09)
.skip_partial .skip_partial
SEP #$30 SEP #$30

View File

@@ -71,7 +71,7 @@ macro ProgrammableItemLogic(index)
LDA.l ProgrammableItemLogicPointer_<index>+2 : BNE ?jump LDA.l ProgrammableItemLogicPointer_<index>+2 : BNE ?jump
BRA ?end BRA ?end
?jump: ?jump:
JSL.l ProgrammableItemLogicJump_<index> JSL ProgrammableItemLogicJump_<index>
?end: ?end:
endmacro endmacro
@@ -89,23 +89,23 @@ ProcessEventItems:
CMP.b #$E0 : BNE + CMP.b #$E0 : BNE +
REP #$30 ; set 16-bit accumulator & index registers REP #$30 ; set 16-bit accumulator & index registers
LDA.l RNGItem : ASL : TAX LDA.l RNGItem : ASL : TAX
LDA.l EventDataOffsets, X : !ADD #EventDataTable : STA.b Scrap00 LDA.l EventDataOffsets, X : !ADD.l #EventDataTable : STA.b Scrap00
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
LDA.b #$AF : STA.b Scrap02 LDA.b #$AF : STA.b Scrap02
JSL.l LoadDialogAddressIndirect JSL LoadDialogAddressIndirect
LDA.l RNGItem : INC : STA.l RNGItem LDA.l RNGItem : INC : STA.l RNGItem
SEP #$10 ; set 8-bit index registers SEP #$10 ; set 8-bit index registers
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA.l GoalItemRequirement : BEQ ++ LDA.l GoalItemRequirement : BEQ ++
LDA.l GoalCounter : INC : STA.l GoalCounter LDA.l GoalCounter : INC : STA.l GoalCounter
CMP.l GoalItemRequirement : BCC ++ CMP.l GoalItemRequirement : BCC ++
LDA.l TurnInGoalItems : AND.w #$00FF : BNE ++ LDA.l TurnInGoalItems : AND.w #$00FF : BNE ++
JSL.l ActivateGoal JSL ActivateGoal
++ ++
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
LDX.b #$01 : BRA .done LDX.b #$01 : BRA .done
+ +
LDX.b #$00 LDX.b #$00
@@ -119,26 +119,26 @@ RTS
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
AddReceivedItemExpanded: AddReceivedItemExpanded:
PHA : PHX PHA : PHX
LDA.l RemoteItems : BEQ + : LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ + LDA.l RemoteItems : BEQ + : LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
LDA.w ItemReceiptMethod : BEQ ++ : CMP.b #$03 : BNE +++ : ++ LDA.w ItemReceiptMethod : BEQ ++ : CMP.b #$03 : BNE +++ : ++
; fromTextOrObject ; fromTextOrObject
LDA.w $0345 : BEQ ++ : LDA.b #$04 : ++ : STA.b $5D ; Restore Link to his swimming state LDA.w $0345 : BEQ ++ : LDA.b #$04 : ++ : STA.b LinkState ; Restore Link to his swimming state
STZ.w ItemReceiptPose : STZ.w NoDamage : STZ.w CutsceneFlag STZ.w ItemReceiptPose : STZ.w NoDamage : STZ.w CutsceneFlag
LDA.b #$0E : STA.w SFX3 LDA.b #$0E : STA.w SFX3
+++ +++
STZ.w ItemReceiptID : STZ.w $02D9 : STZ.w ItemReceiptMethod STZ.w ItemReceiptID : STZ.w ItemReceiptID+1 : STZ.w ItemReceiptMethod
PHY : LDY.b #$00 : JSL AddInventory : PLY PHY : LDY.b #$00 : JSL AddInventory : PLY
PLX : PLA : RTL PLX : PLA : RTL
+ PLX : PLA + PLX : PLA
JSR.w ResolveReceipt JSR ResolveReceipt
PHB : PHK PHB : PHK
JML AddReceivedItem+2 JML AddReceivedItem+2
AddReceivedItemExpandedGetItem: AddReceivedItemExpandedGetItem:
PHX : PHB PHX : PHB
LDA.w ItemReceiptID LDA.w ItemReceiptID
JSL.l FreeDungeonItemNotice JSL FreeDungeonItemNotice
PHA : LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BEQ + PHA : LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
PLA : BRA .done PLA : BRA .done
+ PLA + PLA
@@ -151,9 +151,9 @@ RTL
ItemBehavior: ItemBehavior:
REP #$30 REP #$30
AND #$00FF : ASL : TAX AND.w #$00FF : ASL : TAX
SEP #$20 SEP #$20
JMP.w (ItemReceipts_behavior,X) JMP (ItemReceipts_behavior,X)
.skip .skip
RTS RTS
@@ -266,7 +266,7 @@ ItemBehavior:
RTS RTS
.bow .bow
BIT #$40 : BNE .silversbow BIT.b #$40 : BNE .silversbow
LDA.b #$01 : STA.l BowEquipment LDA.b #$01 : STA.l BowEquipment
RTS RTS
@@ -284,11 +284,11 @@ ItemBehavior:
TAX TAX
LDA.l DungeonItemMasks,X : TAY LDA.l DungeonItemMasks,X : TAY
ORA.l CompassField : STA.l CompassField ORA.l CompassField : STA.l CompassField
JMP.w .increment_compass JMP .increment_compass
..hc_sewers ..hc_sewers
LDA.w #$C000 : TAY LDA.w #$C000 : TAY
ORA.l CompassField : STA.l CompassField ORA.l CompassField : STA.l CompassField
JMP.w .increment_compass JMP .increment_compass
.dungeon_bigkey .dungeon_bigkey
@@ -296,10 +296,10 @@ ItemBehavior:
LDA.w DungeonID : CMP.w #$0003 : BCC ..hc_sewers LDA.w DungeonID : CMP.w #$0003 : BCC ..hc_sewers
TAX TAX
LDA.l DungeonItemMasks,X : ORA.l BigKeyField : STA.l BigKeyField LDA.l DungeonItemMasks,X : ORA.l BigKeyField : STA.l BigKeyField
JMP.w .increment_bigkey JMP .increment_bigkey
..hc_sewers ..hc_sewers
LDA.w #$C000 : ORA.l BigKeyField : STA.l BigKeyField LDA.w #$C000 : ORA.l BigKeyField : STA.l BigKeyField
JMP.w .increment_bigkey JMP .increment_bigkey
.dungeon_map .dungeon_map
REP #$20 REP #$20
@@ -307,11 +307,11 @@ ItemBehavior:
TAX TAX
LDA.l DungeonItemMasks,X : TAY LDA.l DungeonItemMasks,X : TAY
ORA.l MapField : STA.l MapField ORA.l MapField : STA.l MapField
JMP.w .increment_map JMP .increment_map
..hc_sewers ..hc_sewers
LDA.w #$C000 : TAY LDA.w #$C000 : TAY
ORA.l MapField : STA.l MapField ORA.l MapField : STA.l MapField
JMP.w .increment_map JMP .increment_map
.bow_and_arrows .bow_and_arrows
LDA.l BowTracking : BIT.b #$40 : BEQ .no_silvers LDA.l BowTracking : BIT.b #$40 : BEQ .no_silvers
@@ -429,7 +429,7 @@ ItemBehavior:
RTS RTS
.rupoor .rupoor
REP #$20 : LDA.l CurrentRupees : !SUB RupoorDeduction : STA.l CurrentRupees : SEP #$20 ; Take 1 rupee REP #$20 : LDA.l CurrentRupees : !SUB.l RupoorDeduction : STA.l CurrentRupees : SEP #$20 ; Take 1 rupee
RTS RTS
.null .null
@@ -457,7 +457,7 @@ ItemBehavior:
RTS RTS
.triforce .triforce
JSL.l ActivateGoal JSL ActivateGoal
RTS RTS
.goal_item .goal_item
@@ -466,25 +466,25 @@ ItemBehavior:
LDA.l GoalCounter : INC : STA.l GoalCounter LDA.l GoalCounter : INC : STA.l GoalCounter
CMP.w GoalItemRequirement : BCC + CMP.w GoalItemRequirement : BCC +
LDA.l TurnInGoalItems : AND.w #$00FF : BNE + LDA.l TurnInGoalItems : AND.w #$00FF : BNE +
JSL.l ActivateGoal JSL ActivateGoal
+ +
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
RTS RTS
.request_F0 .request_F0
JSL.l ItemGetServiceRequest_F0 JSL ItemGetServiceRequest_F0
RTS RTS
.request_F1 .request_F1
JSL.l ItemGetServiceRequest_F1 JSL ItemGetServiceRequest_F1
RTS RTS
.request_F2 .request_F2
JSL.l ItemGetServiceRequest_F2 JSL ItemGetServiceRequest_F2
RTS RTS
.request_async .request_async
; JSL.l ItemGetServiceRequest ; JSL ItemGetServiceRequest
RTS RTS
.free_map .free_map
@@ -495,13 +495,13 @@ ItemBehavior:
LDA.l DungeonItemMasks,X : TAY LDA.l DungeonItemMasks,X : TAY
ORA.l MapField : STA.l MapField ORA.l MapField : STA.l MapField
SEP #$20 SEP #$20
JMP.w .increment_map JMP .increment_map
.hc_map .hc_map
REP #$20 REP #$20
LDA.w #$C000 : TAY LDA.w #$C000 : TAY
ORA.l MapField : STA.l MapField ORA.l MapField : STA.l MapField
JMP.w .increment_map JMP .increment_map
.free_compass .free_compass
REP #$20 REP #$20
@@ -511,14 +511,14 @@ ItemBehavior:
LDA.l DungeonItemMasks,X : TAY LDA.l DungeonItemMasks,X : TAY
ORA.l CompassField : STA.l CompassField ORA.l CompassField : STA.l CompassField
SEP #$20 SEP #$20
JMP.w .increment_compass JMP .increment_compass
.hc_compass .hc_compass
REP #$20 REP #$20
LDA.w #$C000 : TAY LDA.w #$C000 : TAY
ORA.l CompassField : STA.l CompassField ORA.l CompassField : STA.l CompassField
SEP #$20 SEP #$20
JMP.w .increment_compass JMP .increment_compass
.free_bigkey .free_bigkey
REP #$20 REP #$20
@@ -527,11 +527,11 @@ ItemBehavior:
LDA.w DungeonItemIDMap,X : TAX LDA.w DungeonItemIDMap,X : TAX
LDA.l DungeonItemMasks,X : ORA.l BigKeyField : STA.l BigKeyField LDA.l DungeonItemMasks,X : ORA.l BigKeyField : STA.l BigKeyField
SEP #$20 SEP #$20
JMP.w .increment_bigkey JMP .increment_bigkey
.hc_bigkey .hc_bigkey
LDA.b #$C0 : ORA.l BigKeyField+1 : STA.l BigKeyField+1 LDA.b #$C0 : ORA.l BigKeyField+1 : STA.l BigKeyField+1
JMP.w .increment_bigkey JMP .increment_bigkey
.free_smallkey .free_smallkey
REP #$20 REP #$20
@@ -606,7 +606,7 @@ ItemBehavior:
LDA.l MapsCompasses LDA.l MapsCompasses
CLC : ADC.b #$10 CLC : ADC.b #$10
STA.l MapsCompasses STA.l MapsCompasses
JSL.l MaybeFlagMapTotalPickup JSL MaybeFlagMapTotalPickup
+ +
RTS RTS
@@ -661,42 +661,42 @@ ItemBehavior:
.bee_trap .bee_trap
SEP #$30 SEP #$30
LDA.b #$79 : JSL Sprite_SpawnDynamically : BMI + ; DashBeeHive_SpawnBee LDA.b #$79 : JSL Sprite_SpawnDynamically : BMI + ; DashBeeHive_SpawnBee
LDA $22 : CLC : ADC.b #$03 : AND.b #$F8 : STA $0D10,Y LDA.b LinkPosX : CLC : ADC.b #$03 : AND.b #$F8 : STA.w SpritePosXLow,Y
LDA $23 : ADC.b #$00 : STA $0D30,Y ; round X to nearest 8 LDA.b LinkPosX+1 : ADC.b #$00 : STA.w SpritePosXHigh,Y ; round X to nearest 8
LDA $20 : STA $0D00, Y : LDA $21 : STA $0D20, Y LDA.b LinkPosY : STA.w SpritePosYLow, Y : LDA.b LinkPosY+1 : STA.w SpritePosYHigh, Y
LDA.b $EE : STA.w $0F20,Y ; spawns on same layer as link LDA.b LinkLayer : STA.w SpriteLayer,Y ; spawns on same layer as link
+ RTS + RTS
.fairy .fairy
SEP #$30 SEP #$30
LDA.b #$E3 : JSL Sprite_SpawnDynamically : BMI + LDA.b #$E3 : JSL Sprite_SpawnDynamically : BMI +
LDA $22 : CLC : ADC.b #$03 : AND.b #$F8 : STA $0D10,Y LDA.b LinkPosX : CLC : ADC.b #$03 : AND.b #$F8 : STA.w SpritePosXLow,Y
LDA $23 : ADC.b #$00 : STA $0D30,Y ; round X to nearest 8 LDA.b LinkPosX+1 : ADC.b #$00 : STA.w SpritePosXHigh,Y ; round X to nearest 8
LDA.b $20 : SEC : SBC.b #$10 : STA.w $0D00,Y LDA.b LinkPosY : SEC : SBC.b #$10 : STA.w SpritePosYLow,Y
LDA.b $21 : SBC.b #$00 : STA.w $0D20,Y ; move up 16 pixels LDA.b LinkPosY+1 : SBC.b #$00 : STA.w SpritePosYHigh,Y ; move up 16 pixels
LDA.b $EE : STA.w $0F20,Y ; spawns on same layer as link LDA.b LinkLayer : STA.w SpriteLayer,Y ; spawns on same layer as link
LDA.b #$FF : STA.w $0B58,Y ; allows them to expire LDA.b #$FF : STA.w EnemyStunTimer,Y ; allows them to expire
+ RTS + RTS
.chicken .chicken
SEP #$30 SEP #$30
LDA.b #$0B : JSL Sprite_SpawnDynamically : BMI + LDA.b #$0B : JSL Sprite_SpawnDynamically : BMI +
LDA $22 : CLC : ADC.b #$03 : AND.b #$F8 : STA $0D10,Y LDA.b LinkPosX : CLC : ADC.b #$03 : AND.b #$F8 : STA.w SpritePosXLow,Y
LDA $23 : ADC.b #$00 : STA $0D30,Y ; round X to nearest 8 LDA.b LinkPosX+1 : ADC.b #$00 : STA.w SpritePosXHigh,Y ; round X to nearest 8
LDA.b $20 : SEC : SBC.b #$08 : STA.w $0D00,Y LDA.b LinkPosY : SEC : SBC.b #$08 : STA.w SpritePosYLow,Y
LDA.b $21 : SBC.b #$00 : STA.w $0D20,Y ; move up 8 pixels LDA.b LinkPosY+1 : SBC.b #$00 : STA.w SpritePosYHigh,Y ; move up 8 pixels
LDA.b $EE : STA.w $0F20,Y ; spawns on same layer as link LDA.b LinkLayer : STA.w SpriteLayer,Y ; spawns on same layer as link
+ RTS + RTS
ResolveReceipt: ResolveReceipt:
PHA : PHX PHA : PHX
PHK : PLB PHK : PLB
JSL.l PreItemGet JSL PreItemGet
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID LDA.l !MULTIWORLD_ITEM_PLAYER_ID : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.w ItemReceiptID : STA.l !MULTIWORLD_ITEM_ID LDA.w ItemReceiptID : STA.l !MULTIWORLD_ITEM_ID
JSL.l AttemptItemSubstitution JSL AttemptItemSubstitution
JSR.w HandleBowTracking JSR HandleBowTracking
JSR.w ResolveLootID JSR ResolveLootID
STA.w ItemReceiptID STA.w ItemReceiptID
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE + LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE +
LDA.w ItemReceiptID LDA.w ItemReceiptID
@@ -707,7 +707,7 @@ ResolveReceipt:
ResolveLootIDLong: ResolveLootIDLong:
PHY PHY
JSR.w ResolveLootID JSR ResolveLootID
PLY PLY
RTL RTL
@@ -723,30 +723,30 @@ ResolveLootID:
REP #$30 REP #$30
AND.w #$00FF : ASL : TAX AND.w #$00FF : ASL : TAX
TYA TYA
JMP.w (ItemReceipts_resolution,X) JMP (ItemReceipts_resolution,X)
.have_item .have_item
SEP #$30 SEP #$30
PLB : PLX PLB : PLX
RTS RTS
.skip .skip
JMP.w .have_item JMP .have_item
.bottles .bottles
SEP #$30 SEP #$30
JSR.w CountBottles : CMP.l BottleLimit : BCC + JSR CountBottles : CMP.l BottleLimit : BCC +
LDA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE + LDA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE +
LDA.l BottleLimitReplacement LDA.l BottleLimitReplacement
JMP.w .get_item JMP .get_item
+ +
TYA TYA
JMP.w .have_item JMP .have_item
.magic .magic
SEP #$20 SEP #$20
LDA.l MagicConsumption : TAX LDA.l MagicConsumption : TAX
LDA.w .magic_ids,X LDA.w .magic_ids,X
JMP.w .have_item JMP .have_item
..ids ..ids
db $4E, $4F, $4F db $4E, $4F, $4F
@@ -756,28 +756,28 @@ ResolveLootID:
LDA.l HighestSword LDA.l HighestSword
CMP.l ProgressiveSwordLimit : BCC + CMP.l ProgressiveSwordLimit : BCC +
LDA.l ProgressiveSwordReplacement LDA.l ProgressiveSwordReplacement
JMP.w .get_item JMP .get_item
++ LDA.l SwordEquipment ++ LDA.l SwordEquipment
+ +
TAX TAX
LDA.w .prog_sword_ids,X LDA.w .prog_sword_ids,X
JMP.w .have_item JMP .have_item
..ids ..ids
db $49, $50, $02, $03, $03 db $49, $50, $02, $03, $03
.shields .shields
SEP #$20 SEP #$20
LDA !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE ++ LDA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE ++
LDA.b #$01 : STA.l ProgressiveFlag LDA.b #$01 : STA.l ProgressiveFlag
LDA.l HighestShield LDA.l HighestShield
CMP.l ProgressiveShieldLimit : BCC + CMP.l ProgressiveShieldLimit : BCC +
LDA.l ProgressiveShieldReplacement LDA.l ProgressiveShieldReplacement
JMP.w .get_item JMP .get_item
++ LDA.l HighestShield ++ LDA.l HighestShield
+ +
TAX TAX
LDA.w .shields_ids,X LDA.w .shields_ids,X
JMP.w .have_item JMP .have_item
..ids ..ids
db $04, $05, $06, $06 db $04, $05, $06, $06
@@ -787,12 +787,12 @@ ResolveLootID:
LDA.l HighestMail LDA.l HighestMail
CMP.l ProgressiveArmorLimit : BCC + CMP.l ProgressiveArmorLimit : BCC +
LDA.l ProgressiveArmorReplacement LDA.l ProgressiveArmorReplacement
JMP.w .get_item JMP .get_item
+ +
++ LDA.l ArmorEquipment ++ LDA.l ArmorEquipment
TAX TAX
LDA.w .armor_ids,X LDA.w .armor_ids,X
JMP.w .have_item JMP .have_item
..ids ..ids
db $22, $23, $23 db $22, $23, $23
@@ -801,7 +801,7 @@ ResolveLootID:
SEP #$20 SEP #$20
LDA.l GloveEquipment : TAX LDA.l GloveEquipment : TAX
LDA.w .gloves_ids,X LDA.w .gloves_ids,X
JMP.w .have_item JMP .have_item
..ids ..ids
db $1B, $1C, $1C db $1B, $1C, $1C
@@ -812,7 +812,7 @@ ResolveLootID:
LDA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE .skipbowlimit LDA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE .skipbowlimit
LDA.l BowEquipment : INC : LSR : CMP.l ProgressiveBowLimit : BCC + LDA.l BowEquipment : INC : LSR : CMP.l ProgressiveBowLimit : BCC +
LDA.l ProgressiveBowReplacement LDA.l ProgressiveBowReplacement
JMP.w .get_item JMP .get_item
+ +
LDA.w ItemReceiptMethod : CMP.b #$01 : BEQ + LDA.w ItemReceiptMethod : CMP.b #$01 : BEQ +
LDX.w CurrentSpriteSlot LDX.w CurrentSpriteSlot
@@ -821,14 +821,14 @@ ResolveLootID:
.skipbowlimit .skipbowlimit
LDA.l BowEquipment : TAX LDA.l BowEquipment : TAX
LDA.w ResolveLootID_bows_ids,X LDA.w ResolveLootID_bows_ids,X
JMP.w .get_item JMP .get_item
.progressive_bow_2 .progressive_bow_2
SEP #$30 SEP #$30
LDA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE .skipbowlimit_2 LDA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE .skipbowlimit_2
LDA.l BowEquipment : INC : LSR : CMP.l ProgressiveBowLimit : BCC + LDA.l BowEquipment : INC : LSR : CMP.l ProgressiveBowLimit : BCC +
LDA.l ProgressiveBowReplacement LDA.l ProgressiveBowReplacement
JMP.w .get_item JMP .get_item
+ +
LDA.w ItemReceiptMethod : CMP.b #$01 : BEQ + LDA.w ItemReceiptMethod : CMP.b #$01 : BEQ +
LDX.w CurrentSpriteSlot LDX.w CurrentSpriteSlot
@@ -837,7 +837,7 @@ ResolveLootID:
+ +
LDA.l BowEquipment : TAX LDA.l BowEquipment : TAX
LDA.w ResolveLootID_bows_ids,X LDA.w ResolveLootID_bows_ids,X
JMP.w .get_item JMP .get_item
.bows .bows
..ids ..ids
@@ -845,18 +845,18 @@ ResolveLootID:
.null_chest .null_chest
; JSL ChestItemServiceRequest ; JSL ChestItemServiceRequest
JMP.w .have_item JMP .have_item
.rng_single .rng_single
JSL.l GetRNGItemSingle : STA.w ScratchBufferV+6 JSL GetRNGItemSingle : STA.w ScratchBufferV+6
XBA : JSR.w MarkRNGItemSingle XBA : JSR MarkRNGItemSingle
LDA.b #$FF : STA.l RNGLockIn ; clear lock-in LDA.b #$FF : STA.l RNGLockIn ; clear lock-in
LDA.w ScratchBufferV+6 : JMP.w .get_item LDA.w ScratchBufferV+6 : JMP .get_item
.rng_multi .rng_multi
JSL.l GetRNGItemMulti : STA.w ScratchBufferV+6 JSL GetRNGItemMulti : STA.w ScratchBufferV+6
LDA.b #$FF : STA.l RNGLockIn ; clear lock-in LDA.b #$FF : STA.l RNGLockIn ; clear lock-in
LDA.w ScratchBufferV+6 : JMP.w .get_item LDA.w ScratchBufferV+6 : JMP .get_item
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DungeonItemMasks: DungeonItemMasks:
@@ -925,16 +925,16 @@ RTS
CheckHUDSilverArrows: CheckHUDSilverArrows:
LDA.l ArrowMode : BNE .rupee_bow LDA.l ArrowMode : BNE .rupee_bow
LDA.l BowEquipment : TAX : BEQ .nobow LDA.l BowEquipment : TAX : BEQ .nobow
JSL.l DrawHUDArrows_normal JSL DrawHUDArrows_normal
TXA TXA
RTL RTL
.rupee_bow .rupee_bow
LDA.l BowEquipment : TAX LDA.l BowEquipment : TAX
JSL.l DrawHUDArrows_rupee_arrows JSL DrawHUDArrows_rupee_arrows
TXA TXA
RTL RTL
.nobow .nobow
JSL.l DrawHUDArrows_silverscheck JSL DrawHUDArrows_silverscheck
TXA TXA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -976,7 +976,7 @@ GetRNGItemSingle:
LDA.l RNGLockIn : CMP.b #$FF : BEQ + : TAX : XBA : LDA.l RNGSingleItemTable, X : RTL : + LDA.l RNGLockIn : CMP.b #$FF : BEQ + : TAX : XBA : LDA.l RNGSingleItemTable, X : RTL : +
LDX.b #$00 LDX.b #$00
.single_reroll .single_reroll
JSL.l GetRandomInt : AND.b #$7F ; select random value JSL GetRandomInt : AND.b #$7F ; select random value
INX : CPX.b #$7F : BCC + : LDA.b #$00 : BRA +++ : + ; default to 0 if too many attempts INX : CPX.b #$7F : BCC + : LDA.b #$00 : BRA +++ : + ; default to 0 if too many attempts
CMP.l RNGSingleTableSize : !BGE .single_reroll CMP.l RNGSingleTableSize : !BGE .single_reroll
+++ +++
@@ -986,7 +986,7 @@ GetRNGItemSingle:
TAY TAY
.recheck .recheck
TYA TYA
JSR.w CheckSingleItem : BEQ .single_unused ; already used JSR CheckSingleItem : BEQ .single_unused ; already used
LDA.w ScratchBufferV : INC ; increment index LDA.w ScratchBufferV : INC ; increment index
CMP.l RNGSingleTableSize : BCC +++ : LDA.b #$00 : +++ ; rollover index if needed CMP.l RNGSingleTableSize : BCC +++ : LDA.b #$00 : +++ ; rollover index if needed
STA.w ScratchBufferV ; store index STA.w ScratchBufferV ; store index
@@ -1041,7 +1041,7 @@ GetRNGItemMulti:
LDA.l RNGLockIn : CMP.b #$FF : BEQ + : TAX : XBA : LDA.l RNGMultiItemTable, X : RTL : + LDA.l RNGLockIn : CMP.b #$FF : BEQ + : TAX : XBA : LDA.l RNGMultiItemTable, X : RTL : +
LDX.b #$00 LDX.b #$00
- ; reroll - ; reroll
JSL.l GetRandomInt : AND.b #$7F ; select random value JSL GetRandomInt : AND.b #$7F ; select random value
INX : CPX.b #$7F : BCC + : LDA.b 00 : BRA .done : + ; default to 0 if too many attempts INX : CPX.b #$7F : BCC + : LDA.b 00 : BRA .done : + ; default to 0 if too many attempts
CMP.l RNGMultiTableSize : !BGE - CMP.l RNGMultiTableSize : !BGE -
.done .done
@@ -1108,13 +1108,13 @@ RTS
ActivateGoal: ActivateGoal:
STZ.b GameSubMode STZ.b GameSubMode
STZ.b SubSubModule STZ.b SubSubModule
JML.l StatsFinalPrep JML StatsFinalPrep
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ChestPrep: ChestPrep:
LDA.b #$01 : STA.w ItemReceiptMethod LDA.b #$01 : STA.w ItemReceiptMethod
JSL.l IncrementChestCounter JSL IncrementChestCounter
LDA.l ServerRequestMode : BEQ + LDA.l ServerRequestMode : BEQ +
JSL.l ChestItemServiceRequest JSL ChestItemServiceRequest
RTL RTL
+ +
LDY.b Scrap0C ; get item value LDY.b Scrap0C ; get item value
@@ -1156,11 +1156,11 @@ MaybeFlagDungeonTotalsEntrance:
REP #$10 REP #$10
LDA.l DungeonItemMasks,X : TAY LDA.l DungeonItemMasks,X : TAY
LDA.l CompassMode : AND.w #$000F : BEQ .maps ; Skip if we're not showing compass counts LDA.l CompassMode : AND.w #$000F : BEQ .maps ; Skip if we're not showing compass counts
JSR.w FlagCompassCount JSR FlagCompassCount
.maps .maps
; LDA.l MapHUDMode : AND.w #$000F : BEQ .done ; LDA.l MapHUDMode : AND.w #$000F : BEQ .done
LDX.w DungeonID LDX.w DungeonID
JSR.w FlagMapCount JSR FlagMapCount
.done .done
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -1201,5 +1201,3 @@ dw $0000 ; Sewers
PendantMasks: PendantMasks:
db $04, 01, 02 db $04, 01, 02

View File

@@ -56,7 +56,7 @@ ItemCheck_TreeKid2:
RTL RTL
ItemCheck_TreeKid3: ItemCheck_TreeKid3:
JSL $8DD030 ; FluteAardvark_Draw - thing we wrote over JSL SpriteDraw_Stumpy ; thing we wrote over
LDA.l NpcFlags : AND.b #$08 LDA.l NpcFlags : AND.b #$08
BNE .done BNE .done
LDA.b #$05 LDA.b #$05
@@ -98,8 +98,8 @@ ItemSet_MagicBat:
RTL RTL
ItemSet_OldMan: ItemSet_OldMan:
PHA : LDA OldManItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA PHA : LDA.l OldManItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over JSL Link_ReceiveItem ; thing we wrote over
PHA : LDA.l NpcFlags : ORA.b #$01 : STA.l NpcFlags : PLA PHA : LDA.l NpcFlags : ORA.b #$01 : STA.l NpcFlags : PLA
RTL RTL
@@ -108,20 +108,20 @@ ItemSet_ZoraKing:
RTL RTL
ItemSet_SickKid: ItemSet_SickKid:
PHA : LDA SickKidItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA PHA : LDA.l SickKidItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over JSL Link_ReceiveItem ; thing we wrote over
PHA : LDA.l NpcFlags : ORA.b #$04 : STA.l NpcFlags : PLA PHA : LDA.l NpcFlags : ORA.b #$04 : STA.l NpcFlags : PLA
RTL RTL
ItemSet_TreeKid: ItemSet_TreeKid:
PHA : LDA TreeKidItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA PHA : LDA.l TreeKidItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over JSL Link_ReceiveItem ; thing we wrote over
PHA : LDA.l NpcFlags : ORA.b #$08 : STA.l NpcFlags : PLA PHA : LDA.l NpcFlags : ORA.b #$08 : STA.l NpcFlags : PLA
RTL RTL
ItemSet_Sahasrala: ItemSet_Sahasrala:
PHA : LDA SahasralaItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA PHA : LDA.l SahasralaItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over JSL Link_ReceiveItem ; thing we wrote over
PHA : LDA.l NpcFlags : ORA.b #$10 : STA.l NpcFlags : PLA PHA : LDA.l NpcFlags : ORA.b #$10 : STA.l NpcFlags : PLA
RTL RTL
@@ -130,8 +130,8 @@ ItemSet_Catfish:
RTL RTL
ItemSet_Library: ItemSet_Library:
PHA : LDA LibraryItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA PHA : LDA.l LibraryItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID : PLA
JSL.l Link_ReceiveItem ; thing we wrote over JSL Link_ReceiveItem ; thing we wrote over
PHA : LDA.l NpcFlags : ORA.b #$80 : STA.l NpcFlags : PLA PHA : LDA.l NpcFlags : ORA.b #$80 : STA.l NpcFlags : PLA
RTL RTL
@@ -143,7 +143,7 @@ ItemSet_Mushroom:
; if for any reason the item value is 0 reload it, just in case ; if for any reason the item value is 0 reload it, just in case
%GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues) : TAY %GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues) : TAY
+ +
LDA MushroomItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID LDA.l MushroomItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLA PLA
STZ.w ItemReceiptMethod ; thing we wrote over - the mushroom is an npc for item purposes apparently STZ.w ItemReceiptMethod ; thing we wrote over - the mushroom is an npc for item purposes apparently
RTL RTL
@@ -165,19 +165,19 @@ Set300RupeeNPCItem:
CMP.w #291 : BNE + CMP.w #291 : BNE +
%GetPossiblyEncryptedItem(RupeeNPC_MoldormCave, SpriteItemValues) %GetPossiblyEncryptedItem(RupeeNPC_MoldormCave, SpriteItemValues)
TAY ; load moldorm cave value into Y TAY ; load moldorm cave value into Y
LDA RupeeNPC_MoldormCave_Player LDA.l RupeeNPC_MoldormCave_Player
BRA .done BRA .done
+ CMP.w #286 : BNE + + CMP.w #286 : BNE +
%GetPossiblyEncryptedItem(RupeeNPC_NortheastDarkSwampCave, SpriteItemValues) %GetPossiblyEncryptedItem(RupeeNPC_NortheastDarkSwampCave, SpriteItemValues)
TAY ; load northeast dark swamp cave value into Y TAY ; load northeast dark swamp cave value into Y
LDA RupeeNPC_NortheastDarkSwampCave_Player LDA.l RupeeNPC_NortheastDarkSwampCave_Player
BRA .done BRA .done
+ +
LDA #$0000 LDA.w #$0000
LDY.b #$46 ; default to a normal 300 rupees LDY.b #$46 ; default to a normal 300 rupees
.done .done
SEP #$20 SEP #$20
STA !MULTIWORLD_ITEM_PLAYER_ID STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLP : PLA PLP : PLA
RTL RTL
@@ -185,30 +185,30 @@ RTL
; Randomize Zora King ; Randomize Zora King
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LoadZoraKingItemGFX: LoadZoraKingItemGFX:
LDA.l ZoraItem_Player : : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID LDA.l ZoraItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.l $9DE1C3 ; location randomizer writes zora item to LDA.l $9DE1C3 ; location randomizer writes zora item to
JSL.l AttemptItemSubstitution JSL AttemptItemSubstitution
JSL.l ResolveLootIDLong JSL ResolveLootIDLong
STA.w SpriteID,Y STA.w SpriteID,Y
TYX TYX
JML.l PrepDynamicTile_loot_resolved JML PrepDynamicTile_loot_resolved
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
JumpToSplashItemTarget: JumpToSplashItemTarget:
LDA.w SpriteMovement, X LDA.w SpriteMovement, X
CMP.b #$FF : BNE + : JML.l SplashItem_SpawnSplash : + CMP.b #$FF : BNE + : JML SplashItem_SpawnSplash : +
CMP.b #$00 : JML.l SplashItem_SpawnOther CMP.b #$00 : JML SplashItem_SpawnOther
;================================================================================ ;================================================================================
; Randomize Catfish ; Randomize Catfish
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LoadCatfishItemGFX: LoadCatfishItemGFX:
LDA.l CatfishItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID LDA.l CatfishItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.l $9DE185 ; location randomizer writes catfish item to LDA.l $9DE185 ; location randomizer writes catfish item to
JSL.l AttemptItemSubstitution JSL AttemptItemSubstitution
JSL.l ResolveLootIDLong JSL ResolveLootIDLong
STA.w SpriteID, Y STA.w SpriteID, Y
TYX TYX
JML.l PrepDynamicTile_loot_resolved JML PrepDynamicTile_loot_resolved
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DrawThrownItem: DrawThrownItem:
LDA.b OverworldIndex : CMP.b #$81 : BNE .catfish LDA.b OverworldIndex : CMP.b #$81 : BNE .catfish

View File

@@ -1,7 +1,7 @@
Module_Password: Module_Password:
LDA.b GameSubMode LDA.b GameSubMode
JSL.l JumpTableLong JSL JumpTableLong
dl Password_BeginInit ; 0 dl Password_BeginInit ; 0
dl Password_EndInit ; 1 dl Password_EndInit ; 1
@@ -10,7 +10,7 @@ Module_Password:
dl Password_Return ; 4 dl Password_Return ; 4
Password_BeginInit: Password_BeginInit:
LDA.b #$80 : STA.w $0710 ;skip animated sprite updates in NMI LDA.b #$80 : STA.w SkipOAM ;skip animated sprite updates in NMI
JSL EnableForceBlank JSL EnableForceBlank
JSL Vram_EraseTilemaps_triforce JSL Vram_EraseTilemaps_triforce
@@ -48,41 +48,41 @@ Password_Main:
JSR PasswordEraseOldCursors JSR PasswordEraseOldCursors
; handle joypad input ; handle joypad input
LDA.b $F6 : AND.b #$10 : BEQ + ; R Button LDA.b Joy1B_New : AND.b #$10 : BEQ + ; R Button
JSR PasswordMoveCursorRight JSR PasswordMoveCursorRight
+ +
LDA.b $F6 : AND.b #$20 : BEQ + ; L Button LDA.b Joy1B_New : AND.b #$20 : BEQ + ; L Button
JSR PasswordMoveCursorLeft JSR PasswordMoveCursorLeft
+ +
LDA.b $F4 : AND.b #$01 : BEQ + ; right LDA.b Joy1A_New : AND.b #$01 : BEQ + ; right
LDA.b PasswordSelectPosition : INC A : CMP.b #$24 : !BLT ++ LDA.b PasswordSelectPosition : INC A : CMP.b #$24 : !BLT ++
!SUB.b #$24 !SUB.b #$24
++ ++
STA.b PasswordSelectPosition STA.b PasswordSelectPosition
LDA.b #$20 : STA.w SFX3 LDA.b #$20 : STA.w SFX3
+ +
LDA.b $F4 : AND.b #$02 : BEQ + ; left LDA.b Joy1A_New : AND.b #$02 : BEQ + ; left
LDA.b PasswordSelectPosition : DEC A : BPL ++ LDA.b PasswordSelectPosition : DEC A : BPL ++
!ADD.b #$24 !ADD.b #$24
++ ++
STA.b PasswordSelectPosition STA.b PasswordSelectPosition
LDA.b #$20 : STA.w SFX3 LDA.b #$20 : STA.w SFX3
+ +
LDA.b $F4 : AND.b #$04 : BEQ + ; down LDA.b Joy1A_New : AND.b #$04 : BEQ + ; down
LDA.b PasswordSelectPosition : !ADD.b #$09 : CMP.b #$24 : !BLT ++ LDA.b PasswordSelectPosition : !ADD.b #$09 : CMP.b #$24 : !BLT ++
!SUB.b #$24 !SUB.b #$24
++ ++
STA.b PasswordSelectPosition STA.b PasswordSelectPosition
LDA.b #$20 : STA.w SFX3 LDA.b #$20 : STA.w SFX3
+ +
LDA.b $F4 : AND.b #$08 : BEQ + ; up LDA.b Joy1A_New : AND.b #$08 : BEQ + ; up
LDA.b PasswordSelectPosition : !SUB.b #$09 : BPL ++ LDA.b PasswordSelectPosition : !SUB.b #$09 : BPL ++
!ADD.b #$24 !ADD.b #$24
++ ++
STA.b PasswordSelectPosition STA.b PasswordSelectPosition
LDA.b #$20 : STA.w SFX3 LDA.b #$20 : STA.w SFX3
+ +
LDA.b $F4 : ORA.b $F6 : AND.b #$C0 : BEQ + ; face button LDA.b Joy1A_New : ORA.b Joy1B_New : AND.b #$C0 : BEQ + ; face button
LDX.b PasswordSelectPosition LDX.b PasswordSelectPosition
LDA.l .selectionValues, X : BPL ++ LDA.l .selectionValues, X : BPL ++
CMP.b #$F0 : BNE +++ CMP.b #$F0 : BNE +++
@@ -111,7 +111,7 @@ Password_Main:
++ ++
LDA.b #$2B : STA.w SFX2 LDA.b #$2B : STA.w SFX2
+ +
LDA.b $F4 : AND.b #$10 : BEQ + ; start LDA.b Joy1A_New : AND.b #$10 : BEQ + ; start
INC.b GameSubMode INC.b GameSubMode
+ +
.endOfButtonChecks .endOfButtonChecks
@@ -129,7 +129,7 @@ db $11, $12, $13, $14, $15, $16, $17, $18, $F2
db $19, $1A, $1B, $1C, $1D, $1E, $1F, $20, $F3 db $19, $1A, $1B, $1C, $1D, $1E, $1F, $20, $F3
Password_Check: Password_Check:
JSL.l ValidatePassword : BNE .correct JSL ValidatePassword : BNE .correct
LDA.b #$3C : STA.w SFX2 ; error LDA.b #$3C : STA.w SFX2 ; error
DEC.b GameSubMode DEC.b GameSubMode
RTL RTL
@@ -184,9 +184,9 @@ ValidatePassword:
LDA.l KnownEncryptedValue+4 : STA.l CryptoBuffer+4 LDA.l KnownEncryptedValue+4 : STA.l CryptoBuffer+4
LDA.l KnownEncryptedValue+6 : STA.l CryptoBuffer+6 LDA.l KnownEncryptedValue+6 : STA.l CryptoBuffer+6
LDA.w #$0002 : STA.b $04 ;set block size LDA.w #$0002 : STA.b Scrap04 ;set block size
JSL.l XXTEA_Decode JSL XXTEA_Decode
SEP #$20 ; 8 bit accumulator SEP #$20 ; 8 bit accumulator
@@ -219,29 +219,29 @@ PasswordToKey:
; $00 input offset ; $00 input offset
; $02 output offset ; $02 output offset
; $04 shift amount ; $04 shift amount
LDA.w #$0000 : STA.b $00 : STA.b $02 LDA.w #$0000 : STA.b Scrap00 : STA.b Scrap02
LDA.w #$000B : STA.b $04 LDA.w #$000B : STA.b Scrap04
- -
LDX.b $00 LDX.b Scrap00
LDA.l PasswordSRAM, X : DEC : AND.w #$001F LDA.l PasswordSRAM, X : DEC : AND.w #$001F
LDY.b $04 LDY.b Scrap04
-- : BEQ + : ASL : DEY : BRA -- : + ; Shift left by Y -- : BEQ + : ASL : DEY : BRA -- : + ; Shift left by Y
XBA XBA
LDX.b $02 LDX.b Scrap02
ORA.l KeyBase, X ORA.l KeyBase, X
STA.l KeyBase, X STA.l KeyBase, X
LDA.b $04 : !SUB.w #$0005 : BPL + LDA.b Scrap04 : !SUB.w #$0005 : BPL +
!ADD.w #$0008 !ADD.w #$0008
INC $02 INC.b Scrap02
+ : STA.b $04 + : STA.b Scrap04
LDA.b $00 : INC : STA.b $00 : CMP.w #$0010 : !BLT - LDA.b Scrap00 : INC : STA.b Scrap00 : CMP.w #$0010 : !BLT -
RTS RTS
LoadPasswordStripeTemplate: LoadPasswordStripeTemplate:
LDA.w DMAP0 : PHA : LDA.w BBAD0 : PHA : LDA.w A1T0L : PHA ; preserve DMA parameters LDA.w DMAP0 : PHA : LDA.w BBAD0 : PHA : LDA.w A1T0L : PHA ; preserve DMA parameters
LDA.w A1T0H : PHA : LDA.w A1B0 : PHA : LDA.w DAS0L : PHA ; preserve DMA parameters LDA.w A1T0H : PHA : LDA.w A1B0 : PHA : LDA.w DAS0L : PHA ; preserve DMA parameters
LDA.w DAS0H : PHA ; preserve DMA parameters LDA.w DAS0H : PHA ; preserve DMA parameters
LDA.b #$00 : STA.w DMAP0 ; set DMA transfer direction A -> B, bus A auto increment, single-byte mode LDA.b #$00 : STA.w DMAP0 ; set DMA transfer direction A -> B, bus A auto increment, single-byte mode
@@ -260,7 +260,7 @@ LoadPasswordStripeTemplate:
LDA.b #Password_StripeImageTemplate_end-Password_StripeImageTemplate>>8 LDA.b #Password_StripeImageTemplate_end-Password_StripeImageTemplate>>8
STA.w DAS0H ; set transfer size STA.w DAS0H ; set transfer size
LDA.b #$01 : STA.w MDMAEN ; begin DMA transfer LDA.b #$01 : STA.w DMAENABLE ; begin DMA transfer
PLA : STA.w DAS0H : PLA : STA.w DAS0L : PLA : STA.w A1B0 ; restore DMA parameters PLA : STA.w DAS0H : PLA : STA.w DAS0L : PLA : STA.w A1B0 ; restore DMA parameters
PLA : STA.w A1T0H : PLA : STA.w A1T0L : PLA : STA.w BBAD0 ; restore DMA parameters PLA : STA.w A1T0H : PLA : STA.w A1T0L : PLA : STA.w BBAD0 ; restore DMA parameters
@@ -332,16 +332,16 @@ UpdatePasswordTiles:
LDX.w #$000F LDX.w #$000F
- -
LDA.l PasswordSRAM, X : AND.w #$00FF : TXY LDA.l PasswordSRAM, X : AND.w #$00FF : TXY
ASL #3 : STA.b $00 ASL #3 : STA.b Scrap00
TYA : ASL #4 : STA.b $03 TYA : ASL #4 : STA.b Scrap03
LDX.b $00 : LDA.l HashAlphabetTilesWithBlank, X LDX.b Scrap00 : LDA.l HashAlphabetTilesWithBlank, X
LDX.b $03 : STA.w $1006, X LDX.b Scrap03 : STA.w $1006, X
LDX.b $00 : LDA.l HashAlphabetTilesWithBlank+$02, X LDX.b Scrap00 : LDA.l HashAlphabetTilesWithBlank+$02, X
LDX.b $03 : STA.w $1008, X LDX.b Scrap03 : STA.w $1008, X
LDX.b $00 : LDA.l HashAlphabetTilesWithBlank+$04, X LDX.b Scrap00 : LDA.l HashAlphabetTilesWithBlank+$04, X
LDX.b $03 : STA.w $100E, X LDX.b Scrap03 : STA.w $100E, X
LDX.b $00 : LDA.l HashAlphabetTilesWithBlank+$06, X LDX.b Scrap00 : LDA.l HashAlphabetTilesWithBlank+$06, X
LDX.b $03 : STA.w $1010, X LDX.b Scrap03 : STA.w $1010, X
TYX : DEX : BMI + : BRA - TYX : DEX : BMI + : BRA -
+ +

View File

@@ -22,11 +22,11 @@ HUDRebuildIndoorHole:
.generic .generic
PLA PLA
LDA.l CurrentGenericKeys ; generic key count LDA.l CurrentGenericKeys ; generic key count
JSL.l HUD_RebuildIndoor_Palace JSL HUD_RebuildIndoor_Palace
RTL RTL
.normal .normal
PLA PLA
JSL.l HUD_RebuildIndoor_Palace JSL HUD_RebuildIndoor_Palace
RTL RTL
;================================================================================ ;================================================================================
HUDRebuildIndoor: HUDRebuildIndoor:
@@ -83,7 +83,7 @@ BringMenuDownEnhanced:
EOR.w #$FFFF : !ADD.w #$0001 ; negate menu speed EOR.w #$FFFF : !ADD.w #$0001 ; negate menu speed
!ADD BG3VOFSQL : CMP.w #$FF18 : !BGE .noOvershoot !ADD.l BG3VOFSQL : CMP.w #$FF18 : !BGE .noOvershoot
LDA.w #$FF18 ; if we went past the limit, go to the limit LDA.w #$FF18 ; if we went past the limit, go to the limit
.noOvershoot .noOvershoot
STA.b BG3VOFSQL : CMP.w #$FF18 STA.b BG3VOFSQL : CMP.w #$FF18
@@ -101,7 +101,7 @@ RaiseHudMenu:
LDA.l MenuSpeed : AND.w #$00FF LDA.l MenuSpeed : AND.w #$00FF
++ ++
!ADD BG3VOFSQL : BMI .noOvershoot !ADD.l BG3VOFSQL : BMI .noOvershoot
LDA.w #$0000 ; if we went past the limit, go to the limit LDA.w #$0000 ; if we went past the limit, go to the limit
.noOvershoot .noOvershoot
STA.b BG3VOFSQL STA.b BG3VOFSQL
@@ -139,7 +139,7 @@ UpdateKeys:
.castle_sewers .castle_sewers
STA.l HyruleCastleKeys : STA.l SewerKeys STA.l HyruleCastleKeys : STA.l SewerKeys
.skip .skip
JSL.l PostItemGet JSL PostItemGet
PLP : PLX PLP : PLX
RTL RTL
;$37C = Sewer Passage ;$37C = Sewer Passage
@@ -567,7 +567,7 @@ HandleEmptyMenu:
LDA.b Joy1A_All : BIT.b #$20 : BNE .wait_for_change LDA.b Joy1A_All : BIT.b #$20 : BNE .wait_for_change
LDA.l HudFlag : AND.b #$60 : BEQ .wait_for_change LDA.l HudFlag : AND.b #$60 : BEQ .wait_for_change
LDA.l HudFlag : AND.b #$9F : STA.l HudFlag ; Unset without select LDA.l HudFlag : AND.b #$9F : STA.l HudFlag ; Unset without select
JSL.l MaybePlaySelectSFX JSL MaybePlaySelectSFX
LDA.b #$0C : BRA .done LDA.b #$0C : BRA .done
.sel_pressed .sel_pressed
LDA.l HUDDungeonItems : BIT.b #$0C : BNE + LDA.l HUDDungeonItems : BIT.b #$0C : BNE +
@@ -577,7 +577,7 @@ HandleEmptyMenu:
LDA.b #$60 LDA.b #$60
.store_flag .store_flag
STA.l HudFlag STA.l HudFlag
JSL.l MaybePlaySelectSFX JSL MaybePlaySelectSFX
LDA.b #$0C : BRA .done LDA.b #$0C : BRA .done
.wait_for_change .wait_for_change
LDA.b #$03 : BRA .done LDA.b #$03 : BRA .done
@@ -589,9 +589,9 @@ RTL
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
MaybeDrawEquippedItem: MaybeDrawEquippedItem:
LDA.w ItemCursor : BEQ + LDA.w ItemCursor : BEQ +
JML.l ItemMenu_DrawEquippedYItem+$07 JML ItemMenu_DrawEquippedYItem+$07
+ +
JML.l ItemMenu_DrawEquippedYItem_exit JML ItemMenu_DrawEquippedYItem_exit
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
RestoreMenu_SetSubModule: RestoreMenu_SetSubModule:
LDA.w ItemCursor : BEQ + LDA.w ItemCursor : BEQ +

View File

@@ -99,34 +99,34 @@ TransferNewNameStripes:
REP #$30 REP #$30
LDA.w GameMode : CMP.w #$0204 : BNE .exit LDA.w GameMode : CMP.w #$0204 : BNE .exit
SEP #$20 SEP #$20
LDA.b #NewNameStripes>>0 : STA.b $00 LDA.b #NewNameStripes>>0 : STA.b Scrap00
LDA.b #NewNameStripes>>8 : STA.b $01 LDA.b #NewNameStripes>>8 : STA.b Scrap01
LDA.b #NewNameStripes>>16 : STA.b $02 : STA.w DMA1ADDRB LDA.b #NewNameStripes>>16 : STA.b Scrap02 : STA.w DMA1ADDRB
STZ.b $06 : LDY.w #$0000 STZ.b Scrap06 : LDY.w #$0000
.check_next .check_next
LDA.b [$00],Y : BPL .next_stripe LDA.b [Scrap00],Y : BPL .next_stripe
.exit .exit
SEP #$30 SEP #$30
RTL RTL
.next_stripe .next_stripe
STA.b $04 STA.b Scrap04
INY INY
LDA.b [$00],Y : STA.b $03 LDA.b [Scrap00],Y : STA.b Scrap03
INY INY
LDA.b [$00],Y : AND.b #$80 : ASL : ROL : STA.b $07 LDA.b [Scrap00],Y : AND.b #$80 : ASL : ROL : STA.b Scrap07
LDA.b [$00],Y : AND.b #$40 : STA.b $05 LDA.b [Scrap00],Y : AND.b #$40 : STA.b Scrap05
LSR #3 : ORA.b #$01 : STA.w DMA1MODE LSR #3 : ORA.b #$01 : STA.w DMA1MODE
LDA.b #VMDATAL : STA.w DMA1PORT LDA.b #VMDATAL : STA.w DMA1PORT
REP #$20 REP #$20
LDA.b $03 : STA.w VMADDR LDA.b Scrap03 : STA.w VMADDR
LDA.b [$00],Y : XBA : AND.w #$3FFF LDA.b [Scrap00],Y : XBA : AND.w #$3FFF
TAX : INX : STX.w DMA1SIZE TAX : INX : STX.w DMA1SIZE
INY #2 : TYA INY #2 : TYA
CLC : ADC.b $00 : STA.w DMA1ADDRL CLC : ADC.b Scrap00 : STA.w DMA1ADDRL
LDA.b $05 LDA.b Scrap05
STX.b $03 STX.b Scrap03
TYA : CLC : ADC.b $03 : TAY TYA : CLC : ADC.b Scrap03 : TAY
SEP #$20 SEP #$20
LDA.b $07 : ORA.b #$80 : STA.w VMAIN LDA.b Scrap07 : ORA.b #$80 : STA.w VMAIN
LDA.b #$02 : STA.w DMAENABLE LDA.b #$02 : STA.w DMAENABLE
JMP.w .check_next JMP .check_next

View File

@@ -14,7 +14,7 @@ RefillHealth:
LDA.l PotionHealthRefill : CMP.b #$A0 : !BGE .done LDA.l PotionHealthRefill : CMP.b #$A0 : !BGE .done
LDA.l BusyHealth : BNE ++ LDA.l BusyHealth : BNE ++
LDA.l PotionHealthRefill ; load refill amount LDA.l PotionHealthRefill ; load refill amount
!ADD CurrentHealth ; add to current health !ADD.l CurrentHealth ; add to current health
CMP.l MaximumHealth : !BLT +++ : LDA.l MaximumHealth : +++ CMP.l MaximumHealth : !BLT +++ : LDA.l MaximumHealth : +++
STA.l BusyHealth STA.l BusyHealth
++ ++
@@ -60,7 +60,7 @@ RefillMagic:
LDA.l PotionMagicRefill : CMP.b #$80 : !BGE .done LDA.l PotionMagicRefill : CMP.b #$80 : !BGE .done
LDA.l BusyMagic : BNE ++ LDA.l BusyMagic : BNE ++
LDA.l PotionMagicRefill ; load refill amount LDA.l PotionMagicRefill ; load refill amount
!ADD CurrentMagic ; add to current magic !ADD.l CurrentMagic ; add to current magic
CMP.b #$80 : !BLT +++ : LDA.b #$80 : +++ CMP.b #$80 : !BLT +++ : LDA.b #$80 : +++
STA.l BusyMagic STA.l BusyMagic
++ ++

View File

@@ -19,12 +19,12 @@ QuickSwap:
LDX.w ItemCursor : BRA .special_swap LDX.w ItemCursor : BRA .special_swap
+ +
BIT.b #$10 : BEQ + ; Only pressed R BIT.b #$10 : BEQ + ; Only pressed R
JSR.w RCode JSR RCode
LDA.b Joy1B_All : BIT.b #$20 : BNE .special_swap ; Still holding L from a previous frame LDA.b Joy1B_All : BIT.b #$20 : BNE .special_swap ; Still holding L from a previous frame
BRA .store BRA .store
+ +
; Only pressed L ; Only pressed L
JSR.w LCode JSR LCode
LDA.b Joy1B_All : BIT #$10 : BNE .special_swap ; Still holding R from a previous frame LDA.b Joy1B_All : BIT #$10 : BNE .special_swap ; Still holding R from a previous frame
BRA .store BRA .store
@@ -61,7 +61,7 @@ RCode:
+ INX + INX
DEY : BEQ + DEY : BEQ +
.nextItem .nextItem
JSL.l IsItemAvailable : BEQ - JSL IsItemAvailable : BEQ -
+ +
RTS RTS
@@ -78,7 +78,7 @@ LCode:
+ DEX + DEX
DEY : BEQ + DEY : BEQ +
.nextItem .nextItem
JSL.l IsItemAvailable : BEQ - JSL IsItemAvailable : BEQ -
+ +
RTS RTS

163
ram.asm
View File

@@ -48,8 +48,6 @@ NMIHUD = $7E0016 ; during NMI.
NMIINCR = $7E0017 ; NMIINCR = $7E0017 ;
NMIUP1100 = $7E0018 ; NMIUP1100 = $7E0018 ;
UPINCVH = $7E0019 ; Incremental upload VRAM high byte UPINCVH = $7E0019 ; Incremental upload VRAM high byte
LinkAbsoluteY = $7E0020 ; Link's absolute coordinates. Word length
LinkAbsoluteX = $7E0022 ;
FrameCounter = $7E001A ; Increments every frame that the game isn't lagging FrameCounter = $7E001A ; Increments every frame that the game isn't lagging
IndoorsFlag = $7E001B ; $00 = Outdoors | $01 = Indoors IndoorsFlag = $7E001B ; $00 = Outdoors | $01 = Indoors
MAINDESQ = $7E001C ; PPU register queues written during NMI MAINDESQ = $7E001C ; PPU register queues written during NMI
@@ -69,20 +67,25 @@ LinkDirection = $7E002F ; $00 = Up | $02 = Down | $04 = Left | $06 = R
; ;
OAMOffsetY = $7E0044 ; OAMOffsetY = $7E0044 ;
OAMOffsetX = $7E0045 ; OAMOffsetX = $7E0045 ;
LinkIncapacitatedTimer = $7E0046 ; Countdown when Link takes damage, not same as I-frames
;
ForceMove = $7E0049 ; Forces D-Pad inputs when written to
; ;
CapeTimer = $7E004C ; Countdown for cape sapping magic Countdown for cape sapping magic.. CapeTimer = $7E004C ; Countdown for cape sapping magic Countdown for cape sapping magic..
LinkJumping = $7E004D ; $00 = None | $01 = Bonk/damage/water | $02 = Ledge LinkJumping = $7E004D ; $00 = None | $01 = Bonk/damage/water | $02 = Ledge
; ;
Strafe = $7E0050 ; ??? LinkStrafe = $7E0050 ; ???
; ;
CapeOn = $7E0055 ; Link invisible and untouchable when set. CapeOn = $7E0055 ; Link invisible and untouchable when set.
BunnyFlagDP = $7E0056 ; $00 = Link | $01 = Bunny BunnyFlagDP = $7E0056 ; $00 = Link | $01 = Bunny
; ;
PitTileActField = $7E0059 ; Tile action bitfield used by pits
LinkSlipping = $7E005B ; $00 = None | $01 = Near pit LinkSlipping = $7E005B ; $00 = None | $01 = Near pit
; $02 = Falling | $03 = Falling "more" ; $02 = Falling | $03 = Falling "more"
FallTimer = $7E005C ; Timer for falling animation FallTimer = $7E005C ; Timer for falling animation
LinkState = $7E005D ; Main Link state handler LinkState = $7E005D ; Main Link state handler
LinkSpeed = $7E005E ; Main Link speed handler LinkSpeed = $7E005E ; Main Link speed handler
ManipTileField = $7E005F ; Bitfield used by manipulable tiles
; ;
LinkWalkDirection = $7E0067 ; - - - - u d l r LinkWalkDirection = $7E0067 ; - - - - u d l r
; ;
@@ -102,7 +105,7 @@ W34SELQ = $7E0097 ;
WOBJSELQ = $7E0098 ; WOBJSELQ = $7E0098 ;
CGWSELQ = $7E0099 ; CGWSELQ = $7E0099 ;
CGADSUBQ = $7E009A ; CGADSUBQ = $7E009A ;
HDMAENQ = $7E009B ; HDMA enable flags HDMAENABLEQ = $7E009B ; HDMA enable flags
; ;
RoomIndex = $7E00A0 ; Underworld room index. Word length. High byte: $00 = EG1 | $01 = EG2 RoomIndex = $7E00A0 ; Underworld room index. Word length. High byte: $00 = EG1 | $01 = EG2
; Not zeroed on exit to overworld. ; Not zeroed on exit to overworld.
@@ -111,6 +114,9 @@ PreviousRoom = $7E00A2 ; Stores previous value of RoomIndex
CameraBoundH = $7E00A6 ; Which set of camera boundaries to use. CameraBoundH = $7E00A6 ; Which set of camera boundaries to use.
CameraBoundV = $7E00A7 ; CameraBoundV = $7E00A7 ;
; ;
LinkQuadrantH = $7E00A9 ; Which quadrant Link is in. 0 = left, 1 = right
LinkQuadrantV = $7E00AA ; 0 = top, 2 = bottom
;
RoomTag = $7E00AE ; Room effects; e.g. kill room, shutter switch, etc. Word length. RoomTag = $7E00AE ; Room effects; e.g. kill room, shutter switch, etc. Word length.
; ;
SubSubModule = $7E00B0 ; Often used as a submodule, such as for transitions SubSubModule = $7E00B0 ; Often used as a submodule, such as for transitions
@@ -159,6 +165,7 @@ EntranceIndex = $7E010E ; Entrance ID into underworld. Word length.
; ;
MedallionFlag = $7E0112 ; Medallion cutscene flag. $01 = Cutscene active. MedallionFlag = $7E0112 ; Medallion cutscene flag. $01 = Cutscene active.
; ;
VRAMTileMapIndex = $7E0116 ; Index for high bytes for VRAM tile map uploads
VRAMUploadAddress = $7E0118 ; Incremental VRAM upload address. Low byte always 0. Word length. VRAMUploadAddress = $7E0118 ; Incremental VRAM upload address. Low byte always 0. Word length.
; ;
BG1ShakeV = $7E011A ; Applied to BG Scroll. Word Length. BG1ShakeV = $7E011A ; Applied to BG Scroll. Word Length.
@@ -225,13 +232,18 @@ TileActDig = $7E035B ; Bitfield used by diggable ground. Word lengt
; ;
LinkZap = $7E0360 ; When set, recoil zaps Link. LinkZap = $7E0360 ; When set, recoil zaps Link.
; ;
LinkDashing = $7E0372 ; Flags when Link is dashing, also spinspeed
DamageReceived = $7E0373 ; Damage to deal to Link. DamageReceived = $7E0373 ; Damage to deal to Link.
; ;
UseY2 = $7E037A ; - - b n c h - s UseY2 = $7E037A ; - - b n c h - s
; b = Book | n = Net | c = Canes | h = Hookshot | s = Shovel ; b = Book | n = Net | c = Canes | h = Hookshot | s = Shovel
NoDamage = $7E037B ; Prevents Link from receiving damage. NoDamage = $7E037B ; Prevents Link from receiving damage.
; ;
AncillaGeneral = $7E039F ; General use buffer for front slot ancillae. $0F bytes. AncillaGeneralA = $7E0385 ; General use buffer for front slot ancillae. $05 bytes.
;
AncillaGeneralD = $7E0394 ; General use buffer for front slot ancillae. $05 bytes.
;
AncillaGeneralF = $7E039F ; General use buffer for front slot ancillae. $0F bytes.
; ;
AncillaTimer = $7E03B1 ; Used as a timer for ancilla. AncillaTimer = $7E03B1 ; Used as a timer for ancilla.
; ;
@@ -246,8 +258,13 @@ RoomItemsTaken = $7E0403 ; Items taken in a room: b k u t s e h c
; b = boss kill/item | k = key/heart piece (prevents crystals) ; b = boss kill/item | k = key/heart piece (prevents crystals)
; u = 2nd key/heart piece | t = chest 4/rupees/swamp drain/bomb floor/mire wall ; u = 2nd key/heart piece | t = chest 4/rupees/swamp drain/bomb floor/mire wall
; s = chest 3/pod or dp wall | e, h, c = chest 2, 1, 0 ; s = chest 3/pod or dp wall | e, h, c = chest 2, 1, 0
OverworldIndexMirror = $7E040A ; Overworld Area Index. Mirrors $8A
DungeonID = $7E040C ; High byte mostly unused but sometimes read. Word length. DungeonID = $7E040C ; High byte mostly unused but sometimes read. Word length.
; ;
TransitionDirection = $7E0418 ; OW: 0=N 1=S 2=W 3=E UW: 0=S 1=N 2=E 3=W
;
TrapDoorFlag = $7E0468 ; Flag that is set when trap doors are down. 2 bytes
;
LayerAdjustment = $7E047A ; Flags layer adjustments. Arms EG. LayerAdjustment = $7E047A ; Flags layer adjustments. Arms EG.
; ;
RoomIndexMirror = $7E048E ; Mirrors RoomIndex RoomIndexMirror = $7E048E ; Mirrors RoomIndex
@@ -259,6 +276,10 @@ OWEntranceCutscene = $7E04C6 ;
; ;
HeartBeepTimer = $7E04CA ; HeartBeepTimer = $7E04CA ;
; ;
CameraTargetN = $7E0610 ; Camera scroll target for directions NSEW
CameraTargetS = $7E0612 ;
CameraTargetW = $7E0614 ;
CameraTargetE = $7E0616 ;
CameraScrollN = $7E0618 ; Camera scroll trigger areas for directions NSEW CameraScrollN = $7E0618 ; Camera scroll trigger areas for directions NSEW
CameraScrollS = $7E061A ; The higher boundary should always be +2 from the lower in CameraScrollS = $7E061A ; The higher boundary should always be +2 from the lower in
CameraScrollW = $7E061C ; underworld and -2 in overworld. CameraScrollW = $7E061C ; underworld and -2 in overworld.
@@ -270,9 +291,13 @@ SpriteRoomTag = $7E0642 ; Set high by sprites triggering room tags.
; ;
SomariaSwitchFlag = $7E0646 ; Set by Somaria when on a switch. SomariaSwitchFlag = $7E0646 ; Set by Somaria when on a switch.
; ;
TileMapDoorPos = $7E068E ; (Dungeon) ???? related to trap doors and if they are open ; possibly bomb doors too? Update: module 0x07.0x4 probably uses this to know whether it's a key door or big key door to open. Word length.
DoorTimer = $7E0690 ; Timer for animating doors, like Sanc or HC overworld doors
;
TileMapEntranceDoors = $7E0696 ; Tilemap location of entrance doors. Word length. TileMapEntranceDoors = $7E0696 ; Tilemap location of entrance doors. Word length.
TileMapTile32 = $7E0698 ; Tilemap location of new tile32 objects, such as from graves/rocks. Word length. TileMapTile32 = $7E0698 ; Tilemap location of new tile32 objects, such as from graves/rocks. Word length.
; ;
RandoOverworldTargetEdge = $7E06FA; Used to store target edge IDs
SkipOAM = $7E0710 ; Set to skip OAM updates. High byte written $FF with exploding walls SkipOAM = $7E0710 ; Set to skip OAM updates. High byte written $FF with exploding walls
OWScreenSize = $7E0712 ; Flags overworld screen size. OWScreenSize = $7E0712 ; Flags overworld screen size.
@@ -282,6 +307,8 @@ SpawnedItemIsMultiWorld = $7E0724 ; Multiworld World Flag. Word
SpawnedItemFlag = $7E0726 ; 0x02 - one for pot, 2 for sprite drop SpawnedItemFlag = $7E0726 ; 0x02 - one for pot, 2 for sprite drop
; (flag used as a bitmask in conjunction with StandingItemCounterMask) ; (flag used as a bitmask in conjunction with StandingItemCounterMask)
SpawnedItemMWPlayer = $7E0728 ; Player Id for spawned item if Multiworld item 0x02 SpawnedItemMWPlayer = $7E0728 ; Player Id for spawned item if Multiworld item 0x02
;
EnemyDropIndicator = $7E072A ; Used by HUD to indicate enemy drops remaining
SprDropsItem = $7E0730 ; Array for whether a sprite drops an item 0x16 SprDropsItem = $7E0730 ; Array for whether a sprite drops an item 0x16
SprItemReceipt = $7E0740 ; Array for item id for each sprite 0x16 SprItemReceipt = $7E0740 ; Array for item id for each sprite 0x16
@@ -331,12 +358,17 @@ AncillaVelocityX = $7E0C2C ; $0A bytes.
; ;
AncillaID = $7E0C4A ; $0A bytes. AncillaID = $7E0C4A ; $0A bytes.
; ;
AncillaGeneralN = $7E0C54 ; General use buffer for ancillae. $0A bytes.
;
AncillaGet = $7E0C5E ; Used by varius ancilla in various ways. $0F bytes. AncillaGet = $7E0C5E ; Used by varius ancilla in various ways. $0F bytes.
; ;
AncillaLayer = $7E0C7C ; AncillaLayer = $7E0C7C ;
; ;
SpriteForceDrop = $7E0CBA ; Forces drops on sprite death. $10 bytes.
;
SpriteBump = $7E0CD2 ; See symbols_wram.asm. $10 bytes. SpriteBump = $7E0CD2 ; See symbols_wram.asm. $10 bytes.
; ;
BossSpecialAction = $7E0CF3 ; Indicates special action required for some bosses
TreePullKills = $7E0CFB ; Kills for tree pulls. TreePullKills = $7E0CFB ; Kills for tree pulls.
TreePullHits = $7E0CFC ; Hits taken for tree pulls. TreePullHits = $7E0CFC ; Hits taken for tree pulls.
; ;
@@ -365,12 +397,12 @@ SpriteOAMProperties = $7E0E40 ; h m w o o o o o | h = Harmless | m = m
SpriteHitPoints = $7E0E50 ; Set from $0DB173 SpriteHitPoints = $7E0E50 ; Set from $0DB173
SpriteControl = $7E0E60 ; n i o s p p p t | n = Death animation? | i = Immune to attack/collion? SpriteControl = $7E0E60 ; n i o s p p p t | n = Death animation? | i = Immune to attack/collion?
; o = Shadow | p = OAM prop palette | t = OAM prop name table ; o = Shadow | p = OAM prop palette | t = OAM prop name table
SpriteItemType = $7E0E80 ; Sprite Item Type. Also used for jump table local. $10 bytes. SpriteJumpIndex = $7E0E80 ; Sprite jump table local. $10 bytes.
;
SpriteSpawnStep = $7E0ED0 ; Related to enemies spawning other sprites (eg pikit, zirro)
; ;
SpriteDirectionTable = $7E0EB0 ; Sprite direction. $10 bytes. SpriteDirectionTable = $7E0EB0 ; Sprite direction. $10 bytes.
; ;
SpriteSpawnStep = $7E0ED0 ; Related to enemies spawning other sprites (eg pikit, zirro)
;
SpriteHalt = $7E0F00 ; SpriteHalt = $7E0F00 ;
SpriteTimerE = $7E0F10 ; ? SpriteTimerE = $7E0F10 ; ?
; ;
@@ -426,6 +458,8 @@ ClockBuffer = $7E1E9C ; Clock Temporary
ScratchBufferNV = $7E1EA0 ; Non-volatile scratch buffer. Must preserve values through return. ScratchBufferNV = $7E1EA0 ; Non-volatile scratch buffer. Must preserve values through return.
ScratchBufferV = $7E1EB0 ; Volatile scratch buffer. Can clobber at will. ScratchBufferV = $7E1EB0 ; Volatile scratch buffer. Can clobber at will.
TileMapA = $7E2000
TileMapB = $7E4000
;================================================================================ ;================================================================================
; UNMIRRORED WRAM ; UNMIRRORED WRAM
; Addresses from here on can only be accessed with long addressing ; Addresses from here on can only be accessed with long addressing
@@ -447,6 +481,7 @@ MosaicLevel = $7EC011 ; Word length. High byte unused
RoomDarkness = $7EC017 ; Darkness level of a room. High byte unused. Word length. RoomDarkness = $7EC017 ; Darkness level of a room. High byte unused. Word length.
; ;
SpriteOAM = $7EC025 ; SpriteOAM = $7EC025 ;
SpriteDynamicOAM = $7EC035 ;
; ;
EN_OWSCR2 = $7EC140 ; $7EC140-$7EC171 Used for caching with entrances. EN_OWSCR2 = $7EC140 ; $7EC140-$7EC171 Used for caching with entrances.
EN_MAINDESQ = $7EC142 ; Copied from the JP disassembly. EN_MAINDESQ = $7EC142 ; Copied from the JP disassembly.
@@ -485,6 +520,7 @@ LastBGSet = $7EC2F8 ; Lists loaded sheets to check for decompressi
PaletteBufferAux = $7EC300 ; Secondary and main palette buffer. See symbols_wram.asm PaletteBufferAux = $7EC300 ; Secondary and main palette buffer. See symbols_wram.asm
PaletteBuffer = $7EC500 ; in the disassembly. PaletteBuffer = $7EC500 ; in the disassembly.
HUDTileMapBuffer = $7EC700 ; HUD tile map buffer. $100 bytes (?) HUDTileMapBuffer = $7EC700 ; HUD tile map buffer. $100 bytes (?)
HUDCurrentDungeonWorld = $7EC702 ;
HUDKeyIcon = $7EC726 ; HUDKeyIcon = $7EC726 ;
HUDGoalIndicator = $7EC72A ; HUDGoalIndicator = $7EC72A ;
HUDPrizeIcon = $7EC742 ; HUDPrizeIcon = $7EC742 ;
@@ -492,6 +528,10 @@ HUDRupees = $7EC750 ;
HUDBombCount = $7EC75A ; HUDBombCount = $7EC75A ;
HUDArrowCount = $7EC760 ; HUDArrowCount = $7EC760 ;
HUDKeyDigits = $7EC764 ; HUDKeyDigits = $7EC764 ;
HUDMultiIndicator = $7EC790 ;
HUDKeysObtained = $7EC7A2 ;
HUDKeysSlash = $7EC7A4 ;
HUDKeysTotal = $7EC7A6 ;
; ;
BigRAM = $7EC900 ; Big buffer of free ram (0x1F00) BigRAM = $7EC900 ; Big buffer of free ram (0x1F00)
ItemGFXStack = $7ECB00 ; Pointers to source of decompressed item tiles deferred to NMI loading. ItemGFXStack = $7ECB00 ; Pointers to source of decompressed item tiles deferred to NMI loading.
@@ -527,7 +567,7 @@ TileUploadOffsetOverride: skip 2 ; Offset override for loading sprite gfx
skip 3 ; skip 3 ;
skip 8 ; skip 8 ;
; Shop Block $7F504F - $7F506F ; Shop Block $7F504F - $7F506F
ShopEnableCount: skip 1 ; Whether Shops Count for Location Checks ShopEnableCount: skip 1 ; Whether Shops Count for Location Checks
ShopId: skip 1 ; Shop ID. Used for indexing and loading inventory for custom shops ShopId: skip 1 ; Shop ID. Used for indexing and loading inventory for custom shops
ShopType: skip 1 ; Shop type. $FF = vanilla shop ShopType: skip 1 ; Shop type. $FF = vanilla shop
; t d a v - - q q ; t d a v - - q q
@@ -675,19 +715,23 @@ endmacro
%assertRAM(LinkRecoilY, $7E0027) %assertRAM(LinkRecoilY, $7E0027)
%assertRAM(LinkRecoilX, $7E0028) %assertRAM(LinkRecoilX, $7E0028)
%assertRAM(LinkRecoilZ, $7E0029) %assertRAM(LinkRecoilZ, $7E0029)
%assertRAM(LinkDirection, $7E002F)
%assertRAM(LinkAnimationStep, $7E002E) %assertRAM(LinkAnimationStep, $7E002E)
%assertRAM(LinkDirection, $7E002F)
%assertRAM(OAMOffsetY, $7E0044) %assertRAM(OAMOffsetY, $7E0044)
%assertRAM(OAMOffsetX, $7E0045) %assertRAM(OAMOffsetX, $7E0045)
%assertRAM(LinkIncapacitatedTimer, $7E0046)
%assertRAM(ForceMove, $7E0049)
%assertRAM(CapeTimer, $7E004C) %assertRAM(CapeTimer, $7E004C)
%assertRAM(LinkJumping, $7E004D) %assertRAM(LinkJumping, $7E004D)
%assertRAM(Strafe, $7E0050) %assertRAM(LinkStrafe, $7E0050)
%assertRAM(CapeOn, $7E0055) %assertRAM(CapeOn, $7E0055)
%assertRAM(BunnyFlagDP, $7E0056) %assertRAM(BunnyFlagDP, $7E0056)
%assertRAM(PitTileActField, $7E0059)
%assertRAM(LinkSlipping, $7E005B) %assertRAM(LinkSlipping, $7E005B)
%assertRAM(FallTimer, $7E005C) %assertRAM(FallTimer, $7E005C)
%assertRAM(LinkState, $7E005D) %assertRAM(LinkState, $7E005D)
%assertRAM(LinkSpeed, $7E005E) %assertRAM(LinkSpeed, $7E005E)
%assertRAM(ManipTileField, $7E005F)
%assertRAM(LinkWalkDirection, $7E0067) %assertRAM(LinkWalkDirection, $7E0067)
%assertRAM(ScrapBuffer72, $7E0072) %assertRAM(ScrapBuffer72, $7E0072)
%assertRAM(WorldCache, $7E007B) %assertRAM(WorldCache, $7E007B)
@@ -701,17 +745,19 @@ endmacro
%assertRAM(WOBJSELQ, $7E0098) %assertRAM(WOBJSELQ, $7E0098)
%assertRAM(CGWSELQ, $7E0099) %assertRAM(CGWSELQ, $7E0099)
%assertRAM(CGADSUBQ, $7E009A) %assertRAM(CGADSUBQ, $7E009A)
%assertRAM(HDMAENQ, $7E009B) %assertRAM(HDMAENABLEQ, $7E009B)
%assertRAM(RoomIndex, $7E00A0) %assertRAM(RoomIndex, $7E00A0)
%assertRAM(PreviousRoom, $7E00A2) %assertRAM(PreviousRoom, $7E00A2)
%assertRAM(CameraBoundH, $7E00A6) %assertRAM(CameraBoundH, $7E00A6)
%assertRAM(CameraBoundV, $7E00A7) %assertRAM(CameraBoundV, $7E00A7)
%assertRAM(LinkQuadrantH, $7E00A9)
%assertRAM(LinkQuadrantV, $7E00AA)
%assertRAM(RoomTag, $7E00AE) %assertRAM(RoomTag, $7E00AE)
%assertRAM(SubSubModule, $7E00B0) %assertRAM(SubSubModule, $7E00B0)
%assertRAM(ObjPtr, $7E00B7) %assertRAM(ObjPtr, $7E00B7)
%assertRAM(ObjPtrOffset, $7E00BA) %assertRAM(ObjPtrOffset, $7E00BA)
%assertRAM(ScrapBufferBD, $7E00BD)
%assertRAM(PlayerSpriteBank, $7E00BC) %assertRAM(PlayerSpriteBank, $7E00BC)
%assertRAM(ScrapBufferBD, $7E00BD)
%assertRAM(FileSelectPosition, $7E00C8) %assertRAM(FileSelectPosition, $7E00C8)
%assertRAM(PasswordCodePosition, $7E00C8) %assertRAM(PasswordCodePosition, $7E00C8)
%assertRAM(PasswordSelectPosition, $7E00C9) %assertRAM(PasswordSelectPosition, $7E00C9)
@@ -728,12 +774,12 @@ endmacro
%assertRAM(GameSubModeCache, $7E010D) %assertRAM(GameSubModeCache, $7E010D)
%assertRAM(EntranceIndex, $7E010E) %assertRAM(EntranceIndex, $7E010E)
%assertRAM(MedallionFlag, $7E0112) %assertRAM(MedallionFlag, $7E0112)
%assertRAM(VRAMTileMapIndex, $7E0116)
%assertRAM(VRAMUploadAddress, $7E0118) %assertRAM(VRAMUploadAddress, $7E0118)
%assertRAM(BG1ShakeV, $7E011A) %assertRAM(BG1ShakeV, $7E011A)
%assertRAM(BG1ShakeH, $7E011C) %assertRAM(BG1ShakeH, $7E011C)
%assertRAM(CurrentVolume, $7E0127) %assertRAM(CurrentVolume, $7E0127)
%assertRAM(TargetVolume, $7E0129) %assertRAM(TargetVolume, $7E0129)
%assertRAM(CurrentControlRequest, $7E0133)
%assertRAM(MusicControl, $7E012B) %assertRAM(MusicControl, $7E012B)
%assertRAM(MusicControlRequest, $7E012C) %assertRAM(MusicControlRequest, $7E012C)
%assertRAM(SFX1, $7E012D) %assertRAM(SFX1, $7E012D)
@@ -765,22 +811,32 @@ endmacro
%assertRAM(TileActIce, $7E0348) %assertRAM(TileActIce, $7E0348)
%assertRAM(TileActDig, $7E035B) %assertRAM(TileActDig, $7E035B)
%assertRAM(LinkZap, $7E0360) %assertRAM(LinkZap, $7E0360)
%assertRAM(LinkDashing, $7E0372)
%assertRAM(DamageReceived, $7E0373) %assertRAM(DamageReceived, $7E0373)
%assertRAM(UseY2, $7E037A) %assertRAM(UseY2, $7E037A)
%assertRAM(NoDamage, $7E037B) %assertRAM(NoDamage, $7E037B)
%assertRAM(AncillaGeneral, $7E039F) %assertRAM(AncillaGeneralA, $7E0385)
%assertRAM(AncillaGeneralD, $7E0394)
%assertRAM(AncillaGeneralF, $7E039F)
%assertRAM(AncillaSearch, $7E03C4) %assertRAM(AncillaSearch, $7E03C4)
%assertRAM(ForceSwordUp, $7E03EF) %assertRAM(ForceSwordUp, $7E03EF)
%assertRAM(FluteTimer, $7E03F0) %assertRAM(FluteTimer, $7E03F0)
%assertRAM(YButtonOverride, $7E03FC) %assertRAM(YButtonOverride, $7E03FC)
%assertRAM(RoomItemsTaken, $7E0403) %assertRAM(RoomItemsTaken, $7E0403)
%assertRAM(OverworldIndexMirror, $7E040A)
%assertRAM(DungeonID, $7E040C) %assertRAM(DungeonID, $7E040C)
%assertRAM(TransitionDirection, $7E0418)
%assertRAM(TrapDoorFlag, $7E0468)
%assertRAM(LayerAdjustment, $7E047A) %assertRAM(LayerAdjustment, $7E047A)
%assertRAM(RoomIndexMirror, $7E048E) %assertRAM(RoomIndexMirror, $7E048E)
%assertRAM(RespawnFlag, $7E04AA) %assertRAM(RespawnFlag, $7E04AA)
%assertRAM(Map16ChangeIndex, $7E04AC) %assertRAM(Map16ChangeIndex, $7E04AC)
%assertRAM(OWEntranceCutscene, $7E04C6) %assertRAM(OWEntranceCutscene, $7E04C6)
%assertRAM(HeartBeepTimer, $7E04CA) %assertRAM(HeartBeepTimer, $7E04CA)
%assertRAM(CameraTargetN, $7E0610)
%assertRAM(CameraTargetS, $7E0612)
%assertRAM(CameraTargetW, $7E0614)
%assertRAM(CameraTargetE, $7E0616)
%assertRAM(CameraScrollN, $7E0618) %assertRAM(CameraScrollN, $7E0618)
%assertRAM(CameraScrollS, $7E061A) %assertRAM(CameraScrollS, $7E061A)
%assertRAM(CameraScrollW, $7E061C) %assertRAM(CameraScrollW, $7E061C)
@@ -788,8 +844,11 @@ endmacro
%assertRAM(NMIAux, $7E0632) %assertRAM(NMIAux, $7E0632)
%assertRAM(SpriteRoomTag, $7E0642) %assertRAM(SpriteRoomTag, $7E0642)
%assertRAM(SomariaSwitchFlag, $7E0646) %assertRAM(SomariaSwitchFlag, $7E0646)
%assertRAM(TileMapDoorPos, $7E068E)
%assertRAM(DoorTimer, $7E0690)
%assertRAM(TileMapEntranceDoors, $7E0696) %assertRAM(TileMapEntranceDoors, $7E0696)
%assertRAM(TileMapTile32, $7E0698) %assertRAM(TileMapTile32, $7E0698)
%assertRAM(RandoOverworldTargetEdge, $7E06FA)
%assertRAM(SkipOAM, $7E0710) %assertRAM(SkipOAM, $7E0710)
%assertRAM(OWScreenSize, $7E0712) %assertRAM(OWScreenSize, $7E0712)
%assertRAM(SpawnedItemID, $7E0720) %assertRAM(SpawnedItemID, $7E0720)
@@ -797,6 +856,7 @@ endmacro
%assertRAM(SpawnedItemIsMultiWorld, $7E0724) %assertRAM(SpawnedItemIsMultiWorld, $7E0724)
%assertRAM(SpawnedItemFlag, $7E0726) %assertRAM(SpawnedItemFlag, $7E0726)
%assertRAM(SpawnedItemMWPlayer, $7E0728) %assertRAM(SpawnedItemMWPlayer, $7E0728)
%assertRAM(EnemyDropIndicator, $7E072A)
%assertRAM(SprDropsItem, $7E0730) %assertRAM(SprDropsItem, $7E0730)
%assertRAM(SprItemReceipt, $7E0740) %assertRAM(SprItemReceipt, $7E0740)
%assertRAM(SprItemIndex, $7E0750) %assertRAM(SprItemIndex, $7E0750)
@@ -808,8 +868,6 @@ endmacro
%assertRAM(OAMBuffer2, $7E0A00) %assertRAM(OAMBuffer2, $7E0A00)
%assertRAM(TransparencyFlag, $7E0ABD) %assertRAM(TransparencyFlag, $7E0ABD)
%assertRAM(OWTransitionFlag, $7E0ABF) %assertRAM(OWTransitionFlag, $7E0ABF)
%assertRAM(TreePullKills, $7E0CFB)
%assertRAM(TreePullHits, $7E0CFC)
%assertRAM(ArcVariable, $7E0B08) %assertRAM(ArcVariable, $7E0B08)
%assertRAM(OverlordXLow, $7E0B08) %assertRAM(OverlordXLow, $7E0B08)
%assertRAM(OverlordXHigh, $7E0B10) %assertRAM(OverlordXHigh, $7E0B10)
@@ -822,9 +880,14 @@ endmacro
%assertRAM(AncillaVelocityY, $7E0C22) %assertRAM(AncillaVelocityY, $7E0C22)
%assertRAM(AncillaVelocityX, $7E0C2C) %assertRAM(AncillaVelocityX, $7E0C2C)
%assertRAM(AncillaID, $7E0C4A) %assertRAM(AncillaID, $7E0C4A)
%assertRAM(AncillaGeneralN, $7E0C54)
%assertRAM(AncillaGet, $7E0C5E) %assertRAM(AncillaGet, $7E0C5E)
%assertRAM(AncillaLayer, $7E0C7C) %assertRAM(AncillaLayer, $7E0C7C)
%assertRAM(SpriteForceDrop, $7E0CBA)
%assertRAM(SpriteBump, $7E0CD2) %assertRAM(SpriteBump, $7E0CD2)
%assertRAM(BossSpecialAction, $7E0CF3)
%assertRAM(TreePullKills, $7E0CFB)
%assertRAM(TreePullHits, $7E0CFC)
%assertRAM(SpritePosYLow, $7E0D00) %assertRAM(SpritePosYLow, $7E0D00)
%assertRAM(SpritePosXLow, $7E0D10) %assertRAM(SpritePosXLow, $7E0D10)
%assertRAM(SpritePosYHigh, $7E0D20) %assertRAM(SpritePosYHigh, $7E0D20)
@@ -845,40 +908,13 @@ endmacro
%assertRAM(SpriteOAMProperties, $7E0E40) %assertRAM(SpriteOAMProperties, $7E0E40)
%assertRAM(SpriteHitPoints, $7E0E50) %assertRAM(SpriteHitPoints, $7E0E50)
%assertRAM(SpriteControl, $7E0E60) %assertRAM(SpriteControl, $7E0E60)
%assertRAM(SpriteItemType, $7E0E80) %assertRAM(SpriteJumpIndex, $7E0E80)
%assertRAM(SpriteSpawnStep, $7E0ED0)
%assertRAM(SpriteDirectionTable, $7E0EB0) %assertRAM(SpriteDirectionTable, $7E0EB0)
%assertRAM(SpriteSpawnStep, $7E0ED0)
%assertRAM(SpriteHalt, $7E0F00) %assertRAM(SpriteHalt, $7E0F00)
%assertRAM(SpriteTimerE, $7E0F10) %assertRAM(SpriteTimerE, $7E0F10)
%assertRAM(SpriteLayer, $7E0F20) %assertRAM(SpriteLayer, $7E0F20)
%assertRAM(SpriteOAMProp, $7E0F50) %assertRAM(SpriteOAMProp, $7E0F50)
%assertRAM(EN_OWSCR2, $7EC140)
%assertRAM(EN_MAINDESQ, $7EC142)
%assertRAM(EN_SUBDESQ, $7EC143)
%assertRAM(EN_BG2VERT, $7EC144)
%assertRAM(EN_BG2HORZ, $7EC146)
%assertRAM(EN_POSY, $7EC148)
%assertRAM(EN_POSX, $7EC14A)
%assertRAM(EN_OWSCR, $7EC14C)
%assertRAM(EN_OWTMAPI, $7EC14E)
%assertRAM(EN_SCROLLATN, $7EC150)
%assertRAM(EN_SCROLLATW, $7EC152)
%assertRAM(EN_SCROLLAN, $7EC154)
%assertRAM(EN_SCROLLBN, $7EC156)
%assertRAM(EN_SCROLLAS, $7EC158)
%assertRAM(EN_SCROLLBS, $7EC15A)
%assertRAM(EN_OWTARGN, $7EC15C)
%assertRAM(EN_OWTARGS, $7EC15E)
%assertRAM(EN_OWTARGW, $7EC160)
%assertRAM(EN_OWTARGE, $7EC162)
%assertRAM(EN_AA0, $7EC164)
%assertRAM(EN_BGSET1, $7EC165)
%assertRAM(EN_BGSET2, $7EC166)
%assertRAM(EN_SPRSET1, $7EC167)
%assertRAM(EN_SCRMODYA, $7EC16A)
%assertRAM(EN_SCRMODYB, $7EC16C)
%assertRAM(EN_SCRMODXA, $7EC16E)
%assertRAM(EN_SCRMODXB, $7EC170)
%assertRAM(SpriteZCoord, $7E0F70) %assertRAM(SpriteZCoord, $7E0F70)
%assertRAM(SpriteVelocityZ, $7E0F80) %assertRAM(SpriteVelocityZ, $7E0F80)
%assertRAM(SpriteSubPixelZ, $7E0F90) %assertRAM(SpriteSubPixelZ, $7E0F90)
@@ -911,6 +947,8 @@ endmacro
%assertRAM(ClockBuffer, $7E1E9C) %assertRAM(ClockBuffer, $7E1E9C)
%assertRAM(ScratchBufferNV, $7E1EA0) %assertRAM(ScratchBufferNV, $7E1EA0)
%assertRAM(ScratchBufferV, $7E1EB0) %assertRAM(ScratchBufferV, $7E1EB0)
%assertRAM(TileMapA, $7E2000)
%assertRAM(TileMapB, $7E4000)
%assertRAM(TileUploadBuffer, $7EA180) %assertRAM(TileUploadBuffer, $7EA180)
%assertRAM(RoomFade, $7EC005) %assertRAM(RoomFade, $7EC005)
%assertRAM(FadeTimer, $7EC007) %assertRAM(FadeTimer, $7EC007)
@@ -919,12 +957,41 @@ endmacro
%assertRAM(MosaicLevel, $7EC011) %assertRAM(MosaicLevel, $7EC011)
%assertRAM(RoomDarkness, $7EC017) %assertRAM(RoomDarkness, $7EC017)
%assertRAM(SpriteOAM, $7EC025) %assertRAM(SpriteOAM, $7EC025)
%assertRAM(SpriteDynamicOAM, $7EC035)
%assertRAM(EN_OWSCR2, $7EC140)
%assertRAM(EN_MAINDESQ, $7EC142)
%assertRAM(EN_SUBDESQ, $7EC143)
%assertRAM(EN_BG2VERT, $7EC144)
%assertRAM(EN_BG2HORZ, $7EC146)
%assertRAM(EN_POSY, $7EC148)
%assertRAM(EN_POSX, $7EC14A)
%assertRAM(EN_OWSCR, $7EC14C)
%assertRAM(EN_OWTMAPI, $7EC14E)
%assertRAM(EN_SCROLLATN, $7EC150)
%assertRAM(EN_SCROLLATW, $7EC152)
%assertRAM(EN_SCROLLAN, $7EC154)
%assertRAM(EN_SCROLLBN, $7EC156)
%assertRAM(EN_SCROLLAS, $7EC158)
%assertRAM(EN_SCROLLBS, $7EC15A)
%assertRAM(EN_OWTARGN, $7EC15C)
%assertRAM(EN_OWTARGS, $7EC15E)
%assertRAM(EN_OWTARGW, $7EC160)
%assertRAM(EN_OWTARGE, $7EC162)
%assertRAM(EN_AA0, $7EC164)
%assertRAM(EN_BGSET1, $7EC165)
%assertRAM(EN_BGSET2, $7EC166)
%assertRAM(EN_SPRSET1, $7EC167)
%assertRAM(EN_SCRMODYA, $7EC16A)
%assertRAM(EN_SCRMODYB, $7EC16C)
%assertRAM(EN_SCRMODXA, $7EC16E)
%assertRAM(EN_SCRMODXB, $7EC170)
%assertRAM(PegColor, $7EC172) %assertRAM(PegColor, $7EC172)
%assertRAM(GameOverSongCache, $7EC227) %assertRAM(GameOverSongCache, $7EC227)
%assertRAM(LastBGSet, $7EC2F8) %assertRAM(LastBGSet, $7EC2F8)
%assertRAM(PaletteBufferAux, $7EC300) %assertRAM(PaletteBufferAux, $7EC300)
%assertRAM(PaletteBuffer, $7EC500) %assertRAM(PaletteBuffer, $7EC500)
%assertRAM(HUDTileMapBuffer, $7EC700) %assertRAM(HUDTileMapBuffer, $7EC700)
%assertRAM(HUDCurrentDungeonWorld, $7EC702)
%assertRAM(HUDKeyIcon, $7EC726) %assertRAM(HUDKeyIcon, $7EC726)
%assertRAM(HUDGoalIndicator, $7EC72A) %assertRAM(HUDGoalIndicator, $7EC72A)
%assertRAM(HUDPrizeIcon, $7EC742) %assertRAM(HUDPrizeIcon, $7EC742)
@@ -932,6 +999,10 @@ endmacro
%assertRAM(HUDBombCount, $7EC75A) %assertRAM(HUDBombCount, $7EC75A)
%assertRAM(HUDArrowCount, $7EC760) %assertRAM(HUDArrowCount, $7EC760)
%assertRAM(HUDKeyDigits, $7EC764) %assertRAM(HUDKeyDigits, $7EC764)
%assertRAM(HUDMultiIndicator, $7EC790)
%assertRAM(HUDKeysObtained, $7EC7A2)
%assertRAM(HUDKeysSlash, $7EC7A4)
%assertRAM(HUDKeysTotal, $7EC7A6)
%assertRAM(BigRAM, $7EC900) %assertRAM(BigRAM, $7EC900)
%assertRAM(DecompressionBuffer, $7F0000) %assertRAM(DecompressionBuffer, $7F0000)

View File

@@ -628,7 +628,6 @@ VTIMEH = $00420A
; f - DMA channel 5 (0: disabled | 1: enabled) ; f - DMA channel 5 (0: disabled | 1: enabled)
; g - DMA channel 6 (0: disabled | 1: enabled) ; g - DMA channel 6 (0: disabled | 1: enabled)
; h - DMA channel 7 (0: disabled | 1: enabled) ; h - DMA channel 7 (0: disabled | 1: enabled)
MDMAEN = $00420B
DMAENABLE = $00420B DMAENABLE = $00420B
; H-BLANK DIRECT MEMORY ACCESS CHANNEL DESIGNATION ; H-BLANK DIRECT MEMORY ACCESS CHANNEL DESIGNATION
@@ -642,7 +641,6 @@ DMAENABLE = $00420B
; f - HDMA channel 5 (0: disabled | 1: enabled) ; f - HDMA channel 5 (0: disabled | 1: enabled)
; g - HDMA channel 6 (0: disabled | 1: enabled) ; g - HDMA channel 6 (0: disabled | 1: enabled)
; h - HDMA channel 7 (0: disabled | 1: enabled) ; h - HDMA channel 7 (0: disabled | 1: enabled)
HDMAEN = $00420C
HDMAENABLE = $00420C HDMAENABLE = $00420C
; ACCESS CYCLE DESIGNATION ; ACCESS CYCLE DESIGNATION
@@ -1390,8 +1388,8 @@ endmacro
%assertREG(HTIMEH, $4208) %assertREG(HTIMEH, $4208)
%assertREG(VTIMEL, $4209) %assertREG(VTIMEL, $4209)
%assertREG(VTIMEH, $420A) %assertREG(VTIMEH, $420A)
%assertREG(MDMAEN, $420B) %assertREG(DMAENABLE, $420B)
%assertREG(HDMAEN, $420C) %assertREG(HDMAENABLE, $420C)
%assertREG(MEMSEL, $420D) %assertREG(MEMSEL, $420D)
%assertREG(RDNMI, $4210) %assertREG(RDNMI, $4210)
%assertREG(TIMEUP, $4211) %assertREG(TIMEUP, $4211)

View File

@@ -38,7 +38,7 @@ DecrementArrows:
REP #$20 REP #$20
LDA.b RoomIndex : CMP.w #$0111 : SEP #$20 : BNE .not_archery_game LDA.b RoomIndex : CMP.w #$0111 : SEP #$20 : BNE .not_archery_game
LDA.b IndoorsFlag : BEQ .not_archery_game ; in overworld LDA.b IndoorsFlag : BEQ .not_archery_game ; in overworld
LDA.w $0B9A : BEQ .shoot_arrow ; arrow game active LDA.w BowDryFire : BEQ .shoot_arrow ; arrow game active
LDA.b #$00 : BRA .done LDA.b #$00 : BRA .done
.not_archery_game .not_archery_game

View File

@@ -11,22 +11,22 @@ RigDigRNG:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
RigChestRNG: RigChestRNG:
JSL.l DecrementChestCounter JSL DecrementChestCounter
LDA.w $04C4 : CMP.l ChestGameRNG : BEQ .forceHeart LDA.w $04C4 : CMP.l ChestGameRNG : BEQ .forceHeart
.normalItem .normalItem
JSL GetRandomInt JSL GetRandomInt
AND.b #$07 ; restrict values to 0-7 AND.b #$07 ; restrict values to 0-7
CMP.b #$07 : BEQ .notHeart CMP.b #$07 : BEQ .notHeart
JSL.l DecrementItemCounter JSL DecrementItemCounter
RTL RTL
.forceHeart .forceHeart
LDA.b #$33 : STA.b ScrapBufferBD+$0B ; assure the correct state if player talked to shopkeeper LDA.b #$33 : STA.b ScrapBufferBD+$0B ; assure the correct state if player talked to shopkeeper
LDA.w RoomItemsTaken : AND.b #$40 : BNE .notHeart LDA.w RoomItemsTaken : AND.b #$40 : BNE .notHeart
LDA ChestGameItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID LDA.l ChestGameItem_Player : STA.l !MULTIWORLD_ITEM_PLAYER_ID
LDA.b #$07 ; give prize item LDA.b #$07 ; give prize item
RTL RTL
.notHeart .notHeart
JSL.l DecrementItemCounter JSL DecrementItemCounter
JSL GetRandomInt ; spam RNG until we stop getting the prize item JSL GetRandomInt ; spam RNG until we stop getting the prize item
AND.b #$07 ; restrict values to 0-7 AND.b #$07 ; restrict values to 0-7
@@ -37,7 +37,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FixChestCounterForChestGame: FixChestCounterForChestGame:
JSL DecrementItemCounter JSL DecrementItemCounter
JML $8DBA71 JML GetRandomInt
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
RNG_Lanmolas1: RNG_Lanmolas1:
LDA.b #$00 : BRA _rng_done LDA.b #$00 : BRA _rng_done
@@ -46,7 +46,7 @@ RNG_Moldorm1:
RNG_Agahnim1: RNG_Agahnim1:
LDA.b RoomIndex : CMP.b #$20 : BNE RNG_Agahnim2 ; Agah 1 and 2 use the same code, check which agah we're fighting and branch LDA.b RoomIndex : CMP.b #$20 : BNE RNG_Agahnim2 ; Agah 1 and 2 use the same code, check which agah we're fighting and branch
LDA.b #$02 LDA.b #$02
JSL.l GetStaticRNG : PHA JSL GetStaticRNG : PHA
LDA.l GanonAgahRNG : BEQ + ; check if blue balls are disabled LDA.l GanonAgahRNG : BEQ + ; check if blue balls are disabled
PLA PLA
ORA.b #$01 ; guarantee no blue ball ORA.b #$01 ; guarantee no blue ball
@@ -73,7 +73,7 @@ RNG_Moldorm2:;x
LDA.b #$0A : BRA _rng_done LDA.b #$0A : BRA _rng_done
RNG_Agahnim2: RNG_Agahnim2:
LDA.b #$0B LDA.b #$0B
JSL.l GetStaticRNG : PHA JSL GetStaticRNG : PHA
LDA.l GanonAgahRNG : BEQ + ; check if blue balls are disabled LDA.l GanonAgahRNG : BEQ + ; check if blue balls are disabled
PLA PLA
ORA.b #$01 ; guarantee no blue ball ORA.b #$01 ; guarantee no blue ball
@@ -87,7 +87,7 @@ RNG_Ganon:
LDA.b #$0D : BRA _rng_done LDA.b #$0D : BRA _rng_done
RNG_Ganon_Extra_Warp: RNG_Ganon_Extra_Warp:
LDA.b #$0E LDA.b #$0E
JSL.l GetStaticRNG : PHA JSL GetStaticRNG : PHA
LDA.l GanonAgahRNG : BEQ + ; check if warps are disabled LDA.l GanonAgahRNG : BEQ + ; check if warps are disabled
PLA PLA
AND.b #$FE ; set least significant bit to 0 to prevent teleport AND.b #$FE ; set least significant bit to 0 to prevent teleport
@@ -101,7 +101,7 @@ RNG_Enemy_Drops:
+ +
LDA.b #$0F LDA.b #$0F
_rng_done: _rng_done:
JSL.l GetStaticRNG JSL GetStaticRNG
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; In: A = RNG Index ; In: A = RNG Index

Some files were not shown because too many files have changed in this diff Show More