Another WRAM label pass

Deleted compression.asm
This commit is contained in:
cassidoxa
2022-11-22 00:36:39 -05:00
parent 788cceaab9
commit 09d15f3294
63 changed files with 1438 additions and 1317 deletions

View File

@@ -137,7 +137,6 @@ incsrc goalitem.asm
incsrc quickswap.asm
incsrc endingsequence.asm
incsrc cuccostorm.asm
incsrc compression.asm
incsrc retro.asm
incsrc controllerjank.asm
incsrc boots.asm

View File

@@ -43,7 +43,7 @@ WhitenLoopReal:
LDA.l $7EC3F0 : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5F0
LDA.l $7EC3F2 : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5F2
LDA.l $7EC3F4 : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5F4
LDA.b $10 : CMP.w #$0007 : BNE +
LDA.b GameMode : CMP.w #$0007 : BNE +
LDA.w $048E
CMP.w #$003C : BEQ ++
CMP.w #$009D : BEQ ++
@@ -89,7 +89,7 @@ WhitenLoopDummy:
LDA.l $7EC3F0 : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC5F0
LDA.l $7EC3F2 : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC5F2
LDA.l $7EC3F4 : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC5F4
LDA.b $10 : CMP.w #$0007 : BNE + ; only light invisifloor if we're in dungeon submodule
LDA.b GameMode : CMP.w #$0007 : BNE + ; only light invisifloor if we're in dungeon submodule
LDA.w $048E
CMP.w #$003C : BEQ ++ ; hookshot cave
CMP.w #$009D : BEQ ++ ; gt right

View File

@@ -3,19 +3,19 @@
;--------------------------------------------------------------------------------
LoadLibraryItemGFX:
%GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues)
STA.w $0E80, X ; Store item type
STA.w SpriteItemType, X ; Store item type
JSL.l PrepDynamicTile
RTL
;--------------------------------------------------------------------------------
DrawLibraryItemGFX:
PHA
LDA.w $0E80, X ; Retrieve stored item type
LDA.w SpriteItemType, X ; Retrieve stored item type
JSL.l DrawDynamicTile
PLA
RTL
;--------------------------------------------------------------------------------
SetLibraryItem:
LDY.w $0E80, X ; Retrieve stored item type
LDY.w SpriteItemType, X ; Retrieve stored item type
JSL.l ItemSet_Library ; contains thing we wrote over
RTL
;--------------------------------------------------------------------------------

View File

@@ -8,7 +8,7 @@ ModifyBoots:
+ : CMP.b #$02 : BNE +
PLA : AND.l AbilityFlags : AND.b #$FB : RTL ; no boots
+ : LDA.l FakeBoots : CMP.b #$01 : BNE +
LDA.b $5B : BEQ ++ : LDA.b $59 : BNE + ; hover check
LDA.b LinkSlipping : BEQ ++ : LDA.b $59 : BNE + ; hover check
++ : PLA : AND.l AbilityFlags : ORA.b #$04 : RTL ; yes boots, not hovering
+
PLA
@@ -44,7 +44,7 @@ BonkRockPile:
LDA.l BootsEquipment : BNE + ; Check for Boots
LDA.b #$00 : RTL
+
LDA.w $02EF : AND.b #$70 ; things we wrote over
LDA.w TileActBE : AND.b #$70 ; things we wrote over
RTL
;--------------------------------------------------------------------------------
GravestoneHook:
@@ -60,17 +60,17 @@ JumpDownLedge:
LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BNE + ; Check for Boots
; Disarm Waterwalk
LDA.b $5B : CMP.b #$01 : BNE +
STZ.b $5B
LDA.b LinkSlipping : CMP.b #$01 : BNE +
STZ.b LinkSlipping
+
LDA.b $1B : BNE .done : LDA.b #$02 : STA.b $EE ; things we wrote over
LDA.b IndoorsFlag : BNE .done : LDA.b #$02 : STA.b LinkLayer ; things we wrote over
.done
RTL
;--------------------------------------------------------------------------------
BonkRecoil:
LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BNE + ; Check for Boots
LDA.b #$16 : STA.b $29 : RTL
LDA.b #$16 : STA.b LinkRecoilZ : RTL
+
LDA.b #$24 : STA.b $29 ; things we wrote over
LDA.b #$24 : STA.b LinkRecoilZ ; things we wrote over
RTL

View File

@@ -22,7 +22,7 @@ RTL
;0 = Reset Music
;1 = Don't Reset Music
MSMusicReset:
LDA.b $8A : CMP.b #$80 : BNE +
LDA.b OverworldIndex : CMP.b #$80 : BNE +
LDA.b $23
+
RTL
@@ -46,9 +46,9 @@ RTL
DecideIfBunnyByScreenIndex:
; If indoors we don't have a screen index. Return non-bunny to make mirror-based
; superbunny work
LDA.b $1B : BNE .done
LDA.b IndoorsFlag : BNE .done
LDA.l MoonPearlEquipment : BNE .done
LDA.b $8A : AND.b #$40 : PHA
LDA.b OverworldIndex : AND.b #$40 : PHA
LDA.l InvertedMode : BNE .inverted
.normal
PLA : EOR #$40
@@ -59,10 +59,10 @@ DecideIfBunnyByScreenIndex:
RTL
;--------------------------------------------------------------------------------
FixBunnyOnExitToLightWorld:
LDA.w $02E0 : BEQ +
LDA.w BunnyFlag : BEQ +
JSL.l DecideIfBunny : BEQ +
STZ.b $5D ; set player mode to Normal
STZ.w $02E0 : STZ.b $56 ; return player graphics to normal
STZ.b LinkState ; set player mode to Normal
STZ.w BunnyFlag : STZ.b BunnyFlagDP ; return player graphics to normal
+
RTS
;--------------------------------------------------------------------------------
@@ -80,10 +80,10 @@ FixAga2Bunny:
++
JSL DecideIfBunny : BNE +
JSR MakeBunny
LDA.b #$04 : STA.w $012C ; play bunny music
LDA.b #$04 : STA.w MusicControlRequest ; play bunny music
BRA .done
+
LDA.b #$09 : STA.w $012C ; what we wrote over
LDA.b #$09 : STA.w MusicControlRequest ; what we wrote over
.done
RTL
;--------------------------------------------------------------------------------
@@ -91,8 +91,8 @@ RTL
;--------------------------------------------------------------------------------
MakeBunny:
PHX : PHY
LDA.b #$17 : STA.b $5D ; set player mode to permabunny
LDA.b #$01 : STA.w $02E0 : STA.b $56 ; make player look like bunny
LDA.b #$17 : STA.b LinkState ; set player mode to permabunny
LDA.b #$01 : STA.w BunnyFlag : STA.b BunnyFlagDP ; make player look like bunny
JSL LoadGearPalettes_bunny
PLY : PLX
RTS
@@ -157,7 +157,7 @@ RTL
;--------------------------------------------------------------------------------
; Fix Bunny Palette Map Bug
LoadGearPalette_safe_for_bunny:
LDA.b $10
LDA.b GameMode
CMP.w #$030E : BEQ .new ; opening dungeon map
CMP.w #$070E : BEQ .new ; opening overworld map
.original
@@ -184,15 +184,15 @@ RTL
; Fix pedestal pull overlay
PedestalPullOverlayFix:
LDA.b #$09 : STA.w $039F, X ; the thing we wrote over
LDA.b $1B : BNE +
LDA.b $8A : CMP.b #$80 : BNE +
LDA.b $8C : CMP.b #$97
LDA.b IndoorsFlag : BNE +
LDA.b OverworldIndex : CMP.b #$80 : BNE +
LDA.b OverlayID : CMP.b #$97
+
RTL
;--------------------------------------------------------------------------------
FixJingleGlitch:
LDA.b $11
LDA.b GameSubMode
BEQ .set_doors
LDA.l AllowAccidentalMajorGlitch
@@ -200,7 +200,7 @@ FixJingleGlitch:
.set_doors
LDA.b #$05
STA.b $11
STA.b GameSubMode
.exit
RTL
@@ -216,3 +216,32 @@ SetOverworldTransitionFlags:
STA.w $0ABF ; used by witch
STA.w $021B ; used by race game
RTL
;--------------------------------------------------------------------------------
ParadoxCaveGfxFix:
; Always upload line unless you're moving into paradox cave (0x0FF) from above (0x0EF)
LDA.b IndoorsFlag : BEQ .uploadLine
LDX.b RoomIndex : CPX.w #$00FF : BNE .uploadLine
LDX.b PreviousRoom : CPX.w #$00EF : BNE .uploadLine
;Ignore uploading four specific lines of tiles to VRAM
LDX.w $0118
; Line 1
CPX.w #$1800 : BEQ .skipMostOfLine
; Line 2
CPX.w #$1A00 : BEQ .skipMostOfLine
; Line 3
CPX.w #$1C00 : BEQ .uploadLine
; Line 4
CPX.w #$1E00 : BEQ .uploadLine
.uploadLine
LDA.b #$01 : STA.w MDMAEN
.skipLine
RTL
.skipMostOfLine
; Set line length to 192 bytes (the first 6 8x8 tiles in the line)
LDX.w #$00C0 : STX.w DAS0L
BRA .uploadLine
;--------------------------------------------------------------------------------

View File

@@ -6,7 +6,7 @@ LoadCatfishItemGFX:
JML PrepDynamicTile
;--------------------------------------------------------------------------------
DrawThrownItem:
LDA.b $8A : CMP.b #$81 : BNE .catfish
LDA.b OverworldIndex : CMP.b #$81 : BNE .catfish
.zora
LDA.b #$01 : STA.l RedrawFlag
LDA.l $1DE1C3 ; location randomizer writes zora item to
@@ -18,7 +18,7 @@ DrawThrownItem:
;--------------------------------------------------------------------------------
MarkThrownItem:
JSL Link_ReceiveItem ; thing we wrote over
LDA.b $8A : CMP.b #$81 : BNE .catfish
LDA.b OverworldIndex : CMP.b #$81 : BNE .catfish
.zora
JML ItemSet_ZoraKing
.catfish

View File

@@ -1,9 +1,9 @@
DrawDungeonCompassCounts:
LDX.b $1B : BNE + : RTL : + ; Skip if outdoors
LDX.b IndoorsFlag : BNE + : RTL : + ; Skip if outdoors
; extra hard safeties for getting dungeon ID to prevent crashes
PHA
LDA.w $040C : AND.w #$00FE : TAX ; force dungeon ID to be multiple of 2
LDA.w DungeonID : AND.w #$00FE : TAX ; force dungeon ID to be multiple of 2
PLA
CPX.b #$1B : BCS .done ; Skip if not in a valid dungeon ID

View File

@@ -1,29 +0,0 @@
;--------------------------------------------------------------------------------
ParadoxCaveGfxFix:
; Always upload line unless you're moving into paradox cave (0x0FF) from above (0x0EF)
LDA.b $1B : BEQ .uploadLine
LDX.b RoomIndex : CPX.w #$00FF : BNE .uploadLine
LDX.b $A2 : CPX.w #$00EF : BNE .uploadLine
;Ignore uploading four specific lines of tiles to VRAM
LDX.w $0118
; Line 1
CPX.w #$1800 : BEQ .skipMostOfLine
; Line 2
CPX.w #$1A00 : BEQ .skipMostOfLine
; Line 3
CPX.w #$1C00 : BEQ .uploadLine
; Line 4
CPX.w #$1E00 : BEQ .uploadLine
.uploadLine
LDA.b #$01 : STA.w MDMAEN
.skipLine
RTL
.skipMostOfLine
; Set line length to 192 bytes (the first 6 8x8 tiles in the line)
LDX.w #$00C0 : STX.w DAS0L
BRA .uploadLine
;--------------------------------------------------------------------------------

View File

@@ -9,7 +9,7 @@ CuccoStorm:
SEP #$30 ; set 8-bit accumulator index registers
LDA.l CuccoStormer : BEQ + ; only if storm is on
LDA.b $10 : CMP.b #$09 : BNE + ; only if outdoors
LDA.b GameMode : CMP.b #$09 : BNE + ; only if outdoors
LDA.l LoopFrames : AND.b #$7F : BNE + ; check every 128 frames
-

View File

@@ -27,8 +27,8 @@ SetDeathWorldChecked:
LDA.l InvertedMode : BEQ +
JMP SetDeathWorldChecked_Inverted
+
LDA.b $1B : BEQ .outdoors
LDA.w $040C : CMP.b #$FF : BNE .dungeon
LDA.b IndoorsFlag : BEQ .outdoors
LDA.w DungeonID : CMP.b #$FF : BNE .dungeon
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
++
@@ -63,8 +63,8 @@ DoWorldFix_Inverted:
RTL
;--------------------------------------------------------------------------------
SetDeathWorldChecked_Inverted:
LDA.b $1B : BEQ .outdoors
LDA.w $040C : CMP.b #$FF : BNE .dungeon
LDA.b IndoorsFlag : BEQ .outdoors
LDA.w DungeonID : CMP.b #$FF : BNE .dungeon
LDA.b RoomIndex : ORA.b RoomIndex+1 : BNE ++
LDA.l GanonPyramidRespawn : BNE .castle ; if flag is set, force respawn at pyramid on death to ganon
++
@@ -86,7 +86,7 @@ RTL
;--------------------------------------------------------------------------------
FakeWorldFix:
LDA.l FixFakeWorld : BEQ +
LDA.b $8A : AND.b #$40 : STA.l CurrentWorld
LDA.b OverworldIndex : AND.b #$40 : STA.l CurrentWorld
+
RTL
;--------------------------------------------------------------------------------

View File

