Replace more labels

Removed mask from rupeelimit.asm as total item counter is now a 16-bit
value
Commented out CountBits in utilities.asm in previous commit as I've
allocated a counter byte in SRAM
This commit is contained in:
cassidy
2021-12-06 00:46:05 -05:00
parent c29de40484
commit c1e4ca0053
4 changed files with 25 additions and 52 deletions

View File

@@ -1,46 +1,22 @@
;================================================================================
; Frame Hook
;--------------------------------------------------------------------------------
; $7EF42Ew[2] - loop frame counter (low)
!LOOP_FRAMES_LOW = "$7EF42E"
;--------------------------------------------------------------------------------
; $7EF430w[2] - loop frame counter (high)
!LOOP_FRAMES_HIGH = "$7EF430"
;--------------------------------------------------------------------------------
; $7EF43Ew[2] - nmi frame counter (low)
!NMI_FRAMES_LOW = "$7EF43E"
;--------------------------------------------------------------------------------
; $7EF440w[2] - nmi frame counter (high)
!NMI_FRAMES_HIGH = "$7EF440"
;--------------------------------------------------------------------------------
; $7EF444w[2] - item menu frame counter (low)
!ITEM_FRAMES_LOW = "$7EF444"
;--------------------------------------------------------------------------------
; $7EF446w[2] - item menu frame counter (high)
!ITEM_FRAMES_HIGH = "$7EF446"
;--------------------------------------------------------------------------------
!LOCK_STATS = "$7EF443"
FrameHookAction:
JSL $0080B5 ; Module_MainRouting
JSL CheckMusicLoadRequest
PHP : REP #$30 : PHA
SEP #$20
;LDA EnableSRAMTrace : AND.l TournamentSeedInverse : BEQ +
; LDA $1A : BNE ++ : JSL.l WriteStatusPreview : ++ ; write every 256 frames
;+
LDA !LOCK_STATS : BNE ++
LDA StatsLocked : BNE ++
REP #$20 ; set 16-bit accumulator
LDA !LOOP_FRAMES_LOW : INC : STA !LOOP_FRAMES_LOW : BNE +
LDA !LOOP_FRAMES_HIGH : INC : STA !LOOP_FRAMES_HIGH
LDA LoopFrames : INC : STA LoopFrames : BNE +
LDA LoopFrames+2 : INC : STA LoopFrames+2
+
LDA $10 : CMP.w #$010E : BNE + ; move this to nmi hook?
LDA !ITEM_FRAMES_LOW : INC : STA !ITEM_FRAMES_LOW : BNE +
LDA !ITEM_FRAMES_HIGH : INC : STA !ITEM_FRAMES_HIGH
LDA MenuFrames : INC : STA MenuFrames : BNE +
LDA MenuFrames+2 : INC : STA MenuFrames+2
+
;SEP #$20 ; set 8-bit accumulator ?? check this
++
REP #$30 : PLA : PLP
RTL
@@ -48,9 +24,9 @@ RTL
NMIHookAction:
PHA : PHX : PHY : PHD ; thing we wrote over, push stuff
LDA !LOCK_STATS : AND.w #$00FF : BNE ++
LDA !NMI_FRAMES_LOW : INC : STA !NMI_FRAMES_LOW : BNE +
LDA !NMI_FRAMES_HIGH : INC : STA !NMI_FRAMES_HIGH
LDA StatsLocked : AND.w #$00FF : BNE ++
LDA NMIFrames : INC : STA NMIFrames : BNE +
LDA NMIFrames+2 : INC : STA NMIFrames+2
+
++
@@ -80,4 +56,4 @@ PostNMIHookAction:
LDA $13 : STA $2100 ; thing we wrote over, turn screen back on
JML.l PostNMIHookReturn
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------

View File

@@ -5,9 +5,7 @@ Draw4DigitRupees:
LDA $1B : AND.w #$00FF : BEQ .outdoors ; skip if outdoors
.indoors
LDA $A0 : BNE .normal ; skip except for ganon's room
;LDA #$246E : STA $7EC712
;LDA #$246F : STA $7EC714
LDA $7EF423 : AND #$00FF
LDA TotalItemCounter
BRA .print
.outdoors
.normal

View File

