From e4d917c47ca2746a78fba2d7c40ff00c727badf5 Mon Sep 17 00:00:00 2001 From: cassidy Date: Wed, 1 Dec 2021 23:06:28 -0500 Subject: [PATCH] First pass-through adding labels Added items, equipment, and tracking/indicators Added playername changes Removed some defines --- LTTP_RND_GeneralBugfixes.asm | 14 +--- bookofmudora.asm | 4 +- boots.asm | 20 ++--- bugfixes.asm | 26 +++---- capacityupgrades.asm | 28 +++---- compasses.asm | 4 +- contrib.asm | 2 +- darkworldspawn.asm | 62 +++++++-------- dialog.asm | 19 ++--- entrances.asm | 6 +- events.asm | 24 +++--- fairyfixes.asm | 18 ++--- fastcredits.asm | 2 +- flipperkill.asm | 24 +++--- flute.asm | 2 +- goalitem.asm | 16 ++-- halfmagicbat.asm | 4 +- hardmode.asm | 2 +- heartpieces.asm | 2 +- hooks.asm | 2 +- inverted.asm | 2 +- invertedmaps.asm | 2 +- lampmantlecone.asm | 12 +-- maidencrystals.asm | 6 +- mantle.asm | 4 +- msu.asm | 10 +-- music.asm | 32 ++++---- newhud.asm | 15 ++-- newitems.asm | 147 +++++++++++++++++------------------ npcitems.asm | 6 +- openmode.asm | 14 ++-- pendantcrystalhud.asm | 85 ++++++++++---------- playername.asm | 39 ++++++---- potions.asm | 28 +++---- quickswap.asm | 10 +-- retro.asm | 26 +++---- rngfixes.asm | 2 +- roomloading.asm | 4 +- rupeelimit.asm | 4 +- shopkeeper.asm | 22 +++--- spriteswap.asm | 2 +- sram.asm | 64 +++++++-------- stats.asm | 53 +++++-------- swordswap.asm | 30 +++---- timer.asm | 4 +- treekid.asm | 6 +- utilities.asm | 22 +++--- zelda.asm | 6 +- 48 files changed, 453 insertions(+), 485 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 20030f6..b66ba93 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -2,14 +2,12 @@ ; The Legend of Zelda, A Link to the Past - Randomizer General Development & Bugfixes ;================================================================================ lorom - ;================================================================================ ;org $00FFC0 ; <- 7FC0 - Bank00.asm : 9173 (db "THE LEGEND OF ZELDA " ; 21 bytes) ;db #$23, $4E org $00FFD5 ; <- 7FD5 - Bank00.asm : 9175 (db $20 ; rom layout) -;db #$35 ; set fast exhirom db #$30 ; set fast lorom ;org $00FFD6 ; <- 7FD6 - Bank00.asm : 9176 (db $02 ; cartridge type) @@ -44,10 +42,6 @@ dw !ROM_VERSION_HIGH !BGE = "BCS" ; Rando Specific SRAM assignments -!SHOP_PURCHASE_COUNTS = "$7EF302" ;$7EF302 - $7EF33F (temporary home) -!INVENTORY_SWAP = "$7EF38C" ; [w] -!INVENTORY_SWAP_2 = "$7EF38E" ; [w] -!ITEM_LIMIT_COUNTS = "$7EF390" ; $7EF390 - ???? !NPC_FLAGS = "$7EF410" !NPC_FLAGS_2 = "$7EF411" !MAP_OVERLAY = "$7EF414" ; [w] @@ -58,16 +52,10 @@ dw !ROM_VERSION_HIGH !SHAME_CHEST = "$7EF416" ; ---s ---- !HAS_GROVE_ITEM = "$7EF416" ; ---- ---g general flags, don't waste these !HIGHEST_SWORD_LEVEL = "$7EF417" ; --- -sss -;$7EF41A[w] - Programmable Item #1 -;$7EF41C[w] - Programmable Item #2 -;$7EF41E[w] - Programmable Item #3 -!SRAM_SINK = "$7EF41E" ; <- change this (conflicts with Programmable item 3) ;$7EF418 - Goal Item Counter ;$7EF419 - Service Sequence ;$7EF420 - $7EF46D - Stat Tracking Bank 1 (overlaps with RNG Item Flags) -;$7EF450 - $7EF45F - RNG Item (Single) Flags ;$7EF4A0 - $7EF4A7 - Service Request Block -!FRESH_FILE_MARKER = "$7EF4F0" ; zero if fresh file ;$700500 - $70050F - Extended File Name ;$701000 - $70100F - Password (incorporate into log header) ;$702000 - $702014 - Rom title copy (incorporate into log header) @@ -112,6 +100,7 @@ incsrc treekid.asm incsrc spriteswap.asm incsrc hashalphabethooks.asm incsrc sharedplayerpalettefix.asm +incsrc sram.asm ;org $208000 ; bank #$20 org $A08000 ; bank #$A0 @@ -349,6 +338,7 @@ warnpc $B08000 ;$7F5000[0x800]: Rando's main free ram region ; See tables.asm for specific assignments ;$7F6000[0x500]: Free RAM (reclaimed from damage table) Not allocated yet +;$7F6000[0x500]: SRAM buffer save 2 0x500 ;$7F6500[0xB00]: SRAM mirror for last 0xB00 bytes of SRAM (extended sram) ;$7F7667[0x6719] - free ram ;================================================================================ diff --git a/bookofmudora.asm b/bookofmudora.asm index e26c7fa..6149763 100644 --- a/bookofmudora.asm +++ b/bookofmudora.asm @@ -54,7 +54,7 @@ GiveBonkItem: CMP #$24 : BNE .notKey .key PHY : LDY.b #$24 : JSL.l AddInventory : PLY ; do inventory processing for a small key - LDA $7EF36F : INC A : STA $7EF36F + LDA CurrentSmallKeys : INC A : STA CurrentSmallKeys LDA.b #$2F : JSL.l Sound_SetSfx3PanLong JSL CountBonkItem RTL @@ -74,4 +74,4 @@ LoadBonkItem: + LDA.b #$24 ; default to small key ++ -RTS \ No newline at end of file +RTS diff --git a/boots.asm b/boots.asm index 555fcb8..219c445 100644 --- a/boots.asm +++ b/boots.asm @@ -5,15 +5,15 @@ ModifyBoots: PHA LDA !BOOTS_MODIFIER : CMP.b #$01 : BNE + - PLA : AND $7EF379 : ORA.b #$04 : RTL ; yes boots + PLA : AND AbilityFlags : ORA.b #$04 : RTL ; yes boots + : CMP.b #$02 : BNE + - PLA : AND $7EF379 : AND.b #$FB : RTL ; no boots + PLA : AND AbilityFlags : AND.b #$FB : RTL ; no boots + : LDA FakeBoots : CMP.b #$01 : BNE + LDA $5B : BEQ ++ : LDA $59 : BNE + ; hover check - ++ : PLA : AND $7EF379 : ORA.b #$04 : RTL ; yes boots, not hovering + ++ : PLA : AND AbilityFlags : ORA.b #$04 : RTL ; yes boots, not hovering + PLA - AND $7EF379 ; regular boots + AND AbilityFlags ; regular boots RTL ;-------------------------------------------------------------------------------- AddBonkTremors: @@ -22,7 +22,7 @@ AddBonkTremors: JSL.l IncrementBonkCounter + LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ + - LDA $7EF355 : BNE + ; Check for Boots + LDA BootsEquipment : BNE + ; Check for Boots PLA : RTL + PLA @@ -33,7 +33,7 @@ BonkBreakableWall: PHX : PHP SEP #$30 ; set 8-bit accumulator and index registers LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ + - LDA $7EF355 : BNE + ; Check for Boots + LDA BootsEquipment : BNE + ; Check for Boots PLP : PLX : LDA.w #$0000 : RTL + PLP : PLX @@ -42,7 +42,7 @@ RTL ;-------------------------------------------------------------------------------- BonkRockPile: LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ + - LDA $7EF355 : BNE + ; Check for Boots + LDA BootsEquipment : BNE + ; Check for Boots LDA.b #$00 : RTL + LDA $02EF : AND.b #$70 ; things we wrote over @@ -50,7 +50,7 @@ RTL ;-------------------------------------------------------------------------------- GravestoneHook: LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ + - LDA $7EF355 : BEQ .done ; Check for Boots + LDA BootsEquipment : BEQ .done ; Check for Boots + LDA $0372 : BEQ .done ; things we wrote over JML.l moveGravestone @@ -59,7 +59,7 @@ GravestoneHook: ;-------------------------------------------------------------------------------- JumpDownLedge: LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ + - LDA $7EF355 : BNE + ; Check for Boots + LDA BootsEquipment : BNE + ; Check for Boots ; Disarm Waterwalk LDA $5B : CMP.b #$01 : BNE + STZ $5B @@ -70,7 +70,7 @@ RTL ;-------------------------------------------------------------------------------- BonkRecoil: LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ + - LDA $7EF355 : BNE + ; Check for Boots + LDA BootsEquipment : BNE + ; Check for Boots LDA.b #$16 : STA $29 : RTL + LDA.b #$24 : STA $29 ; things we wrote over diff --git a/bugfixes.asm b/bugfixes.asm index b5ee34b..b1d29b3 100644 --- a/bugfixes.asm +++ b/bugfixes.asm @@ -2,8 +2,8 @@ ;-------------------------------------------------------------------------------- AssignKiki: - LDA.b #$00 : STA $7EF3D3 ; defuse bomb - LDA.b #$0A : STA $7EF3CC ; assign kiki as follower + LDA.b #$00 : STA FollowerDropped ; defuse bomb + LDA.b #$0A : STA FollowerIndicator ; assign kiki as follower RTL ;-------------------------------------------------------------------------------- @@ -13,7 +13,7 @@ RTL ;-------------------------------------------------------------------------------- !ITEM_BUSY = "$7F5091" AllowSQ: - LDA $7EF3C5 : BEQ .done ; thing we overwrote - check if link is in his bed + LDA ProgressIndicator : BEQ .done ; thing we overwrote - check if link is in his bed LDA !ITEM_BUSY : EOR #$01 .done RTL @@ -32,8 +32,8 @@ RTL ;-------------------------------------------------------------------------------- ;0 = Become (Perma)bunny DecideIfBunny: - LDA $7EF357 : BNE .done - LDA $7EF3CA : AND.b #$40 + LDA MoonPearlEquipment : BNE .done + LDA CurrentWorld : AND.b #$40 PHA : LDA.l InvertedMode : BNE .inverted .normal PLA : EOR #$40 @@ -48,7 +48,7 @@ DecideIfBunnyByScreenIndex: ; If indoors we don't have a screen index. Return non-bunny to make mirror-based ; superbunny work LDA $1B : BNE .done - LDA $7EF357 : BNE .done + LDA MoonPearlEquipment : BNE .done LDA $8A : AND.b #$40 : PHA LDA.l InvertedMode : BNE .inverted .normal @@ -63,7 +63,7 @@ RTL ;-------------------------------------------------------------------------------- ;ReadInventoryPond: ; CPX.b #$1B : BNE + : LDA.b #$01 : RTL : + -; LDA $7EF340, X +; LDA SRAMEquipment, X ;RTL ;-------------------------------------------------------------------------------- @@ -112,15 +112,15 @@ RTS ; fix issue where cross world caves (in Entrance randomizer) don't cause ; frog to become smith or vice versa. FixFrogSmith: - LDA.l $7EF3CA : BNE .darkWorld - LDA.l $7EF3CC : CMP.b #$07 : BNE .done + LDA.l CurrentWorld : BNE .darkWorld + LDA.l FollowerIndicator : CMP.b #$07 : BNE .done LDA.b #$08 ; make frog into smith in light world BRA .loadgfx .darkWorld - LDA.l $7EF3CC : CMP.b #$08 : BNE .done + LDA.l FollowerIndicator : CMP.b #$08 : BNE .done LDA.b #$07 ; make smith into frog in dark world .loadgfx - STA.l $7EF3CC + STA.l FollowerIndicator JSL Tagalong_LoadGfx .done RTS @@ -158,8 +158,8 @@ WallmasterCameraFix: ; Fix losing glove colors LoadActualGearPalettesWithGloves: REP #$20 -LDA $7EF359 : STA $0C -LDA $7EF35B : AND.w #$00FF +LDA SwordEquipment : STA $0C +LDA ArmorEquipment : AND.w #$00FF JSL LoadGearPalettes_variable JSL SpriteSwap_Palette_ArmorAndGloves_part_two RTL diff --git a/capacityupgrades.asm b/capacityupgrades.asm index cdd343f..73b3c26 100644 --- a/capacityupgrades.asm +++ b/capacityupgrades.asm @@ -1,43 +1,37 @@ ;================================================================================ ; Capacity Logic ;================================================================================ -!BOMB_UPGRADES = "$7EF370" -!BOMB_CURRENT = "$7EF343" -;-------------------------------------------------------------------------------- IncrementBombs: - LDA !BOMB_UPGRADES ; get bomb upgrades + LDA BombCapacityUpgrades ; get bomb upgrades !ADD.l StartingMaxBombs : BEQ + ; Skip if we can't have bombs DEC - CMP !BOMB_CURRENT + CMP BombsEquipment !BLT + - LDA !BOMB_CURRENT + LDA BombsEquipment CMP.b #99 : !BGE + - INC : STA !BOMB_CURRENT + INC : STA BombsEquipment + RTL ;-------------------------------------------------------------------------------- -!ARROW_UPGRADES = "$7EF371" -!ARROW_CURRENT = "$7EF377" -;-------------------------------------------------------------------------------- IncrementArrows: - LDA !ARROW_UPGRADES ; get arrow upgrades + LDA ArrowCapacityUpgrades ; get arrow upgrades !ADD.l StartingMaxArrows : DEC - CMP !ARROW_CURRENT + CMP CurrentArrows !BLT + - LDA !ARROW_CURRENT + LDA CurrentArrows CMP.b #99 : !BGE + - INC : STA !ARROW_CURRENT + INC : STA CurrentArrows + RTL ;-------------------------------------------------------------------------------- CompareBombsToMax: - LDA !BOMB_UPGRADES ; get bomb upgrades + LDA BombCapacityUpgrades ; get bomb upgrades !ADD.l StartingMaxBombs - CMP !BOMB_CURRENT + CMP BombsEquipment RTL -;-------------------------------------------------------------------------------- \ No newline at end of file +;-------------------------------------------------------------------------------- diff --git a/compasses.asm b/compasses.asm index 4308465..712931a 100644 --- a/compasses.asm +++ b/compasses.asm @@ -23,7 +23,7 @@ DrawDungeonCompassCounts: CPX.b #$1B : BCS .done ; Skip if not in a valid dungeon ID CMP.w #$0002 : BEQ ++ ; if CompassMode==2, we don't check for the compass - LDA $7EF364 : AND.l DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks + LDA CompassField : AND.l DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks BEQ .done ; skip if we don't have compass ++ @@ -143,4 +143,4 @@ CompassCount_Gt: ; $7EF439 - ttttssss - item locations checked ; t - turtle rock ; s - swamp palace -;-------------------------------------------------------------------------------- \ No newline at end of file +;-------------------------------------------------------------------------------- diff --git a/contrib.asm b/contrib.asm index 0fbf354..644082f 100644 --- a/contrib.asm +++ b/contrib.asm @@ -71,7 +71,7 @@ ; ; PLX ; -; LDA.b #$00 : STA $7EF3CC +; LDA.b #$00 : STA FollowerIndicator ; ; STZ $5E ; diff --git a/darkworldspawn.asm b/darkworldspawn.asm index 2b3696b..637dd52 100644 --- a/darkworldspawn.asm +++ b/darkworldspawn.asm @@ -11,14 +11,14 @@ DoWorldFix: JMP DoWorldFix_Inverted + LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check - LDA $7EF353 : BEQ .noMirror ; check if we have the mirror + LDA MirrorEquipment : BEQ .noMirror ; check if we have the mirror .skip_mirror_check ; alt entrance point - LDA $7EF3C5 : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive + LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive .aga1Alive LDA #$00 .noMirror - STA $7EF3CA ; set flag to light world - LDA $7EF3CC : CMP #$07 : BNE .done : INC : STA $7EF3CC ; convert frog to dwarf + STA CurrentWorld ; set flag to light world + LDA FollowerIndicator : CMP #$07 : BNE .done : INC : STA FollowerIndicator ; convert frog to dwarf .done RTL ;-------------------------------------------------------------------------------- @@ -39,25 +39,25 @@ JMP DoWorldFix JMP DoWorldFix_skip_mirror_check .pyramid - LDA #$40 : STA $7EF3CA ; set flag to dark world - LDA $7EF3CC : CMP #$08 : BNE .done : DEC : STA $7EF3CC : + ; convert dwarf to frog + LDA #$40 : STA CurrentWorld ; set flag to dark world + LDA FollowerIndicator : CMP #$08 : BNE .done : DEC : STA FollowerIndicator : + ; convert dwarf to frog .done RTL ;================================================================================ DoWorldFix_Inverted: LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check - LDA $7EF353 : BEQ .noMirror ; check if we have the mirror + LDA MirrorEquipment : BEQ .noMirror ; check if we have the mirror .skip_mirror_check ; alt entrance point - LDA $7EF3C5 : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive + LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive .noMirror .aga1Alive - LDA #$40 : STA $7EF3CA ; set flag to dark world - LDA $7EF3CC + LDA #$40 : STA CurrentWorld ; set flag to dark world + LDA FollowerIndicator CMP #$07 : BEQ .clear ; clear frog CMP #$08 : BEQ .clear ; clear dwarf - consider flute implications BRA .done .clear - LDA.b #$00 : STA $7EF3CC ; clear follower + LDA.b #$00 : STA FollowerIndicator ; clear follower .done RTL ;-------------------------------------------------------------------------------- @@ -75,8 +75,8 @@ JMP DoWorldFix JMP DoWorldFix_Inverted_skip_mirror_check .castle - LDA #$00 : STA $7EF3CA ; set flag to dark world - LDA $7EF3CC : CMP #$07 : BNE + : LDA.b #$08 : STA $7EF3CC : + ; convert frog to dwarf + LDA #$00 : STA CurrentWorld ; set flag to dark world + LDA FollowerIndicator : CMP #$07 : BNE + : LDA.b #$08 : STA FollowerIndicator : + ; convert frog to dwarf .done RTL ;================================================================================ @@ -85,19 +85,19 @@ RTL ;-------------------------------------------------------------------------------- FakeWorldFix: LDA FixFakeWorld : BEQ + - LDA $8A : AND.b #$40 : STA $7EF3CA + LDA $8A : AND.b #$40 : STA CurrentWorld + RTL ;-------------------------------------------------------------------------------- MasterSwordFollowerClear: - LDA $7EF3CC + LDA FollowerIndicator CMP #$0E : BNE .exit ; clear master sword follower - LDA.b #$00 : STA $7EF3CC ; clear follower + LDA.b #$00 : STA FollowerIndicator ; clear follower .exit RTL ;-------------------------------------------------------------------------------- FixAgahnimFollowers: - LDA.b #$00 : STA $7EF3CC ; clear follower + LDA.b #$00 : STA FollowerIndicator ; clear follower JML PrepDungeonExit ; thing we wrote over ;-------------------------------------------------------------------------------- @@ -107,24 +107,24 @@ macro SetMinimum(base,filler,compare) ?done: endmacro RefreshRainAmmo: - LDA $7EF3C5 : CMP.b #$01 : BEQ .rain ; check if we're in rain state + LDA ProgressIndicator : CMP.b #$01 : BEQ .rain ; check if we're in rain state RTL .rain - LDA $7EF3C8 + LDA StartingEntrance + CMP.b #$03 : BNE + ; Uncle - %SetMinimum($7EF36E,$7EF373,RainDeathRefillMagic_Uncle) - %SetMinimum($7EF343,$7EF375,RainDeathRefillBombs_Uncle) - %SetMinimum($7EF377,$7EF376,RainDeathRefillArrows_Uncle) + %SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Uncle) + %SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Uncle) + %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Uncle) BRA .done + CMP.b #$02 : BNE + ; Cell - %SetMinimum($7EF36E,$7EF373,RainDeathRefillMagic_Cell) - %SetMinimum($7EF343,$7EF375,RainDeathRefillBombs_Cell) - %SetMinimum($7EF377,$7EF376,RainDeathRefillArrows_Cell) + %SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Cell) + %SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Cell) + %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Cell) BRA .done + CMP.b #$04 : BNE + ; Mantle - %SetMinimum($7EF36E,$7EF373,RainDeathRefillMagic_Mantle) - %SetMinimum($7EF343,$7EF375,RainDeathRefillBombs_Mantle) - %SetMinimum($7EF377,$7EF376,RainDeathRefillArrows_Mantle) + %SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Mantle) + %SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Mantle) + %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Mantle) + .done RTL @@ -133,7 +133,7 @@ RTL !INFINITE_BOMBS = "$7F50C9" !INFINITE_MAGIC = "$7F50CA" SetEscapeAssist: - LDA $7EF3C5 : CMP.b #$01 : BNE .no_train ; check if we're in rain state + LDA ProgressIndicator : CMP.b #$01 : BNE .no_train ; check if we're in rain state .rain LDA.l EscapeAssist BIT.b #$04 : BEQ + : STA !INFINITE_MAGIC : + @@ -149,8 +149,8 @@ RTL ;-------------------------------------------------------------------------------- SetSilverBowMode: LDA SilverArrowsUseRestriction : BEQ + ; fix bow type for restricted arrow mode - LDA $7EF340 : CMP.b #$3 : BCC + - SBC.b #$02 : STA $7EF340 + LDA BowEquipment : CMP.b #$3 : BCC + + SBC.b #$02 : STA BowEquipment + RTL ;================================================================================ diff --git a/dialog.asm b/dialog.asm index 28962ba..1416d67 100644 --- a/dialog.asm +++ b/dialog.asm @@ -267,7 +267,8 @@ RTL ;-------------------------------------------------------------------------------- DialogFairyThrow: LDA.l Restrict_Ponds : BEQ .normal - LDA $7EF35C : ORA $7EF35D : ORA $7EF35E : ORA $7EF35F : BNE .normal + LDA BottleContentsOne + ORA BottleContentsTwo : ORA BottleContentsThree : ORA BottleContentsFour : BNE .normal .noInventory LDA $0D80, X : !ADD #$08 : STA $0D80, X @@ -294,7 +295,7 @@ RTL ; #$0193 - no silvers alternate ; #$0194 - no silvers ; #$0195 - silvers -; $7EF38E - bsp-- --- +; BowTracking - bsp-- --- ; b = bow ; s = silver arrow bow ; p = 2nd progressive bow @@ -305,7 +306,7 @@ DialogGanon2: BCS + LDA.w #$018D : BRA ++ + - LDA.l $7EF38E + LDA.l BowTracking BIT.w #$0080 : BNE + ; branch if bow LDA.w #$0192 : BRA ++ @@ -334,9 +335,9 @@ DialogEtherTablet: + BIT $F4 : BVC - ; Show normal text if Y is not pressed LDA.l AllowHammerTablets : BEQ ++ - LDA $7EF34B : BEQ .yesText : BRA .noText + LDA HammerEquipment : BEQ .yesText : BRA .noText ++ - LDA $7EF359 : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : BCS .noText + LDA SwordEquipment : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : BCS .noText ;++ .yesText PLA @@ -356,9 +357,9 @@ DialogBombosTablet: + BIT $F4 : BVC - ; Show normal text if Y is not pressed LDA.l AllowHammerTablets : BEQ ++ - LDA $7EF34B : BEQ .yesText : BRA .noText + LDA HammerEquipment : BEQ .yesText : BRA .noText ++ - LDA $7EF359 : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : !BGE .noText + LDA SwordEquipment : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : !BGE .noText ;++ .yesText PLA @@ -371,7 +372,7 @@ DialogBombosTablet: RTL ;-------------------------------------------------------------------------------- DialogSahasrahla: - LDA.l $7EF374 : AND #$04 : BEQ + ;Check if player has green pendant + LDA.l PendantsField : AND #$04 : BEQ + ;Check if player has green pendant LDA.b #$2F LDY.b #$00 JML Sprite_ShowMessageUnconditional @@ -380,7 +381,7 @@ RTL ;-------------------------------------------------------------------------------- DialogBombShopGuy: LDY.b #$15 - LDA.l $7EF37A : AND #$05 : CMP #$05 : BNE + ;Check if player has crystals 5 & 6 + LDA.l CrystalsField : AND #$05 : CMP #$05 : BNE + ;Check if player has crystals 5 & 6 INY ; from 15 to 16 + TYA diff --git a/entrances.asm b/entrances.asm index 35db47e..c174505 100644 --- a/entrances.asm +++ b/entrances.asm @@ -8,7 +8,7 @@ LockAgahnimDoors: ;#$0 = Never Locked LDA.w #$0000 : RTL + : CMP.w #$0001 : BNE + - LDA $7EF3C5 : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip + LDA ProgressIndicator : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip JSR.w LockAgahnimDoorsCore : RTL + : CMP.w #$0002 : BNE + JSR.w LockAgahnimDoorsCore : BEQ .unlock @@ -77,7 +77,7 @@ JML.l Overworld_Entrance_BRANCH_RHO AllowStartFromSingleEntranceCave: ; 16 Bit A, 16 bit XY ; do not need to preserve A or X or Y - LDA $7EF3C8 : AND.w #$00FF ; What we wrote over + LDA StartingEntrance : AND.w #$00FF ; What we wrote over PHA TAX @@ -138,7 +138,7 @@ AllowStartFromExit: LDX $1CE8 LDA.l ShouldStartatExit, X : BNE .doStart - LDA.l $7EF3C8 ; what we wrote over + LDA.l StartingEntrance ; what we wrote over JML.l AllowStartFromExitReturn .doStart diff --git a/events.asm b/events.asm index d8ff634..96f96a4 100644 --- a/events.asm +++ b/events.asm @@ -65,15 +65,15 @@ OnUncleItemGet: PLA JSL Link_ReceiveItem - LDA.l UncleRefill : BIT.b #$04 : BEQ + : LDA.b #$80 : STA $7EF373 : + ; refill magic - LDA.l UncleRefill : BIT.b #$02 : BEQ + : LDA.b #50 : STA $7EF375 : + ; refill bombs + LDA.l UncleRefill : BIT.b #$04 : BEQ + : LDA.b #$80 : STA MagicFiller : + ; refill magic + LDA.l UncleRefill : BIT.b #$02 : BEQ + : LDA.b #50 : STA BombsFiller : + ; refill bombs LDA.l UncleRefill : BIT.b #$01 : BEQ + ; refill arrows - LDA.b #70 : STA $7EF376 + LDA.b #70 : STA ArrowsFiller LDA.l ArrowMode : BEQ + - LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2 ; enable bow toggle + LDA BowTracking : ORA #$80 : STA BowTracking ; enable bow toggle REP #$20 ; set 16-bit accumulator - LDA $7EF360 : !ADD.l FreeUncleItemAmount : STA $7EF360 ; rupee arrows, so also give the player some money to start + LDA TargetRupees : !ADD.l FreeUncleItemAmount : STA TargetRupees ; rupee arrows, so also give the player some money to start SEP #$20 ; set 8-bit accumulator + RTL @@ -95,9 +95,9 @@ OnFileLoad: LDA.b #$07 : STA $210C ; Restore screen 3 to normal tile area - LDA !FRESH_FILE_MARKER : BNE + + LDA FileMarker : BNE + JSL.l OnNewFile - LDA.b #$FF : STA !FRESH_FILE_MARKER + LDA.b #$FF : STA FileMarker + LDA.w $010A : BNE + ; don't adjust the worlds for "continue" or "save-continue" LDA.l $7EC011 : BNE + ; don't adjust worlds if mosiac is enabled (Read: mirroring in dungeon) @@ -108,7 +108,7 @@ OnFileLoad: LDA #$FF : STA !RNG_ITEM_LOCK_IN ; reset rng item lock-in LDA #$00 : STA $7F5001 ; mark fake flipper softlock as impossible LDA.l GenericKeys : BEQ + - LDA $7EF38B : STA $7EF36F ; copy generic keys to key counter + LDA CurrentGenericKeys : STA CurrentSmallKeys ; copy generic keys to key counter + JSL.l SetSilverBowMode @@ -125,17 +125,17 @@ RTL OnNewFile: PHX : PHP REP #$20 ; set 16-bit accumulator - LDA.l LinkStartingRupees : STA $7EF362 : STA $7EF360 + LDA.l LinkStartingRupees : STA CurrentRupees : STA TargetRupees LDA.l StartingTime : STA $7EF454 LDA.l StartingTime+2 : STA $7EF454+2 LDX.w #$004E : - ; copy over starting equipment - LDA StartingEquipment, X : STA $7EF340, X + LDA StartingEquipment, X : STA SRAMEquipment, X DEX : DEX BPL - LDX #$000E : - - LDA $7EF37C, X : STA $7EF4E0, X + LDA SewerKeys, X : STA $7EF4E0, X DEX : DEX BPL - @@ -154,7 +154,7 @@ OnNewFile: LDA.b #$20 : STA $7EF2C3 ; Ganons Tower already open + - LDA StartingSword : STA $7EF359 ; set starting sword type + LDA StartingSword : STA SwordEquipment ; set starting sword type ; reset some values on new file that are otherwise only reset on hard reset STZ $03C4 ; ancilla slot index diff --git a/fairyfixes.asm b/fairyfixes.asm index 5364376..9dec2b8 100644 --- a/fairyfixes.asm +++ b/fairyfixes.asm @@ -2,20 +2,20 @@ ; Fairy Changes & Fixes ;-------------------------------------------------------------------------------- RefillHealthPlusMagic: - LDA BigFairyHealth : STA $7EF372 + LDA BigFairyHealth : STA HeartsFiller RTL ;-------------------------------------------------------------------------------- RefillHealthPlusMagic8bit: - LDA BigFairyHealth : STA $7EF372 - LDA BigFairyMagic : STA $7EF373 + LDA BigFairyHealth : STA HeartsFiller + LDA BigFairyMagic : STA MagicFiller RTL ;-------------------------------------------------------------------------------- CheckFullHealth: LDA BigFairyHealth : BEQ + - LDA $7EF36D : CMP $7EF36C : BNE .player_hp_not_full_yet + LDA CurrentHealth : CMP HealthCapacity : BNE .player_hp_not_full_yet + LDA BigFairyMagic : BEQ + - LDA $7EF36E : CMP.b #$80 : BNE .player_mp_not_full_yet + LDA CurrentMagic : CMP.b #$80 : BNE .player_mp_not_full_yet + LDA.b #$00 RTL @@ -30,10 +30,10 @@ FairyPond_Init: JML.l Sprite_ShowMessageFromPlayerContact + PHY : JSL.l Sprite_CheckDamageToPlayerSameLayerLong : BCC + - LDA $7EF35C : CMP.b #$02 : BNE ++ : LDA.b #$1C : PHA : BRA .emptyBottle : ++ - LDA $7EF35D : CMP.b #$02 : BNE ++ : LDA.b #$1D : PHA : BRA .emptyBottle : ++ - LDA $7EF35E : CMP.b #$02 : BNE ++ : LDA.b #$1E : PHA : BRA .emptyBottle : ++ - LDA $7EF35F : CMP.b #$02 : BNE ++ : LDA.b #$1F : PHA : BRA .emptyBottle : ++ + LDA BottleContentsOne : CMP.b #$02 : BNE ++ : LDA.b #$1C : PHA : BRA .emptyBottle : ++ + LDA BottleContentsTwo : CMP.b #$02 : BNE ++ : LDA.b #$1D : PHA : BRA .emptyBottle : ++ + LDA BottleContentsThree : CMP.b #$02 : BNE ++ : LDA.b #$1E : PHA : BRA .emptyBottle : ++ + LDA BottleContentsFour : CMP.b #$02 : BNE ++ : LDA.b #$1F : PHA : BRA .emptyBottle : ++ .noInventory LDA.b #$0A : STA $0D80, X LDA.b #$51 diff --git a/fastcredits.asm b/fastcredits.asm index 97f23a6..82702f3 100644 --- a/fastcredits.asm +++ b/fastcredits.asm @@ -117,7 +117,7 @@ FastTextScroll: RTL DumbFlagForMSU: - STA.l $7EF3CA + STA.l CurrentWorld STZ.b $50 RTL diff --git a/flipperkill.asm b/flipperkill.asm index 418a6e7..648927b 100644 --- a/flipperkill.asm +++ b/flipperkill.asm @@ -4,16 +4,16 @@ FlipperKill: PHP LDA $5D : CMP #$04 : BNE .done ; skip if we're not swimming - LDA $7EF356 : BNE .done ; skip if we have the flippers + LDA FlippersEquipment : BNE .done ; skip if we have the flippers LDA $7F5001 : BEQ .done ; skip if we're not marked in danger for softlock LDA $8A : CMP $7F5098 : BEQ .done ; skip if we're on the same screen we entered the water on ;JSL.l KillFairies ; take away fairies LDA !IGNORE_FAIRIES : ORA.b #$04 : STA !IGNORE_FAIRIES - LDA.b #$00 : STA $7EF36D ; kill link + LDA.b #$00 : STA CurrentHealth ; kill link LDA.b #$00 : STA $7F5001 ; mark fake flipper softlock as impossible .done PLP - LDA $7EF36D ; thing we wrote over + LDA CurrentHealth ; thing we wrote over RTL ;-------------------------------------------------------------------------------- IgnoreFairyCheck: @@ -28,14 +28,14 @@ RTL RTL ;-------------------------------------------------------------------------------- ;KillFairies: -; LDA $7EF35C : CMP #$06 : BNE + -; LDA #$02 : STA $7EF35C -; + LDA $7EF35D : CMP #$06 : BNE + -; LDA #$02 : STA $7EF35D -; + LDA $7EF35E : CMP #$06 : BNE + -; LDA #$02 : STA $7EF35E -; + LDA $7EF35F : CMP #$06 : BNE + -; LDA #$02 : STA $7EF35F +; LDA BottleContentsOne : CMP #$06 : BNE + +; LDA #$02 : STA BottleContentsOne +; + LDA BottleContentsTwo : CMP #$06 : BNE + +; LDA #$02 : STA BottleContentsTwo +; + LDA BottleContentsThree : CMP #$06 : BNE + +; LDA #$02 : STA BottleContentsThree +; + LDA BottleContentsFour : CMP #$06 : BNE + +; LDA #$02 : STA BottleContentsFour ; + ;RTL ;-------------------------------------------------------------------------------- @@ -47,7 +47,7 @@ RTL ;-------------------------------------------------------------------------------- FlipperFlag: LDA $5D : CMP #$04 : BNE .done ; skip if we're not swimming - LDA $7EF356 : BNE .safe ; skip if we have the flippers + LDA FlippersEquipment : BNE .safe ; skip if we have the flippers LDA #$01 : STA $7F5001 ; mark fake flipper softlock as possible BRA .done .safe diff --git a/flute.asm b/flute.asm index 4de7eb1..06b9edf 100644 --- a/flute.asm +++ b/flute.asm @@ -61,7 +61,7 @@ JML.l FluteBoy_Continue ;-------------------------------------------------------------------------------- FreeDuckCheck: LDA.l InvertedMode : BEQ .done - LDA $7EF34C : CMP.b #$03 : BEQ .done ; flute is already active + LDA FluteEquipment : CMP.b #$03 : BEQ .done ; flute is already active ; check the area, is it #$18 = 30? LDA $8A : CMP.b #$18 : BNE .done diff --git a/goalitem.asm b/goalitem.asm index 8cd7502..9c7e900 100644 --- a/goalitem.asm +++ b/goalitem.asm @@ -62,12 +62,12 @@ CheckGanonVulnerability: ; 02 = All dungeons .all_dungeons - LDA.l $7EF3C5 : CMP.b #$03 : BCC .fail ; require post-aga world state + LDA.l ProgressIndicator : CMP.b #$03 : BCC .fail ; require post-aga world state ; 09 = All dungeons except agahnim .all_dungeons_no_agahnim - LDA.l $7EF374 : AND.b #$07 : CMP.b #$07 : BNE .fail ; require all pendants - LDA.l $7EF37A : AND.b #$7F : CMP.b #$7F : BNE .fail ; require all crystals + LDA.l PendantsField : AND.b #$07 : CMP.b #$07 : BNE .fail ; require all pendants + LDA.l CrystalsField : AND.b #$7F : CMP.b #$7F : BNE .fail ; require all crystals LDA.l $7EF2DB : AND.b #$20 : BEQ .fail ; require aga2 defeated (pyramid hole open) BRA .success @@ -125,12 +125,12 @@ GetRequiredCrystalsInX: RTL ;-------------------------------------------------------------------------------- CheckEnoughCrystalsForGanon: - LDA $7EF37A : JSL CountBits ; the comparison is against 1 less + LDA CrystalsField : JSL CountBits ; the comparison is against 1 less CMP.l NumberOfCrystalsRequiredForGanon RTL ;-------------------------------------------------------------------------------- CheckEnoughCrystalsForTower: - LDA $7EF37A : JSL CountBits ; the comparison is against 1 less + LDA CrystalsField : JSL CountBits ; the comparison is against 1 less CMP.l NumberOfCrystalsRequiredForTower RTL @@ -158,15 +158,15 @@ CheckAgaForPed: ;--------------------------------------------------------------------------------------------------- KillGanon: - STA.l $7EF3C5 ; vanilla game state stuff we overwrote + STA.l ProgressIndicator ; vanilla game state stuff we overwrote LDA.l InvincibleGanon CMP.b #$06 : BNE .exit .light_speed LDA.l $7EF2DB : ORA.b #$20 : STA.l $7EF2DB ; pyramid hole - LDA.b #$08 : STA.l $7EF001 ; kill ganon - LDA.b #$02 : STA.l $7EF357 ; pearl but invisible in menu + LDA.b #$08 : STA.l RoomData[$00].Low ; kill ganon + LDA.b #$02 : STA.l MoonPearlEquipment ; pearl but invisible in menu .exit RTL diff --git a/halfmagicbat.asm b/halfmagicbat.asm index 56ba087..19772fc 100644 --- a/halfmagicbat.asm +++ b/halfmagicbat.asm @@ -10,6 +10,6 @@ GetMagicBatItem: JML.l Link_ReceiveItem .normalLogic LDA HalfMagic - STA $7EF37B + STA MagicConsumption RTL -;-------------------------------------------------------------------------------- \ No newline at end of file +;-------------------------------------------------------------------------------- diff --git a/hardmode.asm b/hardmode.asm index 1b7fe8b..65c934a 100644 --- a/hardmode.asm +++ b/hardmode.asm @@ -32,7 +32,7 @@ CalculateByrnaUsage: LDA.l HardModeExclusionCaneOfByrnaUsage, X : STA $00 PLX ++ - LDA $7EF36E ; thing we wrote over + LDA CurrentMagic ; thing we wrote over JML IncrementMagicUseCounterByrna ;-------------------------------------------------------------------------------- CalculateCapeUsage: diff --git a/heartpieces.asm b/heartpieces.asm index 6a4c3fe..4732c84 100644 --- a/heartpieces.asm +++ b/heartpieces.asm @@ -15,7 +15,7 @@ HeartPieceGet: STZ $02E9 ; 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 $7EF36B : INC A : AND.b #$03 : STA $7EF36B : BNE .unfinished_heart ; add up heart quarters + LDA HeartPieceQuarter : INC A : AND.b #$03 : STA HeartPieceQuarter : BNE .unfinished_heart ; add up heart quarters BRA .giveItem .notHeart diff --git a/hooks.asm b/hooks.asm index f0534dd..74b0adc 100755 --- a/hooks.asm +++ b/hooks.asm @@ -2483,7 +2483,7 @@ org $07A055 ; <- Bank07.asm:5205 (LDA $0B99 : BEQ BRANCH_DELTA) JSL.l ArrowGame : NOP #14 org $07A06C ; <- Bank07.asm:5215 (LDA $7EF377 : BEQ BRANCH_EPSILON) -JSL.l DecrementArrows : SKIP 2 : NOP : LDA $7EF377 +JSL.l DecrementArrows : SKIP 2 : NOP : LDA CurrentArrows ;================================================================================ ;================================================================================ diff --git a/inverted.asm b/inverted.asm index b60085d..92c57ed 100644 --- a/inverted.asm +++ b/inverted.asm @@ -131,7 +131,7 @@ db $02, $02, $02, $02, $02, $02, $02, $00, $00, $01, $01, $01, $02, $00, $08, $0 Electric_Barrier: LDA InvertedMode : BEQ .done - LDA $7EF280, X : ORA #$40 : STA $7EF280, X ;set barrier dead + LDA OverworldData, X : ORA #$40 : STA $7EF280, X ;set barrier dead .done LDA $7EF280, X ; what we wrote over RTL diff --git a/invertedmaps.asm b/invertedmaps.asm index d60cdcc..7ff1fdb 100644 --- a/invertedmaps.asm +++ b/invertedmaps.asm @@ -1007,7 +1007,7 @@ LDA #$0108 : STA $3C38 ;Warp Tile agah defeated LDA #$0034 : STA $3BBE ;Tile when no warp -LDA $7EF3C5 : AND #$00FF : CMP #$0003 : BNE .agahnimAlive +LDA ProgressIndicator : AND #$00FF : CMP #$0003 : BNE .agahnimAlive LDA #$0212 : STA $3BBE ;warp .agahnimAlive diff --git a/lampmantlecone.asm b/lampmantlecone.asm index c2dd7fd..07d5fea 100644 --- a/lampmantlecone.asm +++ b/lampmantlecone.asm @@ -7,9 +7,9 @@ LampCheck: LDA $7F50C4 : CMP.b #$01 : BNE + : RTL : + CMP.b #$FF : BNE + : INC : RTL : + - LDA $7EF34A : BNE .done ; skip if we already have lantern + LDA LampEquipment : BNE .done ; skip if we already have lantern - LDA $7EF3CA : BNE + + LDA CurrentWorld : BNE + .lightWorld LDA $040C : BNE ++ ; check if we're in sewers LDA LampConeSewers : BRA .done @@ -28,18 +28,18 @@ RTL CheckForZelda: ;LDA.l OpenMode : BEQ + ; Skip if not open mode ;LDA $FFFFFF - LDA.l $7EF3C5 : CMP.b #$02 : !BLT + ; Skip if rain is falling + LDA.l ProgressIndicator : CMP.b #$02 : !BLT + ; Skip if rain is falling LDA.b #$01 ; pretend we have zelda anyway RTL + - LDA $7EF3CC + LDA FollowerIndicator RTL ;================================================================================ ;-------------------------------------------------------------------------------- SetOverlayIfLamp: - ;LDA $7EF34A ; check if lamp + ;LDA LampEquipment ; check if lamp JSL.l LampCheck STA $1D ; write it directly to the overlay, this isn't a terrible idea at all RTL ;================================================================================ -;LDA $7EF3CA : EOR #$40 : LSR #6 : AND #$01 ; return the same result as having the lantern in the light world \ No newline at end of file +;LDA CurrentWorld : EOR #$40 : LSR #6 : AND #$01 ; return the same result as having the lantern in the light world diff --git a/maidencrystals.asm b/maidencrystals.asm index cab0c24..e435836 100644 --- a/maidencrystals.asm +++ b/maidencrystals.asm @@ -14,11 +14,11 @@ MaidenCrystalScript: ; Load the dungeon index. Is it the Dark Palace? ;LDA $040C : !SUB.b #$0A : TAY : CPY.b #$02 : BNE + - ; LDA $7EF3C7 : CMP.b #$07 : BCS ++ : LDA.b #$07 : STA $7EF3C7 : ++ + ; LDA MapIcons : CMP.b #$07 : BCS ++ : LDA.b #$07 : STA MapIcons : ++ ;+ - LDA $7EF37A : AND.b #$7F : CMP.b #$7F : BNE + ; check if we have all crystals - LDA.b #$08 : STA $7EF3C7 ; Update the map icon to just be Ganon's Tower + LDA CrystalsField : AND.b #$7F : CMP.b #$7F : BNE + ; check if we have all crystals + LDA.b #$08 : STA MapIcons ; Update the map icon to just be Ganon's Tower + JSL.l MaybeWriteSRAMTrace diff --git a/mantle.asm b/mantle.asm index fd5d1cd..5b60c1b 100644 --- a/mantle.asm +++ b/mantle.asm @@ -2,11 +2,11 @@ ; Mantle Object Changes ;-------------------------------------------------------------------------------- Mantle_CorrectPosition: - LDA $7EF3C6 : AND.b #$04 : BEQ + + LDA ProgressFlags : AND.b #$04 : BEQ + LDA.b #$0A : STA $0D10, X ; just spawn it off to the side where we know it should be LDA.b #$03 : STA $0D30, X LDA.b #$90 : STA $0ED0, X + LDA $0D00, X : !ADD.b #$03 ; thing we did originally RTL -;-------------------------------------------------------------------------------- \ No newline at end of file +;-------------------------------------------------------------------------------- diff --git a/msu.asm b/msu.asm index 49b5904..16259be 100644 --- a/msu.asm +++ b/msu.asm @@ -257,13 +257,13 @@ CheckMusicLoadRequest: -- : PLA : BRA .check_fallback-3 .darkworld PHA - LDA $7EF37A : CMP.b #$7F : BNE -- + LDA CrystalsField : CMP.b #$7F : BNE -- - : PLA LDA.b #61 : BRA .check_fallback-3 .darkwoods PHA - LDA $7EF37A : CMP.b #$7F : BEQ - - LDA $7EF3CA : BEQ -- + LDA CrystalsField : CMP.b #$7F : BEQ - + LDA CurrentWorld : BEQ -- LDA $8A : CMP #$40 : BNE -- PLA LDA.b #15 : BRA .check_fallback-3 @@ -347,7 +347,7 @@ CheckMusicLoadRequest: LDA $7EF2F0 : AND.b #$20 : BEQ .rain + - LDA $7EF3C5 : CMP.b #$02 : BCS + + LDA ProgressIndicator : CMP.b #$02 : BCS + .rain LDX.b #$01 + @@ -385,7 +385,7 @@ SpiralStairsPreCheck: LDA !REG_MSU_ID_45 : CMP !VAL_MSU_ID_45 : BNE .done + - LDA $7EF366 : AND.w #$0004 : BEQ .done ; Check that we have the GT big key + LDA BigKeyField : AND.w #$0004 : BEQ .done ; Check that we have the GT big key LDA !REG_MSU_FALLBACK_TABLE+7 : AND.w #$0004 : BEQ .done ; Check that we have the extended track .fade diff --git a/music.asm b/music.asm index 7973a49..86895e7 100644 --- a/music.asm +++ b/music.asm @@ -22,7 +22,7 @@ PreOverworld_LoadProperties_ChooseMusic: LDX.b #$07 ; Default village theme ; Check what phase we're in - ;LDA $7EF3C5 : CMP.b #$03 : !BLT + + ;LDA ProgressIndicator : CMP.b #$03 : !BLT + ; LDX.b #$02 ; Default light world theme (phase >=3) ;+ @@ -45,14 +45,14 @@ PreOverworld_LoadProperties_ChooseMusic: LDX.b #$02 ; Check phase ; In phase >= 2 - LDA $7EF3C5 : CMP.b #$02 : !BGE + + LDA ProgressIndicator : CMP.b #$02 : !BGE + ; If phase < 2, play the legend music LDX.b #$03 + .endOfLightWorldChecks ; if we are in the light world go ahead and set chosen selection - LDA $7EF3CA : BEQ .checkInverted+4 + LDA CurrentWorld : BEQ .checkInverted+4 LDX.b #$0F ; dark woods theme @@ -68,10 +68,10 @@ PreOverworld_LoadProperties_ChooseMusic: ; if not inverted and light world, or inverted and dark world, skip moon pearl check .checkInverted - LDA $7EF3CA : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck + LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck ; Does Link have a moon pearl? - LDA $7EF357 : BNE + + LDA MoonPearlEquipment : BNE + LDX.b #$04 ; bunny theme + @@ -117,8 +117,8 @@ Overworld_FinishMirrorWarp: LDX.b #$04 ; bunny theme ; if not inverted and light world, or inverted and dark world, skip moon pearl check - LDA $7EF3CA : CLC : ROL #$03 : CMP InvertedMode : BEQ + - LDA $7EF357 : BEQ .endOfLightWorldChecks + LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ + + LDA MoonPearlEquipment : BEQ .endOfLightWorldChecks + LDX.b #$09 ; default dark world theme @@ -138,7 +138,7 @@ Overworld_FinishMirrorWarp: CMP.b #$18 : BNE .endOfLightWorldChecks ; Check what phase we're in - ; LDA $7EF3C5 : CMP.b #$03 : !BGE .endOfLightWorldChecks + ; LDA ProgressIndicator : CMP.b #$03 : !BGE .endOfLightWorldChecks LDX.b #$07 ; Default village theme (phase <3) .endOfLightWorldChecks @@ -158,7 +158,7 @@ Overworld_FinishMirrorWarp: LDX.b #$0D ; dark mountain theme .bunny - LDA $7EF357 : ORA InvertedMode : BNE + + LDA MoonPearlEquipment : ORA InvertedMode : BNE + LDX #$04 ; bunny theme + @@ -185,7 +185,7 @@ BirdTravel_LoadTargetAreaMusic: LDX.b #$07 ; Default village theme ; Check what phase we're in - ;LDA $7EF3C5 : CMP.b #$03 : !BLT + + ;LDA ProgressIndicator : CMP.b #$03 : !BLT + ; LDX.b #$02 ; Default light world theme (phase >=3) ;+ @@ -208,14 +208,14 @@ BirdTravel_LoadTargetAreaMusic: LDX.b #$02 ; Check phase ; In phase >= 2 - LDA $7EF3C5 : CMP.b #$02 : !BGE + + LDA ProgressIndicator : CMP.b #$02 : !BGE + ; If phase < 2, play the legend music LDX.b #$03 + .endOfLightWorldChecks ; if we are in the light world go ahead and set chosen selection - LDA $7EF3CA : BEQ .checkInverted+4 + LDA CurrentWorld : BEQ .checkInverted+4 LDX.b #$09 ; dark overworld theme @@ -236,16 +236,16 @@ BirdTravel_LoadTargetAreaMusic: BRA .checkInverted .darkMountain - LDA $7EF37A : CMP.b #$7F : BEQ + + LDA CrystalsField : CMP.b #$7F : BEQ + LDX.b #$0D ; dark death mountain theme + : LDA.b #$09 : STA $012D ; if not inverted and light world, or inverted and dark world, skip moon pearl check .checkInverted - LDA $7EF3CA : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck + LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck ; Does Link have a moon pearl? - LDA $7EF357 : BNE + + LDA MoonPearlEquipment : BNE + LDX.b #$04 ; bunny theme + @@ -275,7 +275,7 @@ Overworld_MosaicDarkWorldChecks: CMP.b #$51 : bne .doFade .checkCrystals - LDA $7EF37A : CMP.b #$7F : BEQ .done + LDA CrystalsField : CMP.b #$7F : BEQ .done .doFade LDA.b #$F1 : STA $012C ; thing we wrote over, fade out music diff --git a/newhud.asm b/newhud.asm index bb1db93..2265023 100644 --- a/newhud.asm +++ b/newhud.asm @@ -8,7 +8,7 @@ SEP #$30 LDA !INFINITE_BOMBS : BNE .infinite_bombs .finite_bombs - LDA.l $7EF343 ; bombs + LDA.l BombsEquipment ; bombs JSR HudHexToDec2Digit ;requires 8 bit registers! REP #$20 LDX.b $06 : TXA : ORA.w #$2400 : STA !BOMBCOUNT_DRAW_ADDRESS ; Draw bombs 10 digit @@ -26,7 +26,7 @@ SEP #$30 !RUPEE_DRAW_ADDRESS = "$7EC750" ;================================================================================ - LDA.l $7EF362 ; Drawing bombs (above) always ends with 16-bit A, so, no need to REP here + LDA.l CurrentRupees ; Drawing bombs (above) always ends with 16-bit A, so, no need to REP here JSR HudHexToDec4Digit LDX.b $04 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS ; 1000s LDX.b $05 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS+2 ; 100s @@ -43,7 +43,7 @@ SEP #$30 LDA.l ArrowMode : BNE + LDA !INFINITE_ARROWS : BNE .infinite_arrows .finite_arrows - LDA.l $7EF377 ; arrows + LDA.l CurrentArrows ; arrows JSR HudHexToDec2Digit REP #$20 LDX.b $06 : TXA : ORA.w #$2400 : STA !ARROWCOUNT_DRAW_ADDRESS ; Draw arrows 10 digit @@ -104,12 +104,11 @@ SEP #$30 ;================================================================================ ; Draw key count -!KEYS = "$7EF36F" !KEY_DIGITS_ADDRESS = "$7EC764" !KEY_ICON_ADDRESS = "$7EC726" ;================================================================================ SEP #$20 - LDA.l !KEYS : CMP.b #$FF : BEQ .not_in_dungeon + LDA.l CurrentSmallKeys : CMP.b #$FF : BEQ .not_in_dungeon .in_dungeon JSR HudHexToDec2Digit : REP #$20 @@ -156,7 +155,7 @@ SEP #$30 REP #$20 BEQ .drawprize - LDA.l $7EF368 + LDA.l MapField AND.l DungeonItemMasks,X BEQ .noprize @@ -184,13 +183,13 @@ SEP #$30 !INFINITE_MAGIC = "$7F50CA" !DrawMagicMeter_mp_tilemap = "$0DFE0F" ;-------------------------------------------------------------------------------- - LDA $7EF36E : AND #$00FF ; crap we wrote over when placing the hook for OnDrawHud + LDA CurrentMagic : AND #$00FF ; crap we wrote over when placing the hook for OnDrawHud !ADD #$0007 AND #$FFF8 TAX ; end of crap LDA !INFINITE_MAGIC : AND.w #$00FF : BNE + : JMP .green : + - SEP #$20 : LDA.b #$80 : STA $7EF36E : REP #$30 ; set magic to max + SEP #$20 : LDA.b #$80 : STA CurrentMagic : REP #$30 ; set magic to max LDX.w #$0080 ; load full magic meter graphics LDA $1A : AND.w #$000C : LSR #2 BEQ .red diff --git a/newitems.asm b/newitems.asm index c8df278..f9fbb3c 100755 --- a/newitems.asm +++ b/newitems.asm @@ -144,7 +144,6 @@ endmacro ;-------------------------------------------------------------------------------- !CHALLENGE_TIMER = "$7EF454" !GOAL_COUNTER = "$7EF418" -!INVENTORY_SWAP_2 = "$7EF38E" ;-------------------------------------------------------------------------------- ;carry clear if pass ;carry set if caught @@ -201,62 +200,62 @@ AddReceivedItemExpandedGetItem: LDA $02D8 ; check inventory JSL.l FreeDungeonItemNotice CMP.b #$0B : BNE + ; Bow - LDA !INVENTORY_SWAP_2 : AND.b #$40 : BEQ ++ + LDA BowTracking : AND.b #$40 : BEQ ++ LDA.l SilverArrowsUseRestriction : BNE ++ - LDA.b #03 : STA $7EF340 ; set bow to silver + LDA.b #03 : STA BowEquipment ; set bow to silver ++ JMP .done + CMP.b #$3B : BNE + ; Silver Bow LDA.l SilverArrowsUseRestriction : BNE .noequip LDA.l SilverArrowsAutoEquip : AND.b #$01 : BEQ .noequip - LDA $7EF376 : BNE ++ ; check arrows + LDA ArrowsFiller : BNE ++ ; check arrows LDA.b #$03 : BRA +++ ; bow without arrow ++ LDA.b #$04 ; bow with arrow +++ - STA $7EF340 + STA BowEquipment .noequip - LDA !INVENTORY_SWAP_2 : ORA #$40 : STA !INVENTORY_SWAP_2 ; mark silver bow on y-toggle + LDA BowTracking : ORA #$40 : STA BowTracking ; mark silver bow on y-toggle JMP .done + CMP.b #$4C : BNE + ; 50 bombs - ;LDA.b #$07 : STA $7EF370 ; upgrade bombs - LDA.b #50 : !SUB.l StartingMaxBombs : STA $7EF370 ; upgrade bombs - LDA.b #50 : STA $7EF375 ; fill bombs + ;LDA.b #$07 : STA BombCapacityUpgrades ; upgrade bombs + LDA.b #50 : !SUB.l StartingMaxBombs : STA BombCapacityUpgrades ; upgrade bombs + LDA.b #50 : STA BombsFiller ; fill bombs JMP .done + CMP.b #$4D : BNE + ; 70 arrows - ;LDA #$07 : STA $7EF371 ; upgrade arrows - LDA.b #70 : !SUB.l StartingMaxArrows : STA $7EF371 ; upgrade arrows - LDA.b #70 : STA $7EF376 ; fill arrows + ;LDA #$07 : STA ArrowCapacityUpgrades ; upgrade arrows + LDA.b #70 : !SUB.l StartingMaxArrows : STA ArrowCapacityUpgrades ; upgrade arrows + LDA.b #70 : STA ArrowsFiller ; fill arrows JMP .done + CMP.b #$4E : BNE + ; 1/2 magic - LDA $7EF37B : CMP #$02 : !BGE ++ - INC : STA $7EF37B ; upgrade magic + LDA MagicConsumption : CMP #$02 : !BGE ++ + INC : STA MagicConsumption ; upgrade magic ++ - LDA.b #$80 : STA $7EF373 ; fill magic + LDA.b #$80 : STA MagicFiller ; fill magic JMP .done + CMP.b #$4F : BNE + ; 1/4 magic - LDA.b #$02 : STA $7EF37B ; upgrade magic - LDA.b #$80 : STA $7EF373 ; fill magic + LDA.b #$02 : STA MagicConsumption ; upgrade magic + LDA.b #$80 : STA MagicFiller ; fill magic JMP .done + CMP.b #$50 : BNE + ; Master Sword (Safe) - LDA $7EF359 : CMP.b #$02 : !BGE + ; skip if we have a better sword - LDA.b #$02 : STA $7EF359 ; set master sword + LDA SwordEquipment : CMP.b #$02 : !BGE + ; skip if we have a better sword + LDA.b #$02 : STA SwordEquipment ; set master sword JMP .done + CMP.b #$51 : BNE + ; +5 Bombs - LDA $7EF370 : !ADD.b #$05 : STA $7EF370 ; upgrade bombs +5 - LDA.l Upgrade5BombsRefill : STA $7EF375 ; fill bombs + LDA BombCapacityUpgrades : !ADD.b #$05 : STA BombCapacityUpgrades ; upgrade bombs +5 + LDA.l Upgrade5BombsRefill : STA BombsFiller ; fill bombs JMP .done + CMP.b #$52 : BNE + ; +10 Bombs - LDA $7EF370 : !ADD.b #$0A : STA $7EF370 ; upgrade bombs +10 - LDA.l Upgrade10BombsRefill : STA $7EF375 ; fill bombs + LDA BombCapacityUpgrades : !ADD.b #$0A : STA BombCapacityUpgrades ; upgrade bombs +10 + LDA.l Upgrade10BombsRefill : STA BombsFiller ; fill bombs JMP .done + CMP.b #$53 : BNE + ; +5 Arrows - LDA $7EF371 : !ADD.b #$05 : STA $7EF371 ; upgrade arrows +5 - LDA.l Upgrade5ArrowsRefill : STA $7EF376 ; fill arrows + LDA ArrowCapacityUpgrades : !ADD.b #$05 : STA ArrowCapacityUpgrades ; upgrade arrows +5 + LDA.l Upgrade5ArrowsRefill : STA ArrowsFiller ; fill arrows JMP .done + CMP.b #$54 : BNE + ; +10 Arrows - LDA $7EF371 : !ADD.b #$0A : STA $7EF371 ; upgrade arrows +10 - LDA.l Upgrade10ArrowsRefill : STA $7EF376 ; fill arrows + LDA ArrowCapacityUpgrades : !ADD.b #$0A : STA ArrowCapacityUpgrades ; upgrade arrows +10 + LDA.l Upgrade10ArrowsRefill : STA ArrowsFiller ; fill arrows JMP .done + CMP.b #$55 : BNE + ; Programmable Object 1 %ProgrammableItemLogic(1) @@ -270,15 +269,15 @@ AddReceivedItemExpandedGetItem: + CMP.b #$58 : BNE + ; Upgrade-Only Sivler Arrows LDA.l SilverArrowsUseRestriction : BNE +++ LDA.l SilverArrowsAutoEquip : AND.b #$01 : BEQ +++ - LDA $7EF340 : BEQ ++ : CMP.b #$03 : !BGE ++ - !ADD.b #$02 : STA $7EF340 ; switch to silver bow + LDA BowEquipment : BEQ ++ : CMP.b #$03 : !BGE ++ + !ADD.b #$02 : STA BowEquipment ; switch to silver bow ++ +++ LDA.l ArrowMode : BEQ ++ - LDA.b #$01 : STA $7EF376 + LDA.b #$01 : STA ArrowsFiller ++ + CMP.b #$59 : BNE + ; 1 Rupoor - REP #$20 : LDA $7EF360 : !SUB RupoorDeduction : STA $7EF360 : SEP #$20 ; Take 1 rupee + REP #$20 : LDA TargetRupees : !SUB RupoorDeduction : STA TargetRupees : SEP #$20 ; Take 1 rupee JMP .done + CMP.b #$5A : BNE + ; Null Item JMP .done @@ -345,53 +344,53 @@ AddReceivedItemExpandedGetItem: + CMP.b #$70 : !BLT + : CMP.b #$80 : !BGE + ; Free Map AND #$0F : CMP #$08 : !BGE ++ %ValueShift() - ORA $7EF368 : STA $7EF368 ; Map 1 + ORA MapField : STA MapField ; Map 1 JMP .done ++ !SUB #$08 %ValueShift() BIT.b #$C0 : BEQ +++ : LDA.b #$C0 : +++ ; Make Hyrule Castle / Sewers Count for Both - ORA $7EF369 : STA $7EF369 ; Map 2 + ORA MapField+1 : STA MapField+1 ; Map 2 JMP .done + CMP.b #$80 : !BLT + : CMP.b #$90 : !BGE + ; Free Compass AND #$0F : CMP #$08 : !BGE ++ %ValueShift() - ORA $7EF364 : STA $7EF364 ; Compass 1 + ORA CompassField : STA CompassField ; Compass 1 JMP .done ++ !SUB #$08 %ValueShift() BIT.b #$C0 : BEQ +++ : LDA.b #$C0 : +++ ; Make Hyrule Castle / Sewers Count for Both - ORA $7EF365 : STA $7EF365 ; Compass 2 + ORA CompassField+1 : STA CompassField+1 ; Compass 2 JMP .done + CMP.b #$90 : !BLT + : CMP.b #$A0 : !BGE + ; Free Big Key AND #$0F : CMP #$08 : !BGE ++ %ValueShift() - ORA $7EF366 : STA $7EF366 ; Big Key 1 + ORA BigKeyField : STA BigKeyField ; Big Key 1 JMP .done ++ !SUB #$08 %ValueShift() BIT.b #$C0 : BEQ +++ : LDA.b #$C0 : +++ ; Make Hyrule Castle / Sewers Count for Both - ORA $7EF367 : STA $7EF367 ; Big Key 2 + ORA BigKeyField+1 : STA BigKeyField+1 ; Big Key 2 JMP .done + CMP.b #$A0 : !BLT + : CMP.b #$B0 : !BGE + ; Free Small Key AND #$0F : TAX - LDA $7EF37C, X : INC : STA $7EF37C, X ; Increment Key Count + LDA SewerKeys, X : INC : STA SewerKeys, X ; Increment Key Count CPX.b #$00 : BNE ++ - STA $7EF37D ; copy HC to sewers + STA HyruleCastleKeys ; copy HC to sewers ++ : CPX.b #$01 : BNE ++ - STA $7EF37C ; copy sewers to HC + STA SewerKeys ; copy sewers to HC ++ LDA.l GenericKeys : BEQ + .generic - LDA $7EF36F : INC : STA $7EF36F + LDA CurrentSmallKeys : INC : STA CurrentSmallKeys JMP .done .normal TXA : ASL : CMP $040C : BNE ++ - LDA $7EF36F : INC : STA $7EF36F + LDA CurrentSmallKeys : INC : STA CurrentSmallKeys ++ JMP .done + @@ -404,7 +403,7 @@ RTL ; #$90 - Big Keys ; #$A0 - Small Keys ;-------------------------------------------------------------------------------- -!PROGRESSIVE_SHIELD = "$7EF416" ; ss-- ---- +!HIGHEST_ARMOR_SHIELD_SWORD = "$7EF416" ; ss-- ---- !RNG_ITEM = "$7EF450" !SCRATCH_AREA = "$7F5020" !SINGLE_INDEX_TEMP = "$7F5020" @@ -458,11 +457,11 @@ AddReceivedItemExpanded: LDA.l BottleLimitReplacement : STA $02D8 +++ : JMP .done ++ : CMP.b #$4E : BNE ++ ; Progressive Magic - LDA $7EF37B : BEQ +++ + LDA MagicConsumption : BEQ +++ LDA.b #$4F : STA $02D8 +++ : JMP .done ++ : CMP.b #$5E : BNE ++ ; Progressive Sword - LDA $7EF359 : CMP.l ProgressiveSwordLimit : !BLT + + LDA SwordEquipment : CMP.l ProgressiveSwordLimit : !BLT + LDA.l ProgressiveSwordReplacement : STA $02D8 : JMP .done + : CMP.b #$00 : BNE + ; No Sword LDA.b #$49 : STA $02D8 : JMP .done @@ -473,39 +472,35 @@ AddReceivedItemExpanded: + ; Everything Else LDA.b #$03 : STA $02D8 : JMP .done ++ : CMP.b #$5F : BNE ++ ; Progressive Shield - LDA !PROGRESSIVE_SHIELD : LSR #6 : CMP.l ProgressiveShieldLimit : !BLT + + LDA ShieldEquipment : CMP.l ProgressiveShieldLimit : !BLT + LDA.l ProgressiveShieldReplacement : STA $02D8 : JMP .done - + - LDA !PROGRESSIVE_SHIELD : AND.b #$C0 : BNE + ; No Shield - LDA.b #$04 : STA $02D8 - LDA !PROGRESSIVE_SHIELD : !ADD.b #$40 : STA !PROGRESSIVE_SHIELD : JMP .done - + : CMP.b #$40 : BNE + ; Fighter Shield - LDA.b #$05 : STA $02D8 - LDA !PROGRESSIVE_SHIELD : !ADD.b #$40 : STA !PROGRESSIVE_SHIELD : JMP .done + + : CMP.b #$00 : BNE + ; No Shield + LDA.b #$04 : STA $02D8 : JMP .done + + : CMP.b #$01 : BNE + ; Fighter Shield + LDA.b #$05 : STA $02D8 : JMP .done + ; Everything Else - LDA.b #$06 : STA $02D8 - LDA !PROGRESSIVE_SHIELD : !ADD.b #$40 : STA !PROGRESSIVE_SHIELD : JMP .done + LDA.b #$06 : STA $02D8 : JMP .done ++ : CMP.b #$60 : BNE ++ ; Progressive Armor - LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT + + LDA ArmorEquipment : CMP.l ProgressiveArmorLimit : !BLT + LDA.l ProgressiveArmorReplacement : STA $02D8 : JMP .done + : CMP.b #$00 : BNE + ; No Armor LDA.b #$22 : STA $02D8 : JMP .done + ; Everything Else LDA.b #$23 : STA $02D8 : JMP .done ++ : CMP.b #$61 : BNE ++ ; Progressive Lifting Glove - LDA $7EF354 : BNE + ; No Lift + LDA GloveEquipment : BNE + ; No Lift LDA.b #$1B : STA $02D8 : BRA .done + ; Everything Else LDA.b #$1C : STA $02D8 : BRA .done ++ : CMP.b #$64 : BNE ++ : -- ; Progressive Bow - LDA $7EF340 : INC : LSR : CMP.l ProgressiveBowLimit : !BLT + + LDA BowEquipment : INC : LSR : CMP.l ProgressiveBowLimit : !BLT + LDA.l ProgressiveBowReplacement : STA $02D8 : JMP .done + : CMP.b #$00 : BNE + ; No Bow LDA.b #$3A : STA $02D8 : BRA .done + ; Any Bow LDA.b #$3B : STA $02D8 : BRA .done ++ : CMP.b #$65 : BNE ++ ; Progressive Bow 2 - LDA.l !INVENTORY_SWAP_2 : ORA #$20 : STA.l !INVENTORY_SWAP_2 + LDA.l BowTracking : ORA #$20 : STA.l BowTracking BRA -- ; ++ : CMP.b #$FE : BNE ++ ; Server Request (Null Chest) ; JSL ChestItemServiceRequest @@ -758,7 +753,7 @@ org $A08800 dw $F359 ; Master Sword (Safe) dw $F375, $F375, $F376, $F376 ; +5/+10 Bomb Arrows dw $F41A, $F41C, $F41E ; 3x Programmable Item - dw $F340 ; Upgrade-Only Sivler Arrows + dw $F340 ; Upgrade-Only Silver Arrows dw $F360 ; 1 Rupoor dw $F36A ; Null Item dw $F454, $F454, $F454 ; Red, Blue & Green Clocks @@ -918,8 +913,8 @@ Link_ReceiveItemAlternatesExpanded: RTL ;-------------------------------------------------------------------------------- ;DrawHUDSilverArrows: -; LDA $7EF340 : AND.w #$00FF : BNE + -; LDA !INVENTORY_SWAP_2 : AND.w #$0040 : BEQ + +; LDA BowEquipment : AND.w #$00FF : BNE + +; LDA BowTracking : AND.w #$0040 : BEQ + ; LDA.w #$2810 : STA $11C8 ; LDA.w #$2811 : STA $11CA ; LDA.w #$2820 : STA $1208 @@ -928,19 +923,19 @@ RTL ; LDA.w #$11CE : STA $00 ; thing we wrote over ;RTL ;-------------------------------------------------------------------------------- -;Return $7EF340 but also draw silver arrows if you have the upgrade even if you don't have the bow +;Return BowEquipment but also draw silver arrows if you have the upgrade even if you don't have the bow CheckHUDSilverArrows: LDA.l ArrowMode : BEQ .normal .rupee_arrows JSL.l DrawHUDArrows - LDA $7EF340 + LDA BowEquipment RTL .normal - LDA $7EF340 : BNE + - LDA !INVENTORY_SWAP_2 : AND.b #$40 : BEQ ++ + LDA BowEquipment : BNE + + LDA BowTracking : AND.b #$40 : BEQ ++ JSL.l DrawHUDArrows ++ - LDA $7EF340 + LDA BowEquipment + RTL ;-------------------------------------------------------------------------------- @@ -948,9 +943,9 @@ DrawHUDArrows: LDA.l ArrowMode : BEQ .normal .rupee_arrows - LDA $7EF377 : BEQ .none ; assuming silvers will increment this. if we go with something else, reorder these checks - LDA $7EF340 : BNE + - LDA !INVENTORY_SWAP_2 : AND.b #$40 : BNE .silver + LDA CurrentArrows : BEQ .none ; assuming silvers will increment this. if we go with something else, reorder these checks + LDA BowEquipment : BNE + + LDA BowTracking : AND.b #$40 : BNE .silver BRA .wooden + CMP.b #03 : !BGE .silver @@ -1070,7 +1065,7 @@ IncrementItemCounters: .match PHX TXA : LSR #2 : TAX - LDA !ITEM_LIMIT_COUNTS, X : INC : STA !ITEM_LIMIT_COUNTS, X + LDA ItemLimitCounts, X : INC : STA ItemLimitCounts, X PLX BEQ .exit .noMatch @@ -1090,7 +1085,7 @@ AttemptItemSubstitution: .match PHX TXA : LSR #2 : TAX - LDA !ITEM_LIMIT_COUNTS, X + LDA ItemLimitCounts, X PLX CMP.l ItemSubstitutionRules+1, X : !BLT + LDA.l ItemSubstitutionRules+2, X : STA 1,s @@ -1106,10 +1101,10 @@ RTS CountBottles: PHX LDX.b #$00 - LDA $7EF35C : BEQ ++ : INX - ++ : LDA $7EF35D : BEQ ++ : INX - ++ : LDA $7EF35E : BEQ ++ : INX - ++ : LDA $7EF35F : BEQ ++ : INX + LDA BottleContentsOne : BEQ ++ : INX + ++ : LDA BottleContentsTwo : BEQ ++ : INX + ++ : LDA BottleContentsThree : BEQ ++ : INX + ++ : LDA BottleContentsFour : BEQ ++ : INX ++ TXA PLX diff --git a/npcitems.asm b/npcitems.asm index db20ce6..c1a546f 100644 --- a/npcitems.asm +++ b/npcitems.asm @@ -49,11 +49,11 @@ ItemCheck_SickKid: RTL ItemCheck_TreeKid: - LDA !NPC_FLAGS : AND.b #$08 ; FluteBoy_Chillin - 73: LDA $7EF34C + LDA !NPC_FLAGS : AND.b #$08 ; FluteBoy_Chillin - 73: LDA FluteEquipment RTL ItemCheck_TreeKid2: - LDA !NPC_FLAGS : AND.b #$08 : LSR #$02 ; FluteAardvark_InitialStateFromFluteState - 225: LDA $7EF34C : AND.b #$03 + LDA !NPC_FLAGS : AND.b #$08 : LSR #$02 ; FluteAardvark_InitialStateFromFluteState - 225: LDA FluteEquipment : AND.b #$03 RTL ItemCheck_TreeKid3: @@ -92,7 +92,7 @@ ItemCheck_Catfish: ;LDA CatfishGoodItem : BEQ .junk ;PHX ; LDA CatfishGoodItem+1 : TAX - ; LDA $7EF340-1, X + ; LDA BowEquipment-1, X ;PLX ;-- ;CMP CatfishGoodItem : !BLT .oursNewer diff --git a/openmode.asm b/openmode.asm index 4bf907c..c5ddfff 100644 --- a/openmode.asm +++ b/openmode.asm @@ -6,15 +6,15 @@ !INFINITE_MAGIC = "$7F50CA" SetUncleRainState: LDA.l OpenMode : BEQ + : RTL : + ; we're done if open mode is on - LDA.b #$01 : STA $7EF3C5 + LDA.b #$01 : STA ProgressIndicator RTL ;-------------------------------------------------------------------------------- InitOpenMode: LDA.l OpenMode : BEQ + ; Skip if not open mode - LDA $7EF3C5 : CMP #$02 : !BGE + ; Skip if already past escape - LDA.b #$02 : STA $7EF3C5 ; Go to post-escape phase (pre aga1) - LDA $7EF3C6 : ORA #$14 : STA $7EF3C6 ; remove uncle - LDA $7EF3C8 : CMP #$05 : BEQ ++ : LDA.b #$01 : ++ : STA $7EF3C8 ; set spawn points to house+sanc unless already house+sanc+mountain + LDA ProgressIndicator : CMP #$02 : !BGE + ; Skip if already past escape + LDA.b #$02 : STA ProgressIndicator ; Go to post-escape phase (pre aga1) + LDA ProgressFlags : ORA #$14 : STA ProgressFlags ; remove uncle + LDA StartingEntrance : CMP #$05 : BEQ ++ : LDA.b #$01 : ++ : STA StartingEntrance ; set spawn points to house+sanc unless already house+sanc+mountain LDA $7EF29B : ORA.b #$20 : STA $7EF29B ; open castle gate JSL MaybeSetPostAgaWorldState + @@ -22,8 +22,8 @@ RTL ;-------------------------------------------------------------------------------- MaybeSetPostAgaWorldState: LDA.l InstantPostAgaWorldState : BEQ + ; Skip if not enabled - LDA.b #$03 : STA $7EF3C5 ; Go to post-aga phase + LDA.b #$03 : STA ProgressIndicator ; Go to post-aga phase LDA $7EF282 : ORA.b #$20 : STA $7EF282 ; make lumberjack tree accessible + RTL -;-------------------------------------------------------------------------------- \ No newline at end of file +;-------------------------------------------------------------------------------- diff --git a/pendantcrystalhud.asm b/pendantcrystalhud.asm index 256b395..e0fe5a9 100644 --- a/pendantcrystalhud.asm +++ b/pendantcrystalhud.asm @@ -8,13 +8,13 @@ FlipLWDWFlag: PHP SEP #$20 ; set 8-bit accumulator - LDA $7EF3CA : EOR.b #$40 : STA $7EF3CA + LDA CurrentWorld : EOR.b #$40 : STA CurrentWorld BEQ + LDA.b #07 : BRA ++ ; dark world - crystals + LDA.b #03 ; light world - pendants ++ - STA $7EF3C7 + STA MapIcons PLP RTL ;================================================================================ @@ -23,7 +23,7 @@ HUDRebuildIndoorHole: LDA.l GenericKeys : BEQ .normal .generic PLA - LDA $7EF38B ; generic key count + LDA CurrentGenericKeys ; generic key count JSL.l HUD_RebuildIndoor_Palace RTL .normal @@ -35,7 +35,7 @@ HUDRebuildIndoor: LDA.l GenericKeys : BEQ .normal .generic LDA.b #$00 : STA $7EC017 - LDA $7EF38B ; generic key count + LDA CurrentGenericKeys ; generic key count RTL .normal LDA.b #$00 : STA $7EC017 @@ -45,25 +45,24 @@ RTL GetCrystalNumber: PHX TXA : ASL : TAX - LDA $7EF3CA : EOR.b #$40 : BNE + + LDA CurrentWorld : EOR.b #$40 : BNE + INX + LDA.l CrystalNumberTable-16, X PLX RTL ;================================================================================ -!INVENTORY_MAP = "$7EF368" !MAP_OVERLAY = "$7EF414" ; [2] OverworldMap_CheckObject: PHX ;CPX.b #$01 : BNE + : JMP ++ : + : JMP .fail - LDA $7EF3CA : AND.b #$40 : BNE + + LDA CurrentWorld : AND.b #$40 : BNE + ;LW Map LDA.l MapMode : BEQ +++ - LDA !INVENTORY_MAP : ORA !MAP_OVERLAY : AND.b #$01 : BNE +++ + LDA MapField : ORA !MAP_OVERLAY : AND.b #$01 : BNE +++ PHX LDA.l .lw_map_offsets, X : TAX ; put map offset into X - LDA !INVENTORY_MAP, X : ORA !MAP_OVERLAY, X + LDA MapField, X : ORA !MAP_OVERLAY, X PLX AND.l .lw_map_masks, X : BNE +++ JMP .fail @@ -74,10 +73,10 @@ OverworldMap_CheckObject: + ;DW Map LDA.l MapMode : BEQ +++ - LDA !INVENTORY_MAP : ORA !MAP_OVERLAY : AND.b #$02 : BNE +++ + LDA MapField : ORA !MAP_OVERLAY : AND.b #$02 : BNE +++ PHX LDA.l .dw_map_offsets, X : TAX ; put map offset into X - LDA.l !INVENTORY_MAP, X : ORA !MAP_OVERLAY, X + LDA.l MapField, X : ORA !MAP_OVERLAY, X PLX AND.l .dw_map_masks, X : BNE +++ JMP .fail @@ -92,11 +91,11 @@ RTL AND.b #$40 : BNE .checkCrystal .checkPendant - LDA $7EF374 : AND.l CrystalPendantFlags, X : BNE .fail + LDA PendantsField : AND.l CrystalPendantFlags, X : BNE .fail CLC : BRA .done .checkCrystal - LDA $7EF37A : AND.l CrystalPendantFlags, X : BNE .fail + LDA CrystalsField : AND.l CrystalPendantFlags, X : BNE .fail CLC : BRA .done .fail @@ -121,18 +120,18 @@ db $02, $80, $08, $10, $01, $40, $04 SetLWDWMap: PHP SEP #$20 ; set 8-bit accumulator - LDA $7EF3CA : EOR.b #$40 + LDA CurrentWorld : EOR.b #$40 BNE + LDA.b #07 : BRA ++ ; dark world - crystals + LDA.b #03 ; light world - pendants ++ - STA $7EF3C7 + STA MapIcons PLP RTL ;================================================================================ GetMapMode: - LDA $7EF3CA : AND.b #$40 : BEQ + + LDA CurrentWorld : AND.b #$40 : BEQ + LDA.b #07 ; dark world - crystals RTL + @@ -205,13 +204,13 @@ UpdateKeys: LSR : TAX ; get dungeon index and store to X - LDA $7EF36F ; load current key count - STA $7EF37C, X ; save to main counts + LDA CurrentSmallKeys ; load current key count + STA SewerKeys, X ; save to main counts CPX.b #$00 : BNE + - STA $7EF37D ; copy HC to sewers + STA HyruleCastleKeys ; copy HC to sewers + : CPX.b #$01 : BNE + - STA $7EF37C ; copy sewers to HC + STA SewerKeys ; copy sewers to HC + .skip JSL.l PostItemGet @@ -285,19 +284,19 @@ DrawHUDDungeonItems: dw 30 ; Ganon's Tower .small_key_x_offset - dw $7EF37D-$7EF37D ; Hyrule Castle - dw $7EF37E-$7EF37D ; Eastern - dw $7EF37F-$7EF37D ; Desert - dw $7EF386-$7EF37D ; Hera - dw $7EF380-$7EF37D ; Agahnims Tower - dw $7EF382-$7EF37D ; PoD - dw $7EF381-$7EF37D ; Swamp - dw $7EF384-$7EF37D ; Skull Woods - dw $7EF387-$7EF37D ; Thieves Town - dw $7EF385-$7EF37D ; Ice - dw $7EF383-$7EF37D ; Mire - dw $7EF388-$7EF37D ; Turtle Rock - dw $7EF389-$7EF37D ; Ganon's Tower + dw HyruleCastleKeys-DungeonKeys ; Hyrule Castle + dw EasternKeys-DungeonKeys ; Eastern + dw DesertKeys-DungeonKeys ; Desert + dw HeraKeys-DungeonKeys ; Hera + dw CastleTowerKeys-DungeonKeys ; Agahnims Tower + dw PalaceOfDarknessKeys-DungeonKeys ; PoD + dw SwampKeys-DungeonKeys ; Swamp + dw SkullWoodsKeys-DungeonKeys ; Skull Woods + dw ThievesTownKeys-DungeonKeys ; Thieves Town + dw IcePalaceKeys-DungeonKeys ; Ice + dw MireKeys-DungeonKeys ; Mire + dw TurtleRockKeys-DungeonKeys ; Turtle Rock + dw GanonsTowerKeys-DungeonKeys ; Ganon's Tower .dungeon_bitmasks @@ -386,7 +385,7 @@ DrawHUDDungeonItems: .next_small_key LDX.w .small_key_x_offset,Y - LDA.l $7EF37D,X + LDA.l DungeonKeys,X AND.w #$00FF LDX.w .dungeon_positions,Y @@ -410,7 +409,7 @@ DrawHUDDungeonItems: LDX.w #0 ; load once and test multiple times - LDA.l $7EF366 + LDA.l BigKeyField .next_big_key BIT.w .dungeon_bitmasks,X @@ -421,7 +420,7 @@ DrawHUDDungeonItems: STA.w $16C6,Y ; reload - LDA.l $7EF366 + LDA.l BigKeyField ..skip_key INX : INX @@ -469,7 +468,7 @@ DrawHUDDungeonItems: LDX.w #0 ; load once and test multiple times - LDA.l $7EF368 + LDA.l MapField .next_map BIT.w .dungeon_bitmasks,X @@ -480,7 +479,7 @@ DrawHUDDungeonItems: STA.w $1686,Y ; reload - LDA.l $7EF368 + LDA.l MapField ..skip_map INX : INX @@ -498,7 +497,7 @@ DrawHUDDungeonItems: LDX.w #0 ; load once and test multiple times - LDA.l $7EF364 + LDA.l CompassField .next_compass BIT.w .dungeon_bitmasks,X @@ -509,7 +508,7 @@ DrawHUDDungeonItems: STA.w $16C6,Y ; reload - LDA.l $7EF364 + LDA.l CompassField ..skip_compass INX : INX @@ -542,7 +541,7 @@ DrawPendantCrystalDiagram: INX #2 : CPX.w #$0014 : BCC - ; pendants - LDA $7EF374 + LDA PendantsField LSR : BCC + ; pendant of wisdom (red) LDX.w #$252B @@ -569,7 +568,7 @@ DrawPendantCrystalDiagram: ; crystals - LDA $7EF37A + LDA CrystalsField LDX.w #$2D44 LDY.w #$2D45 @@ -675,4 +674,4 @@ dw $A8FB, $A8F9, $A8F9, $A8F9, $A8F9, $A8F9, $A8F9, $A8F9, $A8F9, $E8FB ;0x1A - Ganon's Tower ;0x1C - ??? possibly unused. (Were they planning two extra dungeons perhaps?) ;0x1E - ??? possibly unused. -;================================================================================ \ No newline at end of file +;================================================================================ diff --git a/playername.asm b/playername.asm index 68dbb8f..2a820b6 100644 --- a/playername.asm +++ b/playername.asm @@ -1,30 +1,35 @@ ; Note shortly before this we have a blank-the-sram slot code that we might want to hook WriteBlanksToPlayerName: - STA.l !ExtendedPlayerName - STA.l !ExtendedPlayerName+2 - STA.l !ExtendedPlayerName+4 - STA.l !ExtendedPlayerName+6 + STA.l ExtendedFileNameSRAM + STA.l ExtendedFileNameSRAM+2 + STA.l ExtendedFileNameSRAM+4 + STA.l ExtendedFileNameSRAM+6 - STA.l !ExtendedPlayerName+8 - STA.l !ExtendedPlayerName+10 - STA.l !ExtendedPlayerName+12 - STA.l !ExtendedPlayerName+14 + STA.l ExtendedFileNameSRAM+8 + STA.l ExtendedFileNameSRAM+10 + STA.l ExtendedFileNameSRAM+12 + STA.l ExtendedFileNameSRAM+14 - STA.l $7003D9, X ;What we wrote over (clear first byte of vanilla name slot) + STA.l ExtendedFileNameSRAM+16 + STA.l ExtendedFileNameSRAM+18 + STA.l ExtendedFileNameSRAM+20 + STA.l ExtendedFileNameSRAM+22 + + STA.l $7003D9, X ;What we wrote over (clear first byte of vanilla name slot) RTL WriteCharacterToPlayerName: - CPX.w #$0008 : !BLT .orig - STA !ExtendedPlayerName-8, X - .orig - STA $7003D9, X ;what we wrote over + STA ExtendedFileNameSRAM, X + CPX.w #$0008 : !BGE + + STA $7003D9, X ;what we wrote over + + RTL ReadCharacterFromPlayerName: ;Only for use on Name Screen - CPX.w #$0008 : !BLT .orig - LDA !ExtendedPlayerName-8, X - .orig - LDA $7003D9, X ;what we wrote over + LDA ExtendedFileNameSRAM, X + CPX.w #$0008 : !BGE + + LDA $7003D9, X ;what we wrote over + + RTL GetCharacterPosition: diff --git a/potions.asm b/potions.asm index f5985c0..5e9b4c6 100644 --- a/potions.asm +++ b/potions.asm @@ -15,19 +15,19 @@ RefillHealth: LDA.l PotionHealthRefill : CMP.b #$A0 : !BGE .done LDA !BUSY_HEALTH : BNE ++ LDA.l PotionHealthRefill ; load refill amount - !ADD $7EF36D ; add to current health - CMP $7EF36C : !BLT +++ : LDA $7EF36C : +++ + !ADD CurrentHealth ; add to current health + CMP HealthCapacity : !BLT +++ : LDA HealthCapacity : +++ STA !BUSY_HEALTH ++ - LDA $7EF36D : CMP.l !BUSY_HEALTH : !BLT ++ - LDA.b #$00 : STA $7EF372 + LDA CurrentHealth : CMP.l !BUSY_HEALTH : !BLT ++ + LDA.b #$00 : STA HeartsFiller LDA $020A : BNE .notDone LDA.b #$00 : STA !BUSY_HEALTH SEC RTL ++ - LDA.b #$08 : STA $7EF372 ; refill some health + LDA.b #$08 : STA HeartsFiller ; refill some health .notDone CLC RTL @@ -35,16 +35,16 @@ RefillHealth: ; Check goal health versus actual health. ; if(actual < goal) then branch. - LDA $7EF36D : CMP $7EF36C : BCC .refillAllHealth - LDA $7EF36C : STA $7EF36D - LDA.b #$00 : STA $7EF372 + LDA CurrentHealth : CMP HealthCapacity : BCC .refillAllHealth + LDA HealthCapacity : STA CurrentHealth + LDA.b #$00 : STA HeartsFiller ; ??? not sure what purpose this branch serves. LDA $020A : BNE .beta SEC RTL .refillAllHealth ; Fill up ze health. - LDA.b #$A0 : STA $7EF372 + LDA.b #$A0 : STA HeartsFiller .beta CLC RTL @@ -62,27 +62,27 @@ RefillMagic: LDA.l PotionMagicRefill : CMP.b #$80 : !BGE .done LDA !BUSY_MAGIC : BNE ++ LDA.l PotionMagicRefill ; load refill amount - !ADD $7EF36E ; add to current magic + !ADD CurrentMagic ; add to current magic CMP.b #$80 : !BLT +++ : LDA.b #$80 : +++ STA !BUSY_MAGIC ++ - LDA $7EF36E : CMP.l !BUSY_MAGIC : !BLT ++ + LDA CurrentMagic : CMP.l !BUSY_MAGIC : !BLT ++ LDA.b #$00 : STA !BUSY_MAGIC SEC RTL ++ - LDA.b #$01 : STA $7EF373 ; refill some magic + LDA.b #$01 : STA MagicFiller ; refill some magic CLC RTL .done SEP #$30 ; Check if Link's magic meter is full - LDA $7EF36E : CMP.b #$80 + LDA CurrentMagic : CMP.b #$80 BCS .itsFull ; Tell the magic meter to fill up until it's full. - LDA.b #$80 : STA $7EF373 + LDA.b #$80 : STA MagicFiller SEP #$30 RTL .itsFull diff --git a/quickswap.asm b/quickswap.asm index e73938c..d23bddd 100644 --- a/quickswap.asm +++ b/quickswap.asm @@ -28,7 +28,7 @@ QuickSwap: BRA .store .special_swap - LDA !INVENTORY_SWAP_2 : ORA #$01 : STA !INVENTORY_SWAP_2 + LDA BowTracking : ORA #$01 : STA BowTracking CPX.b #$02 : BEQ + ; boomerang CPX.b #$01 : BEQ + ; bow CPX.b #$05 : BEQ + ; powder @@ -50,10 +50,10 @@ RTL RCode: LDX.w $0202 LDA.b $F2 : BIT #$20 : BNE ++ ; Still holding L from a previous frame - LDA !INVENTORY_SWAP_2 : AND #$FE : STA !INVENTORY_SWAP_2 + LDA BowTracking : AND #$FE : STA BowTracking BRA + ++ - LDA !INVENTORY_SWAP_2 : BIT #$01 : BEQ + + LDA BowTracking : BIT #$01 : BEQ + RTS - + CPX.b #$14 : BNE + : LDX.b #$00 ;will wrap around to 1 @@ -65,10 +65,10 @@ RTS LCode: LDX.w $0202 LDA.b $F2 : BIT #$10 : BNE ++ ; Still holding R from a previous frame - LDA !INVENTORY_SWAP_2 : AND #$FE : STA !INVENTORY_SWAP_2 + LDA BowTracking : AND #$FE : STA BowTracking BRA + ++ - LDA !INVENTORY_SWAP_2 : BIT #$01 : BEQ + + LDA BowTracking : BIT #$01 : BEQ + RTS - + CPX.b #$01 : BNE + : LDX.b #$15 ; will wrap around to $14 diff --git a/retro.asm b/retro.asm index d073cc4..477f4a8 100644 --- a/retro.asm +++ b/retro.asm @@ -10,13 +10,13 @@ RTL LoadBombCount: LDA !INFINITE_BOMBS : BNE .infinite .finite - LDA $7EF343 + LDA BombsEquipment .infinite RTL LoadBombCount16: LDA !INFINITE_BOMBS : AND.w #$00FF : BNE .infinite .finite - LDA $7EF343 + LDA BombsEquipment .infinite RTL StoreBombCount: @@ -24,13 +24,13 @@ StoreBombCount: .infinite PLA : LDA.b #$01 : RTL .finite - PLA : STA $7EF343 + PLA : STA BombsEquipment RTL SearchForEquippedItem: LDA !INFINITE_BOMBS : BEQ + LDA.b #$01 : LDX.b #$00 : RTL + - LDA $7EF340 ; thing we wrote over + LDA BowEquipment ; thing we wrote over RTL !INFINITE_ARROWS = "$7F50C8" @@ -40,8 +40,8 @@ DecrementArrows: .infinite LDA.b #$01 : RTL .normal - LDA $7EF377 : BEQ .done - DEC : STA $7EF377 : INC + LDA CurrentArrows : BEQ .done + DEC : STA CurrentArrows : INC BRA .done .rupees REP #$20 @@ -51,17 +51,17 @@ DecrementArrows: LDA.b #$00 : BRA .done .not_archery_game - LDA.l $7EF377 : BNE .shoot_arrow ; check if we have arrows + LDA.l CurrentArrows : BNE .shoot_arrow ; check if we have arrows BRA .done .shoot_arrow PHX REP #$20 - LDA $7EF360 : BEQ + - PHA : LDA $7EF340 : DEC : AND #$0002 : TAX : PLA + LDA TargetRupees : BEQ + + PHA : LDA BowEquipment : DEC : AND #$0002 : TAX : PLA !SUB.l ArrowModeWoodArrowCost, X ; CMP.w #$0000 BMI .not_enough_money - STA $7EF360 : LDA.w #$0001 : BRA + + STA TargetRupees : LDA.w #$0001 : BRA + .not_enough_money LDA.w #$0000 + @@ -76,13 +76,13 @@ ArrowGame: DEC $0B99 ; reduce minigame arrow count LDA.l ArrowMode : BNE .rupees .normal - LDA $7EF377 : INC #2 : STA $7EF377 ; increment arrow count (by 2 for some reason) + LDA CurrentArrows : INC #2 : STA CurrentArrows ; increment arrow count (by 2 for some reason) RTL .rupees PHX REP #$20 ; set 16-bit accumulator - LDA $7EF340 : DEC : AND #$0002 : TAX - LDA $7EF360 : !ADD.l ArrowModeWoodArrowCost, X : STA $7EF360 + LDA BowEquipment : DEC : AND #$0002 : TAX + LDA TargetRupees : !ADD.l ArrowModeWoodArrowCost, X : STA TargetRupees SEP #$20 ; set 8-bit accumulator PLX + diff --git a/rngfixes.asm b/rngfixes.asm index 33cddff..adb3d1c 100644 --- a/rngfixes.asm +++ b/rngfixes.asm @@ -97,7 +97,7 @@ RNG_Ganon_Extra_Warp: PLA RTL RNG_Enemy_Drops: - LDA.l $7EF3C5 : CMP #$01 : BEQ + ; drops are static after uncle pickup & before rescuing zelda + LDA.l ProgressIndicator : CMP #$01 : BEQ + ; drops are static after uncle pickup & before rescuing zelda JML GetRandomInt + LDA.b #$0F diff --git a/roomloading.asm b/roomloading.asm index d545b29..2e07057 100644 --- a/roomloading.asm +++ b/roomloading.asm @@ -84,7 +84,7 @@ IcePalaceBombosNE: RTL CastleEastEntrance: - LDA $7EF3C5 : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1) + LDA ProgressIndicator : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1) LDA.l BlockCastleDoorsInRain : BNE + : RTL : + REP #$20 ; 16 A @@ -115,7 +115,7 @@ CastleEastEntrance: RTL CastleWestEntrance: - LDA $7EF3C5 : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1) + LDA ProgressIndicator : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1) LDA.l BlockCastleDoorsInRain : BNE + : RTL : + REP #$20 ; 16 A diff --git a/rupeelimit.asm b/rupeelimit.asm index b17f56b..8c573d0 100644 --- a/rupeelimit.asm +++ b/rupeelimit.asm @@ -11,7 +11,7 @@ Draw4DigitRupees: BRA .print .outdoors .normal - LDA $7EF362 + LDA CurrentRupees .print JSL.l HexToDec LDA $7F5004 : AND.w #$00FF : ORA.w #$2400 : STA $7EC750 @@ -19,4 +19,4 @@ Draw4DigitRupees: LDA $7F5006 : AND.w #$00FF : ORA.w #$2400 : STA $7EC754 LDA $7F5007 : AND.w #$00FF : ORA.w #$2400 : STA $7EC756 RTL -;================================================================================ \ No newline at end of file +;================================================================================ diff --git a/shopkeeper.asm b/shopkeeper.asm index 4132011..8b29c55 100644 --- a/shopkeeper.asm +++ b/shopkeeper.asm @@ -168,7 +168,7 @@ SpritePrep_ShopKeeper: PHY PHX LDA.b #$00 : XBA : TYA : LSR #2 : !ADD !SHOP_SRAM_INDEX : TAX - LDA !SHOP_PURCHASE_COUNTS, X : TYX : STA.l !SHOP_INVENTORY+3, X : TAY + LDA PurchaseCounts, X : TYX : STA.l !SHOP_INVENTORY+3, X : TAY PLX LDA.l ShopContentsTable+4, X : BEQ ++ @@ -214,7 +214,7 @@ SpritePrep_ShopKeeper: .takeAll LDA.b #$00 : XBA : LDA !SHOP_SRAM_INDEX : TAX - LDA.l !SHOP_PURCHASE_COUNTS, X + LDA.l PurchaseCounts, X BRA ++ .notTakeAll LDA.b #$00 @@ -266,7 +266,7 @@ RTS ;!SHOP_INVENTORY, X ;[id][$lo][$hi][purchase_counter] ;-------------------------------------------------------------------------------- -;!SHOP_PURCHASE_COUNTS = "$7EF302" +;PurchaseCounts = "$7EF51A" ;-------------------------------------------------------------------------------- Shopkeeper_UploadVRAMTilesLong: JSR.w Shopkeeper_UploadVRAMTiles @@ -390,13 +390,13 @@ Sprite_ShopKeeper: BIT.b #$20 : BNE + ; Not A Take-All PHX LDA !SHOP_SRAM_INDEX : TAX - LDA !SHOP_PURCHASE_COUNTS, X : BEQ ++ : PLX : BRA .done : ++ + LDA PurchaseCounts, X : BEQ ++ : PLX : BRA .done : ++ PLX BRA .normal + ; Take-All ;PHX ; LDA !SHOP_SRAM_INDEX : TAX - ; LDA.w !SHOP_PURCHASE_COUNTS, X : STA.l !SHOP_STATE + ; LDA.w PurchaseCounts, X : STA.l !SHOP_STATE ;PLX .normal @@ -539,7 +539,7 @@ Shopkeeper_BuyItem: + LDA !SHOP_TYPE : AND.b #$80 : BNE .buy ; don't charge if this is a take-any - REP #$20 : LDA $7EF360 : CMP.l !SHOP_INVENTORY+1, X : SEP #$20 : !BGE .buy + REP #$20 : LDA TargetRupees : CMP.l !SHOP_INVENTORY+1, X : SEP #$20 : !BGE .buy .cant_afford LDA.b #$7A @@ -555,7 +555,7 @@ Shopkeeper_BuyItem: JMP .done .buy LDA !SHOP_TYPE : AND.b #$80 : BNE ++ ; don't charge if this is a take-any - REP #$20 : LDA $7EF360 : !SUB !SHOP_INVENTORY+1, X : STA $7EF360 : SEP #$20 ; Take price away + REP #$20 : LDA TargetRupees : !SUB !SHOP_INVENTORY+1, X : STA TargetRupees : SEP #$20 ; Take price away ++ LDA.l !SHOP_INVENTORY, X : TAY : JSL.l Link_ReceiveItem LDA.l !SHOP_INVENTORY+3, X : INC : STA.l !SHOP_INVENTORY+3, X @@ -565,7 +565,7 @@ Shopkeeper_BuyItem: LDA.l !SHOP_STATE : ORA.w Shopkeeper_ItemMasks, X : STA.l !SHOP_STATE PHX TXA : !ADD !SHOP_SRAM_INDEX : TAX - LDA !SHOP_PURCHASE_COUNTS, X : INC : BEQ +++ : STA !SHOP_PURCHASE_COUNTS, X : +++ + LDA PurchaseCounts, X : INC : BEQ +++ : STA PurchaseCounts, X : +++ PLX BRA ++ + ; Take-any @@ -573,11 +573,11 @@ Shopkeeper_BuyItem: BIT.b #$20 : BNE .takeAll .takeAny LDA.l !SHOP_STATE : ORA.b #$07 : STA.l !SHOP_STATE - PHX : LDA.l !SHOP_SRAM_INDEX : TAX : LDA.b #$01 : STA.l !SHOP_PURCHASE_COUNTS, X : PLX + PHX : LDA.l !SHOP_SRAM_INDEX : TAX : LDA.b #$01 : STA.l PurchaseCounts, X : PLX BRA ++ .takeAll LDA.l !SHOP_STATE : ORA.w Shopkeeper_ItemMasks, X : STA.l !SHOP_STATE - PHX : LDA.l !SHOP_SRAM_INDEX : TAX : LDA.l !SHOP_STATE : STA.l !SHOP_PURCHASE_COUNTS, X : PLX + PHX : LDA.l !SHOP_SRAM_INDEX : TAX : LDA.l !SHOP_STATE : STA.l PurchaseCounts, X : PLX ++ .done PLY : PLX @@ -587,7 +587,7 @@ db #$01, #$02, #$04 ;-------------------- ;!SHOP_ID = "$7F5050" ;!SHOP_SRAM_INDEX = "$7F5062" -;!SHOP_PURCHASE_COUNTS = "$7EF302" +;PurchaseCounts = "$7EF51A" ;-------------------- Setup_ShopItemCollisionHitbox: ;The complications with XBA are to handle the fact that nintendo likes to store diff --git a/spriteswap.asm b/spriteswap.asm index ab5e82c..def5ead 100644 --- a/spriteswap.asm +++ b/spriteswap.asm @@ -39,7 +39,7 @@ SpriteSwap_Palette_ArmorAndGloves: SEP #$30 LDA !SPRITE_SWAP : BNE .continue REP #$30 - LDA $7EF354 + LDA GloveEquipment JSL $1BEE21 ; Read Original Palette Code RTL diff --git a/sram.asm b/sram.asm index d7bea70..cc30c26 100644 --- a/sram.asm +++ b/sram.asm @@ -98,48 +98,51 @@ skip 1 ; Not used SwordEquipment: skip 1 ; $01 = Fighter | $02 = Master | $03 = Tempered | $04 = Gold ShieldEquipment: skip 1 ; $01 = Fighter | $02 = Red | $03 = Mirror ArmorEquipment: skip 1 ; $00 = Green | $01 = Blue | $02 = Red -BottleContentsOne: skip 1 ; \ Bottle Contents +BottleContents: ; \ Bottle Contents +BottleContentsOne: skip 1 ; | BottleContentsTwo: skip 1 ; | $00 = No Bottle | $01 = Mushroom | $02 = Empty Bottle BottleContentsThree: skip 1 ; | $03 = Red Potion | $04 = Green Potion | $05 = Blue Potion BottleContentsFour: skip 1 ; / $06 = Fairy | $07 = Bee | $08 = Good Bee TargetRupees: skip 2 ; \ CurrentRupees will always increment or decrement to match CurrentRupees: skip 2 ; / TargetRupees if not equal (16-bit integer) ;-------------------------------------------------------------------------------- - ; Dungeon item bitfields -CompassFieldOne: skip 2 ; \ - - g r t h i s -BigKeyFieldOne: skip 2 ; | g = Ganon's Tower | r = Turtle Rock | t = Thieves' Town -MapFieldOne: skip -3 ; / h = Tower of Hera | i = Ice Palace | s = Skull Woods -CompassFieldTwo: skip 2 ; \ m d s a t e h p -BigKeyFieldTwo: skip 2 ; | m = Misery Mire | d = Palace of Darkness | s = Swamp Palace -MapFieldTwo: skip 1 ; | a = Aga Tower | t = Desert Palace | e = Eastern Palace - ; / h = Hyrule Castle | s = Sewer Passage +CompassField: skip 2 ; Dungeon item bitfields +BigKeyField: skip 2 ; Low byte: - - g r t h i s +MapField: skip 2 ; g = Ganon's Tower | r = Turtle Rock | t = Thieves' Town + ; h = Tower of Hera | i = Ice Palace | s = Skull Woods + ;------------------------------------------------ + ; High Byte: m d s a t e h p + ; m = Misery Mire | d = Palace of Darkness | s = Swamp Palace + ; a = Aga Tower | t = Desert Palace | e = Eastern Palace + ; h = Hyrule Castle | s = Sewer Passage ;-------------------------------------------------------------------------------- ; HUD & other equipment skip 1 ; Wishing Pond Rupee (Unused) -HeartPieceFraction: skip 1 ; Heart pieces of four for upgrade. Wraps around to $00 after $03. +HeartPieceQuarter: skip 1 ; Heart pieces of four for health upgrade. Wraps around to $00 after $03. HealthCapacity: skip 1 ; \ Health Capacity & Current Health CurrentHealth: skip 1 ; / Max value is $A0 | $04 = half heart | $08 = heart CurrentMagic: skip 1 ; Current magic | Max value is $80 CurrentSmallKeys: skip 1 ; Number of small keys held for current dungeon (integer) BombCapacityUpgrades: skip 1 ; \ Bomb & Arrow Capacity Upgrades ArrowCapacityUpgrades: skip 1 ; / Indicates flatly how many can be held above vanilla max (integers) -HeartFiller: skip 1 ; Hearts collected yet to be filled. Write in multiples of $08 +HeartsFiller: skip 1 ; Hearts collected yet to be filled. Write in multiples of $08 MagicFiller: skip 1 ; Magic collected yet to be filled -PendantsField: skip 1 ; - - - - - g b r (bitfield) +PendantsField: skip 1 ; - - - - - g b r (bitfield) ; g = Green (Courage) | b = Blue (Power) | r = Red (Wisdom) -BombFiller: skip 1 ; Bombs collected yet to be filled (integer) -ArrowFiller: skip 1 ; Arrows collected yet to be filled (integer) +BombsFiller: skip 1 ; Bombs collected yet to be filled (integer) +ArrowsFiller: skip 1 ; Arrows collected yet to be filled (integer) CurrentArrows: skip 1 ; Current arrows (integer) skip 1 ; Unknown AbilityFlags: skip 1 ; - r t - p d s - (bitfield) ; r = Read | t = Talk | p = Pull | d = Dash ; s = Swim -CurrentCrystals: skip 1 ; - 3 4 2 7 5 1 6 (bitfield) +CrystalsField: skip 1 ; - 3 4 2 7 5 1 6 (bitfield) MagicConsumption: skip 1 ; $00 = Normal | $01 = Half Magic | $02 = Quarter Magic ;-------------------------------------------------------------------------------- ; Small keys earned per dungeon (integers) -SewerKeys: skip 1 ; \ Hyrule Castle and Sewer keys typically increment -HyruleCastleKeys: skip 1 ; / and decrement together +SewerKeys: skip 1 ; \ Hyrule Castle and Sewer keys typically increment +DungeonKeys: ; | and decrement together +HyruleCastleKeys: skip 1 ; / EasternKeys: skip 1 ; Eastern Palace small keys DesertKeys: skip 1 ; Desert Palace small keys CastleTowerKeys: skip 1 ; Agahnim's Tower small keys @@ -152,7 +155,8 @@ HeraKeys: skip 1 ; Tower of Hera small keys ThievesTownKeys: skip 1 ; Thieves' Town small keys TurtleRockKeys: skip 1 ; Turtle Rock small keys GanonsTowerKeys: skip 1 ; Ganon's Tower small keys -skip 2 ; Unused +skip 1 ; Unused +CurrentGenericKeys: skip 1 ; Generic small keys ;================================================================================ ; Tracking & Indicators ($7EF38C - $7EF3F0) @@ -166,9 +170,9 @@ BowTracking: skip 2 ; b s p - - - - - (bitfield) ; The front end writes two distinct progressive bow items. p ; indicates whether the "second" has been found independent of ; the first -ItemLimitCounts: skip 3 ; Keeps track of limited non-progressive items such as lamp. +ItemLimitCounts: skip 10 ; Keeps track of limited non-progressive items such as lamp. ; See: ItemSubstitutionRules in tables.asm -skip 50 ; +skip 43 ; ProgressIndicator: skip 1 ; $00 = Pre-Uncle | $01 = Post-Uncle item | $02 = Zelda Rescued ; $03 = Agahnim 1 defeated ; $04 and above don't do anything. $00-$02 used in standard mode @@ -382,28 +386,25 @@ assert BottleContentsFour = $7EF35F, "BottleContentsFour labeled at incorrec assert TargetRupees = $7EF360, "TargetRupees labeled at incorrect address" assert CurrentRupees = $7EF362, "CurrentRupees labeled at incorrect address" ;-------------------------------------------------------------------------------- -assert CompassFieldOne = $7EF364, "Compass bitfield labeled at incorrect address" -assert CompassFieldTwo = $7EF365, "Compass bitfield labeled at incorrect address" -assert BigKeyFieldOne = $7EF366, "Big Key item bitfield labeled at incorrect address" -assert BigKeyFieldTwo = $7EF367, "Big Key item bitfield labeled at incorrect address" -assert MapFieldOne = $7EF368, "Map item bitfield labeled at incorrect address" -assert MapFieldTwo = $7EF369, "Map item bitfield labeled at incorrect address" +assert CompassField = $7EF364, "Compass bitfield labeled at incorrect address" +assert BigKeyField = $7EF366, "Big Key item bitfield labeled at incorrect address" +assert MapField = $7EF368, "Map item bitfield labeled at incorrect address" ;-------------------------------------------------------------------------------- -assert HeartPieceFraction = $7EF36B, "HeartPieceFraction labeled at incorrect address" +assert HeartPieceQuarter = $7EF36B, "HeartPieceQuarter labeled at incorrect address" assert HealthCapacity = $7EF36C, "HealthCapacity labeled at incorrect address" assert CurrentHealth = $7EF36D, "CurrentHealth labeled at incorrect address" assert CurrentMagic = $7EF36E, "CurrentMagic labeled at incorrect address" assert CurrentSmallKeys = $7EF36F, "CurrentSmallKeys labeled at incorrect address" assert BombCapacityUpgrades = $7EF370, "BombCapacityUpgrades labeled at incorrect address" assert ArrowCapacityUpgrades = $7EF371, "ArrowCapacityUpgrades labeled at incorrect address" -assert HeartFiller = $7EF372, "HeartFiller labeled at incorrect address" +assert HeartsFiller = $7EF372, "HeartsFiller labeled at incorrect address" assert MagicFiller = $7EF373, "MagicFiller labeled at incorrect address" assert PendantsField = $7EF374, "PendantsField labeled at incorrect address" -assert BombFiller = $7EF375, "BombFiller labeled at incorrect address" -assert ArrowFiller = $7EF376, "ArrowFiller labeled at incorrect address" +assert BombsFiller = $7EF375, "BombsFiller labeled at incorrect address" +assert ArrowsFiller = $7EF376, "ArrowsFiller labeled at incorrect address" assert CurrentArrows = $7EF377, "CurrentArrows labeled at incorrect address" assert AbilityFlags = $7EF379, "AbilityFlags labeled at incorrect address" -assert CurrentCrystals = $7EF37A, "CurrentCrystals labeled at incorrect address" +assert CrystalsField = $7EF37A, "CrystalsField labeled at incorrect address" assert MagicConsumption = $7EF37B, "MagicConsumption labeled at incorrect address" ;-------------------------------------------------------------------------------- assert SewerKeys = $7EF37C, "SewerKeys labeled at incorrect address" @@ -420,6 +421,7 @@ assert HeraKeys = $7EF386, "HeraKeys labeled at incorrect address" assert ThievesTownKeys = $7EF387, "ThievesTownKeys labeled at incorrect address" assert TurtleRockKeys = $7EF388, "TurtleRockKeys labeled at incorrect address" assert GanonsTowerKeys = $7EF389, "GanonsTowerKeys labeled at incorrect address" +assert CurrentGenericKeys = $7EF38B, "CurrentGenericKeys labeled at incorrect address" ;-------------------------------------------------------------------------------- assert ProgressIndicator = $7EF3C5, "ProgressIndicator labeled at incorrect address" assert ProgressFlags = $7EF3C6, "ProgressFlags labeled at incorrect address" diff --git a/stats.asm b/stats.asm index 40df03a..30f6cb7 100644 --- a/stats.asm +++ b/stats.asm @@ -107,9 +107,9 @@ ;-------------------------------------------------------------------------------- ; $7EF44B - flute counter ;-------------------------------------------------------------------------------- -; $7EF44Cl[3] - RTA-Timestamp (Start) +; $7EF44Cl[3] - Unused ;-------------------------------------------------------------------------------- -; $7EF44Fl[3] - RTA-Timestamp (End) +; $7EF44Fl[3] - Unused ;-------------------------------------------------------------------------------- ; $7EF452 - sssscccc ; s - swordless bosses @@ -182,10 +182,10 @@ DungeonHoleEntranceTransition: LDA.l SilverArrowsAutoEquip : AND.b #$02 : BEQ + LDA $010E : CMP.b #$7B : BNE + ; skip unless falling to ganon's room - LDA !INVENTORY_SWAP_2 : AND.b #$40 : BEQ + ; skip if we don't have silvers - LDA $7EF340 : BEQ + ; skip if we have no bow + LDA BowTracking : AND.b #$40 : BEQ + ; skip if we don't have silvers + LDA BowEquipment : BEQ + ; skip if we have no bow CMP.b #$03 : !BGE + ; skip if the bow is already silver - !ADD #$02 : STA $7EF340 ; increase bow to silver + !ADD #$02 : STA BowEquipment ; increase bow to silver + BRA StatTransitionCounter @@ -218,7 +218,7 @@ IncrementFlute: RTL ;-------------------------------------------------------------------------------- IncrementSmallKeys: - STA $7EF36F ; thing we wrote over, write small key count + STA CurrentSmallKeys ; thing we wrote over, write small key count PHX LDA !LOCK_STATS : BNE + JSL AddInventory_incrementKeyLong @@ -230,7 +230,7 @@ IncrementSmallKeys: RTL ;-------------------------------------------------------------------------------- IncrementSmallKeysNoPrimary: - STA $7EF36F ; thing we wrote over, write small key count + STA CurrentSmallKeys ; thing we wrote over, write small key count PHX LDA !LOCK_STATS : BNE + JSL AddInventory_incrementKeyLong @@ -249,7 +249,7 @@ IncrementSmallKeysNoPrimary: RTL ;-------------------------------------------------------------------------------- DecrementSmallKeys: - STA $7EF36F ; thing we wrote over, write small key count + STA CurrentSmallKeys ; thing we wrote over, write small key count JSL.l UpdateKeys RTL ;-------------------------------------------------------------------------------- @@ -302,7 +302,7 @@ RTL IncrementDeathCounter: PHA LDA !LOCK_STATS : BNE + - LDA $7EF36D : BNE + ; link is still alive, skip + LDA CurrentHealth : BNE + ; link is still alive, skip LDA !DEATH_COUNTER : INC : STA !DEATH_COUNTER ;JSL.l DecrementSaveCounter + @@ -311,7 +311,7 @@ RTL ;-------------------------------------------------------------------------------- !FAIRY_COUNTER = "$7EF453" IncrementFairyRevivalCounter: - STA $7EF35C, X ; thing we wrote over + STA BottleContents, X ; thing we wrote over PHA LDA !LOCK_STATS : BNE + LDA !FAIRY_COUNTER : INC : STA !FAIRY_COUNTER @@ -368,7 +368,7 @@ RTL !DAMAGE_COUNTER = $7EF46A !MAGIC_COUNTER = $7EF46C IncrementDamageTakenCounter_Eight: - STA.l $7EF36D + STA.l CurrentHealth PHA : PHP LDA !LOCK_STATS : BNE + REP #$21 @@ -393,11 +393,11 @@ IncrementDamageTakenCounter_Arb: ++ STA.l !DAMAGE_COUNTER + PLP - LDA.l $7EF36D + LDA.l CurrentHealth RTL IncrementMagicUseCounter: - STA.l $7EF36E + STA.l CurrentMagic IncrementMagicUseCounterByrna: PHA : PHP @@ -421,7 +421,7 @@ IncrementMagicUseCounterOne: BEQ ++ STA.l !MAGIC_COUNTER ++ SEP #$20 -+ LDA.l $7EF36E ++ LDA.l CurrentMagic RTL ;-------------------------------------------------------------------------------- @@ -429,7 +429,7 @@ IncrementMagicUseCounterOne: IncrementOWMirror: PHA LDA !LOCK_STATS : BNE + - LDA $7EF3CA : BEQ + ; only do this for DW->LW + LDA CurrentWorld : BEQ + ; only do this for DW->LW LDA !OW_MIRROR_COUNTER : INC : STA !OW_MIRROR_COUNTER + PLA @@ -451,7 +451,7 @@ RTL !SPENT_RUPEES = "$7EF42B" IncrementSpentRupees: DEC A : BPL .subtractRupees - LDA.w #$0000 : STA $7EF360 + LDA.w #$0000 : STA $7EF RTL .subtractRupees PHA : PHP @@ -490,7 +490,6 @@ JMP StatTransitionCounter !RUPEES_COLLECTED = "$7F503C" !ITEM_TOTAL = "$7EF423" -!RTA_END = "$7EF44F" StatsFinalPrep: PHA : PHX : PHP SEP #$30 ; set 8-bit accumulator and index registers @@ -517,27 +516,11 @@ StatsFinalPrep: LDA !NMI_COUNTER+2 : SBC !LOOP_COUNTER+2 : STA !LAG_TIME+2 LDA !NMI_COUNTER+3 : SBC !LOOP_COUNTER+3 : STA !LAG_TIME+3 - LDA !SPENT_RUPEES : !ADD $7EF362 : STA !RUPEES_COLLECTED + LDA !SPENT_RUPEES : !ADD CurrentRupees : STA !RUPEES_COLLECTED LDA !SPENT_RUPEES+1 : ADC $7EF363 : STA !RUPEES_COLLECTED+1 LDA !ITEM_TOTAL : !SUB !CHEST_COUNTER : STA !NONCHEST_COUNTER - - ;LDA $FFFFFF - ;JSL.l Clock_IsSupported - ;BRA + - ; REP #$20 ; set 16-bit accumulator - ; - ; LDA $00 : PHA - ; LDA $02 : PHA - ; - ; JSL.l Clock_QuickStamp - ; LDA $00 : STA !RTA_END - ; LDA $02 : STA !RTA_END+2 - ; - ; PLA : STA $02 - ; PLA : STA $00 - ;+ - + .done PLP : PLX : PLA LDA.b #$19 : STA $10 ; thing we wrote over, load triforce room diff --git a/swordswap.asm b/swordswap.asm index 7dbd635..3a04b02 100644 --- a/swordswap.asm +++ b/swordswap.asm @@ -20,7 +20,7 @@ ;JML.l Smithy_DoesntHaveSword ;================================================================================ ;LoadSwordForDamage: -; LDA $7EF359 : CMP #$04 : BNE .done ; skip if not gold sword +; LDA SwordEquipment : CMP #$04 : BNE .done ; skip if not gold sword ; LDA $1B : BEQ + ; skip if outdoors ; LDA $A0 : CMP #41 : BNE + ; decimal 41 ; skip if not in the mothula room ; LDA #$03 ; pretend we're using tempered @@ -62,20 +62,20 @@ RTL ; $7F50C0 - Sword Modifier LoadModifiedSwordLevel: ; returns short LDA $7F50C0 : BEQ + - !ADD $7EF359 ; add normal sword value to modifier + !ADD SwordEquipment ; add normal sword value to modifier BNE ++ : LDA.b #$01 : RTS : ++ CMP.b #$05 : !BLT ++ : LDA.b #$04 : RTS : ++ RTS + - LDA $7EF359 ; load normal sword value + LDA SwordEquipment ; load normal sword value RTS ;================================================================================ -; $7EF35B - Armor Inventory +; ArmorEquipment - Armor Inventory ; $7F50C2 - Armor Modifier ; $7F5020 - Scratch Space (Caller Preserved) LoadModifiedArmorLevel: PHA - LDA $7EF35B : !ADD $7F50C2 + LDA ArmorEquipment : !ADD $7F50C2 CMP.b #$FF : BNE + : LDA.b #$00 : + CMP.b #$03 : !BLT + : LDA.b #$02 : + STA $7F5020 @@ -83,16 +83,16 @@ LoadModifiedArmorLevel: !ADD $7F5020 RTL ;================================================================================ -; $7EF37B - Magic Inventory +; MagicConsumption - Magic Inventory ; $7F50C3 - Magic Modifier LoadModifiedMagicLevel: LDA $7F50C3 : BEQ + - !ADD $7EF37B ; add normal magic value to modifier + !ADD MagicConsumption ; add normal magic value to modifier CMP.b #$FF : BNE ++ : LDA.b #$00 : RTL : ++ CMP.b #$03 : !BLT ++ : LDA.b #$02 : ++ RTL + - LDA $7EF37B ; load normal magic value + LDA MagicConsumption ; load normal magic value RTL ;================================================================================ ; $7E0348 - Ice Value @@ -116,17 +116,17 @@ RTL ;================================================================================ CheckTabletSword: LDA.l AllowHammerTablets : BEQ + - LDA $7EF34B : BEQ + ; check for hammer + LDA HammerEquipment : BEQ + ; check for hammer LDA.b #$02 : RTL + - LDA $7EF359 ; get actual sword value + LDA SwordEquipment ; get actual sword value RTL ;================================================================================ GetSwordLevelForEvilBarrier: LDA.l AllowHammerEvilBarrierWithFighterSword : BEQ + LDA #$FF : RTL + - LDA $7EF359 + LDA SwordEquipment RTL ;================================================================================ CheckGanonHammerDamage: @@ -143,7 +143,7 @@ GetSmithSword: JML.l Smithy_DoesntHaveSword ; Classic Smithy + - REP #$20 : LDA $7EF360 : CMP #$000A : SEP #$20 : !BGE .buy + REP #$20 : LDA TargetRupees : CMP #$000A : SEP #$20 : !BGE .buy .cant_afford REP #$10 LDA.b #$7A @@ -158,7 +158,7 @@ GetSmithSword: STZ $02E9 ; Item from NPC PHX : JSL Link_ReceiveItem : PLX - REP #$20 : LDA $7EF360 : !SUB.w #$000A : STA $7EF360 : SEP #$20 ; Take 10 rupees + REP #$20 : LDA TargetRupees : !SUB.w #$000A : STA TargetRupees : SEP #$20 ; Take 10 rupees JSL ItemSet_SmithSword .done @@ -170,7 +170,7 @@ CheckMedallionSword: LDA.b #$02 ; Pretend we have master sword RTL .check_sword - LDA $7EF359 + LDA SwordEquipment RTL .check_pad PHB : PHX : PHY @@ -220,7 +220,7 @@ CheckMedallionSword: + .done PLY : PLX : PLB - LDA $7EF359 + LDA SwordEquipment RTL .permit SEP #$20 ; set 8-bit accumulator diff --git a/timer.asm b/timer.asm index 34eb56c..bff9bb2 100644 --- a/timer.asm +++ b/timer.asm @@ -182,8 +182,8 @@ OHKOTimer: LDA.l TimeoutBehavior : CMP #$02 : BNE + LDA !Status : AND.b #$02 : BEQ + .kill - LDA.b #$00 : STA $7EF36D ; kill link + LDA.b #$00 : STA CurrentHealth ; kill link + - LDA $7EF36D + LDA CurrentHealth RTL ;-------------------------------------------------------------------------------- diff --git a/treekid.asm b/treekid.asm index 07e853e..4b9f8bc 100644 --- a/treekid.asm +++ b/treekid.asm @@ -1,9 +1,9 @@ ;================================================================================ ; Tree Kid Fix ;-------------------------------------------------------------------------------- -org $06B12B ; <- 3312B - tree status set - 418 - LDA $7EF3C9 : ORA.b #$08 : STA $7EF3C9 -LDA $7EF3C9 : AND.b #$F7 : STA $7EF3C9 ; unset arboration instead of setting it +org $06B12B ; <- 3312B - tree status set - 418 - LDA NpcFlagsVanilla : ORA.b #$08 : STA NpcFlagsVanilla +LDA NpcFlagsVanilla : AND.b #$F7 : STA NpcFlagsVanilla ; unset arboration instead of setting it ;-------------------------------------------------------------------------------- org $06B072 ; <- 33072 - FluteAardvark_InitialStateFromFluteState - 418 : dw FluteAardvark_AlreadyArborated db #$8B -;================================================================================ \ No newline at end of file +;================================================================================ diff --git a/utilities.asm b/utilities.asm index 209cf58..abadf53 100644 --- a/utilities.asm +++ b/utilities.asm @@ -45,7 +45,7 @@ GetSpriteID: RTL .specialHandling CMP.b #$F9 : BNE ++ ; Progressive Magic - LDA.l $7EF37B : BNE +++ + LDA.l MagicConsumption : BNE +++ LDA.b #$3B : RTL ; Half Magic +++ LDA.b #$3C : RTL ; Quarter Magic @@ -54,13 +54,13 @@ RTL ++ CMP.b #$FB : BNE ++ ; RNG Item (Multi) JSL.l GetRNGItemMulti : JMP GetSpriteID ++ CMP.b #$FD : BNE ++ ; Progressive Armor - LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit + LDA ArmorEquipment : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit LDA.l ProgressiveArmorReplacement JMP GetSpriteID + LDA.b #$04 : RTL ++ CMP.b #$FE : BNE ++ ; Progressive Sword - LDA $7EF359 + LDA SwordEquipment CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit LDA.l ProgressiveSwordReplacement JMP GetSpriteID @@ -85,7 +85,7 @@ RTL + ; Everything Else LDA.b #$2E : RTL ++ : CMP.b #$F8 : BNE ++ ; Progressive Bow - LDA $7EF340 : INC : LSR + LDA BowEquipment : INC : LSR CMP.l ProgressiveBowLimit : !BLT + LDA.l ProgressiveBowReplacement JMP GetSpriteID @@ -183,7 +183,7 @@ GetSpritePalette: RTL .specialHandling CMP.b #$FD : BNE ++ ; Progressive Sword - LDA $7EF359 + LDA SwordEquipment CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit LDA.l ProgressiveSwordReplacement JMP GetSpritePalette @@ -207,7 +207,7 @@ RTL + ; Everything Else LDA.b #$08 : RTL ++ : CMP.b #$FF : BNE ++ ; Progressive Armor - LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit + LDA ArmorEquipment : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit LDA.l ProgressiveArmorReplacement JMP GetSpritePalette + : CMP.b #$00 : BNE + ; Green Tunic @@ -215,12 +215,12 @@ RTL + ; Everything Else LDA.b #$02 : RTL ++ : CMP.b #$FC : BNE ++ ; Progressive Gloves - LDA $7EF354 : BNE + ; No Gloves + LDA GloveEquipment : BNE + ; No Gloves LDA.b #$02 : RTL + ; Everything Else LDA.b #$08 : RTL ++ : CMP.b #$F8 : BNE ++ ; Progressive Bow - LDA $7EF340 : INC : LSR + LDA BowEquipment : INC : LSR CMP.l ProgressiveBowLimit : !BLT + LDA.l ProgressiveBowReplacement JMP GetSpritePalette @@ -307,7 +307,7 @@ IsNarrowSprite: + : JMP .continue .notBottle CMP.b #$5E : BNE ++ ; Progressive Sword - LDA $7EF359 : CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit + LDA SwordEquipment : CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit LDA.l ProgressiveSwordReplacement JSL.l IsNarrowSprite JMP .done @@ -319,7 +319,7 @@ IsNarrowSprite: JSL.l IsNarrowSprite JMP .done ++ CMP.b #$60 : BNE ++ ; Progressive Armor - LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT .continue + LDA ArmorEquipment : CMP.l ProgressiveArmorLimit : !BLT .continue LDA.l ProgressiveArmorReplacement JSL.l IsNarrowSprite JMP .done @@ -330,7 +330,7 @@ IsNarrowSprite: JSL.l GetRNGItemMulti ++ CMP.b #$64 : BEQ + ; Progressive Bow CMP.b #$65 : BNE .continue ; Progressive Bow (alt) - + : LDA $7EF340 : INC : LSR + + : LDA BowEquipment : INC : LSR CMP.l ProgressiveBowLimit : !BLT + LDA.l ProgressiveBowReplacement JSL.l IsNarrowSprite diff --git a/zelda.asm b/zelda.asm index 358d7e8..1a11cc1 100644 --- a/zelda.asm +++ b/zelda.asm @@ -2,16 +2,16 @@ ; Spawn Zelda (or not) ;-------------------------------------------------------------------------------- SpawnZelda: - LDA.l $7EF3CC : CMP #$08 : BEQ + ; don't spawn if dwarf is present + LDA.l FollowerIndicator : CMP #$08 : BEQ + ; don't spawn if dwarf is present CMP #$07 : BEQ + ; don't spawn if frog is present CMP #$0C : BEQ + ; don't spawn if purple chest is present CLC + RTL ;-------------------------------------------------------------------------------- EndRainState: - LDA $7EF3C5 : CMP.b #$02 : !BGE + ; skip if past escape already + LDA ProgressIndicator : CMP.b #$02 : !BGE + ; skip if past escape already LDA.b #$00 : STA !INFINITE_ARROWS : STA !INFINITE_BOMBS : STA !INFINITE_MAGIC - LDA.b #$02 : STA $7EF3C5 ; end rain state + LDA.b #$02 : STA ProgressIndicator ; end rain state JSL MaybeSetPostAgaWorldState + RTL