@@ -6,11 +6,11 @@ DialogOverride:
LDA.l DialogBuffer, X ; use alternate buffer
RTL
.skip
LDA.l $7F1200, X
LDA.l DecompressionBuffer+$1200, X
RTL
ResetDialogPointer:
STZ.w $1CF0 : STZ.w $1CF1 ; reset decompression buffer
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$00 : STA.l AltTextFlag ; zero out the alternate flag
LDA.b #$1C : STA.w $1CE9 ; thing we wrote over
RTL
@@ -23,7 +23,7 @@ macro LoadDialogAddress(address)
REP #$10 ; set 16-bit index registers
PEI.b ($00)
LDA.b Scrap02 : PHA
STZ.w $1CF0 : STZ.w $1CF1 ; reset decompression buffer
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$01 : STA.l AltTextFlag ; set flag
%CopyDialog(<address>)
PLA : STA.b Scrap02
@@ -55,7 +55,7 @@ macro CopyDialogIndirect()
endmacro
;--------------------------------------------------------------------------------
LoadDialogAddressIndirect:
STZ.w $1CF0 : STZ.w $1CF1 ; reset decompression buffer
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$01 : STA.l AltTextFlag ; set flag
%CopyDialogIndirect()
RTL
@@ -119,7 +119,6 @@ FreeDungeonItemNotice:
LDA.w ScratchBufferV : AND.b #$F0 : CMP.b #$A0 : BNE + ; small key of...
LDA.w ScratchBufferV : CMP.b #$AF : BNE ++ : JMP .skip : ++
%CopyDialog(Notice_SmallKeyOf)
PLA : AND.b #$0F : STA.w ScratchBufferV : LDA.b #$0F : !SUB.w ScratchBufferV : PHA
LDA.b #$01 : STA.w ScratchBufferNV ; set up a flip for small keys
BRA .dungeon
+
@@ -170,7 +169,7 @@ FreeDungeonItemNotice:
+
.done
STZ.w $1CF0 : STZ.w $1CF1 ; reset decompression buffer
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$01 : STA.l AltTextFlag ; set alternate dialog flag
STA.l TextBoxDefer
@@ -211,7 +210,7 @@ DialogFairyThrow:
ORA.l BottleContentsTwo : ORA.l BottleContentsThree : ORA.l BottleContentsFour : BNE .normal
.noInventory
LDA.w $0D80, X : !ADD #$08 : STA.w $0D80, X
LDA.w SpriteUnknown, X : !ADD #$08 : STA.w SpriteUnknown, X
LDA.b #$51
LDY.b #$01
RTL
@@ -226,7 +225,7 @@ DialogGanon1:
LDA.w #$018C
BCC +
LDA.w #$016D
+ STA.w $1CF0
+ STA.w TextID
SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt
RTL
@@ -262,18 +261,18 @@ DialogGanon2:
+
LDA.w #$016E
++
STA.w $1CF0
STA.w TextID
SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt
RTL
;--------------------------------------------------------------------------------
DialogEtherTablet:
PHA
LDA.w $0202 : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
LDA.w ItemCursor : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
-
PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text
+
BIT $F4 : BVC - ; Show normal text if Y is not pressed
BIT.b Joy1A_New : BVC - ; Show normal text if Y is not pressed
LDA.l AllowHammerTablets : BEQ ++
LDA.l HammerEquipment : BEQ .yesText : BRA .noText
++
@@ -291,11 +290,11 @@ RTL
;--------------------------------------------------------------------------------
DialogBombosTablet:
PHA
LDA.w $0202 : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
LDA.w ItemCursor : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
-
PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text
+
BIT $F4 : BVC - ; Show normal text if Y is not pressed
BIT.b Joy1A_New : BVC - ; Show normal text if Y is not pressed
LDA.l AllowHammerTablets : BEQ ++
LDA.l HammerEquipment : BEQ .yesText : BRA .noText
++
@@ -339,16 +338,16 @@ AgahnimAsksAboutPed:
BNE .vanilla
LDA.b #$8C ; message 018C for no ped
STA.w $1CF0
STA.w TextID
.vanilla
JML $05FA8E ; Sprite_ShowMessageMinimal
;--------------------------------------------------------------------------------
Main_ShowTextMessage_Alt:
; Are we in text mode? If so then end the routine.
LDA.b $10 : CMP.b #$0E : BEQ .already_in_text_mode
LDA.b GameMode : CMP.b #$0E : BEQ .already_in_text_mode
Sprite_ShowMessageMinimal_Alt:
STZ.b $11
STZ.b GameSubMode
PHX : PHY
PEI.b (Scrap00)
@@ -356,7 +355,7 @@ Sprite_ShowMessageMinimal_Alt:
LDA.b #$1C : STA.b Scrap02
REP #$30
LDA.w $1CF0 : ASL : TAX
LDA.w TextID : ASL : TAX
LDA.l $7F71C0, X
STA.b Scrap00
SEP #$30
@@ -376,13 +375,13 @@ Sprite_ShowMessageMinimal_Alt:
STZ.w $1CD8 ; Initialize the step in the submodule
; Go to text display mode (as opposed to maps, etc)
LDA.b #$02 : STA.b $11
LDA.b #$02 : STA.b GameSubMode
; Store the current module in the temporary location.
LDA.b $10 : STA.w $010C
LDA.b GameMode : STA.w GameModeCache
; Switch the main module ($10) to text mode.
LDA.b #$0E : STA.b $10
LDA.b #$0E : STA.b GameMode
.end
PLA : STA.b Scrap02
PLA : STA.b Scrap01
@@ -398,15 +397,15 @@ CalculateSignIndex:
; And we do this in a way that will likely give the right value even
; with major glitches.
LDA.b $8A : ASL A : TAY ;what we wrote over
LDA.b OverworldIndex : ASL A : TAY ;what we wrote over
LDA.w $0712 : BEQ .done ; If a small map, we can skip these calculations.
LDA.b $21 : AND.w #$0002 : ASL #2 : EOR $8A : AND.w #$0008 : BEQ +
LDA.b $21 : AND.w #$0002 : ASL #2 : EOR.b OverworldIndex : AND.w #$0008 : BEQ +
TYA : !ADD.w #$0010 : TAY ;add 16 if we are in lower half of big screen.
+
LDA.b $23 : AND.w #$0002 : LSR : EOR.b $8A : AND.w #$0001 : BEQ +
LDA.b $23 : AND.w #$0002 : LSR : EOR.b OverworldIndex : AND.w #$0001 : BEQ +
TYA : INC #2 : TAY ;add 16 if we are in lower half of big screen.
+
; ensure even if things go horribly wrong, we don't read the sign out of bounds and crash:
@@ -420,26 +419,26 @@ RTL
;================================================================
Sprite_ShowSolicitedMessageIfPlayerFacing_Alt:
{
STA.w $1CF0
STY.w $1CF1
STA.w TextID
STY.w TextID+1
JSL Sprite_CheckDamageToPlayerSameLayerLong : BCC .alpha
JSL Sprite_CheckIfPlayerPreoccupied : BCS .alpha
LDA.b $F6 : BPL .alpha
LDA.b Joy1B_New : BPL .alpha
LDA.w $0F10, X : BNE .alpha
LDA.b $4D : CMP.b #$02 : BEQ .alpha
LDA.b LinkJumping : CMP.b #$02 : BEQ .alpha
JSL Sprite_DirectionToFacePlayerLong : PHX : TYX
; Make sure that the sprite is facing towards the player, otherwise
; talking can't happen. (What sprites actually use this???)
LDA.l $05E1A3, X : PLX : CMP.b $2F : BNE .not_facing_each_other
LDA.l $05E1A3, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other
PHY
LDA.w $1CF0
LDY.w $1CF1
LDA.w TextID
LDY.w TextID+1
; Check what room we're in so we know which npc we're talking to
LDA.b RoomIndex
@@ -483,15 +482,15 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage:
JSL Sprite_CheckDamageToPlayerSameLayerLong : BCC .alpha
JSL Sprite_CheckIfPlayerPreoccupied : BCS .alpha
LDA.b $F6 : BPL .alpha
LDA.b Joy1B_New : BPL .alpha
LDA.w $0F10, X : BNE .alpha
LDA.b $4D : CMP.b #$02 : BEQ .alpha
LDA.b LinkJumping : CMP.b #$02 : BEQ .alpha
JSL Sprite_DirectionToFacePlayerLong : PHX : TYX
; Make sure that the sprite is facing towards the player, otherwise
; talking can't happen. (What sprites actually use this???)
LDA.l $05E1A3, X : PLX : CMP.b $2F : BNE .not_facing_each_other
LDA.l $05E1A3, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other
PLA : XBA : PLA

View File

@@ -2,7 +2,7 @@
; Dungeon & Boss Drop Fixes
;--------------------------------------------------------------------------------
DropSafeDungeon:
LDA.w $040C : CMP.b #$08 : BEQ +
LDA.w DungeonID : CMP.b #$08 : BEQ +
LDA.l $01C6FC, X : JML Sprite_SpawnFallingItem
+
RTL

View File

@@ -9,7 +9,7 @@ DoDungeonMapBossIcon:
.dungeonmap
LDX.w $040C
LDX.w DungeonID
BMI .cave
; get dungeon boss room

View File

@@ -1,6 +1,6 @@
NewElderCode:
{
LDA.b $8A : CMP.b #$1B : BEQ .newCodeContinue
LDA.b OverworldIndex : CMP.b #$1B : BEQ .newCodeContinue
;Restore Jump we can keep the RTL so JML
JML $05F0CD
.newCodeContinue
@@ -19,7 +19,7 @@ RTL
LDA.b #$02 : STA.b Scrap06 : STZ.b Scrap07 ;Number of Tiles
LDA.w $0DC0, X : ASL #04
LDA.w SpriteGFXControl, X : ASL #04
ADC.b #.animation_states : STA.b Scrap08
LDA.b #.animation_states>>8 : ADC.b #$00 : STA.b Scrap09
@@ -46,11 +46,11 @@ RTL
LDA.l TurnInGoalItems : AND.w #$00FF : BNE +
.despawn
SEP #$20
STZ.w $0DD0, X ; despawn self
STZ.w SpriteAITable, X ; despawn self
RTS
+
SEP #$20
LDA.b $11
LDA.b GameSubMode
BNE .done
LDA.b #$96
LDY.b #$01
@@ -66,6 +66,6 @@ RTL
.done
SEP #$20
LDA.b $1A : LSR #5 : AND.b #$01 : STA.w $0DC0, X
LDA.b FrameCounter : LSR #5 : AND.b #$01 : STA.w SpriteGFXControl, X
RTS
}

View File

@@ -149,10 +149,10 @@ JML.l AllowStartFromExitReturn
LDA.l $02D8D3, X : STA.b RoomIndex+1
; Go to pre-overworld mode
LDA.b #$08 : STA.b $10
LDA.b #$08 : STA.b GameMode
STZ.b $11
STZ.b $B0
STZ.b GameSubMode
STZ.b SubSubModule
STZ.w $010A
@@ -168,7 +168,7 @@ CheckHole:
.nextHoleClassic
LDA.b Scrap00 : CMP.l $1BB800, X
BNE .wrongMap16Classic
LDA.w $040A : CMP.l $1BB826, X
LDA.b OverworldIndex : CMP.l $1BB826, X
BEQ .matchedHoleClassic
.wrongMap16Classic
DEX #2 : BPL .nextHoleClassic
@@ -177,7 +177,7 @@ CheckHole:
.nextHoleExtra
LDA.b Scrap00 : CMP.l ExtraHole_Map16, X
BNE .wrongMap16Extra
LDA.w $040A : CMP.l ExtraHole_Area, X
LDA.b OverworldIndex : CMP.l ExtraHole_Area, X
BEQ .matchedHoleExtra
.wrongMap16Extra
DEX #2 : BPL .nextHoleExtra
@@ -194,8 +194,8 @@ JML Overworld_Hole_End
PreventEnterOnBonk:
STA.b Scrap00 ; part of what we wrote over
LDA.l InvertedMode : AND.w #$00FF : BEQ .done
LDA.l $5D : AND.w #$00FF : CMP.w #$0014 : BNE .done ;in mirror mode?
LDA.b $8A : AND.w #$0040 : CMP.b $7B : BEQ .done ; Are we bonking, or doing the superbunny glitch?
LDA.b LinkState : AND.w #$00FF : CMP.w #$0014 : BNE .done ;in mirror mode?
LDA.b OverworldIndex : AND.w #$0040 : CMP.b $7B : BEQ .done ; Are we bonking, or doing the superbunny glitch?
; If in inverted, are in mirror mode, and are bonking then do not enter
JML.l PreventEnterOnBonk_BRANCH_IX
@@ -206,7 +206,7 @@ JML.l PreventEnterOnBonk_return
;--------------------------------------------------------------------------------
TurtleRockEntranceFix:
LDA.l TurtleRockAutoOpenFix : BEQ .done
LDA.b $8A : CMP.b #$47 : BNE .done
LDA.b OverworldIndex : CMP.b #$47 : BNE .done
;If exiting to turtle rock ensure the entrance is open
LDA.l OverworldEventDataWRAM+$47 : ORA.b #$20 : STA.l OverworldEventDataWRAM+$47
.done
@@ -215,14 +215,14 @@ RTL
AnimatedEntranceFix: ;when an entrance animation tries to start
PHA
LDA.l InvertedMode : BEQ + ;If we are in inverted mode
LDA.b $8A : AND.b #$40 : BNE + ;and in the light world
LDA.b OverworldIndex : AND.b #$40 : BNE + ;and in the light world
PLA
STZ.w $04C6 ; skip it.
STZ.w OWEntranceCutscene ; skip it.
LDA.b #$00
RTL
+
PLA
STA.w $02E4 ;what we wrote over
STA.w $0FC1 ;what we wrote over
STA.w $0710 ;what we wrote over
STA.w CutsceneFlag ;what we wrote over
STA.w FreezeSprites ;what we wrote over
STA.w SkipOAM ;what we wrote over
RTL

View File

@@ -1,5 +1,5 @@
OnPrepFileSelect:
LDA.b $11 : CMP.b #$03 : BNE +
LDA.b GameSubMode : CMP.b #$03 : BNE +
LDA.b #$06 : STA.b $14 ; thing we wrote over
RTL
+
@@ -33,7 +33,7 @@ OnDungeonExit:
JSL.l SQEGFix
PLP : PLA
STA.w $040C : STZ.w $04AC ; thing we wrote over
STA.w DungeonID : STZ.w $04AC ; thing we wrote over
PHA : PHP
JSL.l HUD_RebuildLong
@@ -84,15 +84,15 @@ OnFileCreation:
; Copy initial SRAM state from ROM to cart SRAM
; If the inital SRAM table is move these addresses must be changed
PHB
LDA.w #$03D7 ; \
LDX.w #$B000 ; | Copies from beginning of inital sram table up to file name
LDY.w #$0000 ; | (exclusively)
MVN SRAMBank, SRAMTableBank ; /
; Skip file name and validity value
LDA.w #$010C ; \
LDX.w #$B3E3 ; | Rando-Specific Assignments & Game Stats block
LDY.w #$03E3 ; |
MVN SRAMBank, SRAMTableBank ; /
LDA.w #$03D7 ; \
LDX.w #$B000 ; | Copies from beginning of inital sram table up to file name
LDY.w #$0000 ; | (exclusively)
MVN !SRAMBank, !SRAMTableBank ; /
; Skip file name and validity value
LDA.w #$010C ; \
LDX.w #$B3E3 ; | Rando-Specific Assignments & Game Stats block
LDY.w #$03E3 ; |
MVN !SRAMBank, !SRAMTableBank ; /
PLB
; resolve instant post-aga if standard
@@ -104,7 +104,7 @@ OnFileCreation:
REP #$20
; Set validity value and do some cleanup. Jump to checksum.
LDA.w #$55AA : STA.l $7003E1
LDA.w #$55AA : STA.l FileValiditySRAM
STZ.b Scrap00
STZ.b Scrap01
LDX.b Scrap00
@@ -167,7 +167,6 @@ RTL
OnLinkDamaged:
JSL.l IncrementDamageTakenCounter_Arb
JML.l OHKOTimer
;--------------------------------------------------------------------------------
;OnEnterWater:
; JSL.l UnequipCapeQuiet ; what we wrote over
@@ -178,18 +177,17 @@ OnLinkDamagedFromPit:
LDA.l AllowAccidentalMajorGlitch
BEQ ++
-- LDA.b #$14 : STA.b $11 ; thing we wrote over
-- LDA.b #$14 : STA.b GameSubMode ; thing we wrote over
RTL
++ LDA.b $10 : CMP.b #$12 : BNE --
++ LDA.b GameMode : CMP.b #$12 : BNE --
STZ.b $11
STZ.b GameSubMode
RTL
;--------------------------------------------------------------------------------
OnLinkDamagedFromPitOutdoors:
JML.l OHKOTimer ; make sure this is last
;--------------------------------------------------------------------------------
OnOWTransition:
JSL.l FloodGateReset
@@ -204,13 +202,11 @@ OnLoadDuckMap:
LDA.l DuckMapFlag
BNE +
INC : STA.l DuckMapFlag
JSL OverworldMap_InitGfx : DEC $0200
JSL OverworldMap_InitGfx : DEC.w SubModuleInterface
RTL
+
LDA.b #$00 : STA.l DuckMapFlag
JML OverworldMap_DarkWorldTilemap
;--------------------------------------------------------------------------------
PreItemGet:
LDA.b #$01 : STA.l BusyItem ; mark item as busy
@@ -224,16 +220,16 @@ PostItemAnimation:
LDA.b #$00 : STA.l BusyItem ; mark item as finished
LDA.l TextBoxDefer : BEQ +
STZ.w $1CF0 : STZ.w $1CF1 ; reset decompression buffer
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
JSL.l Main_ShowTextMessage_Alt
LDA.b #$00 : STA.l TextBoxDefer
+
LDA.w $02E9 : CMP.b #$01 : BNE +
LDA.b $2F : BEQ +
LDA.w ItemReceiptMethod : CMP.b #$01 : BNE +
LDA.b LinkDirection : BEQ +
JSL.l IncrementChestTurnCounter
+
STZ.w $02E9 : LDA.w $0C5E, X ; thing we wrote over to get here
STZ.w ItemReceiptMethod : LDA.w $0C5E, X ; thing we wrote over to get here
RTL
;--------------------------------------------------------------------------------

View File

@@ -130,12 +130,12 @@ Crashed:
LDA.w #$0C78>>1
STA.b VMADDL
LDA.l $10
LDA.l GameMode
AND.w #$00FF
ORA.w #$0100
STA.b VMDATAL
LDA.l $11
LDA.l GameSubMode
AND.w #$00FF
ORA.w #$0100
STA.b VMDATAL

View File

@@ -35,16 +35,16 @@ FairyPond_Init:
LDA.l BottleContentsThree : CMP.b #$02 : BNE ++ : LDA.b #$1E : PHA : BRA .emptyBottle : ++
LDA.l BottleContentsFour : CMP.b #$02 : BNE ++ : LDA.b #$1F : PHA : BRA .emptyBottle : ++
.noInventory
LDA.b #$0A : STA.w $0D80, X
LDA.b #$0A : STA.w SpriteUnknown, X
LDA.b #$51
LDY.b #$01
JSL.l Sprite_ShowMessageFromPlayerContact
JMP .cleanup
.emptyBottle
LDA.b #$02 : STA.w $0D80, X
STZ $2F
LDA.b #$01 : STA.w $02E4
LDA.b #$02 : STA.w SpriteUnknown, X
STZ.b LinkDirection
LDA.b #$01 : STA.w CutsceneFlag
PLA : STA.w $1CE8
.cleanup
STZ.w $0EB0, X ; Clear the sprite's item-given variable
@@ -60,26 +60,26 @@ HappinessPond_Check:
LDA.b #$72
JSL Sprite_SpawnDynamically
LDA.w $0FD8 : STA.w $0D10, Y
LDA.w $0FD9 : STA.w $0D30, Y
LDA.w SpriteCoordCacheX : STA.w SpritePosXLow, Y
LDA.w SpriteCoordCacheX+1 : STA.w SpritePosXHigh, Y
LDA.w $0FDA : !SUB.b #$40 : STA.w $0D00, Y
LDA.w $0FDB : SBC.b #$00 : STA.w $0D20, Y
LDA.w SpriteCoordCacheY : !SUB.b #$40 : STA.w SpritePosYLow, Y
LDA.w SpriteCoordCacheY+1 : SBC.b #$00 : STA.w SpritePosYHigh, Y
LDA.b #$01 : STA.w $0DA0, Y
LDA.b #$01 : STA.w SpriteAuxTable, Y
LDA.b #$BB
JSL Sprite_SpawnDynamically
LDA.b #$08 : STA.w $0DD0, Y ; ensure we run prep for the shopkeeper
LDA.b #$08 : STA.w SpriteAITable, Y ; ensure we run prep for the shopkeeper
LDA.w $0FD8 : STA.w $0D10, Y
LDA.w $0FD9 : STA.w $0D30, Y
LDA.w SpriteCoordCacheX : STA.w SpritePosXLow, Y
LDA.w SpriteCoordCacheX+1 : STA.w SpritePosXHigh, Y
LDA.w $0FDA : !SUB.b #$20 : STA.w $0D00, Y
LDA.w $0FDB : SBC.b #$00 : STA.w $0D20, Y
LDA.w SpriteCoordCacheY : !SUB.b #$20 : STA.w SpritePosYLow, Y
LDA.w SpriteCoordCacheY+1 : SBC.b #$00 : STA.w SpritePosYHigh, Y
STZ.w $0DD0, X ; self terminate
STZ.w SpriteAITable, X ; self terminate
PLP
.done

View File

@@ -1,21 +1,21 @@
;===================================================================================================
FastCreditsCutsceneTimer:
BIT.b $F2-1 : BVC .slow
BIT.b Joy1B_All-1 : BVC .slow
LDA.w #$0001 : STA.b $50
LDA.b $C8
LDA.b ScrapBufferBD+$0B
CLC
ADC.w #$0004
AND.w #$FFFE
STA.b $C8
STA.b ScrapBufferBD+$0B
SEP #$20
RTL
.slow
INC.b $C8
INC.b ScrapBufferBD+$0B
SEP #$20
RTL
@@ -60,7 +60,7 @@ FastCreditsCutsceneScroll:
BCC ++ ; scroll if carry not set
LDA.w #$0000
++ BIT.b $F2-1 : BVC .slow ; check for X held
++ BIT.b Joy1B_All-1 : BVC .slow ; check for X held
AND.w #$FFFF ; get sign of A
BPL .positive
@@ -90,8 +90,8 @@ FastCreditsCutsceneScroll:
FastCreditsCutsceneUnderworldX:
JSR FastCreditsCutsceneScrollX
CLC
ADC.b $E2
STA.b $E2
ADC.b BG2H
STA.b BG2H
RTL
@@ -99,15 +99,15 @@ FastCreditsCutsceneUnderworldX:
FastCreditsCutsceneUnderworldY:
JSR FastCreditsCutsceneScrollY
CLC
ADC.b $E8
STA.b $E8
ADC.b BG2V
STA.b BG2V
RTL
FastTextScroll:
LDA.b $1A
BIT.b $F2-1 : BVC .slow
LDA.b FrameCounter
BIT.b Joy1B_All-1 : BVC .slow
AND.w #$0000
RTL

View File

@@ -82,42 +82,42 @@ JMP DrawItemGray
DrawBottle:
AND.w #$00FF : BNE +
LDX #FileSelectItems_empty_bottle
LDX.w #FileSelectItems_empty_bottle
JMP DrawItemGray
+ : DEC #2 : BNE +
LDX #FileSelectItems_empty_bottle
LDX.w #FileSelectItems_empty_bottle
JMP DrawItem
+ : DEC : BNE +
LDX #FileSelectItems_red_potion
LDX.w #FileSelectItems_red_potion
JMP DrawItem
+ : DEC : BNE +
LDX #FileSelectItems_green_potion
LDX.w #FileSelectItems_green_potion
JMP DrawItem
+ : DEC : BNE +
LDX #FileSelectItems_blue_potion
LDX.w #FileSelectItems_blue_potion
JMP DrawItem
+ : DEC : BNE +
LDX #FileSelectItems_fairy_bottle
LDX.w #FileSelectItems_fairy_bottle
JMP DrawItem
+ : DEC : BNE +
LDX #FileSelectItems_bee_bottle
LDX.w #FileSelectItems_bee_bottle
JMP DrawItem
+
LDX #FileSelectItems_good_bee_bottle
LDX.w #FileSelectItems_good_bee_bottle
JMP DrawItem
DrawPlayerFile:
LDA.b $1A : AND.w #$0001 : BNE .normal
LDA.b FrameCounter : AND.w #$0001 : BNE .normal
JSR DrawPlayerFileShared
INC $0710 ; Suppress animated tile updates for this frame
INC.w SkipOAM ; Suppress animated tile updates for this frame
; re-enable Stripe Image format upload on this frame
; Value loaded must match what gets set by AltBufferTable
LDA.w #$0161 : STA.w $1002
BRA .done
.normal
STZ $0710 ; ensure core animated tile updates are not suppressed
STZ.w SkipOAM ; ensure core animated tile updates are not suppressed
LDA.w #$FFFF : STA.w $1002 ; Suppress Stripe Image format upload on this frame
.done
LDA.w #$0004 : STA.b Scrap02 ; thing we wrote over
@@ -642,7 +642,7 @@ AltBufferTable:
LDA.w #$00FF : STA.w $1402
; Draw Unlock option if applicable
LDA.b $10 : AND.w #$00FF : CMP.w #$0001 : BNE +
LDA.b GameMode : AND.w #$00FF : CMP.w #$0001 : BNE +
LDA.l IsEncrypted : AND.w #$00FF : CMP.w #$0002 : BNE +
PHP : SEP #$30 : PHX : PHY : JSL ValidatePassword : PLY : PLX : PLP
AND.w #$00FF : BNE +
@@ -754,7 +754,7 @@ RTL
;--------------------------------------------------------------------------------
SetFileSelectPalette:
LDA.b $10 : CMP.b #$04 : BNE +
LDA.b GameMode : CMP.b #$04 : BNE +
; load the vanilla file select screen BG3 palette for naming screen
LDA.b #$01 : STA.w $0AB2
JSL.l Palette_Hud
@@ -814,7 +814,7 @@ DrawPlayerFile_credits:
RTL
;--------------------------------------------------------------------------------
FSCursorUp:
LDA.b $C8 : BNE +
LDA.b FileSelectPosition : BNE +
LDA.b #$04 ; up from file becomes delete
BRA .done
+ : CMP.b #$03 : BNE +
@@ -828,11 +828,11 @@ FSCursorUp:
+
LDA.b #$00 ;otherwise up from delete is file
.done
STA.b $C8
STA.b FileSelectPosition
RTL
FSCursorDown:
LDA.b $C8 : BNE +
LDA.b FileSelectPosition : BNE +
LDA.l IsEncrypted : CMP.b #$02 : BNE ++
LDA.l ValidKeyLoaded : BNE ++
LDA.b #$03 ; down from file is unlock for password protected seeds
@@ -846,23 +846,23 @@ FSCursorDown:
+
LDA.b #$00 ; down from delete is file
.done
STA.b $C8
STA.b FileSelectPosition
RTL
;--------------------------------------------------------------------------------
FSSelectFile:
LDA.l IsEncrypted : CMP.b #$02 : BNE .normal
STZ $012E ; temporarily cancel file screen selection sound
STZ.w SFX2 ; temporarily cancel file screen selection sound
PHX : PHY
JSL ValidatePassword : BEQ .must_unlock
PLY : PLX
LDA.b #$2C : STA.w $012E ;file screen selection sound
LDA.b #$2C : STA.w SFX2 ;file screen selection sound
.normal
LDA.b #$F1 : STA.w $012C
LDA.b #$F1 : STA.w MusicControlRequest
JML FSSelectFile_continue
.must_unlock
PLY : PLX
LDA.b #$03 : STA.b $C8 ;set cursor to unlock
LDA.b #$3C : STA.w $012E ; play error sound
LDA.b #$03 : STA.b FileSelectPosition ;set cursor to unlock
LDA.b #$3C : STA.w SFX2 ; play error sound
JML FSSelectFile_return
;--------------------------------------------------------------------------------
MaybeForceFileName:

View File

@@ -38,7 +38,7 @@ protectff:
; Remove dark world bit
; in game table that converts coordinates to actual screen ID
; special case for other areas
LDA.b $8A
LDA.b OverworldIndex
BMI .special_overworld
AND.b #$3F
@@ -47,17 +47,17 @@ protectff:
.protect
LDA.b #$15
STA.b $5D
STA.b LinkState
STZ.b $2E
STZ.b $67
LDA.b #$02
STA.b $2F
STA.b LinkDirection
STZ.w $0112
STZ.w $02E4
STZ.w $0FFC
STZ.w MedallionFlag
STZ.w CutsceneFlag
STZ.w NoMenu
++ RTL

View File

@@ -2,18 +2,18 @@
; Randomize Flute Dig Item
;--------------------------------------------------------------------------------
SpawnHauntedGroveItem:
LDA.b $8A : CMP.b #$2A : BEQ + : RTL : + ; Skip if not the haunted grove
LDA.b $1B : BEQ + : RTL : + ; Skip if indoors
LDA.b OverworldIndex : CMP.b #$2A : BEQ + : RTL : + ; Skip if not the haunted grove
LDA.b IndoorsFlag : BEQ + : RTL : + ; Skip if indoors
%GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues)
JSL.l PrepDynamicTile
LDA.b #$EB
STA.l $7FFE00
STA.l MiniGameTime
JSL Sprite_SpawnDynamically
LDX.b #$00
LDA.b $2F : CMP.b #$04 : BEQ + : INX : +
LDA.b LinkDirection : CMP.b #$04 : BEQ + : INX : +
LDA.l .x_speeds, X : STA.w $0D50, Y
@@ -32,7 +32,7 @@ SpawnHauntedGroveItem:
LDA.b #$00 : STA.w $0F20, Y
TYX
LDX.b $8A ; haunted grove (208D0A)
LDX.b OverworldIndex ; haunted grove (208D0A)
LDA.l OverworldEventDataWRAM, X : AND.b #$40 : BNE +
LDA.b #$1B : JSL Sound_SetSfx3PanLong
+
@@ -52,11 +52,11 @@ RTL
}
;--------------------------------------------------------------------------------
FluteBoy:
LDA.b $10 : CMP.b #$1A : BEQ +
LDA.b GameMode : CMP.b #$1A : BEQ +
LDA.b #$01 : STA.w $0FDD
JML.l FluteBoy_Abort
+
LDA.w $0D80, X : CMP.b #$03 ; thing we wrote over
LDA.w SpriteUnknown, X : CMP.b #$03 ; thing we wrote over
JML.l FluteBoy_Continue
;--------------------------------------------------------------------------------
FreeDuckCheck:
@@ -64,7 +64,7 @@ FreeDuckCheck:
LDA.l FluteEquipment : CMP.b #$03 : BEQ .done ; flute is already active
; check the area, is it #$18 = 30?
LDA.b $8A : CMP.b #$18 : BNE .done
LDA.b OverworldIndex : CMP.b #$18 : BNE .done
REP #$20
@@ -84,7 +84,7 @@ FreeDuckCheck:
SEP #$20
; Apparently a special Overworld mode for doing this?
LDA.b #$2D : STA.b $11
LDA.b #$2D : STA.b GameSubMode
; Trigger the sequence to start the weathervane explosion.
LDY.b #$00