@@ -2,19 +2,19 @@
; Randomize Tablets
;--------------------------------------------------------------------------------
ItemSet_EtherTablet:
PHA : LDA !NPC_FLAGS_2 : ORA.b #$01 : STA !NPC_FLAGS_2 : PLA
PHA : LDA NpcFlags+1 : ORA.b #$01 : STA NpcFlags+1 : PLA
RTL
;--------------------------------------------------------------------------------
ItemSet_BombosTablet:
PHA : LDA !NPC_FLAGS_2 : ORA.b #$02 : STA !NPC_FLAGS_2 : PLA
PHA : LDA NpcFlags+1 : ORA.b #$02 : STA NpcFlags+1 : PLA
RTL
;--------------------------------------------------------------------------------
ItemCheck_EtherTablet:
LDA !NPC_FLAGS_2 : AND.b #$01
LDA NpcFlags+1 : AND.b #$01
RTL
;--------------------------------------------------------------------------------
ItemCheck_BombosTablet:
LDA !NPC_FLAGS_2 : AND.b #$02
LDA NpcFlags+1 : AND.b #$02
RTL
;--------------------------------------------------------------------------------
SetTabletItem:
@@ -132,4 +132,4 @@ DrawNarrowDroppedObject:
PLY
.large_sprite
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------

View File

@@ -1,8 +1,6 @@
;================================================================================
; Utility Functions
;================================================================================
!PROGRESSIVE_SHIELD = "$7EF416" ; ss-- ----
;--------------------------------------------------------------------------------
; GetSpriteTile
; in: A - Loot ID
; out: A - Sprite GFX ID
@@ -60,7 +58,7 @@ RTL
+
LDA.b #$04 : RTL
++ CMP.b #$FE : BNE ++ ; Progressive Sword
LDA SwordEquipment
LDA HighestSword
CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA.l ProgressiveSwordReplacement
JMP GetSpriteID
@@ -74,7 +72,7 @@ RTL
LDA.b #$46 : RTL
+
++ : CMP.b #$FF : BNE ++ ; Progressive Shield
LDA !PROGRESSIVE_SHIELD : AND #$C0 : LSR #6
LDA HighestShield
CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit
LDA.l ProgressiveShieldReplacement
JMP GetSpriteID
@@ -183,7 +181,7 @@ GetSpritePalette:
RTL
.specialHandling
CMP.b #$FD : BNE ++ ; Progressive Sword
LDA SwordEquipment
LDA HighestSword
CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA.l ProgressiveSwordReplacement
JMP GetSpritePalette
@@ -196,7 +194,7 @@ RTL
+ ; Everything Else
LDA.b #$08 : RTL
++ : CMP.b #$FE : BNE ++ ; Progressive Shield
LDA !PROGRESSIVE_SHIELD : AND #$C0 : LSR #6
LDA HighestShield
CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit
LDA.l ProgressiveShieldReplacement
JMP GetSpritePalette
@@ -207,7 +205,8 @@ RTL
+ ; Everything Else
LDA.b #$08 : RTL
++ : CMP.b #$FF : BNE ++ ; Progressive Armor
LDA ArmorEquipment : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit
LDA HighestMail
CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit
LDA.l ProgressiveArmorReplacement
JMP GetSpritePalette
+ : CMP.b #$00 : BNE + ; Green Tunic
@@ -307,19 +306,19 @@ IsNarrowSprite:
+ : JMP .continue
.notBottle
CMP.b #$5E : BNE ++ ; Progressive Sword
LDA SwordEquipment : CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA HighestSword : CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA.l ProgressiveSwordReplacement
JSL.l IsNarrowSprite
JMP .done
+ : JMP .continue
++ CMP.b #$5F : BNE ++ ; Progressive Shield
LDA !PROGRESSIVE_SHIELD : AND #$C0 : BNE + : SEC : JMP .done ; No Shield
+ : LSR #6 : CMP.l ProgressiveShieldLimit : !BLT .continue
LDA HighestShield : BNE + : JMP .done ; No Shield
+ : CMP.l ProgressiveShieldLimit : !BLT .continue
LDA.l ProgressiveShieldReplacement
JSL.l IsNarrowSprite
JMP .done
++ CMP.b #$60 : BNE ++ ; Progressive Armor
LDA ArmorEquipment : CMP.l ProgressiveArmorLimit : !BLT .continue
LDA HighestMail : CMP.l ProgressiveArmorLimit : !BLT .continue
LDA.l ProgressiveArmorReplacement
JSL.l IsNarrowSprite
JMP .done