View File

@@ -13,7 +13,7 @@ FrameHookAction:
LDA.l LoopFrames : INC : STA.l LoopFrames : BNE +
LDA.l LoopFrames+2 : INC : STA.l LoopFrames+2
+
LDA.l $10 : CMP.w #$010E : BNE + ; move this to nmi hook?
LDA.l GameMode : CMP.w #$010E : BNE + ; move this to nmi hook?
LDA.l MenuFrames : INC : STA.l MenuFrames : BNE +
LDA.l MenuFrames+2 : INC : STA.l MenuFrames+2
+

View File

@@ -70,10 +70,10 @@ GetAgahnimLightning:
;1 = Forbid
AllowJoypadInput:
LDA.l PermitSQFromBosses : BEQ .fullCheck
LDA.w $0403 : AND.b #$80 : BEQ .fullCheck
LDA.w $0112 : ORA.w $02E4 ; we have heart container, do short check
LDA.w ItemsTaken : AND.b #$80 : BEQ .fullCheck
LDA.w MedallionFlag : ORA.w CutsceneFlag ; we have heart container, do short check
RTL
.fullCheck
LDA.w $0112 : ORA.w $02E4 : ORA.w $0FFC
LDA.w MedallionFlag : ORA.w CutsceneFlag : ORA.w NoMenu
RTL
;--------------------------------------------------------------------------------

View File

@@ -1,14 +1,14 @@
GoalItemGanonCheck:
LDA.w $0E20, 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
BCS .success
.fail
LDA.w $0D80, X : CMP.b #17 : !BLT .success ; decmial 17 because Acmlm's chart is decimal
LDA.w SpriteUnknown, X : CMP.b #17 : !BLT .success ; decmial 17 because Acmlm's chart is decimal
LDA.b #$00
RTL
.success
LDA.b $44 : CMP.b #$80 ; thing we wrote over
LDA.b OAMOffsetY : CMP.b #$80 ; thing we wrote over
RTL
;--------------------------------------------------------------------------------
;Carry clear = ganon invincible
@@ -143,8 +143,8 @@ CheckAgaForPed:
RTL
.force_blue_ball
LDA.b #$01 : STA.w $0DA0, Y
LDA.b #$20 : STA.w $0DF0, Y
LDA.b #$01 : STA.w SpriteAuxTable, Y
LDA.b #$20 : STA.w SpriteTimer, Y
CLC ; skip the RNG check
RTL

View File

@@ -6,7 +6,7 @@ GetMagicBatItem:
%GetPossiblyEncryptedItem(MagicBatItem, SpriteItemValues)
CMP.b #$FF : BEQ .normalLogic
TAY
STZ.b $02E9 ; 0 = Receiving item from an NPC or message
STZ.b ItemReceiptMethod ; 0 = Receiving item from an NPC or message
JML.l Link_ReceiveItem
.normalLogic
LDA.l HalfMagic

View File

@@ -16,7 +16,7 @@ CalculateSpikeFloorDamage:
RTL
;--------------------------------------------------------------------------------
CalculateByrnaUsage:
LDA.b $1B : BEQ ++
LDA.b IndoorsFlag : BEQ ++
REP #$20 ; set 16-bit accumulator
LDA.b RoomIndex ; these are all decimal because i got them that way
CMP.w #95 : BEQ + ; Ice Palace Spike Room
@@ -36,7 +36,7 @@ CalculateByrnaUsage:
JML IncrementMagicUseCounterByrna
;--------------------------------------------------------------------------------
CalculateCapeUsage:
LDA.b $1B : BEQ ++
LDA.b IndoorsFlag : BEQ ++
REP #$20 ; set 16-bit accumulator
LDA.b RoomIndex ; these are all decimal because i got them that way
CMP.w #95 : BEQ + ; Ice Palace Spike Room
@@ -54,7 +54,7 @@ CalculateCapeUsage:
JML IncrementMagicUseCounterOne
;--------------------------------------------------------------------------------
ActivateInvulnerabilityOrDont:
LDA.b $1B : BEQ .nowhere_special
LDA.b IndoorsFlag : BEQ .nowhere_special
REP #$20 ; set 16-bit accumulator
LDA.b RoomIndex ; these are all decimal because i got them that way
CMP.w #95 : BEQ .somewhere_cool ; Ice Palace Spike Room

View File

@@ -3,10 +3,10 @@
;================================================================================
BeepLogic:
LDA.l HeartBeep : BEQ +
STA.w $04CA
LDA.b #$2B : STA.w $012E
STA.w HeartBeepTimer
LDA.b #$2B : STA.w SFX2
RTL
+
LDA.b #$FF : STA.w $04CA
LDA.b #$FF : STA.w HeartBeepTimer
RTL
;================================================================================

View File

@@ -3,7 +3,7 @@
;--------------------------------------------------------------------------------
HeartPieceGet:
PHX : PHY
LDY.w $0E80, X ; load item value into Y register
LDY.w SpriteItemType, X ; load item value into Y register
BNE +
; if for any reason the item value is 0 reload it, just in case
JSL.l LoadHeartPieceRoomValue : TAY
@@ -12,7 +12,7 @@ HeartPieceGet:
.skipLoad
STZ.w $02E9 ; 0 = Receiving item from an NPC or message
STZ.w ItemReceiptMethod ; 0 = Receiving item from an NPC or message
CPY.b #$26 : BNE .notHeart ; don't add a 1/4 heart if it's not a heart piece
LDA.l HeartPieceQuarter : INC A : AND.b #$03 : STA.l HeartPieceQuarter : BNE .unfinished_heart ; add up heart quarters
@@ -36,7 +36,7 @@ RTL
HeartContainerGet:
PHX : PHY
JSL.l AddInventory_incrementBossSwordLong
LDY $0E80, X ; load item value into Y register
LDY.w SpriteItemType, X ; load item value into Y register
BNE +
; if for any reason the item value is 0 reload it, just in case
JSL.l LoadHeartContainerRoomValue : TAY
@@ -54,7 +54,7 @@ DrawHeartPieceGFX:
JMP .done ; don't draw on the init frame
.skipInit
LDA.w $0E80, X ; Retrieve stored item type
LDA.w SpriteItemType, X ; Retrieve stored item type
.skipLoad
@@ -83,7 +83,7 @@ DrawHeartContainerGFX:
BRA DrawHeartPieceGFX_done ; don't draw on the init frame
.skipInit
LDA.w $0E80, X ; Retrieve stored item type
LDA.w SpriteItemType, X ; Retrieve stored item type
BRA DrawHeartPieceGFX_skipLoad
;--------------------------------------------------------------------------------
@@ -122,11 +122,11 @@ HeartPieceSpritePrep:
LDA.l ServerRequestMode : BEQ + : : +
LDA.b #$01 : STA.l RedrawFlag
LDA.b $5D : 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
JSL.l LoadHeartPieceRoomValue ; load item type
STA.w $0E80, X ; Store item type
STA.w SpriteItemType, X ; Store item type
JSL.l PrepDynamicTile
.skip
@@ -138,14 +138,14 @@ HeartContainerSpritePrep:
LDA.b #$00 : STA.l RedrawFlag
JSL.l LoadHeartContainerRoomValue ; load item type
STA.w $0E80, X ; Store item type
STA.w SpriteItemType, X ; Store item type
JSL.l PrepDynamicTile
PLA
RTL
;--------------------------------------------------------------------------------
LoadHeartPieceRoomValue:
LDA.b $1B : BEQ .outdoors ; check if we're indoors or outdoors
LDA.b IndoorsFlag : BEQ .outdoors ; check if we're indoors or outdoors
.indoors
JSL.l LoadIndoorValue
JMP .done
@@ -161,9 +161,9 @@ RTL
;--------------------------------------------------------------------------------
MaybeMarkDigSpotCollected:
PHA : PHP
LDA.b $1B : BNE +
LDA.b IndoorsFlag : BNE +
REP #$20 ; set 16-bit accumulator
LDA.b $8A
LDA.b OverworldIndex
CMP.w #$2A : BNE +
LDA.l HasGroveItem : ORA.w #$0001 : STA.l HasGroveItem
+
@@ -237,7 +237,7 @@ RTL
LoadOutdoorValue:
PHP
REP #$20 ; set 16-bit accumulator
LDA.b $8A
LDA.b OverworldIndex
CMP.w #$03 : BNE +
LDA.b $22 : CMP.w #1890 : !BLT ++
%GetPossiblyEncryptedItem(HeartPiece_Spectacle, HeartPieceOutdoorValues)

View File

@@ -1637,12 +1637,12 @@ NOP #8
;================================================================================
org $028B8F ; <- 10B8F - Bank02.asm:2236 (LDA $7EF374 : LSR A : BCS BRANCH_BETA)
JSL CheckHeraBossDefeated : BNE + : NOP
LDX.b #$F1 : STX.w $012C
LDX.b #$F1 : STX.w MusicControlRequest
+
;================================================================================
org $029090 ; <- 11090 - Bank02.asm:3099 (LDA $7EF374 : LSR A : BCS BRANCH_GAMMA)
JSL CheckHeraBossDefeated : BNE + : NOP
STX.w $012C ; DON'T MOVE THIS FORWARD OR MADNESS AWAITS
STX.w MusicControlRequest ; DON'T MOVE THIS FORWARD OR MADNESS AWAITS
+
;================================================================================
org $029798 ; <- 11798 - Bank02.asm:4287 (CMP $02895C, X : BNE BRANCH_ALPHA)

View File

@@ -3,7 +3,7 @@ ShouldOverrideFileLoad:
CPY #$0A ; 0A = Ice/Mire floor file
BNE .no
LDA.w $040C ; Dungeon number
LDA.w DungeonID ; Dungeon number
CMP #$12 ; Ice Palace
BEQ .yes
.no

View File

@@ -53,7 +53,7 @@ Init_Primary:
LDA.b #$01 : STA.w MEMSEL ; enable fastrom access on upper banks
STA.l OneMindId
LDA.b #$10 : STA.b $BC ; set default player sprite bank
LDA.b #$10 : STA.b PlayerSpriteBank ; set default player sprite bank
LDA.b #$81 : STA.w NMITIMEN ; thing we wrote over, turn on NMI & gamepad
RTL

View File

@@ -28,14 +28,14 @@
; out: Carry - 0 = No Button, 1 = Yes Button
;--------------------------------------------------------------------------------
ProcessMenuButtons:
LDA.b $F4 : BIT.b #$40 : BNE .y_pressed ; check for P1 Y-button
LDA.b Joy1A_New : BIT.b #$40 : BNE .y_pressed ; check for P1 Y-button
BIT #$20 : BNE .sel_pressed ; check for P1 Select button
LDA.b $F0 : BIT.b #$20 : BNE .sel_held
LDA.b Joy1A_All : BIT.b #$20 : BNE .sel_held
.sel_unheld
LDA.l HudFlag : AND.b #$20 : BEQ +
LDA.l HudFlag : AND.b #$DF : STA.l HudFlag ; select is released, unset hud flag
LDA.b $1B : BEQ + ; skip if outdoors
LDA.b #$20 : STA.w $012F ; menu select sound
LDA.b IndoorsFlag : BEQ + ; skip if outdoors
LDA.b #$20 : STA.w SFX3 ; menu select sound
+
JSL.l ResetEquipment
+
@@ -44,16 +44,16 @@ ProcessMenuButtons:
RTL
.sel_pressed
LDA.l HudFlag : ORA.b #$20 : STA.l HudFlag ; set hud flag
LDA.b #$20 : STA.w $012F ; menu select sound
LDA.b #$20 : STA.w SFX3 ; menu select sound
JSL.l ResetEquipment
RTL
.y_pressed ; Note: used as entry point by quickswap code. Must preserve X.
LDA.b #$10 : STA.w $0207
LDA.w $0202 ; check selected item
LDA.b #$10 : STA.w MenuBlink
LDA.w ItemCursor ; check selected item
CMP.b #$02 : BNE + ; boomerang
LDA.l InventoryTracking : AND.b #$C0 : CMP.b #$C0 : BNE .errorJump ; make sure we have both boomerangs
LDA.l BoomerangEquipment : EOR.b #$03 : STA.l BoomerangEquipment ; swap blue & red boomerang
LDA.b #$20 : STA.w $012F ; menu select sound
LDA.b #$20 : STA.w SFX3 ; menu select sound
JMP .captured
+ CMP #$01 : BNE + ; bow
LDA.l BowTracking : AND.b #$C0 : CMP.b #$C0 : BNE .errorJump ; make sure we have both bows
@@ -70,7 +70,7 @@ RTL
BRA .errorJump2
++
LDA.l BowEquipment : !SUB #$01 : EOR.b #$02 : !ADD #$01 : STA.l BowEquipment ; swap bows
LDA.b #$20 : STA.w $012F ; menu select sound
LDA.b #$20 : STA.w SFX3 ; menu select sound
JMP .captured
+ BRA +
.errorJump
@@ -78,7 +78,7 @@ RTL
+ CMP #$05 : BNE + ; powder
LDA.l InventoryTracking : AND.b #$30 : CMP.b #$30 : BNE .errorJump ; make sure we have mushroom & magic powder
LDA.l PowderEquipment : EOR.b #$03 : STA.l PowderEquipment ; swap mushroom & magic powder
LDA.b #$20 : STA.w $012F ; menu select sound
LDA.b #$20 : STA.w SFX3 ; menu select sound
JMP .captured
+ BRA +
.errorJump2
@@ -99,7 +99,7 @@ RTL
LDA.b #$01 ; set shovel
.fluteSuccess
STA.l FluteEquipment ; store set item
LDA.b #$20 : STA.w $012F ; menu select sound
LDA.b #$20 : STA.w SFX3 ; menu select sound
BRA .captured
+
CMP.b #$10 : BNE .error : JSL.l ProcessBottleMenu : BRA .captured : +
@@ -107,7 +107,7 @@ RTL
RTL
.midShovel
.error
LDA.b #$3C : STA.w $012E ; error sound
LDA.b #$3C : STA.w SFX2 ; error sound
.captured
SEC
RTL
@@ -124,13 +124,13 @@ ProcessBottleMenu:
TAX : LDA.l BottleContents-1, X ; check bottle
BNE + : LDX.b #$01 : + ; wrap if we reached the last bottle
TXA : STA.l BottleIndex ; set bottle index
LDA.b #$20 : STA.w $012F ; menu select sound
LDA.b #$20 : STA.w SFX3 ; menu select sound
PLX
.no_bottles
LDA.b #$00 ; pretend like the controller state was 0 from the overridden load
RTL
; .y_not_pressed
; LDA.b $F4 : AND.b #$0C ; thing we wrote over - load controller state
; LDA.b Joy1A_New : AND.b #$0C ; thing we wrote over - load controller state
;RTL
;--------------------------------------------------------------------------------
@@ -138,33 +138,27 @@ RTL
;OpenBottleMenu:
;--------------------------------------------------------------------------------
OpenBottleMenu:
LDA.b $F6 : AND.b #$40 : BEQ .x_not_pressed ; skip if X is not down
LDA.b #$10 : STA.w $0207 ; set 16 frame cool off
LDA.b #$20 : STA.w $012F ; make menu sound
LDA.b #$07 : STA.w $0200 ; thing we wrote over - opens bottle menu
LDA.b Joy1B_New : AND.b #$40 : BEQ .x_not_pressed ; skip if X is not down
LDA.b #$10 : STA.w MenuBlink ; set 16 frame cool off
LDA.b #$20 : STA.w SFX3 ; make menu sound
LDA.b #$07 : STA.w SubModuleInterface ; thing we wrote over - opens bottle menu
.x_not_pressed
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
;CloseBottleMenu:
;--------------------------------------------------------------------------------
CloseBottleMenu:
LDA.b $F6 : AND.b #$40 : BEQ .x_not_pressed ; skip if X is not down
LDA.b Joy1B_New : AND.b #$40 : BEQ .x_not_pressed ; skip if X is not down
LDA.b #$10 : STA.w MenuBlink ; set 16 frame cool off
LDA.b #$20 : STA.w SFX3 ; make menu sound
LDA.b #$10 : STA.w $0207 ; set 16 frame cool off
LDA.b #$20 : STA.w $012F ; make menu sound
INC.w $0200 ; return to normal menu
STZ.w $0205
LDA.b #$00
INC.w SubModuleInterface ; return to normal menu
STZ.w BottleMenuCounter
LDA.b #$00
RTL
.x_not_pressed
LDA.b $F4 : AND.b #$0C ; thing we wrote over (probably)
.x_not_pressed
LDA.b Joy1A_New : AND.b #$0C ; thing we wrote over (probably)
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; AddInventory:
;--------------------------------------------------------------------------------
@@ -253,8 +247,8 @@ AddInventory:
+
CPY.b #$3B : BNE + : JMP .dungeonCounts : + ; Silver Arrow Bow - Skip Shop/Fairy Check for Silver Arrow Bow
LDA.b $1B : BEQ ++ ; skip shop check if outdoors
LDA.w $02E9 : CMP.b #$01 : BEQ ++ ; skip shop check for chests
LDA.b IndoorsFlag : BEQ ++ ; skip shop check if outdoors
LDA.w ItemReceiptMethod : CMP.b #$01 : BEQ ++ ; skip shop check for chests
PHP : REP #$20 ; set 16-bit accumulator
LDA.w $048E
CMP.w #274 : BNE + : JMP .shop : + ; dark world death mountain shop, ornamental shield shop
@@ -274,10 +268,10 @@ AddInventory:
++
.dungeonCounts
LDA.b $1B : BNE + : JMP .fullItemCounts : +
LDA.b IndoorsFlag : BNE + : JMP .fullItemCounts : +
SEP #$20 ; Set 8-bit Accumulator
LDA.w $040C ; get dungeon id
LDA.w DungeonID ; get dungeon id
CMP.b #$FF : BEQ .fullItemCounts
CMP.l BallNChainDungeon : BNE +
@@ -370,7 +364,7 @@ AddInventory:
+ CPY.b #$1D : BNE + ; Book of Mudora - LEAVE THIS ABOVE THE 1B-1F CONDITION - kkat
JSR .incrementY
JMP .done
+ CPY.b #$1B : !BLT + ; Items $1B - $1F
+ CPY.b #$1B : !BLT + ; Items IndoorsFlag - $1F
CPY.b #$20 : !BGE +
JSR .incrementA
JMP .done
@@ -442,7 +436,7 @@ AddInventory:
JSR .incrementY
JMP .done
+ CPY.b #$49 : BNE + ; Fighter's Sword
LDX #$01
LDX.b #$01
JSR .incrementSword
JMP .done
+ CPY.b #$4A : BNE + ; Flute (Active)
@@ -462,15 +456,15 @@ AddInventory:
JSR .incrementCapacity
JMP .done
+ CPY.b #$50 : BNE + ; Master Sword (Safe)
LDX #$02
LDX.b #$02
JSR .incrementSword
JMP .done
+ CPY.b #$51 : BNE + ; 5 Bomb Capacity Upgrade
LDX #$02
LDX.b #$02
JSR .maybeIncrementBombs
JMP .done
+ CPY.b #$52 : BNE + ; 10 Bomb Capacity Upgrade
LDX #$02
LDX.b #$02
JSR .maybeIncrementBombs
JMP .done
+ CPY.b #$51 : !BLT + ; Items $51 - $54 - Capacity Upgrades
@@ -671,7 +665,7 @@ RTL
RTS
.setDungeonCompletion
LDX $040C : BMI +
LDX.w DungeonID : BMI +
REP #$20 ; 16 bit
LDA.l DungeonMask, X
ORA.l DungeonsCompleted : STA.l DungeonsCompleted
@@ -701,10 +695,10 @@ RTL
;--------------------------------------------------------------------------------
HandleBombAbsorbtion:
STA.l BombsFiller ; thing we wrote over
LDA.w $0303 : BNE + ; skip if we already have some item selected
LDA.w CurrentYItem : BNE + ; skip if we already have some item selected
LDA.l BombCapacity : BEQ + ; skip if we can't have bombs
LDA.b #$04 : STA.w $0202 ; set selected item to bombs
LDA.b #$01 : STA.w $0303 ; 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
JSL.l HUD_RebuildLong
+
RTL
@@ -714,7 +708,7 @@ RTL
; AddYMarker:
;--------------------------------------------------------------------------------
AddYMarker:
LDA.w $0202 : AND.w #$FF ; load item value
LDA.w ItemCursor : AND.w #$FF ; load item value
CMP.w #$02 : BNE + ; boomerang
LDA.l InventoryTracking : AND.w #$C0 : CMP.w #$C0 : BEQ .drawYBubble : BRA .drawNormal
+ CMP.w #$01 : BNE + ; bow
@@ -732,7 +726,7 @@ AddYMarker:
BRA .drawTile
.drawJarMarker
LDA.w $0207 : AND.w #$0020 : BNE .drawXBubble
LDA.w MenuBlink : AND.w #$0020 : BNE .drawXBubble
.drawYBubble
LDA.w #$3D4F
@@ -785,7 +779,7 @@ RTL
;--------------------------------------------------------------------------------
CheckKeys:
LDA.l GenericKeys : BEQ + : RTL : +
LDA.w $040C : CMP.b #$FF
LDA.w DungeonID : CMP.b #$FF
RTL
;--------------------------------------------------------------------------------
@@ -856,7 +850,7 @@ RTL
LoadPowder:
JSL.l Sprite_SpawnDynamically ; thing we wrote over
%GetPossiblyEncryptedItem(WitchItem, SpriteItemValues)
STA.w $0DA0, Y ; Store item type
STA.w SpriteAuxTable, Y ; Store item type
JSL.l PrepDynamicTile
RTL
;--------------------------------------------------------------------------------
@@ -880,12 +874,12 @@ RTL
DrawPowder:
LDA.w $02DA : BNE .defer ; defer if link is buying a potion
LDA.l RedrawFlag : BEQ +
LDA.w $0DA0, X ; Retrieve stored item type
LDA.w SpriteAuxTable, X ; Retrieve stored item type
JSL.l PrepDynamicTile
LDA.b #$00 : STA.l RedrawFlag ; reset redraw flag
BRA .defer
+
LDA.w $0DA0, X ; Retrieve stored item type
LDA.w SpriteAuxTable, X ; Retrieve stored item type
JSL.l DrawDynamicTile
.defer
RTL
@@ -895,17 +889,17 @@ RTL
; LoadMushroom:
;--------------------------------------------------------------------------------
LoadMushroom:
LDA.b #$00 : STA.w $0DC0, X ; thing we wrote over
LDA.b #$00 : STA.w SpriteGFXControl, X ; thing we wrote over
.justGFX
PHA
LDA.b #$01 : STA.l RedrawFlag
LDA.b $5D : 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
%GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues)
STA.w $0E80, X ; Store item type
STA.w SpriteItemType, X ; Store item type
JSL.l PrepDynamicTile
.skip
@@ -923,7 +917,7 @@ DrawMushroom:
BRA .done ; don't draw on the init frame
.skipInit
LDA.w $0E80, X ; Retrieve stored item type
LDA.w SpriteItemType, X ; Retrieve stored item type
JSL.l DrawDynamicTile
.done
@@ -935,12 +929,12 @@ RTL
; CollectPowder:
;--------------------------------------------------------------------------------
CollectPowder:
LDY $0DA0, X ; Retrieve stored item type
LDY.w SpriteAuxTable, X ; Retrieve stored item type
BNE +
; if for any reason the item value is 0 reload it, just in case
%GetPossiblyEncryptedItem(WitchItem, SpriteItemValues) : TAY
+
STZ $02E9 ; item from NPC
STZ.w ItemReceiptMethod ; item from NPC
JSL.l Link_ReceiveItem
;JSL.l FullInventoryExternal
JSL.l ItemSet_Powder
@@ -981,9 +975,9 @@ RTL
; SpawnShovelGamePrizeSFX:
;--------------------------------------------------------------------------------
SpawnShovelGamePrizeSFX:
STA.l $7FFE00 ; thing we wrote over
STA.l MiniGameTime ; thing we wrote over
PHA
LDA.b #$1B : STA.w $012F ; play puzzle sound
LDA.b #$1B : STA.w SFX3 ; play puzzle sound
PLA
RTL
;--------------------------------------------------------------------------------
@@ -995,9 +989,9 @@ SpawnChestGamePrizeSFX:
CPX.b #$07 : BNE .normal
LDA.b RoomIndex : CMP.b #$06 : BNE .normal
.prize
LDA.b #$1B : STA.w $012F : RTL ; play puzzle sound
LDA.b #$1B : STA.w SFX3 : RTL ; play puzzle sound
.normal
LDA.b #$0E : STA.w $012F ; play chest sound
LDA.b #$0E : STA.w SFX3 ; play chest sound
RTL
;--------------------------------------------------------------------------------
@@ -1012,15 +1006,15 @@ SpawnShovelItem:
JMP .skip
+
LDA.w $035B : AND.b #$01 : BNE + : JMP .skip : + ; corner dig fix
LDA.w TileActDig : AND.b #$01 : BNE + : JMP .skip : + ; corner dig fix
PHY : PHP
PHB : PHK : PLB
SEP #$30 ; set 8-bit accumulator and index registers
LDA.b $1B : BEQ + : JMP .no_drop : + ; skip if indoors
LDA.b IndoorsFlag : BEQ + : JMP .no_drop : + ; skip if indoors
LDA.b $8A : CMP.b #$2A : BEQ .no_drop ; don't drop in the haunted grove
LDA.b OverworldIndex : CMP.b #$2A : BEQ .no_drop ; don't drop in the haunted grove
CMP.b #$68 : BEQ .no_drop ; don't drop in the digging game area
JSL GetRandomInt : BIT.b #$03 : BNE .no_drop ; drop with 1/4 chance
@@ -1031,25 +1025,25 @@ SpawnShovelItem:
;most of this part below is copied from the digging game
STA.l $7FFE00
STA.l MiniGameTime
JSL Sprite_SpawnDynamically
LDX.b #$00
LDA.b $2F : CMP.b #$04 : BEQ + : INX : +
LDA.b LinkDirection : CMP.b #$04 : BEQ + : INX : +
LDA.l .x_speeds, X : STA.w $0D50, Y
LDA.l .x_speeds, X : STA.w SpriteVelocityX, Y
LDA.b #$00 : STA.w $0D40, Y
LDA.b #$00 : STA.w SpriteVelocityY, Y
LDA.b #$18 : STA.w $0F80, Y
LDA.b #$FF : STA.w $0B58, Y
LDA.b #$30 : STA.w $0F10, Y
LDA.b $22 : !ADD.l .x_offsets, X
AND.b #$F0 : STA.w $0D10, Y
LDA.b $23 : ADC.b #$00 : STA.w $0D30, Y
AND.b #$F0 : STA.w SpritePosXLow, Y
LDA.b $23 : ADC.b #$00 : STA.w SpritePosXHigh, Y
LDA.b $20 : !ADD.b #$16 : AND.b #$F0 : STA.w $0D00, Y
LDA.b $21 : ADC.b #$00 : STA.w $0D20, Y
LDA.b $20 : !ADD.b #$16 : AND.b #$F0 : STA.w SpritePosYLow, Y
LDA.b $21 : ADC.b #$00 : STA.w SpritePosYHigh, Y
LDA.b #$00 : STA.w $0F20, Y
TYX

View File

@@ -67,13 +67,13 @@ Overworld_CreatePyramidHoleModified:
LDA.w #$FFFF : STA.w $1012, Y
.ending
LDA.w #$3515 : STA.w $012D
LDA.w #$3515 : STA.w SFX1
SEP #$30
LDA.l OverworldEventDataWRAM+$5B : ORA.b #$20 : STA.l OverworldEventDataWRAM+$5B
LDA.b #$03 : STA.w $012F
LDA.b #$03 : STA.w SFX3
LDA.b #$01 : STA.b $14
@@ -138,26 +138,27 @@ RTL
GanonTowerAnimation:
LDA.l InvertedMode : BEQ .done
LDA.b #$1B : STA.w $012F
STZ.w $04C6
STZ.b $B0
STZ.w $0710
STZ.w $02E4
STZ.w $0FC1
STZ.w $011A
STZ.w $011B
STZ.w $011C
STZ.w $011D
LDA.b #$02 : STA.w $012C
LDA.b #$09 : STA.w $012D
RTL
.done
LDA.b #$05 : STA.w $04C6 ;what we wrote over
STZ.b $B0 ; (continued)
STZ.b $C8 ; (continued)
LDA.l InvertedMode : BEQ .done
LDA.b #$1B : STA.w SFX3
STZ.w OWEntranceCutscene
STZ.b SubSubModule
STZ.w SkipOAM
STZ.w CutsceneFlag
STZ.w FreezeSprites
STZ.w BG1ShakeV
STZ.w BG1ShakeV+1
STZ.w BG1ShakeH
STZ.w BG1ShakeH+1
LDA.b #$02 : STA.w MusicControlRequest
LDA.b #$09 : STA.w SFX1
RTL
.done
LDA.b #$05 : STA.w OWEntranceCutscene ; what we wrote over
STZ.b SubSubModule ; (continued)
STZ.b ScrapBufferBD+$0B ; (continued)
RTL
GanonTowerInvertedCheck:
@@ -166,7 +167,7 @@ GanonTowerInvertedCheck:
LDA.b #$01 ; Load a random value so it doesn't BEQ
RTL
.done
LDA.b $8A : CMP.b #$43 ;what we wrote over
LDA.b OverworldIndex : CMP.b #$43 ;what we wrote over
RTL
}
@@ -177,7 +178,7 @@ HardcodedRocks:
LDA.l InvertedMode : AND.w #$00FF : BEQ .normalrocks
BRA .noRock2
.normalrocks
LDA.w #$020F : LDX $8A : CPX.w #$0033 : BNE .noRock
LDA.w #$020F : LDX.b OverworldIndex : CPX.w #$0033 : BNE .noRock
STA.l $7E22A8
.noRock
CPX.w #$002F : BNE .noRock2
@@ -202,9 +203,9 @@ MirrorBonk:
; otherwise fall through to .normal
PHX : PHP
PHB : PHK : PLB
LDA.b $8A : AND.b #$40 : BEQ .endLoop ;World we're in? branch if we are in LW we don't want bonks
LDA.b OverworldIndex : AND.b #$40 : BEQ .endLoop ;World we're in? branch if we are in LW we don't want bonks
REP #$30
LDX #$0000
LDX.w #$0000
.loop
LDA.l .bonkRectanglesTable, X ;Load X1
CMP $22 : !BGE ++

View File

@@ -1,19 +1,19 @@
Overworld_LoadNewTiles:
{
; add sign to EDM for OWG people to read
LDA.w $040A : AND.w #$00FF : CMP.w #$0005 : BNE +
LDA.b OverworldIndex : AND.w #$00FF : CMP.w #$0005 : BNE +
LDA.w #$0101 : STA.l $7E2E18 ; #$0101 is the sign tile16 id, $7E2D98 is the position of the tile16 on map
+
; GT sign
LDA.l InvertedMode : AND.w #$00FF : BNE +
LDA.w $040A : AND.w #$00FF : CMP.w #$0043 : BNE +
LDA.b OverworldIndex : AND.w #$00FF : CMP.w #$0043 : BNE +
LDA.w #$0101 : STA.l $7E2550
+
; Pyramid sign
LDA.l InvertedMode : AND.w #$00FF : BNE +
LDA.w $040A : AND.w #$00FF : CMP.w #$005B : BNE +
LDA.b OverworldIndex : AND.w #$00FF : CMP.w #$005B : BNE +
LDA.w #$0101 : STA.w $7E27B6 ; Moved sign near statue
LDA.w #$05C2 : STA.w $7E27B4 ; added a pyramid peg on the left of the sign
+
@@ -26,7 +26,7 @@ Overworld_LoadNewTiles:
LDA.b #$7E : PHA : PLB
REP #$30
; Use it as an index into a jump table.
LDA.b $8A : CMP.w #$0080 : !BGE .noData
LDA.b OverworldIndex : CMP.w #$0080 : !BGE .noData
ASL A : TAX
JSR (Overworld_NewTilesTable, X)

View File

@@ -1,7 +1,7 @@
;Statically mapped at $A1A000 Referenced by the front end. Do not move without coordination.
InvertedTileAttributeLookup:
SEP #$20
LDA.b $8A : CMP.b #$47 : BEQ .turtleRock
LDA.b OverworldIndex : CMP.b #$47 : BEQ .turtleRock
LDA.l Overworld_TileAttr, X
JML.l Overworld_GetTileAttrAtLocation_continue
.turtleRock

View File

@@ -11,7 +11,7 @@ LampCheck:
LDA.l CurrentWorld : BNE +
.lightWorld
LDA.w $040C : BNE ++ ; check if we're in sewers
LDA.w DungeonID : BNE ++ ; check if we're in sewers
LDA.l LampConeSewers : BRA .done
++
LDA.l LampConeLightWorld : BRA .done

View File

@@ -10,7 +10,7 @@ MaidenCrystalScript:
STZ.w $02D8
STZ.w $02DA
STZ.b $2E
LDA.b #$02 : STA.w $2F
LDA.b #$02 : STA.w LinkDirection
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
+

View File

@@ -3,7 +3,7 @@
;--------------------------------------------------------------------------------
TryOpenMire:
; Checks if we're in the Swamp of Evil.
LDA.b $8A : CMP.b #$70 : BNE .untriggered
LDA.b OverworldIndex : CMP.b #$70 : BNE .untriggered
; Checks whether the Misery Mire dungeon is already revealed.
LDA.l OverworldEventDataWRAM+$70 : AND.b #$20 : BNE .untriggered
@@ -12,17 +12,17 @@ TryOpenMire:
LDY.b #$02 : JSL.l Ancilla_CheckIfEntranceTriggered : BCC .untriggered
; Do the 3rd animation for opening entrances
LDA.b #$03 : STA.w $04C6
LDA.b #$03 : STA.w OWEntranceCutscene
STZ.b $B0 ; reset the sub-submodule index
STZ.b $C8 ; reset this other index.
STZ.b SubSubModule ; reset the sub-submodule index
STZ.b ScrapBufferBD+$0B ; reset this other index.
.untriggered
RTL
;--------------------------------------------------------------------------------
TryOpenTRock:
; Checks if we're at Turtle Rock.
LDA.b $8A : CMP.b #$47 : BNE .untriggered
LDA.b OverworldIndex : CMP.b #$47 : BNE .untriggered
; Checks whether the Turtle Rock dungeon is already revealed.
LDA.l OverworldEventDataWRAM+$47 : AND.b #$20 : BNE .untriggered
@@ -31,17 +31,17 @@ TryOpenTRock:
LDY.b #$03 : JSL.l Ancilla_CheckIfEntranceTriggered : BCC .untriggered
; Do the 4rd animation for opening entrances
LDA.b #$04 : STA.w $04C6
LDA.b #$04 : STA.w OWEntranceCutscene
STZ.b $B0 ; reset the sub-submodule index
STZ.b $C8 ; reset this other index.
STZ.b SubSubModule ; reset the sub-submodule index
STZ.b ScrapBufferBD+$0B ; reset this other index.
.untriggered
RTL
;--------------------------------------------------------------------------------
MedallionTrigger_Bombos:
STZ.b $50 ; stuff we wrote over
STZ.w $0FC1
STZ.w FreezeSprites
PHA
LDA.l MireRequiredMedallion : BNE +

24
msu.asm
View File

@@ -208,7 +208,7 @@ CheckMusicLoadRequest:
CMP.b #21 : BNE .check_fallback
;.boss
LDA.w $040C : LSR : !ADD.b #45
LDA.w DungeonID : LSR : !ADD.b #45
BRA .check_fallback-3
.lightworld
PHA
@@ -226,14 +226,14 @@ CheckMusicLoadRequest:
PHA
LDA.l CrystalsField : CMP.b #$7F : BEQ -
LDA.l CurrentWorld : BEQ --
LDA.b $8A : CMP #$40 : BNE --
LDA.b OverworldIndex : CMP #$40 : BNE --
PLA
LDA.b #15 : BRA .check_fallback-3
.castle
LDA.w $040C
LDA.w DungeonID
CMP.b #$08 : BNE .check_fallback ; Hyrule Castle 2
.dungeon
LDA.w $040C : LSR : !ADD.b #33 : STA.w MusicControlRequest
LDA.w DungeonID : LSR : !ADD.b #33 : STA.w MusicControlRequest
.check_fallback
LDX.w MusicControlRequest
@@ -267,7 +267,7 @@ CheckMusicLoadRequest:
.dungeon_fallback
PHB : REP #$10
LDX $040C
LDX.w DungeonID
LDA.b #Music_Eastern>>16 : PHA : PLB ; Set bank to music pointers
LDY.b Scrap00 : PHY
REP #$20
@@ -291,7 +291,7 @@ CheckMusicLoadRequest:
LDA.w MusicControlRequest : CMP.b #08 : BEQ .done+3 ; No SFX during warp track
LDA.b $10
LDA.b GameMode
CMP.b #$07 : BEQ .sfx_indoors
CMP.b #$0E : BEQ .sfx_indoors
CMP.b #$09 : BNE .done
@@ -300,7 +300,7 @@ CheckMusicLoadRequest:
SEP #$10
LDX.b #$09
LDA.b $8A ; Dark Death Mountain
LDA.b OverworldIndex ; Dark Death Mountain
CMP.b #$43 : BEQ + : CMP.b #$45 : BEQ + : CMP.b #$47 : BEQ +
LDX.b #$05
+
@@ -313,7 +313,7 @@ CheckMusicLoadRequest:
.rain
LDX.b #$01
+
STX.w $012D
STX.w SFX1
REP #$10
.done
@@ -323,7 +323,7 @@ CheckMusicLoadRequest:
.sfx_indoors
LDA.w MusicControlRequest : STA.w MusicControl : STZ.w MusicControlRequest
SEP #$20 : LDA.b #$05 : STA.w $012D
SEP #$20 : LDA.b #$05 : STA.w SFX1
REP #$30 : PLY : PLX : PLA : PLD : PLB : PLP
JML Module_PreDungeon_setAmbientSfx
;--------------------------------------------------------------------------------
@@ -660,7 +660,7 @@ MSUMain:
LDA.b #$00 : STA.w MSUResumeTrack
+
CPX #07 : BNE + ; Kakariko Village
LDA.b $10 : CMP #$07 : BNE +
LDA.b GameMode : CMP #$07 : BNE +
; we're in link's house -> ignore
LDA.b #$00
BRA ++
@@ -680,7 +680,7 @@ MSUMain:
CMP.b #47 : !BGE .done
+ : PHB : REP #$10
LDX $040C
LDX.w DungeonID
LDA.b #Music_Eastern>>16 : PHA : PLB ; Set bank to music pointers
LDY.b Scrap00 : PHY
REP #$20
@@ -763,7 +763,7 @@ CrystalFanfareWait:
; Delay input scanning on startup/S&Q to avoid hard-lock from button mashing
;--------------------------------------------------------------------------------
StartupWait:
LDA.b $11 : CMP.b #$04 : BCC .done ; thing we wrote over
LDA.b GameSubMode : CMP.b #$04 : BCC .done ; thing we wrote over
LDA.w APUIO0 : BEQ .done-1
CMP.b #$01 : BEQ .done
CLC

View File

@@ -9,7 +9,7 @@ PreOverworld_LoadProperties_ChooseMusic:
LDX.b #$02 ; Default light world theme
LDA.b $8A : ORA.b #$40 ; check both light and dark world DM at the same time
LDA.b OverworldIndex : ORA.b #$40 ; check both light and dark world DM at the same time
CMP.b #$43 : BEQ .endOfLightWorldChecks
CMP.b #$45 : BEQ .endOfLightWorldChecks
CMP.b #$47 : BEQ .endOfLightWorldChecks
@@ -17,12 +17,12 @@ PreOverworld_LoadProperties_ChooseMusic:
LDY.b #$5A ; Main overworld animated tileset
; Skip village and lost woods checks if entering dark world or a special area
LDA.b $8A : CMP.b #$40 : !BGE .notVillageOrWoods
LDA.b OverworldIndex : CMP.b #$40 : !BGE .notVillageOrWoods
LDX.b #$07 ; Default village theme
; Check if we're entering the village
LDA.b $8A : CMP.b #$18 : BEQ .endOfLightWorldChecks
LDA.b OverworldIndex : CMP.b #$18 : BEQ .endOfLightWorldChecks
; For NA release would we also branch on indexes #$22 #$28 #$29
LDX.b #$05 ; Lost woods theme
@@ -33,7 +33,7 @@ PreOverworld_LoadProperties_ChooseMusic:
+
; check if we are entering lost woods
LDA.b $8A : BEQ .endOfLightWorldChecks
LDA.b OverworldIndex : BEQ .endOfLightWorldChecks
.notVillageOrWoods
; Use the normal overworld (light world) music
@@ -52,7 +52,7 @@ PreOverworld_LoadProperties_ChooseMusic:
LDX.b #$0F ; dark woods theme
; This music is used in dark woods
LDA.b $8A
LDA.b OverworldIndex
CMP.b #$40 : BEQ +
LDX.b #$0D ; dark death mountain theme
@@ -118,7 +118,7 @@ Overworld_FinishMirrorWarp:
LDX.b #$09 ; default dark world theme
LDA.b $8A : CMP.b #$40 : !BGE .endOfLightWorldChecks
LDA.b OverworldIndex : CMP.b #$40 : !BGE .endOfLightWorldChecks
LDX.b #$02 ; hyrule field theme
@@ -136,9 +136,9 @@ Overworld_FinishMirrorWarp:
LDX.b #$07 ; Default village theme (phase <3)
.endOfLightWorldChecks
STX.w $012C
STX.w MusicControlRequest
LDA.b $8A : CMP.b #$40 : BNE +
LDA.b OverworldIndex : CMP.b #$40 : BNE +
LDX.b #$0F ; dark woods theme
BRA .bunny
+
@@ -148,7 +148,7 @@ Overworld_FinishMirrorWarp:
CMP.b #$47 : BNE .notDarkMountain
.darkMountain
LDA.b #$09 : STA.w $012D ; set storm ambient SFX
LDA.b #$09 : STA.w SFX1 ; set storm ambient SFX
LDX.b #$0D ; dark mountain theme
.bunny
@@ -156,16 +156,16 @@ Overworld_FinishMirrorWarp:
LDX.b #$04 ; bunny theme
+
STX.w $012C
STX.w MusicControlRequest
.notDarkMountain
LDA.b $11 : STA.w $010C
LDA.b GameSubMode : STA.w GameSubModeCache ; GameModeCache
STZ.b $11
STZ.b $B0
STZ.w $0200
STZ.w $0710
STZ.b GameSubMode
STZ.b SubSubModule
STZ.w SubModuleInterface
STZ.w SkipOAM
RTL
;--------------------------------------------------------------------------------
@@ -173,17 +173,17 @@ Overworld_FinishMirrorWarp:
;--------------------------------------------------------------------------------
BirdTravel_LoadTargetAreaMusic:
; Skip village and lost woods checks if entering dark world or a special area
LDA.b $8A : CMP.b #$43 : BEQ .endOfLightWorldChecks
LDA.b OverworldIndex : CMP.b #$43 : BEQ .endOfLightWorldChecks
CMP.b #$40 : !BGE .notVillageOrWoods
LDX.b #$07 ; Default village theme
; Check if we're entering the village
LDA.b $8A : CMP.b #$18 : BEQ .endOfLightWorldChecks
LDA.b OverworldIndex : CMP.b #$18 : BEQ .endOfLightWorldChecks
; For NA release would we also branch on indexes #$22 #$28 #$29
; check if we are entering lost woods
LDA.b $8A : BEQ .endOfLightWorldChecks
LDA.b OverworldIndex : BEQ .endOfLightWorldChecks
.notVillageOrWoods
; Use the normal overworld (light world) music
@@ -201,24 +201,24 @@ BirdTravel_LoadTargetAreaMusic:
LDX.b #$09 ; dark overworld theme
LDA.b $8A
LDA.b OverworldIndex
; Misery Mire rain SFX
CMP.b #$70 : BNE ++
LDA.l OverworldEventDataWRAM+$70 : AND.b #$20 : BNE ++
LDA.b #$01 : CMP.w $0131 : BEQ +
STA.w $012D
STA.w SFX1
+ : BRA .checkInverted
++
; This music is used in dark death mountain
CMP.b #$43 : BEQ .darkMountain
LDA.b #$05 : STA.w $012D
LDA.b #$05 : STA.w SFX1
BRA .checkInverted
.darkMountain
LDA.l CrystalsField : CMP.b #$7F : BEQ +
LDX.b #$0D ; dark death mountain theme
+ : LDA.b #$09 : STA.w $012D
+ : LDA.b #$09 : STA.w SFX1
; if not inverted and light world, or inverted and dark world, skip moon pearl check
.checkInverted
@@ -237,8 +237,8 @@ BirdTravel_LoadTargetAreaMusic:
;0 = Is Kakariko Overworld
;1 = Not Kakariko Overworld
PsychoSolder_MusicCheck:
LDA.w $040A : CMP.b #$18 : BNE .done ; thing we overwrote - check if overworld location is Kakariko
LDA.b $1B ; Also check that we are outdoors
LDA.b OverworldIndex : CMP.b #$18 : BNE .done ; thing we overwrote - check if overworld location is Kakariko
LDA.b IndoorsFlag ; Also check that we are outdoors
.done
RTL
;--------------------------------------------------------------------------------
@@ -258,7 +258,7 @@ Overworld_MosaicDarkWorldChecks:
LDA.l CrystalsField : CMP.b #$7F : BEQ .done
.doFade
LDA.b #$F1 : STA.w $012C ; thing we wrote over, fade out music
LDA.b #$F1 : STA.w MusicControlRequest ; thing we wrote over, fade out music
.done
RTL

File diff suppressed because it is too large Load Diff

View File

@@ -126,14 +126,14 @@ NewDrawHud:
!C_ICON = $295F
SEP #$20
LDA.b $1B : BEQ .noprize
LDA.b IndoorsFlag : BEQ .noprize
LDX.w $040C
LDX.w DungeonID
CPX #$1A : !BGE .noprize
CPX #$04 : !BLT .noprize
CPX #$08 : BEQ .noprize
LDA.b $10 : CMP #$12 : BEQ .noprize
LDA.b GameMode : CMP #$12 : BEQ .noprize
LDA.l MapMode
REP #$20
@@ -174,7 +174,7 @@ DrawMagicMeter_mp_tilemap = $0DFE0F
LDA.l InfiniteMagic : AND.w #$00FF : BNE + : JMP .green : +
SEP #$20 : LDA.b #$80 : STA.l CurrentMagic : REP #$30 ; set magic to max
LDX.w #$0080 ; load full magic meter graphics
LDA.b $1A : AND.w #$000C : LSR #2
LDA.b FrameCounter : AND.w #$000C : LSR #2
BEQ .red
CMP.w #0001 : BEQ .yellow
CMP.w #0002 : BNE + : JMP .green : +

View File

@@ -359,14 +359,14 @@ AddReceivedItemExpandedGetItem:
LDA.l CurrentSmallKeys : INC : STA.l CurrentSmallKeys
JMP .done
.normal
TXA : ASL : CMP.w $040C : BNE ++
TXA : ASL : CMP.w DungeonID : BNE ++
LDA.l CurrentSmallKeys : INC : STA.l CurrentSmallKeys
++
JMP .done
+
.done
PLX
LDA.w $02E9 : CMP.b #$01 ; thing we wrote over
LDA.w ItemReceiptMethod : CMP.b #$01 ; thing we wrote over
RTL
; #$70 - Maps
; #$80 - Compasses
@@ -1050,18 +1050,18 @@ CountBottles:
RTS
;--------------------------------------------------------------------------------
ActivateGoal:
STZ.b $11
STZ.b $B0
STZ.b GameSubMode
STZ.b SubSubModule
JML.l StatsFinalPrep
;--------------------------------------------------------------------------------
ChestPrep:
LDA.b #$01 : STA.w $02E9
LDA.b #$01 : STA.w ItemReceiptMethod
JSL.l IncrementChestCounter
LDA.l ServerRequestMode : BEQ +
JSL.l ChestItemServiceRequest
RTL
+
LDY.b $0C ; get item value
LDY.b Scrap0C ; get item value
SEC
RTL
;--------------------------------------------------------------------------------
@@ -1069,7 +1069,7 @@ RTL
; counts on
MaybeFlagCompassTotalPickup:
LDA.l CompassMode : AND.b #$0F : BEQ .done
LDA.w $040C : CMP.b #$FF : BEQ .done
LDA.w DungeonID : CMP.b #$FF : BEQ .done
LSR : STA.b Scrap04 : LDA.b #$0F : !SUB Scrap04 ; Compute flag "index"
CPY.b #$25 : BEQ .setFlag ; Set flag if it's a compass for this dungeon
STA.b Scrap04
@@ -1090,7 +1090,7 @@ RTL
; Set the compass count display flag if we're entering a dungeon and alerady have
; that compass
MaybeFlagCompassTotalEntrance:
LDX.w $040C : CPX.b #$FF : BEQ .done ; Skip if we're not entering dungeon
LDX.w DungeonID : CPX.b #$FF : BEQ .done ; Skip if we're not entering dungeon
LDA.l CompassMode : AND.w #$000F : BEQ .done ; Skip if we're not showing compass counts
CMP.w #$0002 : BEQ .countShown
LDA.l CompassField : AND.l DungeonItemMasks, X : BEQ .done ; skip if we don't have compass

View File

@@ -61,7 +61,7 @@ ItemCheck_TreeKid3:
BRA .done
LDA.b #$05
.normal
LDA.w $0D80, X
LDA.w SpriteUnknown, X
.done
RTL
@@ -133,13 +133,13 @@ RTL
ItemSet_Mushroom:
PHA
LDA.l NpcFlags+1 : ORA.b #$10 : STA.l NpcFlags+1
LDY.w $0E80, X ; Retrieve stored item type
LDY.w SpriteItemType, X ; Retrieve stored item type
BNE +
; if for any reason the item value is 0 reload it, just in case
%GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues) : TAY
+
PLA
STZ.w $02E9 ; 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
ItemSet_Powder:
@@ -151,7 +151,7 @@ RTL
; Randomize 300 Rupee NPC
;--------------------------------------------------------------------------------
Set300RupeeNPCItem:
INC.w $0D80, X ; thing we wrote over
INC.w SpriteUnknown, X ; thing we wrote over
PHA : PHP
REP #$20 ; set 16-bit accumulator

View File

@@ -1,8 +1,5 @@
PASSWORD_CODE_POSITION = $C8
PASSWORD_SELECTION_POSITION = $C9
Module_Password:
LDA.b $11
LDA.b GameSubMode
JSL.l UseImplicitRegIndexedLongJumpTable
@@ -21,15 +18,15 @@ Password_BeginInit:
JSL LoadCustomHudPalette ; replace the 2bpp palettes, and trigger upload
LDA.b #$07 : STA.b $14 ; have NMI load up the initial tilemap from Password_Tilemap
INC.b $11
INC.b GameSubMode
RTL
Password_EndInit:
JSR LoadPasswordStripeTemplate
;reset the variables used by this screen
STZ.b PASSWORD_CODE_POSITION
STZ.b PASSWORD_SELECTION_POSITION
STZ.b PasswordCodePosition
STZ.b PasswordSelectPosition
JSL ValidatePassword : BNE +
; zero out password if not valid
@@ -41,7 +38,7 @@ Password_EndInit:
+
LDA.b #$0F : STA.b $13
INC $11
INC.b GameSubMode
RTL
Password_Main:
@@ -58,38 +55,38 @@ Password_Main:
JSR PasswordMoveCursorLeft
+
LDA.b $F4 : AND.b #$01 : BEQ + ; right
LDA.b PASSWORD_SELECTION_POSITION : INC A : CMP.b #$24 : !BLT ++
LDA.b PasswordSelectPosition : INC A : CMP.b #$24 : !BLT ++
!SUB.b #$24
++
STA.b PASSWORD_SELECTION_POSITION
LDA.b #$20 : STA.w $012F
STA.b PasswordSelectPosition
LDA.b #$20 : STA.w SFX3
+
LDA.b $F4 : AND.b #$02 : BEQ + ; left
LDA.b PASSWORD_SELECTION_POSITION : DEC A : BPL ++
LDA.b PasswordSelectPosition : DEC A : BPL ++
!ADD.b #$24
++
STA.b PASSWORD_SELECTION_POSITION
LDA.b #$20 : STA.w $012F
STA.b PasswordSelectPosition
LDA.b #$20 : STA.w SFX3
+
LDA.b $F4 : AND.b #$04 : BEQ + ; down
LDA.b PASSWORD_SELECTION_POSITION : !ADD.b #$09 : CMP.b #$24 : !BLT ++
LDA.b PasswordSelectPosition : !ADD.b #$09 : CMP.b #$24 : !BLT ++
!SUB.b #$24
++
STA.b PASSWORD_SELECTION_POSITION
LDA.b #$20 : STA.w $012F
STA.b PasswordSelectPosition
LDA.b #$20 : STA.w SFX3
+
LDA.b $F4 : AND.b #$08 : BEQ + ; up
LDA.b PASSWORD_SELECTION_POSITION : !SUB.b #$09 : BPL ++
LDA.b PasswordSelectPosition : !SUB.b #$09 : BPL ++
!ADD.b #$24
++
STA.b PASSWORD_SELECTION_POSITION
LDA.b #$20 : STA.w $012F
STA.b PasswordSelectPosition
LDA.b #$20 : STA.w SFX3
+
LDA.b $F4 : ORA.b $F6 : AND.b #$C0 : BEQ + ; face button
LDX.b PASSWORD_SELECTION_POSITION
LDX.b PasswordSelectPosition
LDA.l .selectionValues, X : BPL ++
CMP.b #$F0 : BNE +++
INC $11
INC.b GameSubMode
BRA .endOfButtonChecks
+++ : CMP.b #$F1 : BNE +++
JSR PasswordMoveCursorLeft
@@ -98,24 +95,24 @@ Password_Main:
JSR PasswordMoveCursorRight
BRA +
+++ : CMP.b #$F3 : BNE +++
INC $11 : INC $11 ; skip to return submodule
LDA.b #$2C : STA.w $012E ;file screen selection sound
INC.b GameSubMode : INC.b GameSubMode ; skip to return submodule
LDA.b #$2C : STA.w SFX2 ;file screen selection sound
BRA .endOfButtonChecks
+++
BRA +
++
LDX.b PASSWORD_CODE_POSITION
LDX.b PasswordCodePosition
STA.l PasswordSRAM,X
TXA : INC A : AND.b #$0F : STA.b PASSWORD_CODE_POSITION
TXA : INC A : AND.b #$0F : STA.b PasswordCodePosition
BNE ++
STZ.w $012E
INC $11
STZ.w SFX2
INC.b GameSubMode
BRA .endOfButtonChecks
++
LDA.b #$2B : STA.w $012E
LDA.b #$2B : STA.w SFX2
+
LDA.b $F4 : AND.b #$10 : BEQ + ; start
INC $11
INC.b GameSubMode
+
.endOfButtonChecks
@@ -133,21 +130,21 @@ db $19, $1A, $1B, $1C, $1D, $1E, $1F, $20, $F3
Password_Check:
JSL.l ValidatePassword : BNE .correct
LDA.b #$3C : STA.w $012E ; error
DEC $11
LDA.b #$3C : STA.w SFX2 ; error
DEC.b GameSubMode
RTL
.correct
LDA.b #$1B : STA.w $012F ; solved puzzle sound
INC $11
LDA.b #$1B : STA.w SFX3 ; solved puzzle sound
INC.b GameSubMode
RTL
Password_Return:
LDA.b #$01 : STA.w $10 ; select screen
LDA.b #$01 : STA.w $11 ; Skip the first submodule
STZ $B0
STZ $0B9D ; Reset file screen cursor pre-selection
STZ $C8
STZ $C9
LDA.b #$01 : STA.b GameMode ; select screen
LDA.b #$01 : STA.b GameSubMode ; Skip the first submodule
STZ.b SubSubModule
STZ.w SaveFileIndex
STZ.b PasswordCodePosition
STZ.b PasswordCodePosition+1
RTL
;--------------------------------------------------------------------------------
@@ -275,14 +272,14 @@ PasswordEraseOldCursors:
REP #$20 ; set 16-bit accumulator
;Code Cursor
LDA.b PASSWORD_CODE_POSITION : AND.w #$00FF : ASL : TAX
LDA.b PasswordCodePosition : AND.w #$00FF : ASL : TAX
LDA.l .code_offsets, X
!ADD.w #$20*Scrap04+Scrap04+$6000
XBA ; because big endian is needed
STA.l $1002+Password_StripeImageTemplate_CodeCursorErase-Password_StripeImageTemplate
;selection cursor
LDA.b PASSWORD_SELECTION_POSITION : AND.w #$00FF : ASL : TAX
LDA.b PasswordSelectPosition : AND.w #$00FF : ASL : TAX
LDA.l .selection_offsets, X
!ADD.w #$20*Scrap0D+Scrap03+$6000
XBA ; because big endian is needed
@@ -308,14 +305,14 @@ RTS
PasswordSetNewCursors:
REP #$20 ; set 16-bit accumulator
;Code Cursor
LDA.b PASSWORD_CODE_POSITION : AND.w #$00FF : ASL : TAX
LDA.b PasswordCodePosition : AND.w #$00FF : ASL : TAX
LDA.l PasswordEraseOldCursors_code_offsets, X
!ADD.w #$20*Scrap04+Scrap04+$6000
XBA ; because big endian is needed
STA.l $1002+Password_StripeImageTemplate_CodeCursorDraw-Password_StripeImageTemplate
;Selection cursor
LDA.b PASSWORD_SELECTION_POSITION : AND.w #$00FF : ASL : TAX
LDA.b PasswordSelectPosition : AND.w #$00FF : ASL : TAX
LDA.l PasswordEraseOldCursors_selection_offsets, X
!ADD.w #$20*Scrap0D+Scrap03+$6000
XBA ; because big endian is needed
@@ -353,13 +350,13 @@ RTS
PasswordMoveCursorRight:
; return new code position
LDA.b #$2B : STA.w $012E
LDA.b PASSWORD_CODE_POSITION : INC A : AND.b #$0F : STA.b PASSWORD_CODE_POSITION
LDA.b #$2B : STA.w SFX2
LDA.b PasswordCodePosition : INC A : AND.b #$0F : STA.b PasswordCodePosition
RTS
PasswordMoveCursorLeft:
; return new code position
LDA.b #$2B : STA.w $012E
LDA.b PASSWORD_CODE_POSITION : DEC A : AND.b #$0F : STA.b PASSWORD_CODE_POSITION
LDA.b #$2B : STA.w SFX2
LDA.b PasswordCodePosition : DEC A : AND.b #$0F : STA.b PasswordCodePosition
RTS
macro dw_big_endian(value)

View File

@@ -145,13 +145,13 @@ BringMenuDownEnhanced:
EOR.w #$FFFF : !ADD.w #$0001 ; negate menu speed
!ADD $EA : CMP.w #$FF18 : !BGE .noOvershoot
!ADD BG3VOFSQL : CMP.w #$FF18 : !BGE .noOvershoot
LDA.w #$FF18 ; if we went past the limit, go to the limit
.noOvershoot
STA.b $EA : CMP.w #$FF18
STA.b BG3VOFSQL : CMP.w #$FF18
SEP #$20 ; set 8-bit accumulator
BNE .notDoneScrolling
INC $0200
INC.w SubModuleInterface
.notDoneScrolling
RTL
;================================================================================
@@ -163,30 +163,30 @@ RaiseHudMenu:
LDA.l MenuSpeed : AND.w #$00FF
++
!ADD $EA : BMI .noOvershoot
!ADD BG3VOFSQL : BMI .noOvershoot
LDA.w #$0000 ; if we went past the limit, go to the limit
.noOvershoot
STA.b $EA
STA.b BG3VOFSQL
RTL
;================================================================================
CheckCloseItemMenu:
LDA.l MenuCollapse : BNE +
LDA.b $F4 : AND.b #$10 : RTL
LDA.b Joy1A_New : AND.b #$10 : RTL
+
LDA.b $F0 : AND.b #$10 : EOR.b #$10
LDA.b Joy1A_All : AND.b #$10 : EOR.b #$10
RTL
;================================================================================
ShowDungeonItems:
LDA.w $040C : AND.w #$00FF : CMP.w #$00FF : BNE + : RTL : + ; return normal result if outdoors or in a cave
LDA.w DungeonID : AND.w #$00FF : CMP.w #$00FF : BNE + : RTL : + ; return normal result if outdoors or in a cave
LDA.l HudFlag : AND.w #$0020 ; check hud flag
BEQ + : LDA.w #$0000 : RTL : + ; if set, send the zero onwards
LDA.w $040C : AND.w #$00FF : CMP.w #$00FF ; original logic
LDA.w DungeonID : AND.w #$00FF : CMP.w #$00FF ; original logic
RTL
;--------------------------------------------------------------------------------
UpdateKeys:
PHX : PHP
SEP #$30 ; set 8-bit accumulator & index registers
LDA.w $040C : CMP.b $1F : !BLT .skip
LDA.w DungeonID : CMP.b $1F : !BLT .skip
LSR : TAX ; get dungeon index and store to X

View File

@@ -4,28 +4,28 @@ QuickSwap:
; We perform all other checks only if we are pushing L or R in order to have minimal
; perf impact, since this runs every frame
LDA.b $F6 : AND.b #$30 : BEQ .done
LDA.b Joy1B_New : AND.b #$30 : BEQ .done
XBA ; stash away the value for after the checks.
LDA.l QuickSwapFlag : BEQ .done
LDA.w $0202 : BEQ .done ; Skip everything if we don't have any items
LDA.w ItemCursor : BEQ .done ; Skip everything if we don't have any items
LDY.b #$14
PHX
XBA ; restore the stashed value
CMP.b #$30 : BNE +
; If prossing both L and R this frame, then go directly to the special swap code
LDX.w $0202 : BRA .special_swap
LDX.w ItemCursor : BRA .special_swap
+
BIT.b #$10 : BEQ + ; Only pressed R
JSR.w RCode
LDA.b $F2 : 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
+
; Only pressed L
JSR.w LCode
LDA.b $F2 : 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
.special_swap
@@ -36,21 +36,21 @@ QuickSwap:
CPX.b #$0D : BEQ + ; flute
CPX.b #$10 : BEQ + ; bottle
BRA .store
+ STX.w $0202 : JSL ProcessMenuButtons_y_pressed
+ STX.w ItemCursor : JSL ProcessMenuButtons_y_pressed
.store
LDA.b #$20 : STA.w $012F
STX.w $0202
LDA.b #$20 : STA.w SFX3
STX.w ItemCursor
JSL HUD_RefreshIconLong
PLX
.done
LDA.b $F6 : AND.b #$40 ;what we wrote over
LDA.b Joy1B_New : AND.b #$40 ;what we wrote over
RTL
RCode:
LDX.w $0202
LDA.b $F2 : BIT.b #$20 : BNE ++ ; Still holding L from a previous frame
LDX.w ItemCursor
LDA.b Joy1B_All : BIT.b #$20 : BNE ++ ; Still holding L from a previous frame
LDA.l InventoryTracking+1 : AND.b #$FE : STA.l InventoryTracking+1
BRA +
++
@@ -66,8 +66,8 @@ RCode:
RTS
LCode:
LDX.w $0202
LDA.b $F2 : BIT #$10 : BNE ++ ; Still holding R from a previous frame
LDX.w ItemCursor
LDA.b Joy1B_All : BIT #$10 : BNE ++ ; Still holding R from a previous frame
LDA.l InventoryTracking+1 : AND.b #$FE : STA.l InventoryTracking+1
BRA +
++

453
ram.asm
View File

@@ -2,99 +2,226 @@
; RAM Labels & Assertions
;--------------------------------------------------------------------------------
; This module is primarily concerned with labeling WRAM addresses used by the
; randomizer and documenting their usage.
; randomizer and documenting their usage. We use a combination of base $[address]
; and WRAMLabel = $[address] here, favoring the former when we have larger blocks
; of contiguous ram labeled. In some cases the label name can be descriptive enough
; without documentation, you may want to consult more in-depth reference materials,
; or I just don't understand what they are.
;
; See the JP 1.0 disassembly for reference
; (https://github.com/spannerisms/jpdasm/ - 31/10/2022)
; See the JP 1.0 disassembly for reference, specifically symbols_wram.asm
; (https://github.com/spannerisms/jpdasm/ - 19/11/2022)
;--------------------------------------------------------------------------------
pushpc
org 0
;================================================================================
; Bank 7E
;--------------------------------------------------------------------------------
;================================================================================
; Direct Page
;--------------------------------------------------------------------------------
base $7E0000
Scrap:
Scrap00: skip 1 ; Used as short-term scratch space. If you need some short-term
Scrap01: skip 1 ; RAM, you can often use these. Double check that the next use
Scrap02: skip 1 ; of the addresses you want to use is a write.
Scrap03: skip 1 ;
Scrap04: skip 1 ;
Scrap05: skip 1 ;
Scrap06: skip 1 ;
Scrap07: skip 1 ;
Scrap08: skip 1 ;
Scrap09: skip 1 ;
Scrap0A: skip 1 ;
Scrap0B: skip 1 ;
Scrap0C: skip 1 ;
Scrap0D: skip 1 ;
Scrap0E: skip 1 ;
Scrap0F: skip 1 ;
Scrap00: skip 1 ; Used as short-term scratch space. If you need some short-term
Scrap01: skip 1 ; RAM, you can often use these. Double check that the next use
Scrap02: skip 1 ; of the addresses you want to use is a write.
Scrap03: skip 1 ;
Scrap04: skip 1 ;
Scrap05: skip 1 ;
Scrap06: skip 1 ;
Scrap07: skip 1 ;
Scrap08: skip 1 ;
Scrap09: skip 1 ;
Scrap0A: skip 1 ;
Scrap0B: skip 1 ;
Scrap0C: skip 1 ;
Scrap0D: skip 1 ;
Scrap0E: skip 1 ;
Scrap0F: skip 1 ;
;
GameMode = $7E0010 ; Game mode & submode. Refer to disassembly.
GameSubMode = $7E0011 ;
;
FrameCounter = $7E001A ; Increments every frame that the game isn't lagging
IndoorsFlag = $7E001B ; $00 = Outdoors | $01 = Indoors
;
LinkPosY = $7E0020 ; Link's absolute x/y coordinates. Both are word length.
LinkPosX = $7E0022 ;
LinkPosZ = $7E0024 ; $FFFF when on ground
;
LinkRecoilY = $7E0027 ;
LinkRecoilX = $7E0028 ;
LinkRecoilZ = $7E0029 ;
;
LinkDirection = $7E002F ; $00 = Up | $02 = Down | $04 = Left | $06 = Right
;
OAMOffsetY = $7E0044 ;
OAMOffsetX = $7E0045 ;
;
LinkJumping = $7E004D ; $00 = None | $01 = Bonk/damage/water | $02 = Ledge
;
BunnyFlagDP = $7E0056 ; $00 = Link | $01 = Bunny
;
LinkSlipping = $7E005B ; $00 = None | $01 = Near pit
; $02 = Falling | $03 = Falling "more"
FallTimer = $7E005C ; Timer for falling animation
LinkState = $7E005D ; Main Link state handler
LinkSpeed = $7E005E ; Main Link speed handler
;
OverworldIndex = $7E008A ; Overworld screen index. Word length. Dark world is OR $40 of
; light world screen in same position. Zeroed on UW entry.
OverlayID = $7E008C ; Overworld overlay ID. One Byte.
;
RoomIndex = $7E00A0 ; Underworld room index. Word length. High byte: $00 = EG1 | $01 = EG2
; Not zeroed on exit to overworld.
PreviousRoom = $7E00A2 ; Stores previous value of RoomIndex
;
SubSubModule = $7E00B0 ; Often used as a submodule, such as for transitions
;
ObjPtr = $7E00B7 ; Pointer for drawing room objects. Three bytes.
ObjPtrOffset = $7E00BA ; Used as an offset for ObjPointer. Word Length.
PlayerSpriteBank = $7E00BC ;
ScrapBufferBD = $7E00BD ; Another scrap buffer. $23 bytes.
FileSelectPosition = $7E00C8 ;
PasswordCodePosition = $7E00C8 ;
PasswordSelectPosition = $7E00C9 ;
;
BG1H = $7E00E0 ; Background scroll registers
BG2H = $7E00E2 ; For BG1 and BG2, these registers are used for calculations later for different writes to PPU.
BG3HOFSQL = $7E00E4 ; For BG3, the values are written directly to the PPU during NMI
BG1V = $7E00E6 ; Since BG1 and BG2 are not written directly to PPU they are given different names from BG3.
BG2V = $7E00E8 ;
BG3VOFSQL = $7E00EA ;
;
LinkLayer = $7E00EE ; Layer that Link is on. $00 = BG2 (upper) | $02 = BG1 (lower)
;
Joy1A_All = $7E00F0 ; Joypad input
Joy2A_All = $7E00F1 ; All = Current & previous frame
Joy1B_All = $7E00F2 ; New = Current frame
Joy2B_All = $7E00F3 ; Old = Previous frame
Joy1A_New = $7E00F4 ;
Joy2A_New = $7E00F5 ;
Joy1B_New = $7E00F6 ;
Joy2B_New = $7E00F7 ;
Joy1A_Old = $7E00F8 ;
Joy2A_Old = $7E00F9 ;
Joy1B_Old = $7E00FA ;
Joy2B_Old = $7E00FB ;
LinkPosY = $7E0020 ; 2 bytes
LinkPosX = $7E0022 ; 2 bytes
RoomIndex = $7E00A0 ; 2 bytes, UW room index
;================================================================================
; Bank 7E
;--------------------------------------------------------------------------------
;================================================================================
; Mirrored WRAM
;--------------------------------------------------------------------------------
; Pages 0x000x1F of Bank7E are mirrored to every program bank ALTTP uses.
;--------------------------------------------------------------------------------
CurrentMSUTrack = $7E010B
CurrentVolume = $7E0127
TargetVolume = $7E0129
CurrentControlRequest = $7E0133 ; Last thing written to MusicControlRequest
MusicControl = $7E012B
MusicControlRequest = $7E012C
CurrentMSUTrack = $7E010B ;
GameModeCache = $7E010C ;
GameSubModeCache = $7E010D ;
;
MedallionFlag = $7E0112 ; Medallion cutscene flag. $01 = Cutscene active.
;
BG1ShakeV = $7E011A ; Applied to BG Scroll. Word Length.
BG1ShakeH = $7E011C ;
;
CurrentVolume = $7E0127 ;
TargetVolume = $7E0129 ;
CurrentControlRequest = $7E0133 ; Last thing written to MusicControlRequest
MusicControl = $7E012B ;
MusicControlRequest = $7E012C ;
SFX1 = $7E012D ;
SFX2 = $7E012E ;
SFX3 = $7E012F ;
;
SubModuleInterface = $7E0200 ; Word length. High byte expected to be $00.
ItemCursor = $7E0202 ; Current location of the item menu cursor.
;
BottleMenuCounter = $7E0205 ; Step counter for opening bottle menu
MenuFrameCounter = $7E0206 ; Incremented every menu frame. Never read.
MenuBlink = $7E0207 ; Incremented every frame and masked with $10 to blink cursor
;
ItemReceiptID = $7E02D8 ;
;
BunnyFlag = $7E02E0 ; $00 = Link | $01 = Bunny
;
CutsceneFlag = $7E02E4 ; Flags various cutscenes. All non-zero behave the same.
;
ItemReceiptMethod = $7E02E9 ;
;
TileActBE = $7E02EF ; Bitfield used by breakables and entrances. b b b b d d d d
; b = Breakables | d = Entrances
CurrentYItem = $7E0303 ;
;
;
TileActDig = $7E035B ; Bitfield used by diggable ground. Word length. High byte unused.
;
ForceSwordUp = $7E03EF ; $01 = Force sword up pose.
;
ItemsTaken = $7E0403 ; Items taken in a room: b k u t s e h c
; 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
; s = chest 3/pod or dp wall | e, h, c = chest 2, 1, 0
DungeonID = $7E040C ; High byte mostly unused but sometimes read. Word length.
;
OWEntranceCutscene = $7E04C6 ;
;
HeartBeepTimer = $7E04CA ;
;
NMIAux = $7E0632 ; Stores long address of NMI jump. Currently only used by shops.
;
SkipOAM = $7E0710 ; Set to skip OAM updates. High byte written $FF with exploding walls
;
BowDryFire = $7E0B9A ; If set, arrows are deleted immediately
;
SaveFileIndex = $7E0B9D ;
;
SpritePosYLow = $7E0D00 ; Sprite slot data. Each label has $10 bytes.
SpritePosXLow = $7E0D10 ;
SpritePosYHigh = $7E0D20 ;
SpritePosXHigh = $7E0D30 ;
SpriteVelocityY = $7E0D40 ;
SpriteVelocityX = $7E0D50 ;
;
SpriteUnknown = $7E0D80 ; Don't know what this is
;
SpriteAuxTable = $7E0DA0 ; $20 bytes.
SpriteGFXControl = $7E0DC0 ;
SpriteAITable = $7E0DD0 ; AI state of sprites. $10 bytes.
;
SpriteTimer = $7E0DF0 ;
;
SpriteTypeTable = $7E0E20 ; Which sprite occupies this slot. $10 bytes.
;
SpriteItemType = $7E0E80 ; Sprite Item Type. $10 bytes.
;
SpriteDirectionTable = $7E0EB0 ; Sprite direction. $10 bytes.
;
FreezeSprites = $7E0FC1 ; "Seems to freeze sprites"
;
SpriteCoordCacheX = $7E0FD8 ;
SpriteCoordCacheY = $7E0FDA ;
;
NoMenu = $7E0FFC ; When set prevents menu, mirror, medallions
;
TextID = $7E1CF0 ; Message ID and page. Word length.
;
ToastBuffer = $7E1E0E ; Multiworld buffer. Word length.
;
MSUResumeTime = $7E1E6B ; Mirrored MSU block
MSUResumeControl = $7E1E6F ;
MSUFallbackTable = $7E1E70 ;
MSUDelayedCommand = $7E1E79 ;
MSUPackCount = $7E1E7A ;
MSUPackCurrent = $7E1E7B ;
MSUPackRequest = $7E1E7C ;
MSULoadedTrack = $7E1E7D ;
MSUResumeTrack = $7E1E7F ;
ItemReceiptID = $7E02D8
NMIAux = $7E0632
SpritePosYLow = $7E0D00 ; all $10 bytes
SpritePosXLow = $7E0D10
SpritePosYHigh = $7E0D20
SpritePosXHigh = $7E0D30
SpriteAuxTable = $7E0DA0 ; 0x1F bytes
SpriteAITable = $7E0DD0
SpriteTypeTable = $7E0E20
SpriteDirectionTable = $7E0EB0
ToastBuffer = $7E1E0E ; 2 bytes DoToast
MSUResumeTime = $7E1E6B ; 4 bytes
MSUResumeControl = $7E1E6F
MSUFallbackTable = $7E1E70 ; 8 bytes
MSUDelayedCommand = $7E1E79
MSUPackCount = $7E1E7A
MSUPackCurrent = $7E1E7B
MSUPackRequest = $7E1E7C
MSULoadedTrack = $7E1E7D ; 2 bytes
MSUResumeTrack = $7E1E7F
;1E90
ClockHours = $7E1E90 ; Clock Hours
ClockMinutes = $7E1E94 ; Clock Minutes
ClockSeconds = $7E1E98 ; Clock Seconds
ClockBuffer = $7E1E9C ; Clock Temporary
;1EA0
ScratchBufferNV = $7E1EA0 ; Callee preserved
;1EB0
ScratchBufferV = $7E1EB0 ; Caller preserved
;1EC0
;1ED0
;1EE0
;1EF0
ClockHours = $7E1E90 ; Clock Hours
ClockMinutes = $7E1E94 ; Clock Minutes
ClockSeconds = $7E1E98 ; Clock Seconds
ClockBuffer = $7E1E9C ; Clock Temporary
ScratchBufferNV = $7E1EA0 ; Non-volatile scratch buffer. Must preserve values through return.
ScratchBufferV = $7E1EB0 ; Volatile scratch buffer. Can clobber at will.
;================================================================================
; UNMIRRORED WRAM
@@ -102,24 +229,24 @@ ScratchBufferV = $7E1EB0 ; Caller preserved
; or absolute addressing with the appropriate data bank set
;--------------------------------------------------------------------------------
TileUploadBuffer = $7EA180 ; 0x300 bytes
SpriteOAM = $7EC025 ;
TileUploadBuffer = $7EA180 ; 0x300 bytes
SpriteOAM = $7EC025 ;
; $7EC700 - Tile map buffer for HUD
HUDKeyIcon = $7EC726 ;
HUDGoalIndicator = $7EC72A ;
HUDPrizeIcon = $7EC742 ;
HUDRupees = $7EC750 ;
HUDBombCount = $7EC75A ;
HUDArrowCount = $7EC760 ;
HUDKeyDigits = $7EC764 ;
; $7EC700 - Tile map buffer for HUD
HUDKeyIcon = $7EC726
HUDGoalIndicator = $7EC72A
HUDPrizeIcon = $7EC742
HUDRupees = $7EC750
HUDBombCount = $7EC75A
HUDArrowCount = $7EC760
HUDKeyDigits = $7EC764
BigRAM = $7EC900 ; Big buffer of free ram (0x1F00)
BigRAM = $7EC900 ; Big buffer of free ram (0x1F00)
;================================================================================
; Bank 7F
;--------------------------------------------------------------------------------
DecompressionBuffer = $7F0000 ; Decompression Buffer. $2000 bytes.
base $7F5000
RedrawFlag: skip 1 ;
skip 2 ;
@@ -226,6 +353,9 @@ skip $40 ; Unused
skip $260 ; Unused
DialogBuffer: skip $100 ; Dialog Buffer
MiniGameTime = $7FFE00 ; Time spent in mini game. 32-bits.
MiniGameTimeFinal = $7FFE04 ; Final mini game time. 32 bits.
;================================================================================
; RAM Assertions
;--------------------------------------------------------------------------------
@@ -249,29 +379,98 @@ endmacro
%assertRAM(Scrap0D, $7E000D)
%assertRAM(Scrap0E, $7E000E)
%assertRAM(Scrap0F, $7E000F)
%assertRAM(GameMode, $7E0010)
%assertRAM(GameSubMode, $7E0011)
%assertRAM(FrameCounter, $7E001A)
%assertRAM(IndoorsFlag, $7E001B)
%assertRAM(LinkPosY, $7E0020)
%assertRAM(LinkPosX, $7E0022)
%assertRAM(LinkPosZ, $7E0024)
%assertRAM(LinkRecoilY, $7E0027)
%assertRAM(LinkRecoilX, $7E0028)
%assertRAM(LinkRecoilZ, $7E0029)
%assertRAM(LinkDirection, $7E002F)
%assertRAM(OAMOffsetY, $7E0044)
%assertRAM(OAMOffsetX, $7E0045)
%assertRAM(LinkJumping, $7E004D)
%assertRAM(BunnyFlagDP, $7E0056)
%assertRAM(LinkSlipping, $7E005B)
%assertRAM(FallTimer, $7E005C)
%assertRAM(LinkState, $7E005D)
%assertRAM(LinkSpeed, $7E005E)
%assertRAM(OverworldIndex, $7E008A)
%assertRAM(OverlayID, $7E008C)
%assertRAM(RoomIndex, $7E00A0)
%assertRAM(PreviousRoom, $7E00A2)
%assertRAM(SubSubModule, $7E00B0)
%assertRAM(ObjPtr, $7E00B7)
%assertRAM(ObjPtrOffset, $7E00BA)
%assertRAM(ScrapBufferBD, $7E00BD)
%assertRAM(PlayerSpriteBank, $7E00BC)
%assertRAM(FileSelectPosition, $7E00C8)
%assertRAM(PasswordCodePosition, $7E00C8)
%assertRAM(PasswordSelectPosition, $7E00C9)
%assertRAM(BG1H, $7E00E0)
%assertRAM(BG2H, $7E00E2)
%assertRAM(BG3HOFSQL, $7E00E4)
%assertRAM(BG1V, $7E00E6)
%assertRAM(BG2V, $7E00E8)
%assertRAM(BG3VOFSQL, $7E00EA)
%assertRAM(LinkLayer, $7E00EE)
%assertRAM(CurrentMSUTrack, $7E010B)
%assertRAM(GameModeCache, $7E010C)
%assertRAM(GameSubModeCache, $7E010D)
%assertRAM(MedallionFlag, $7E0112)
%assertRAM(BG1ShakeV, $7E011A)
%assertRAM(BG1ShakeH, $7E011C)
%assertRAM(CurrentVolume, $7E0127)
%assertRAM(TargetVolume, $7E0129)
%assertRAM(CurrentControlRequest, $7E0133)
%assertRAM(MusicControl, $7E012B)
%assertRAM(MusicControlRequest, $7E012C)
%assertRAM(SFX1, $7E012D)
%assertRAM(SFX2, $7E012E)
%assertRAM(SFX3, $7E012F)
%assertRAM(SubModuleInterface, $7E0200)
%assertRAM(ItemCursor, $7E0202)
%assertRAM(BottleMenuCounter, $7E0205)
%assertRAM(MenuBlink, $7E0207)
%assertRAM(ItemReceiptID, $7E02D8)
%assertRAM(BunnyFlag, $7E02E0)
%assertRAM(CutsceneFlag, $7E02E4)
%assertRAM(ItemReceiptMethod, $7E02E9)
%assertRAM(TileActBE, $7E02EF)
%assertRAM(CurrentYItem, $7E0303)
%assertRAM(TileActDig, $7E035B)
%assertRAM(ForceSwordUp, $7E03EF)
%assertRAM(ItemsTaken, $7E0403)
%assertRAM(DungeonID, $7E040C)
%assertRAM(OWEntranceCutscene, $7E04C6)
%assertRAM(HeartBeepTimer, $7E04CA)
%assertRAM(NMIAux, $7E0632)
%assertRAM(SkipOAM, $7E0710)
%assertRAM(BowDryFire, $7E0B9A)
%assertRAM(SaveFileIndex, $7E0B9D)
%assertRAM(SpritePosYLow, $7E0D00)
%assertRAM(SpritePosXLow, $7E0D10)
%assertRAM(SpritePosYHigh, $7E0D20)
%assertRAM(SpritePosXHigh, $7E0D30)
%assertRAM(SpriteVelocityY, $7E0D40)
%assertRAM(SpriteVelocityX, $7E0D50)
%assertRAM(SpriteUnknown, $7E0D80)
%assertRAM(SpriteAuxTable, $7E0DA0)
%assertRAM(SpriteGFXControl, $7E0DC0)
%assertRAM(SpriteAITable, $7E0DD0)
%assertRAM(SpriteTimer, $7E0DF0)
%assertRAM(SpriteTypeTable, $7E0E20)
%assertRAM(SpriteItemType, $7E0E80)
%assertRAM(SpriteDirectionTable, $7E0EB0)
%assertRAM(FreezeSprites, $7E0FC1)
%assertRAM(SpriteCoordCacheX, $7E0FD8)
%assertRAM(SpriteCoordCacheY, $7E0FDA)
%assertRAM(NoMenu, $7E0FFC)
%assertRAM(TextID, $7E1CF0)
%assertRAM(ToastBuffer, $7E1E0E)
%assertRAM(MSUResumeTime, $7E1E6B)
%assertRAM(MSUResumeControl, $7E1E6F)
%assertRAM(MSUFallbackTable, $7E1E70)
@@ -281,8 +480,6 @@ endmacro
%assertRAM(MSUPackRequest, $7E1E7C)
%assertRAM(MSULoadedTrack, $7E1E7D)
%assertRAM(MSUResumeTrack, $7E1E7F)
%assertRAM(ClockHours, $7E1E90)
%assertRAM(ClockMinutes, $7E1E94)
%assertRAM(ClockSeconds, $7E1E98)
@@ -299,6 +496,8 @@ endmacro
%assertRAM(HUDArrowCount, $7EC760)
%assertRAM(HUDKeyDigits, $7EC764)
%assertRAM(BigRAM, $7EC900)
%assertRAM(DecompressionBuffer, $7F0000)
%assertRAM(RedrawFlag, $7F5000)
%assertRAM(HexToDecDigit1, $7F5003)
%assertRAM(HexToDecDigit2, $7F5004)
@@ -306,9 +505,6 @@ endmacro
%assertRAM(HexToDecDigit4, $7F5006)
%assertRAM(HexToDecDigit5, $7F5007)
%assertRAM(SpriteSkipEOR, $7F5008)
%assertRAM(AltTextFlag, $7F5035)
%assertRAM(BossKills, $7F5037)
%assertRAM(LagTime, $7F5038)
@@ -369,68 +565,7 @@ endmacro
%assertRAM(TxStatus, $7F53FF)
%assertRAM(CompassTotalsWRAM, $7F5410)
%assertRAM(DialogBuffer, $7F5700)
%assertRAM(MiniGameTime, $7FFE00)
%assertRAM(MiniGameTimeFinal, $7FFE04)
pullpc
;================================================================================
; Bank 7F
;--------------------------------------------------------------------------------
;OLDSTUFF
; $7F5042 - Tile Upload Offset Override (Low)
; $7F5043 - Tile Upload Offset Override (High)
; $7F5044 - $7F5046 - NMI Auxiliary Function
; $7F5047 - $7F504F - Unused
; $7F5050 - $7F506F - Shop Block
; $7F5070 - Reserved for OneMind
; $7F5071 - Reserved for OneMind
; $7F5072 - OneMind player ID
; $7F5073 - $7F5074 - OneMind timer
; $7F5075 - $7F507D - Unused
; $7F507E - Clock Status
; $7F507F - Always Zero
; $7F5080 - $7F508F - unused
; $7F5090 - RNG Item Lock-In
; $7F5091 - Item Animation Busy Flag
; $7F5092 - Potion Animation Busy Flags (Health)
; $7F5093 - Potion Animation Busy Flags (Magic)
; $7F5094 - Dialog Offset Pointer (Low)
; $7F5095 - Dialog Offset Pointer (High)
; $7F5096 - Dialog Offset Pointer Return (Low)
; $7F5097 - Dialog Offset Pointer Return (High)
; $7F5098 - Unused
; $7F5099 - Last Entered Overworld Door ID
; $7F509A - (Reserved)
; $7F509B - Unused
; $7F509C - Duck Map Flag
; $7F509E - Valid Key Loaded
; $7F509F - Text Box Defer Flag
; $7F50A0 - $7F50AF - Unused
; $7F50B0 - $7F50BF - Downstream Reserved (Enemizer)
; $7F50C1 - Shield Modifier (Not Implemented)
; $7F50C2 - Armor Modifier
; $7F50C3 - Magic Modifier
; $7F50C4 - Light Cone Modifier
; $7F50C5 - Cucco Storm
; $7F50C6 - Old Man Dash Modifier
; $7F50C7 - Ice Physics Modifier
; $7F50C8 - Infinite Arrows Modifier
; $7F50C9 - Infinite Bombs Modifier
; $7F50CA - Infinite Magic Modifier
; $7F50CB - Invert D-Pad (Fill in values)
; $7F50CC - OHKO Flag
; $7F50CD - Sprite Swapper
; $7F50CE - Boots Modifier (0=Off, 1=Always, 2=Never)
; $7F50D0 - $7F50FF - Block Cypher Parameters
; $7F5100 - $7F51FF - Block Cypher Buffer
; $7F5200 - $7F52FF - RNG Pointer Block
; $7F5300 - $7F53FF - Multiworld Block
; $7F5400 - $7F540F - Unused
; $7F5410 - $7F545F - Dungeon Tracking Block
; $7F5460 - $7F56FF - Unused
; $7F5700 - $7F57FF - Dialog Buffer

View File

@@ -2,7 +2,7 @@
; SNES Registers
;===================================================================================================
; Note: This is almost entirely a copy from the JP 1.0 disassembly.
; See: https://github.com/spannerisms/jpdasm/ - 02/11/2022
; See: https://github.com/spannerisms/jpdasm/ - 19/11/2022
;--------------------------------------------------------------------------------

View File

@@ -36,7 +36,7 @@ DecrementArrows:
.rupees
REP #$20
LDA.b RoomIndex : CMP.w #$0111 : SEP #$20 : BNE .not_archery_game
LDA.b $1B : 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.b #$00 : BRA .done

View File

@@ -2,11 +2,11 @@
; RNG Fixes
;--------------------------------------------------------------------------------
RigDigRNG:
LDA.l $7FFE01 : CMP.l DiggingGameRNG : !BGE .forceHeart
LDA.l MiniGameTime+1 : CMP.l DiggingGameRNG : !BGE .forceHeart
.normalItem
JML GetRandomInt
.forceHeart
LDA.l $7FFE00 : BNE .normalItem
LDA.l MiniGameTime : BNE .normalItem
LDA.b #$04
RTL
;--------------------------------------------------------------------------------
@@ -20,8 +20,8 @@ RigChestRNG:
JSL.l DecrementItemCounter
RTL
.forceHeart
LDA.b #$33 : STA.b $C8 ; assure the correct state if player talked to shopkeeper
LDA.w $0403 : AND.b #$40 : BNE .notHeart
LDA.b #$33 : STA.b ScrapBufferBD+$0B ; assure the correct state if player talked to shopkeeper
LDA.w ItemsTaken : AND.b #$40 : BNE .notHeart
LDA.b #$07 ; give prize item
RTL
.notHeart

View File

@@ -14,10 +14,10 @@ WriteSaveChecksumAndBackup:
STA.l InverseChecksumSRAM
PHB
LDA.w #$14FF ; \
LDX.w #CartridgeSRAM&$FFFF ; | Copies $1500 bytes from beginning of cart SRAM to
LDY.w #SaveBackupSRAM&$FFFF ; | $704000
MVN SRAMBank, SRAMBank ; /
LDA.w #$14FF ; \
LDX.w #CartridgeSRAM&$FFFF ; | Copies $1500 bytes from beginning of cart SRAM to
LDY.w #SaveBackupSRAM&$FFFF ; | $704000
MVN !SRAMBank, !SRAMBank ; /
PLB
RTL
@@ -51,10 +51,10 @@ ValidateSRAM:
TDC : STA.l FileValiditySRAM ; Delete save by way of zeroing validity marker
BRA .goodchecksum : +
PHB
LDA.w #$14FF ; \
LDX.w #SaveBackupSRAM&$FFFF ; | Copies $1500 bytes from backup on cart SRAM to
LDY.w #CartridgeSRAM&$FFFF ; | main save location at $700000
MVN SRAMBank, SRAMBank ; /
LDA.w #$14FF ; \
LDX.w #SaveBackupSRAM&$FFFF ; | Copies $1500 bytes from backup on cart SRAM to
LDY.w #CartridgeSRAM&$FFFF ; | main save location at $700000
MVN !SRAMBank, !SRAMBank ; /
PLB
.goodchecksum

View File

@@ -58,13 +58,13 @@ endmacro
;--------------------------------------------------------------------------------
macro ServiceRequestChest(type)
LDA.l TxStatus : BEQ + : CLC : RTL : + ; return fail if we don't have the lock
LDA.b $1B : STA.l TxBuffer+8 ; indoor/outdoor
LDA.b IndoorsFlag : STA.l TxBuffer+8 ; indoor/outdoor
BEQ +
LDA.b RoomIndex : STA.l TxBuffer+9 ; roomid low
LDA.b RoomIndex+1 : STA.l TxBuffer+10 ; roomid high
BRA ++
+
LDA.w $040A : STA.l TxBuffer+9 ; area id
LDA.b OverworldIndex : STA.l TxBuffer+9 ; area id
LDA.b #$00 : STA.l TxBuffer+10 ; protocol defines this as a ushort
++
LDA.b $76 : !SUB #$58 : STA.l TxBuffer+11 ; object index (type 2 only)
@@ -76,13 +76,13 @@ endmacro
;--------------------------------------------------------------------------------
macro ServiceRequest(type,index)
LDA.l TxStatus : BEQ + : CLC : RTL : + ; return fail if we don't have the lock
LDA.b $1B : STA.l TxBuffer+8 ; indoor/outdoor
LDA.b IndoorsFlag : STA.l TxBuffer+8 ; indoor/outdoor
BEQ +
LDA.b RoomIndex : STA.l TxBuffer+9 ; roomid low
LDA.b RoomIndex+1 : STA.l TxBuffer+10 ; roomid high
BRA ++
+
LDA.w $040A : STA.l TxBuffer+9 ; area id
LDA.b OverworldIndex : STA.l TxBuffer+9 ; area id
LDA.b #$00 : STA.l TxBuffer+10 ; protocol defines this as a ushort
++
LDA.b #<index> : STA.l TxBuffer+11 ; object index (type 2 only)
@@ -111,7 +111,7 @@ PollService:
BRA .done
+ : CMP.b #!SCM_PROMPT : BNE + ; item prompt
LDA.l RxBuffer+8 : TAX
LDA.l RxBuffer+9 : STA.w $012E, X ; set sound effect
LDA.l RxBuffer+9 : STA.w SFX2, X ; set sound effect
REP #$30 ; set 16-bit accumulator and index registers
LDA.l RxBuffer+10 : TAX
LDA.l RxBuffer+12

View File

@@ -331,7 +331,7 @@ Shopkepeer_CallOriginal:
LDA.b #ShopkeeperJumpTable>>16 : PHA
LDA.b #ShopkeeperJumpTable>>8 : PHA
LDA.b #ShopkeeperJumpTable : PHA
LDA.w $0E80, X
LDA.w SpriteItemType, X
JML.l UseImplicitRegIndexedLocalJumpTable
;--------------------------------------------------------------------------------
Sprite_ShopKeeper:
@@ -370,7 +370,7 @@ RTL
;--------------------------------------------------------------------------------
macro DrawMerchant(head,body,speed)
PHX : LDX.b #$00
LDA.b $1A : AND.b <speed> : BEQ +
LDA.b FrameCounter : AND.b <speed> : BEQ +
-
LDA.w .oam_shopkeeper_f1, X : STA.l BigRAM, X : INX
CPX.b #$10 : !BLT -
@@ -420,7 +420,7 @@ Shopkeeper_DrawMerchant_Type1:
LDA.b #$01 : STA.b Scrap06 ; request 1 OAM slot
LDA.b #$04 : JSL.l OAM_AllocateFromRegionA ; request 4 bytes
STZ.b Scrap07
LDA.b $1A : AND #$08 : BEQ +
LDA.b FrameCounter : AND #$08 : BEQ +
LDA.b #.oam_shopkeeper_f1 : STA.b Scrap08
LDA.b #.oam_shopkeeper_f1>>8 : STA.b Scrap09
BRA ++
@@ -464,8 +464,8 @@ Shopkeeper_SetupHitboxes:
JSR.w Setup_ShopItemInteractionHitbox
JSL.l Utility_CheckIfHitBoxesOverlapLong : BCC .no_interaction
LDA.b $F6 : AND.b #$80 : BEQ .no_interaction ; check for A-press
LDA.b $10 : CMP.b #$0C : !BGE .no_interaction ; don't interact in other modes besides game action
LDA.b Joy1B_New : AND.b #$80 : BEQ .no_interaction ; check for A-press
LDA.b GameMode : CMP.b #$0C : !BGE .no_interaction ; don't interact in other modes besides game action
JSR.w Shopkeeper_BuyItem
.no_interaction
INY #4
@@ -496,13 +496,13 @@ Shopkeeper_BuyItem:
LDA.b #$7A
LDY.b #$01
JSL.l Sprite_ShowMessageUnconditional
LDA.b #$3C : STA.w $012E ; error sound
LDA.b #$3C : STA.w SFX2 ; error sound
JMP .done
.full_bottles
LDA.b #$6B
LDY.b #$01
JSL.l Sprite_ShowMessageUnconditional
LDA.b #$3C : STA.w $012E ; error sound
LDA.b #$3C : STA.w SFX2 ; error sound
JMP .done
.buy
LDA.l ShopType : AND.b #$80 : BNE ++ ; don't charge if this is a take-any
@@ -544,7 +544,7 @@ Setup_ShopItemCollisionHitbox:
SEP #$20 ; set 8-bit accumulator
; load shopkeeper X (16 bit)
LDA.w $0D30, X : XBA : LDA.w $0D10, X
LDA.w SpritePosXHigh, X : XBA : LDA.w SpritePosXLow, X
REP #$20 ; set 16-bit accumulator
PHA : PHY
@@ -561,7 +561,7 @@ Setup_ShopItemCollisionHitbox:
STA.b Scrap04 : XBA : STA.b Scrap0A
;load shopkeeper Y (16 bit)
LDA.w $0D20, X : XBA : LDA.w $0D00, X
LDA.w SpritePosYHigh, X : XBA : LDA.w SpritePosYLow, X
REP #$20 ; set 16-bit accumulator
PHY : INY #2
@@ -624,7 +624,7 @@ RTS
Sprite_HaltSpecialPlayerMovementCopied:
PHX
JSL Sprite_NullifyHookshotDrag
STZ $5E ; Set Link's speed to zero...
STZ.b LinkSpeed ; Set Link's speed to zero...
JSL Player_HaltDashAttackLong
PLX
RTS

View File

@@ -1,5 +1,5 @@
org $008A01 ; 0xA01 - Bank00.asm (LDA.b #$10 : STA $4304 : STA $4314 : STA $4324)
LDA.b $BC
LDA.b PlayerSpriteBank
org $1BEDF9
JSL SpriteSwap_Palette_ArmorAndGloves ;4bytes
@@ -16,9 +16,9 @@ org $BF8000
SwapSpriteIfNecessary:
PHP
SEP #$20 ; set 8-bit accumulator
LDA.l SpriteSwapper : BEQ + : !ADD #!BANK_BASE : CMP.b $BC : BEQ +
STA.b $BC
STZ.w $0710 ; Set Normal Sprite NMI
LDA.l SpriteSwapper : BEQ + : !ADD #!BANK_BASE : CMP.b PlayerSpriteBank : BEQ +
STA.b PlayerSpriteBank
STZ.w SkipOAM ; Set Normal Sprite NMI
JSL.l SpriteSwap_Palette_ArmorAndGloves_part_two
+
PLP
@@ -28,7 +28,7 @@ SpriteSwap_Palette_ArmorAndGloves:
{
;DEDF9
LDA.l SpriteSwapper : BNE .continue
LDA.b #$10 : STA.b $BC ; Load Original Sprite Location
LDA.b #$10 : STA.b PlayerSpriteBank ; Load Original Sprite Location
REP #$21
LDA.l ArmorEquipment
JSL $1BEDFF ; Read Original Palette Code
@@ -60,7 +60,7 @@ SpriteSwap_Palette_ArmorAndGloves:
TXY : TAX
LDA.b $BC : AND.w #$00FF : STA.b Scrap02
LDA.b PlayerSpriteBank : AND.w #$00FF : STA.b Scrap02
.loop

View File

@@ -425,8 +425,8 @@ base off
; If these move (most likely by placing initsramtable.asm somewhere else) these
; bank definitions need to be changed as well.
;================================================================================
SRAMBank = $70
SRAMTableBank = $30|$80
!SRAMBank = $70
!SRAMTableBank = $30|$80
;================================================================================
; Assertions

View File

@@ -16,7 +16,7 @@ RTL
StatSaveCounter:
PHA
LDA.l StatsLocked : BNE +
LDA.b $10 : CMP.b #$17 : BNE + ; not a proper s&q, link probably died
LDA.b GameMode : CMP.b #$17 : BNE + ; not a proper s&q, link probably died
LDA.l SaveQuitCounter : INC
CMP.b #100 : BEQ + ; decimal 100
STA.l SaveQuitCounter
@@ -55,7 +55,7 @@ DungeonExitTransition:
JSL Player_HaltDashAttackLong
LDA.b #$00 : STA.w $0301 ; stop item dashing
+
LDA.b #$0F : STA.b $10 ; stop running through the transition
LDA.b #$0F : STA.b GameMode ; stop running through the transition
StatTransitionCounter:
PHA : PHP
LDA.l StatsLocked : BNE +
@@ -93,7 +93,7 @@ IncrementSmallKeysNoPrimary:
JSL AddInventory_incrementKeyLong
+
JSL.l UpdateKeys
LDA.b $1B : BEQ + ; skip room check if outdoors
LDA.b IndoorsFlag : BEQ + ; skip room check if outdoors
PHP : REP #$20 ; set 16-bit accumulator
LDA.w $048E : CMP.w #$0087 : BNE ++ ; hera basement
PLP : PHY : LDY.b #$24 : JSL.l FullInventoryExternal
@@ -116,13 +116,13 @@ RTL
;--------------------------------------------------------------------------------
CountChestKey: ; called by neighbor functions
PHA : PHX
CPY.b #$24 : BEQ + ; small key for this dungeon - use $040C
CPY.b #$24 : BEQ + ; small key for this dungeon - use DungeonID
CPY.b #$A0 : !BLT .end ; Ignore most items
CPY.b #$AE : !BGE .end ; Ignore reserved key and generic key
TYA : AND.B #$0F : BNE ++ ; If this is an HC key, instead count it as a sewers key
INC
++ TAX : BRA .count ; use Key id instead of $040C (Keysanity)
+ LDA.w $040C : LSR
++ TAX : BRA .count ; use Key id instead of DungeonID (Keysanity)
+ LDA.w DungeonID : LSR
BNE +
INC ; combines HC and Sewer counts
+ TAX
@@ -182,7 +182,7 @@ IncrementChestTurnCounter:
RTL
;--------------------------------------------------------------------------------
IncrementChestCounter:
LDA.b #$01 : STA.w $02E9 ; thing we wrote over
LDA.b #$01 : STA.w ItemReceiptMethod ; thing we wrote over
PHA
LDA.l StatsLocked : BNE +
LDA.l ChestsOpened : INC : STA.l ChestsOpened
@@ -289,7 +289,7 @@ IncrementUWMirror:
PHA
LDA.b #$00 : STA.l $7F5035 ; bandaid patch bug with mirroring away from text
LDA.l StatsLocked : BNE +
LDA.w $040C : CMP.b #$FF : BEQ + ; skip if we're in a cave or house
LDA.w DungeonID : CMP.b #$FF : BEQ + ; skip if we're in a cave or house
LDA.l UnderworldMirrors : INC : STA.l UnderworldMirrors
JSL.l StatTransitionCounter
+
@@ -350,9 +350,9 @@ StatsFinalPrep:
.done
PLP : PLX : PLA
LDA.b #$19 : STA.b $10 ; thing we wrote over, load triforce room
STZ.b $11
STZ.b $B0
LDA.b #$19 : STA.b GameMode ; thing we wrote over, load triforce room
STZ.b GameSubMode
STZ.b SubSubModule
RTL
;--------------------------------------------------------------------------------
; Notes:

View File

@@ -4,7 +4,7 @@
;$03348E: smith sword check (to see if uprade-able)
;================================================================================
LoadSwordForDamage:
LDA.w $0E20, X : CMP.b #$88 : BNE .notMoth
LDA.w SpriteTypeTable, X : CMP.b #$88 : BNE .notMoth
JSR.w LoadModifiedSwordLevel ; load normal sword value
CMP.b #$04 : !BLT + : DEC : + ; if it's gold sword, change it to tempered
RTL
@@ -66,17 +66,17 @@ RTL
; $7E0348 - Ice Value
LoadModifiedIceFloorValue_a11:
LDA.b RoomIndex : CMP.b #$91 : BEQ + : CMP.b #$92 : BEQ + : CMP.b #$93 : BEQ + ; mire basement currently broken - not sure why
LDA.b $5D : CMP.b #$01 : BEQ + : CMP.b #$17 : BEQ + : CMP.b #$1C : BEQ +
LDA.b $5E : CMP.b #$02 : BEQ +
LDA.b $5B : BNE +
LDA.b LinkState : CMP.b #$01 : BEQ + : CMP.b #$17 : BEQ + : CMP.b #$1C : BEQ +
LDA.b LinkSpeed : CMP.b #$02 : BEQ +
LDA.b LinkSlipping : BNE +
LDA.w $0348 : ORA.l IceModifier : AND.b #$11 : RTL
+ : LDA.w $0348 : AND.b #$11
RTL
LoadModifiedIceFloorValue_a01:
LDA.b RoomIndex : CMP.b #$91 : BEQ + : CMP.b #$92 : BEQ + : CMP.b #$93 : BEQ + ; mire basement currently broken - not sure why
LDA.b $5D : CMP.b #$01 : BEQ + : CMP.b #$17 : BEQ + : CMP.b #$1C : BEQ +
LDA.b $5E : CMP.b #$02 : BEQ +
LDA.b $5B : BNE +
LDA.b LinkState : CMP.b #$01 : BEQ + : CMP.b #$17 : BEQ + : CMP.b #$1C : BEQ +
LDA.b LinkSpeed : CMP.b #$02 : BEQ +
LDA.b LinkSlipping : BNE +
LDA.w $0348 : ORA.l IceModifier : AND.b #$01 : RTL
+ : LDA.w $0348 : AND.b #$01
RTL
@@ -98,10 +98,10 @@ RTL
;================================================================================
CheckGanonHammerDamage:
LDA.l HammerableGanon : BEQ +
LDA.w $0E20, X : CMP.b #$D8 ; original behavior except ganon
LDA.w SpriteTypeTable, X : CMP.b #$D8 ; original behavior except ganon
RTL
+
LDA.w $0E20, X : CMP.b #$D6 ; original behavior
LDA.w SpriteTypeTable, X : CMP.b #$D6 ; original behavior
RTL
;================================================================================
GetSmithSword:
@@ -122,7 +122,7 @@ GetSmithSword:
.buy
LDA.l SmithItem : TAY
STZ.w $02E9 ; Item from NPC
STZ.w ItemReceiptMethod ; Item from NPC
PHX : JSL Link_ReceiveItem : PLX
REP #$20 : LDA.l CurrentRupees : !SUB.w #$000A : STA.l CurrentRupees : SEP #$20 ; Take 10 rupees
@@ -133,7 +133,7 @@ GetSmithSword:
;================================================================================
CheckMedallionSword:
LDA.l AllowSwordlessMedallionUse : BEQ .check_sword
CMP #$01 : BEQ .check_pad
CMP.b #$01 : BEQ .check_pad
LDA.b #$02 ; Pretend we have master sword
RTL
.check_sword
@@ -141,31 +141,31 @@ CheckMedallionSword:
RTL
.check_pad
PHB : PHX : PHY
LDA.b $1B : BEQ .outdoors
LDA.b IndoorsFlag : BEQ .outdoors
.indoors
REP #$20 ; set 16-bit accumulator
LDA.b RoomIndex ; load room ID
CMP.w #$000E : BNE + ; freezor1
LDA.b $22 : AND.w #$01FF ; check x-coord
LDA.b LinkPosX : AND.w #$01FF ; check x-coord
CMP.w #368-8 : !BLT .normal
CMP.w #368+32-8 : !BGE .normal
LDA.b $20 : AND.w #$01FF ; check y-coord
LDA.b LinkPosY : AND.w #$01FF ; check y-coord
CMP.w #400-22 : !BLT .normal
CMP.w #400+32-22 : !BGE .normal
JMP .permit
+ : CMP.w #$007E : BNE + ; freezor2
LDA.b $22 : AND.w #$01FF ; check x-coord
LDA.b LinkPosX : AND.w #$01FF ; check x-coord
CMP.w #112-8 : !BLT .normal
CMP.w #112+32-8 : !BGE .normal
LDA.b $20 : AND.w #$01FF ; check y-coord
LDA.b LinkPosY : AND.w #$01FF ; check y-coord
CMP.w #400-22 : !BLT .normal
CMP.w #400+32-22 : !BGE .normal
JMP .permit
+ : CMP.w #$00DE : BNE + ; kholdstare
LDA.b $22 : AND.w #$01FF ; check x-coord
LDA.b LinkPosX : AND.w #$01FF ; check x-coord
CMP.w #368-8 : !BLT .normal
CMP.w #368+32-8 : !BGE .normal
LDA.b $20 : AND.w #$01FF ; check y-coord
LDA.b LinkPosY : AND.w #$01FF ; check y-coord
CMP.w #144-22 : !BLT .normal
CMP.w #144+32-22 : !BGE .normal
BRA .permit
@@ -173,14 +173,14 @@ CheckMedallionSword:
SEP #$20 ; set 8-bit accumulator
BRA .done
.outdoors
LDA.b $8A : CMP.b #$70 : BNE +
LDA.l MireRequiredMedallion : TAX : LDA.l .medallion_type, X : CMP.w $0303 : BNE .done
LDA.b OverworldIndex : CMP.b #$70 : BNE +
LDA.l MireRequiredMedallion : TAX : LDA.l .medallion_type, X : CMP.w CurrentYItem : BNE .done
LDA.l OverworldEventDataWRAM+$70 : AND.b #$20 : BNE .done
LDA.b #$08 : PHA : PLB ; set data bank to $08
LDY.b #$02 : JSL.l Ancilla_CheckIfEntranceTriggered : BCS .permit ; misery mire
BRA .done
+ : CMP.b #$47 : BNE +
LDA.l TRockRequiredMedallion : TAX : LDA.l .medallion_type, X : CMP.w $0303 : BNE .done
LDA.l TRockRequiredMedallion : TAX : LDA.l .medallion_type, X : CMP.w CurrentYItem : BNE .done
LDA.l OverworldEventDataWRAM+$47 : AND.b #$20 : BNE .done
LDA.b #$08 : PHA : PLB ; set data bank to $08
LDY.b #$03 : JSL.l Ancilla_CheckIfEntranceTriggered : BCS .permit ; turtle rock

View File

@@ -20,7 +20,7 @@ RTL
SetTabletItem:
JSL.l GetSpriteID
PHA
LDA.b $8A : CMP.b #$03 : BEQ .ether ; if we're on the map where ether is, we're the ether tablet
LDA.b OverworldIndex : CMP.b #$03 : BEQ .ether ; if we're on the map where ether is, we're the ether tablet
.bombos
JSL.l ItemSet_BombosTablet : BRA .done
.ether
@@ -33,36 +33,36 @@ SpawnTabletItem:
JSL.l LoadOutdoorValue
PHA
JSL.l PrepDynamicTile
JSL.l SetTabletItem
LDA.b #$EB
STA.l $7FFE00
STA.l MiniGameTime
JSL Sprite_SpawnDynamically
PLA : STA.w $0E80, Y ; Store item type
LDA.b $22 : STA.w $0D10, Y
LDA.b $23 : STA.w $0D30, Y
PLA : STA.w SpriteItemType, Y ; Store item type
LDA.b LinkPosX : STA.w SpritePosXLow, Y
LDA.b LinkPosX+1 : STA.w SpritePosXHigh, Y
LDA.b $20 : STA.w $0D00, Y
LDA.b $21 : STA.w $0D20, Y
LDA.b LinkPosY : STA.w SpritePosYLow, Y
LDA.b LinkPosY+1 : STA.w SpritePosYHigh, Y
LDA.b #$00 : STA.w $0F20, Y
LDA.b #$7F : STA.w $0F70, Y ; spawn WAY up high
RTL
;--------------------------------------------------------------------------------
MaybeUnlockTabletAnimation:
PHA : PHP
JSL.l IsMedallion : BCC +
STZ $0112 ; disable falling-medallion mode
STZ $03EF ; release link from item-up pose
LDA.b #$00 : STA.b $5D ; set link to ground state
STZ.w MedallionFlag ; disable falling-medallion mode
STZ.w ForceSwordUp ; release link from item-up pose
LDA.b #$00 : STA.b LinkState ; set link to ground state
REP #$20 ; set 16-bit accumulator
LDA.b $8A : CMP.w #$0030 : BNE ++ ; Desert
LDA.b OverworldIndex : CMP.w #$0030 : BNE ++ ; Desert
SEP #$20 ; set 8-bit accumulator
LDA.b #$02 : STA.b $2F ; face link forward
LDA.b #$02 : STA.b LinkDirection ; face link forward
LDA.b #$3C : STA.b $46 ; lock link for 60f
++
SEP #$20 ; set 8-bit accumulator
@@ -72,15 +72,15 @@ RTL
;--------------------------------------------------------------------------------
IsMedallion:
REP #$20 ; set 16-bit accumulator
LDA.b $8A
LDA.b OverworldIndex
CMP.w #$03 : BNE + ; Death Mountain
LDA.b $22 : CMP.w #1890 : !BGE ++
LDA.b LinkPosX : CMP.w #1890 : !BGE ++
SEC
JMP .done
++
BRA .false
+ CMP.w #$30 : BNE + ; Desert
LDA.b $22 : CMP.w #512 : !BLT ++
LDA.b LinkPosX : CMP.w #512 : !BLT ++
SEC
JMP .done
++

View File

@@ -5,8 +5,8 @@ RenderCharSetColorExtended_init:
RenderCharSetColorExtended_close:
stz.b Scrap0C
lda.w $010c
sta.b $10
lda.w GameModeCache
sta.b GameMode
rtl
RenderCharSetColorExtended:

View File

@@ -157,7 +157,7 @@ DrawChallengeTimer:
LDA.w ClockSeconds+2 : STA.l $7EC7A2
LDA.w ClockSeconds : STA.l $7EC7A4
++
LDA.b $1A : AND.w #$001F : BNE + : JSR CalculateTimer : +
LDA.b FrameCounter : AND.w #$001F : BNE + : JSR CalculateTimer : +
RTL
;--------------------------------------------------------------------------------

View File

@@ -504,23 +504,23 @@ Sprite_IsOnscreen:
JSR _Sprite_IsOnscreen_DoWork
BCS +
REP #$20
LDA.b $E2 : PHA : !SUB.w #$0F : STA.b $E2
LDA.b $E8 : PHA : !SUB.w #$0F : STA.b $E8
LDA.b BG2H : PHA : !SUB.w #$0F : STA.b BG2H
LDA.b BG2V : PHA : !SUB.w #$0F : STA.b BG2V
SEP #$20
JSR _Sprite_IsOnscreen_DoWork
REP #$20
PLA : STA.b $E8
PLA : STA.b $E2
PLA : STA.b BG2V
PLA : STA.b BG2H
SEP #$20
+
RTL
_Sprite_IsOnscreen_DoWork:
LDA.w $0D10, X : CMP.b $E2
LDA.w $0D30, X : SBC.b $E3 : BNE .offscreen
LDA.w SpritePosXLow, X : CMP.b BG2H
LDA.w SpritePosXHigh, X : SBC.b $E3 : BNE .offscreen
LDA.w $0D00, X : CMP.b $E8
LDA.w $0D20, X : SBC.b $E9 : BNE .offscreen
LDA.w SpritePosYLow, X : CMP.b BG2V
LDA.w SpritePosYHigh, X : SBC.b $E9 : BNE .offscreen
SEC
RTS
.offscreen
@@ -542,13 +542,13 @@ Sprite_GetScreenRelativeCoords:
STA.b Scrap08
LDA.w $0D00, X : STA.b Scrap00
!SUB $E8 : STA.b Scrap06
LDA.w $0D20, X : STA.b Scrap01
LDA.w SpritePosYLow, X : STA.b Scrap00
!SUB.b BG2V : STA.b Scrap06
LDA.w SpritePosYHigh, X : STA.b Scrap01
LDA.w $0D10, X : STA.b Scrap02
!SUB $E2 : STA.b Scrap07
LDA.w $0D30, X : STA.b Scrap03
LDA.w SpritePosXLow, X : STA.b Scrap02
!SUB.b BG2H : STA.b Scrap07
LDA.w SpritePosXHigh, X : STA.b Scrap03
RTL
;--------------------------------------------------------------------------------