Refactor inventory code and add more labels
Refactored highest sword, shield, and mail counting Refactored how heart pieces, heart containers, and crystals are counted Moved quickswap lock bit to high byte of InventoryTracking Fixed sword and shield item downgrade Added PreFluteLocations counter
This commit is contained in:
@@ -125,12 +125,12 @@ GetRequiredCrystalsInX:
|
|||||||
RTL
|
RTL
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
CheckEnoughCrystalsForGanon:
|
CheckEnoughCrystalsForGanon:
|
||||||
LDA CrystalsField : JSL CountBits ; the comparison is against 1 less
|
LDA CrystalCounter
|
||||||
CMP.l NumberOfCrystalsRequiredForGanon
|
CMP.l NumberOfCrystalsRequiredForGanon
|
||||||
RTL
|
RTL
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
CheckEnoughCrystalsForTower:
|
CheckEnoughCrystalsForTower:
|
||||||
LDA CrystalsField : JSL CountBits ; the comparison is against 1 less
|
LDA CrystalCounter
|
||||||
CMP.l NumberOfCrystalsRequiredForTower
|
CMP.l NumberOfCrystalsRequiredForTower
|
||||||
RTL
|
RTL
|
||||||
|
|
||||||
|
|||||||
261
inventory.asm
261
inventory.asm
@@ -1,19 +1,19 @@
|
|||||||
;================================================================================
|
;================================================================================
|
||||||
; Inventory Updates
|
; Inventory Updates
|
||||||
;================================================================================
|
;================================================================================
|
||||||
!INVENTORY_SWAP = "$7EF38C"
|
|
||||||
; Item Tracking Slot
|
; Item Tracking Slot
|
||||||
; brmpnskf
|
; InventoryTracking
|
||||||
; b = blue boomerang
|
; brmpnskf -------q
|
||||||
; r = red boomerang
|
; b = blue boomerang |
|
||||||
; m = mushroom current
|
; r = red boomerang |
|
||||||
; p = magic powder
|
; m = mushroom current |
|
||||||
; n = mushroom past
|
; p = magic powder |
|
||||||
; s = shovel
|
; n = mushroom past |
|
||||||
; k = fake flute
|
; s = shovel |
|
||||||
; f = working flute
|
; k = fake flute |
|
||||||
|
; f = working flute |
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
!INVENTORY_SWAP_2 = "$7EF38E"
|
; BowTracking
|
||||||
; Item Tracking Slot #2
|
; Item Tracking Slot #2
|
||||||
; bsp-----
|
; bsp-----
|
||||||
; b = bow
|
; b = bow
|
||||||
@@ -23,13 +23,13 @@
|
|||||||
; -
|
; -
|
||||||
; -
|
; -
|
||||||
; -
|
; -
|
||||||
; q = quickswap lock
|
; -
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
; ProcessMenuButtons:
|
; ProcessMenuButtons:
|
||||||
; out: Carry - 0 = No Button, 1 = Yes Button
|
; out: Carry - 0 = No Button, 1 = Yes Button
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
ProcessMenuButtons:
|
ProcessMenuButtons:
|
||||||
;LDA #$FD : STA !INVENTORY_SWAP ; DEBUG MODE
|
;LDA #$FD : STA InventoryTracking ; DEBUG MODE
|
||||||
;LDA $F6 : BIT #$20 : BNE .l_pressed ; check for P1 L-button
|
;LDA $F6 : BIT #$20 : BNE .l_pressed ; check for P1 L-button
|
||||||
LDA $F4 : BIT #$40 : BNE .y_pressed ; check for P1 Y-button
|
LDA $F4 : BIT #$40 : BNE .y_pressed ; check for P1 Y-button
|
||||||
BIT #$20 : BNE .sel_pressed ; check for P1 Select button
|
BIT #$20 : BNE .sel_pressed ; check for P1 Select button
|
||||||
@@ -57,12 +57,12 @@ RTL
|
|||||||
LDA.b #$10 : STA $0207
|
LDA.b #$10 : STA $0207
|
||||||
LDA $0202 ; check selected item
|
LDA $0202 ; check selected item
|
||||||
CMP #$02 : BNE + ; boomerang
|
CMP #$02 : BNE + ; boomerang
|
||||||
LDA !INVENTORY_SWAP : AND #$C0 : CMP #$C0 : BNE .errorJump ; make sure we have both boomerangs
|
LDA InventoryTracking : AND #$C0 : CMP #$C0 : BNE .errorJump ; make sure we have both boomerangs
|
||||||
LDA $7EF341 : EOR #$03 : STA $7EF341 ; swap blue & red boomerang
|
LDA BoomerangEquipment : EOR #$03 : STA BoomerangEquipment ; swap blue & red boomerang
|
||||||
LDA.b #$20 : STA $012F ; menu select sound
|
LDA.b #$20 : STA $012F ; menu select sound
|
||||||
JMP .captured
|
JMP .captured
|
||||||
+ CMP #$01 : BNE + ; bow
|
+ CMP #$01 : BNE + ; bow
|
||||||
LDA !INVENTORY_SWAP_2 : AND #$C0 : CMP #$C0 : BNE .errorJump ; make sure we have both bows
|
LDA BowTracking : AND #$C0 : CMP #$C0 : BNE .errorJump ; make sure we have both bows
|
||||||
PHX : LDX.b #$00 ; scan ancilla table for arrows
|
PHX : LDX.b #$00 ; scan ancilla table for arrows
|
||||||
-- : CPX.b #$0A : !BGE ++
|
-- : CPX.b #$0A : !BGE ++
|
||||||
LDA $0C4A, X : CMP.b #$09 : BNE +++
|
LDA $0C4A, X : CMP.b #$09 : BNE +++
|
||||||
@@ -72,18 +72,18 @@ RTL
|
|||||||
PLX
|
PLX
|
||||||
LDA.l SilverArrowsUseRestriction : BEQ ++
|
LDA.l SilverArrowsUseRestriction : BEQ ++
|
||||||
LDA $A0 : ORA $A1 : BEQ ++ ; not in ganon's room in restricted mode
|
LDA $A0 : ORA $A1 : BEQ ++ ; not in ganon's room in restricted mode
|
||||||
LDA $7EF340 : CMP.b #$03 : !BLT .errorJump : !SUB #$02 : STA $7EF340
|
LDA BowEquipment : CMP.b #$03 : !BLT .errorJump : !SUB #$02 : STA BowEquipment
|
||||||
BRA .errorJump2
|
BRA .errorJump2
|
||||||
++
|
++
|
||||||
LDA $7EF340 : !SUB #$01 : EOR #$02 : !ADD #$01 : STA $7EF340 ; swap bows
|
LDA BowEquipment : !SUB #$01 : EOR #$02 : !ADD #$01 : STA BowEquipment ; swap bows
|
||||||
LDA.b #$20 : STA $012F ; menu select sound
|
LDA.b #$20 : STA $012F ; menu select sound
|
||||||
JMP .captured
|
JMP .captured
|
||||||
+ BRA +
|
+ BRA +
|
||||||
.errorJump
|
.errorJump
|
||||||
BRA .errorJump2
|
BRA .errorJump2
|
||||||
+ CMP #$05 : BNE + ; powder
|
+ CMP #$05 : BNE + ; powder
|
||||||
LDA !INVENTORY_SWAP : AND #$30 : CMP #$30 : BNE .errorJump ; make sure we have mushroom & magic powder
|
LDA InventoryTracking : AND #$30 : CMP #$30 : BNE .errorJump ; make sure we have mushroom & magic powder
|
||||||
LDA $7EF344 : EOR #$03 : STA $7EF344 ; swap mushroom & magic powder
|
LDA PowderEquipment : EOR #$03 : STA PowderEquipment ; swap mushroom & magic powder
|
||||||
LDA.b #$20 : STA $012F ; menu select sound
|
LDA.b #$20 : STA $012F ; menu select sound
|
||||||
JMP .captured
|
JMP .captured
|
||||||
+ BRA +
|
+ BRA +
|
||||||
@@ -91,11 +91,11 @@ RTL
|
|||||||
BRA .error
|
BRA .error
|
||||||
+ CMP #$0D : BNE + ; flute
|
+ CMP #$0D : BNE + ; flute
|
||||||
LDA $037A : CMP #$01 : BEQ .midShovel ; inside a shovel animation, force the shovel & make error sound
|
LDA $037A : CMP #$01 : BEQ .midShovel ; inside a shovel animation, force the shovel & make error sound
|
||||||
LDA !INVENTORY_SWAP : BIT #$04 : BEQ .error ; make sure we have shovel
|
LDA InventoryTracking : BIT #$04 : BEQ .error ; make sure we have shovel
|
||||||
AND #$03 : BEQ .error ; make sure we have one of the flutes
|
AND #$03 : BEQ .error ; make sure we have one of the flutes
|
||||||
LDA $7EF34C : CMP #01 : BNE .toShovel ; not shovel
|
LDA FluteEquipment : CMP #01 : BNE .toShovel ; not shovel
|
||||||
|
|
||||||
LDA !INVENTORY_SWAP : AND #$01 : BEQ .toFakeFlute ; check for real flute
|
LDA InventoryTracking : AND #$01 : BEQ .toFakeFlute ; check for real flute
|
||||||
LDA #$03 ; set real flute
|
LDA #$03 ; set real flute
|
||||||
BRA .fluteSuccess
|
BRA .fluteSuccess
|
||||||
.toFakeFlute
|
.toFakeFlute
|
||||||
@@ -104,7 +104,7 @@ RTL
|
|||||||
.toShovel
|
.toShovel
|
||||||
LDA #$01 ; set shovel
|
LDA #$01 ; set shovel
|
||||||
.fluteSuccess
|
.fluteSuccess
|
||||||
STA $7EF34C ; store set item
|
STA FluteEquipment ; store set item
|
||||||
LDA.b #$20 : STA $012F ; menu select sound
|
LDA.b #$20 : STA $012F ; menu select sound
|
||||||
BRA .captured
|
BRA .captured
|
||||||
+
|
+
|
||||||
@@ -112,7 +112,7 @@ RTL
|
|||||||
CLC
|
CLC
|
||||||
RTL
|
RTL
|
||||||
.midShovel
|
.midShovel
|
||||||
; LDA #$01 : STA $7EF34C ; set shovel
|
; LDA #$01 : STA FluteEquipment ; set shovel
|
||||||
.error
|
.error
|
||||||
LDA.b #$3C : STA $012E ; error sound
|
LDA.b #$3C : STA $012E ; error sound
|
||||||
.captured
|
.captured
|
||||||
@@ -127,13 +127,13 @@ ProcessBottleMenu:
|
|||||||
; LDA $F6 : AND #$30 : CMP.b #$30 : BEQ .double_shoulder_pressed
|
; LDA $F6 : AND #$30 : CMP.b #$30 : BEQ .double_shoulder_pressed
|
||||||
; LDA $F4 : AND #$40 : BEQ .y_not_pressed ; skip if Y is not down
|
; LDA $F4 : AND #$40 : BEQ .y_not_pressed ; skip if Y is not down
|
||||||
; .double_shoulder_pressed
|
; .double_shoulder_pressed
|
||||||
LDA $7EF34F ; check bottle state
|
LDA BottleIndex ; check bottle state
|
||||||
BEQ .no_bottles ; skip if we have no bottles
|
BEQ .no_bottles ; skip if we have no bottles
|
||||||
PHX
|
PHX
|
||||||
INC : CMP #$05 : !BLT + : LDA #$01 : + ;increment and wrap 1-4
|
INC : CMP #$05 : !BLT + : LDA #$01 : + ;increment and wrap 1-4
|
||||||
TAX : LDA $7EF35C-1, X ; check bottle
|
TAX : LDA BottleContents-1, X ; check bottle
|
||||||
BNE + : LDX #$01 : + ; wrap if we reached the last bottle
|
BNE + : LDX #$01 : + ; wrap if we reached the last bottle
|
||||||
TXA : STA $7EF34F ; set bottle index
|
TXA : STA BottleIndex ; set bottle index
|
||||||
LDA.b #$20 : STA $012F ; menu select sound
|
LDA.b #$20 : STA $012F ; menu select sound
|
||||||
PLX
|
PLX
|
||||||
.no_bottles
|
.no_bottles
|
||||||
@@ -204,47 +204,47 @@ FullInventoryExternal:
|
|||||||
AddInventory:
|
AddInventory:
|
||||||
PHA : PHX : PHP
|
PHA : PHX : PHP
|
||||||
CPY.b #$0C : BNE + ; Blue Boomerang
|
CPY.b #$0C : BNE + ; Blue Boomerang
|
||||||
LDA !INVENTORY_SWAP : ORA #$80 : STA !INVENTORY_SWAP
|
LDA InventoryTracking : ORA #$80 : STA InventoryTracking
|
||||||
JMP .incrementCounts
|
JMP .incrementCounts
|
||||||
+ CPY.b #$2A : BNE + ; Red Boomerang
|
+ CPY.b #$2A : BNE + ; Red Boomerang
|
||||||
LDA !INVENTORY_SWAP : ORA #$40 : STA !INVENTORY_SWAP
|
LDA InventoryTracking : ORA #$40 : STA InventoryTracking
|
||||||
JMP .incrementCounts
|
JMP .incrementCounts
|
||||||
+ CPY.b #$29 : BNE + ; Mushroom
|
+ CPY.b #$29 : BNE + ; Mushroom
|
||||||
LDA !INVENTORY_SWAP : ORA #$28 : STA !INVENTORY_SWAP
|
LDA InventoryTracking : ORA #$28 : STA InventoryTracking
|
||||||
JMP .incrementCounts
|
JMP .incrementCounts
|
||||||
+ CPY.b #$0D : BNE + ; Magic Powder
|
+ CPY.b #$0D : BNE + ; Magic Powder
|
||||||
LDA !INVENTORY_SWAP : ORA #$10 : STA !INVENTORY_SWAP
|
LDA InventoryTracking : ORA #$10 : STA InventoryTracking
|
||||||
JMP .incrementCounts
|
JMP .incrementCounts
|
||||||
+ CPY.b #$13 : BNE + ; Shovel
|
+ CPY.b #$13 : BNE + ; Shovel
|
||||||
LDA !INVENTORY_SWAP : ORA #$04 : STA !INVENTORY_SWAP
|
LDA InventoryTracking : ORA #$04 : STA InventoryTracking
|
||||||
JMP .incrementCounts
|
JMP .incrementCounts
|
||||||
+ CPY.b #$14 : BNE + ; Flute (Inactive)
|
+ CPY.b #$14 : BNE + ; Flute (Inactive)
|
||||||
LDA !INVENTORY_SWAP : ORA #$02 : STA !INVENTORY_SWAP
|
LDA InventoryTracking : ORA #$02 : STA InventoryTracking
|
||||||
JMP .incrementCounts
|
JMP .incrementCounts
|
||||||
+ CPY.b #$4A : BNE + ; Flute (Active)
|
+ CPY.b #$4A : BNE + ; Flute (Active)
|
||||||
LDA !INVENTORY_SWAP : ORA #$01 : STA !INVENTORY_SWAP
|
LDA InventoryTracking : ORA #$01 : STA InventoryTracking
|
||||||
JMP .incrementCounts
|
JMP .incrementCounts
|
||||||
+ CPY.b #$0B : BNE + ; Bow
|
+ CPY.b #$0B : BNE + ; Bow
|
||||||
LDA ArrowMode : BNE +++
|
LDA ArrowMode : BNE +++
|
||||||
LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2
|
LDA BowTracking : ORA #$80 : STA BowTracking
|
||||||
+++
|
+++
|
||||||
JMP .incrementCounts
|
JMP .incrementCounts
|
||||||
+ CPY.b #$3A : BNE + ; Bow & Arrows
|
+ CPY.b #$3A : BNE + ; Bow & Arrows
|
||||||
LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2
|
LDA BowTracking : ORA #$80 : STA BowTracking
|
||||||
JMP .incrementCounts
|
JMP .incrementCounts
|
||||||
+ CPY.b #$3B : BNE + ; Bow & Silver Arrows
|
+ CPY.b #$3B : BNE + ; Bow & Silver Arrows
|
||||||
LDA !INVENTORY_SWAP_2 : ORA #$40 : STA !INVENTORY_SWAP_2
|
LDA BowTracking : ORA #$40 : STA BowTracking
|
||||||
LDA ArrowMode : BNE +++
|
LDA ArrowMode : BNE +++
|
||||||
LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2 ; activate wood arrows when not in rupee bow
|
LDA BowTracking : ORA #$80 : STA BowTracking ; activate wood arrows when not in rupee bow
|
||||||
+++
|
+++
|
||||||
JMP .incrementCounts
|
JMP .incrementCounts
|
||||||
+ CPY.b #$43 : BNE + ; Single arrow
|
+ CPY.b #$43 : BNE + ; Single arrow
|
||||||
LDA ArrowMode : BEQ +++
|
LDA ArrowMode : BEQ +++
|
||||||
LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2 ; activate wood arrows in quick-swap
|
LDA BowTracking : ORA #$80 : STA BowTracking ; activate wood arrows in quick-swap
|
||||||
+++
|
+++
|
||||||
JMP .incrementCounts
|
JMP .incrementCounts
|
||||||
+ CPY.b #$58 : BNE + ; Upgrade-Only Silver Arrows
|
+ CPY.b #$58 : BNE + ; Upgrade-Only Silver Arrows
|
||||||
LDA !INVENTORY_SWAP_2 : ORA #$40 : STA !INVENTORY_SWAP_2
|
LDA BowTracking : ORA #$40 : STA BowTracking
|
||||||
+
|
+
|
||||||
|
|
||||||
.incrementCounts
|
.incrementCounts
|
||||||
@@ -259,7 +259,6 @@ AddInventory:
|
|||||||
CPY.b #$37 : BNE + : JMP .itemCounts : + ; Pendant
|
CPY.b #$37 : BNE + : JMP .itemCounts : + ; Pendant
|
||||||
CPY.b #$38 : BNE + : JMP .itemCounts : + ; Pendant
|
CPY.b #$38 : BNE + : JMP .itemCounts : + ; Pendant
|
||||||
CPY.b #$39 : BNE + : JMP .itemCounts : + ; Pendant
|
CPY.b #$39 : BNE + : JMP .itemCounts : + ; Pendant
|
||||||
CPY.b #$00 : BNE + : JMP .itemCounts : + ; Uncle Sword & Shield
|
|
||||||
|
|
||||||
CPY.b #$04 : !BLT .isSword ; Swords - Skip Shop/Fairy Check for Swords
|
CPY.b #$04 : !BLT .isSword ; Swords - Skip Shop/Fairy Check for Swords
|
||||||
CPY.b #$49 : BEQ .isSword
|
CPY.b #$49 : BEQ .isSword
|
||||||
@@ -353,7 +352,7 @@ AddInventory:
|
|||||||
JMP .fullItemCounts
|
JMP .fullItemCounts
|
||||||
+ CMP.b #$1A : BNE + ; Ganon's Tower
|
+ CMP.b #$1A : BNE + ; Ganon's Tower
|
||||||
LDA $7EF436 : !ADD #$08 : STA $7EF436
|
LDA $7EF436 : !ADD #$08 : STA $7EF436
|
||||||
LDA $7EF366 : AND #$04 : BNE ++
|
LDA BigKeyField : AND #$04 : BNE ++
|
||||||
JSR .incrementGTowerPreBigKey
|
JSR .incrementGTowerPreBigKey
|
||||||
++
|
++
|
||||||
;JMP .fullItemCounts
|
;JMP .fullItemCounts
|
||||||
@@ -362,16 +361,20 @@ AddInventory:
|
|||||||
; == END INDOOR-ONLY SECTION
|
; == END INDOOR-ONLY SECTION
|
||||||
.fullItemCounts
|
.fullItemCounts
|
||||||
|
|
||||||
CPY.b #$3B : BNE + ; Skip Total Counts for Repeat Silver Arrows
|
;CPY.b #$3B : BNE + ; Skip Total Counts for Repeat Silver Arrows
|
||||||
LDA $7EF42A : BIT #$20 : BEQ + : BRA .itemCounts
|
; LDA $7EF42A : BIT #$20 : BEQ + : BRA .itemCounts
|
||||||
|
;+
|
||||||
|
|
||||||
|
LDA BootsEquipment : BNE + ; Check for Boots
|
||||||
|
LDA PreBootsLocations : INC : STA PreBootsLocations ; Increment Pre Boots Counter
|
||||||
+
|
+
|
||||||
|
|
||||||
LDA $7EF355 : BNE + ; Check for Boots
|
LDA MirrorEquipment : BNE + ; Check for Mirror
|
||||||
LDA $7EF432 : INC : STA $7EF432 ; Increment Pre Boots Counter
|
LDA PreMirrorLocations : INC : STA PreMirrorLocations ; Increment Pre Mirror Counter
|
||||||
+
|
+
|
||||||
|
|
||||||
LDA $7EF353 : BNE + ; Check for Mirror
|
LDA FluteEquipment : BNE + ; Check for Flute
|
||||||
LDA $7EF433 : INC : STA $7EF433 ; Increment Pre Mirror Counter
|
LDA PreFluteLocations : INC : STA PreFluteLocations ; Increment Pre Mirror Counter
|
||||||
+
|
+
|
||||||
|
|
||||||
LDA $7EF423 : INC : STA $7EF423 ; Increment Item Total
|
LDA $7EF423 : INC : STA $7EF423 ; Increment Item Total
|
||||||
@@ -379,25 +382,32 @@ AddInventory:
|
|||||||
.itemCounts
|
.itemCounts
|
||||||
|
|
||||||
CPY.b #$00 : BNE + ; Fighter's Sword & Fighter's Shield
|
CPY.b #$00 : BNE + ; Fighter's Sword & Fighter's Shield
|
||||||
|
LDX #$01
|
||||||
JSR .incrementSword
|
JSR .incrementSword
|
||||||
JSR .incrementShield
|
JSR .incrementShield
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$01 : BNE + ; Master Sword
|
+ CPY.b #$01 : BNE + ; Master Sword
|
||||||
|
LDX #$02
|
||||||
JSR .incrementSword
|
JSR .incrementSword
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$02 : BNE + ; Tempered Sword
|
+ CPY.b #$02 : BNE + ; Tempered Sword
|
||||||
|
LDX #$03
|
||||||
JSR .incrementSword
|
JSR .incrementSword
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$03 : BNE + ; Golden Sword
|
+ CPY.b #$03 : BNE + ; Golden Sword
|
||||||
|
LDX #$04
|
||||||
JSR .incrementSword
|
JSR .incrementSword
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$04 : BNE + ; Fighter's Shield
|
+ CPY.b #$04 : BNE + ; Fighter's Shield
|
||||||
|
LDX #$01
|
||||||
JSR .incrementShield
|
JSR .incrementShield
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$05 : BNE + ; Red Shield
|
+ CPY.b #$05 : BNE + ; Red Shield
|
||||||
|
LDX #$02
|
||||||
JSR .incrementShield
|
JSR .incrementShield
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$06 : BNE + ; Mirror Shield
|
+ CPY.b #$06 : BNE + ; Mirror Shield
|
||||||
|
LDX #$03
|
||||||
JSR .incrementShield
|
JSR .incrementShield
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$07 : !BLT + ; Items $07 - $0D
|
+ CPY.b #$07 : !BLT + ; Items $07 - $0D
|
||||||
@@ -436,10 +446,12 @@ AddInventory:
|
|||||||
+ CPY.b #$21 : BNE + ; Bug Net
|
+ CPY.b #$21 : BNE + ; Bug Net
|
||||||
JSR .incrementY
|
JSR .incrementY
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$22 : !BLT + ; Items $22 - $23
|
+ CPY.b #$22 : BNE + ; Blue Mail
|
||||||
CPY.b #$24 : !BGE +
|
LDX #$01
|
||||||
JSR .incrementMail
|
JSR .incrementMail
|
||||||
JMP .done
|
+ CPY.b #$23 : BNE + ; Red Mail
|
||||||
|
LDX #$02
|
||||||
|
JSR .incrementMail
|
||||||
+ CPY.b #$24 : BNE + ; Small Key
|
+ CPY.b #$24 : BNE + ; Small Key
|
||||||
JSR .incrementKey
|
JSR .incrementKey
|
||||||
JMP .done
|
JMP .done
|
||||||
@@ -450,10 +462,10 @@ AddInventory:
|
|||||||
;JSR .incrementHeartContainer
|
;JSR .incrementHeartContainer
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$27 : BNE + ; 1 Bomb
|
+ CPY.b #$27 : BNE + ; 1 Bomb
|
||||||
JSR .maybeIncrementBombs
|
;JSR .maybeIncrementBombs
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$28 : BNE + ; 3 Bombs
|
+ CPY.b #$28 : BNE + ; 3 Bombs
|
||||||
JSR .maybeIncrementBombs
|
;JSR .maybeIncrementBombs
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$29 : BNE + ; Musoroom
|
+ CPY.b #$29 : BNE + ; Musoroom
|
||||||
JSR .incrementY
|
JSR .incrementY
|
||||||
@@ -463,7 +475,7 @@ AddInventory:
|
|||||||
JSR .incrementY
|
JSR .incrementY
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$31 : BNE + ; 10 Bombs
|
+ CPY.b #$31 : BNE + ; 10 Bombs
|
||||||
JSR .maybeIncrementBombs
|
;JSR .maybeIncrementBombs
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$32 : BNE + ; Big Key
|
+ CPY.b #$32 : BNE + ; Big Key
|
||||||
JSR .incrementBigKey
|
JSR .incrementBigKey
|
||||||
@@ -493,6 +505,7 @@ AddInventory:
|
|||||||
JSR .incrementY
|
JSR .incrementY
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$49 : BNE + ; Fighter's Sword
|
+ CPY.b #$49 : BNE + ; Fighter's Sword
|
||||||
|
LDX #$01
|
||||||
JSR .incrementSword
|
JSR .incrementSword
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$4A : BNE + ; Flute (Active)
|
+ CPY.b #$4A : BNE + ; Flute (Active)
|
||||||
@@ -505,29 +518,33 @@ AddInventory:
|
|||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$4C : BNE + ; Bomb Capacity Upgrade
|
+ CPY.b #$4C : BNE + ; Bomb Capacity Upgrade
|
||||||
JSR .incrementCapacity
|
JSR .incrementCapacity
|
||||||
JSR .maybeIncrementBombs
|
;JSR .maybeIncrementBombs
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$4D : !BLT + ; Items $4D - $4F - Capacity Upgrades
|
+ CPY.b #$4D : !BLT + ; Items $4D - $4F - Capacity Upgrades
|
||||||
CPY.b #$50 : !BGE +
|
CPY.b #$50 : !BGE +
|
||||||
JSR .incrementCapacity
|
JSR .incrementCapacity
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$50 : BNE + ; Master Sword (Safe)
|
+ CPY.b #$50 : BNE + ; Master Sword (Safe)
|
||||||
|
LDX #$02
|
||||||
JSR .incrementSword
|
JSR .incrementSword
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$51 : !BLT + ; Items $51 - $54 - Capacity Upgrades
|
+ CPY.b #$51 : !BLT + ; Items $51 - $54 - Capacity Upgrades
|
||||||
CPY.b #$55 : !BGE +
|
CPY.b #$55 : !BGE +
|
||||||
JSR .incrementCapacity
|
JSR .incrementCapacity
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$58 : BNE + ; Upgrade-Only Sivler Arrows
|
+ CPY.b #$58 : BNE + ; Upgrade-Only Silver Arrows
|
||||||
JSR .incrementBow
|
JSR .incrementBow
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$5E : BNE + ; Progressive Sword
|
+ CPY.b #$5E : BNE + ; Progressive Sword
|
||||||
|
LDA SwordEquipment : TAX
|
||||||
JSR .incrementSword
|
JSR .incrementSword
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$5F : BNE + ; Progressive Shield
|
+ CPY.b #$5F : BNE + ; Progressive Shield
|
||||||
|
LDA ShieldEquipment : TAX
|
||||||
JSR .incrementShield
|
JSR .incrementShield
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$60 : BNE + ; Progressive Armor
|
+ CPY.b #$60 : BNE + ; Progressive Armor
|
||||||
|
LDA ArmorEquipment : TAX
|
||||||
JSR .incrementMail
|
JSR .incrementMail
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CPY.b #$61 : BNE + ; Progressive Lifting Glove
|
+ CPY.b #$61 : BNE + ; Progressive Lifting Glove
|
||||||
@@ -608,72 +625,58 @@ RTS
|
|||||||
RTS
|
RTS
|
||||||
|
|
||||||
.incrementSword
|
.incrementSword
|
||||||
; CHECK FOR DUPLICATE SWORDS
|
|
||||||
JSR .stampSword
|
JSR .stampSword
|
||||||
TYA ; load sword item
|
LDA HighestSword
|
||||||
CMP.b #$50 : BNE + : LDA.b #$01 : + ; convert extra master sword to normal one
|
INC : STA $04 : CPX $04 : !BLT + ; don't increment unless we're getting a better sword
|
||||||
CMP.b #$49 : BNE + : LDA.b #$00 : + ; convert extra fighter sword to normal one
|
TXA : STA HighestSword
|
||||||
INC : CMP !HIGHEST_SWORD_LEVEL : !BLT + ; skip if highest is higher
|
+
|
||||||
PHA
|
|
||||||
LDA !HIGHEST_SWORD_LEVEL : AND #$F8 : ORA 1,s : STA !HIGHEST_SWORD_LEVEL
|
|
||||||
PLA
|
|
||||||
+
|
|
||||||
|
|
||||||
LDA $7EF422 : !ADD #$20 : STA $7EF422 ; increment sword counter
|
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.incrementShield
|
.incrementShield
|
||||||
; CHECK FOR DUPLICATE SHIELDS
|
LDA HighestShield
|
||||||
LDA $7EF422 : !ADD #$08 : AND #$18 : TAX
|
INC : STA $04 : CPX $04 : !BLT + ; don't increment unless we're getting a better shield
|
||||||
LDA $7EF422 : AND #$E7 : STA $7EF422
|
TXA : STA HighestShield
|
||||||
TXA : ORA $7EF422 : STA $7EF422
|
+
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.incrementBow
|
.incrementBow
|
||||||
CPY.b #$3B : BNE ++
|
LDA BowEquipment : BNE .dontCount ; Don't increment Y item count for extra bows
|
||||||
LDA $7EF42A : BIT #$20 : BEQ + : RTS : +
|
|
||||||
ORA #$20 : STA $7EF42A
|
|
||||||
++
|
|
||||||
.incrementY
|
.incrementY
|
||||||
LDA $7EF421 : !ADD #$08 : STA $7EF421
|
LDA YAItemCounter : !ADD #$08 : STA YAItemCounter
|
||||||
|
.dontCount
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.incrementA
|
.incrementA
|
||||||
LDA $7EF421 : INC : AND #$07 : TAX
|
LDA YAItemCounter : INC : AND #$07 : TAX
|
||||||
LDA $7EF421 : AND #$F8 : STA $7EF421
|
LDA YAItemCounter : AND #$F8 : STA YAItemCounter
|
||||||
TXA : ORA $7EF421 : STA $7EF421
|
TXA : ORA YAItemCounter : STA YAItemCounter
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.incrementPendant
|
.incrementPendant
|
||||||
LDA $7EF429 : INC : AND #$03 : TAX
|
LDA PendantCounter : INC : STA PendantCounter
|
||||||
LDA $7EF429 : AND #$FC : STA $7EF429
|
|
||||||
TXA : ORA $7EF429 : STA $7EF429
|
|
||||||
; JSR .incrementBossSword
|
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.incrementCapacity
|
.incrementCapacity
|
||||||
%BottomHalf($7EF452)
|
LDA CapacityUpgrades : INC : STA CapacityUpgrades
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.incrementHeartPiece
|
.incrementHeartPiece
|
||||||
LDA $7EF448 : INC : AND #$1F : TAX
|
LDA HeartPieceCounter : INC : STA HeartPieceCounter
|
||||||
LDA $7EF448 : AND #$E0 : STA $7EF448
|
|
||||||
TXA : ORA $7EF448 : STA $7EF448
|
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.incrementHeartContainer
|
.incrementHeartContainer
|
||||||
%TopHalf($7EF429)
|
LDA HeartContainerCounter : INC : STA HeartContainerCounter
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.incrementCrystal
|
.incrementCrystal
|
||||||
LDA $7EF422 : INC : AND #$07 : TAX
|
LDA CrystalCounter : INC : STA CrystalCounter
|
||||||
LDA $7EF422 : AND #$F8 : STA $7EF422
|
|
||||||
TXA : ORA $7EF422 : STA $7EF422
|
|
||||||
; JSR .incrementBossSword
|
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.incrementMail
|
.incrementMail
|
||||||
LDA $7EF424 : !ADD #$40 : STA $7EF424
|
LDA HighestMail
|
||||||
|
INC : STA $04 : CPX $04 : !BLT + ; don't increment unless we're getting a better mail
|
||||||
|
TXA : STA HighestMail
|
||||||
|
+
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.incrementKeyLong
|
.incrementKeyLong
|
||||||
@@ -702,12 +705,12 @@ RTS
|
|||||||
TXA : ORA $7EF42A : STA $7EF42A
|
TXA : ORA $7EF42A : STA $7EF42A
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.maybeIncrementBombs
|
;.maybeIncrementBombs
|
||||||
LDA $7EF42A : AND #$80 : BNE +
|
; LDA $7EF42A : AND #$80 : BNE +
|
||||||
LDA $7EF42A : ORA #$80 : STA $7EF42A
|
; LDA $7EF42A : ORA #$80 : STA $7EF42A
|
||||||
JSR .incrementY
|
; JSR .incrementY
|
||||||
+
|
; +
|
||||||
RTS
|
;RTS
|
||||||
|
|
||||||
.incrementMap
|
.incrementMap
|
||||||
LDA $7EF428 : !ADD #$10 : STA $7EF428
|
LDA $7EF428 : !ADD #$10 : STA $7EF428
|
||||||
@@ -718,7 +721,7 @@ RTS
|
|||||||
RTL
|
RTL
|
||||||
|
|
||||||
.incrementBossSword
|
.incrementBossSword
|
||||||
LDA $7EF359
|
LDA SwordEquipment
|
||||||
BNE + : -
|
BNE + : -
|
||||||
%TopHalf($7EF452) : RTS
|
%TopHalf($7EF452) : RTS
|
||||||
+ CMP #$FF : BEQ -
|
+ CMP #$FF : BEQ -
|
||||||
@@ -738,11 +741,11 @@ RTS
|
|||||||
; Link_ReceiveItem_HUDRefresh:
|
; Link_ReceiveItem_HUDRefresh:
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
Link_ReceiveItem_HUDRefresh:
|
Link_ReceiveItem_HUDRefresh:
|
||||||
LDA $7EF343 : BNE + ; skip if we have bombs
|
LDA BombsEquipment : BNE + ; skip if we have bombs
|
||||||
LDA $7EF370 : !ADD.l StartingMaxBombs : BEQ + ; skip if we can't have bombs
|
LDA BombCapacityUpgrades : !ADD.l StartingMaxBombs : BEQ + ; skip if we can't have bombs
|
||||||
LDA $7EF375 : BEQ + ; skip if we are filling no bombs
|
LDA BombsFiller : BEQ + ; skip if we are filling no bombs
|
||||||
DEC : STA $7EF375 ; decrease bomb fill count
|
DEC : STA BombsFiller ; decrease bomb fill count
|
||||||
LDA.b #$01 : STA $7EF343 ; increase actual bomb count
|
LDA.b #$01 : STA BombsEquipment ; increase actual bomb count
|
||||||
+
|
+
|
||||||
|
|
||||||
JSL.l HUD_RefreshIconLong ; thing we wrote over
|
JSL.l HUD_RefreshIconLong ; thing we wrote over
|
||||||
@@ -754,9 +757,9 @@ RTL
|
|||||||
; HandleBombAbsorbtion:
|
; HandleBombAbsorbtion:
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
HandleBombAbsorbtion:
|
HandleBombAbsorbtion:
|
||||||
STA $7EF375 ; thing we wrote over
|
STA BombsFiller ; thing we wrote over
|
||||||
LDA $0303 : BNE + ; skip if we already have some item selected
|
LDA $0303 : BNE + ; skip if we already have some item selected
|
||||||
LDA $7EF370 : !ADD.l StartingMaxBombs : BEQ + ; skip if we can't have bombs
|
LDA BombCapacityUpgrades : !ADD.l StartingMaxBombs : BEQ + ; skip if we can't have bombs
|
||||||
LDA.b #$04 : STA $0202 ; set selected item to bombs
|
LDA.b #$04 : STA $0202 ; set selected item to bombs
|
||||||
LDA.b #$01 : STA $0303 ; set selected item to bombs
|
LDA.b #$01 : STA $0303 ; set selected item to bombs
|
||||||
JSL.l HUD_RebuildLong
|
JSL.l HUD_RebuildLong
|
||||||
@@ -771,13 +774,13 @@ RTL
|
|||||||
AddYMarker:
|
AddYMarker:
|
||||||
LDA $0202 : AND.w #$FF ; load item value
|
LDA $0202 : AND.w #$FF ; load item value
|
||||||
CMP.w #$02 : BNE + ; boomerang
|
CMP.w #$02 : BNE + ; boomerang
|
||||||
LDA !INVENTORY_SWAP : AND.w #$C0 : CMP.w #$C0 : BEQ .drawYBubble : BRA .drawNormal
|
LDA InventoryTracking : AND.w #$C0 : CMP.w #$C0 : BEQ .drawYBubble : BRA .drawNormal
|
||||||
+ CMP.w #$01 : BNE + ; bow
|
+ CMP.w #$01 : BNE + ; bow
|
||||||
LDA !INVENTORY_SWAP_2 : AND.w #$C0 : CMP.w #$C0 : BEQ .drawYBubble : BRA .drawNormal
|
LDA BowTracking : AND.w #$C0 : CMP.w #$C0 : BEQ .drawYBubble : BRA .drawNormal
|
||||||
+ CMP.w #$05 : BNE + ; powder
|
+ CMP.w #$05 : BNE + ; powder
|
||||||
LDA !INVENTORY_SWAP : AND.w #$30 : CMP.w #$30 : BEQ .drawYBubble : BRA .drawNormal
|
LDA InventoryTracking : AND.w #$30 : CMP.w #$30 : BEQ .drawYBubble : BRA .drawNormal
|
||||||
+ CMP.w #$0D : BNE + ; flute
|
+ CMP.w #$0D : BNE + ; flute
|
||||||
LDA !INVENTORY_SWAP : BIT.w #$04 : BEQ .drawNormal ; make sure we have shovel
|
LDA InventoryTracking : BIT.w #$04 : BEQ .drawNormal ; make sure we have shovel
|
||||||
AND.w #$03 : BNE .drawYBubble ; make sure we have one of the flutes
|
AND.w #$03 : BNE .drawYBubble ; make sure we have one of the flutes
|
||||||
BRA .drawNormal
|
BRA .drawNormal
|
||||||
+ CMP.w #$10 : BEQ .drawJarMarker
|
+ CMP.w #$10 : BEQ .drawJarMarker
|
||||||
@@ -831,8 +834,8 @@ RTS
|
|||||||
; UpgradeFlute:
|
; UpgradeFlute:
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
UpgradeFlute:
|
UpgradeFlute:
|
||||||
LDA !INVENTORY_SWAP : AND #$FC : ORA #$01 : STA !INVENTORY_SWAP ; switch to the working flute
|
LDA InventoryTracking : AND #$FC : ORA #$01 : STA InventoryTracking ; switch to the working flute
|
||||||
LDA.b #$03 : STA $7EF34C ; upgrade primary inventory
|
LDA.b #$03 : STA FluteEquipment ; upgrade primary inventory
|
||||||
RTL
|
RTL
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -859,10 +862,10 @@ RTL
|
|||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
LoadKeys:
|
LoadKeys:
|
||||||
LDA.l GenericKeys : BEQ +
|
LDA.l GenericKeys : BEQ +
|
||||||
LDA $7EF38B
|
LDA CurrentGenericKeys
|
||||||
RTL
|
RTL
|
||||||
+
|
+
|
||||||
LDA $7EF37C, X
|
LDA SewerKeys, X
|
||||||
RTL
|
RTL
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -872,10 +875,10 @@ RTL
|
|||||||
SaveKeys:
|
SaveKeys:
|
||||||
PHA
|
PHA
|
||||||
LDA.l GenericKeys : BEQ +
|
LDA.l GenericKeys : BEQ +
|
||||||
PLA : STA $7EF38B
|
PLA : STA CurrentGenericKeys
|
||||||
RTL
|
RTL
|
||||||
+
|
+
|
||||||
PLA : STA $7EF37C, X
|
PLA : STA SewerKeys, X
|
||||||
RTL
|
RTL
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -889,10 +892,10 @@ ClearOWKeys:
|
|||||||
JSL.l FakeWorldFix
|
JSL.l FakeWorldFix
|
||||||
JSR.w FixBunnyOnExitToLightWorld
|
JSR.w FixBunnyOnExitToLightWorld
|
||||||
LDA.l GenericKeys : BEQ +
|
LDA.l GenericKeys : BEQ +
|
||||||
PLA : LDA $7EF38B : STA $7EF36F
|
PLA : LDA CurrentGenericKeys : STA CurrentSmallKeys
|
||||||
RTL
|
RTL
|
||||||
+
|
+
|
||||||
PLA : STA $7EF36F
|
PLA : STA CurrentSmallKeys
|
||||||
RTL
|
RTL
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -955,10 +958,10 @@ RTL
|
|||||||
; InitializeBottles:
|
; InitializeBottles:
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
InitializeBottles:
|
InitializeBottles:
|
||||||
STA $7EF35C, X ; thing we wrote over
|
STA BottleContents, X ; thing we wrote over
|
||||||
PHA
|
PHA
|
||||||
LDA $7EF34F : BNE +
|
LDA BottleIndex : BNE +
|
||||||
TXA : INC : STA $7EF34F ; write bottle index to menu properly
|
TXA : INC : STA BottleIndex ; write bottle index to menu properly
|
||||||
+
|
+
|
||||||
PLA
|
PLA
|
||||||
RTL
|
RTL
|
||||||
@@ -1047,12 +1050,12 @@ RTL
|
|||||||
; RemoveMushroom:
|
; RemoveMushroom:
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
RemoveMushroom:
|
RemoveMushroom:
|
||||||
LDA !INVENTORY_SWAP : AND #$DF : STA !INVENTORY_SWAP ; remove the mushroom
|
LDA InventoryTracking : AND #$DF : STA InventoryTracking ; remove the mushroom
|
||||||
AND #$10 : BEQ .empty ; check if we have powder
|
AND #$10 : BEQ .empty ; check if we have powder
|
||||||
LDA.b #$02 : STA $7EF344 ; give powder if we have it
|
LDA.b #$02 : STA PowderEquipment ; give powder if we have it
|
||||||
RTL
|
RTL
|
||||||
.empty
|
.empty
|
||||||
LDA.b #$00 : STA $7EF344 ; clear the inventory slot if we don't have powder
|
LDA.b #$00 : STA PowderEquipment ; clear the inventory slot if we don't have powder
|
||||||
RTL
|
RTL
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -1060,7 +1063,7 @@ RTL
|
|||||||
; DrawMagicHeader:
|
; DrawMagicHeader:
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
DrawMagicHeader:
|
DrawMagicHeader:
|
||||||
LDA $7EF37B : AND.w #$00FF : CMP.w #$0002 : BEQ .quarterMagic
|
LDA MagicConsumption : AND.w #$00FF : CMP.w #$0002 : BEQ .quarterMagic
|
||||||
.halfMagic
|
.halfMagic
|
||||||
LDA.w #$28F7 : STA $7EC704
|
LDA.w #$28F7 : STA $7EC704
|
||||||
LDA.w #$2851 : STA $7EC706
|
LDA.w #$2851 : STA $7EC706
|
||||||
@@ -1078,7 +1081,7 @@ RTL
|
|||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
;FixShovelLock:
|
;FixShovelLock:
|
||||||
; LDA $037A : CMP #$01 : BEQ + ; skip if link is shoveling
|
; LDA $037A : CMP #$01 : BEQ + ; skip if link is shoveling
|
||||||
; LDA $7EF34C ; load shovel/flute item ID
|
; LDA FluteEquipment ; load shovel/flute item ID
|
||||||
; +
|
; +
|
||||||
; CMP #$00
|
; CMP #$00
|
||||||
;RTL
|
;RTL
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ ItemDowngradeFixMain:
|
|||||||
CPY.b #$0B : BEQ .isBow ; Bow
|
CPY.b #$0B : BEQ .isBow ; Bow
|
||||||
CPY.b #$3A : BEQ .isBowAndArrows ; Bow
|
CPY.b #$3A : BEQ .isBowAndArrows ; Bow
|
||||||
|
|
||||||
CPY.b #$49 : BEQ .isFightersSword ; Fighter's Sword
|
CPY.b #$49 : BEQ .isSword ; Fighter's Sword
|
||||||
CPY.b #$01 : BEQ .isMasterSword ; Master Sword
|
CPY.b #$01 : BEQ .isSword ; Master Sword
|
||||||
CPY.b #$50 : BEQ .isMasterSword ; Master Sword (Safe)
|
CPY.b #$50 : BEQ .isSword ; Master Sword (Safe)
|
||||||
CPY.b #$02 : BEQ .isTemperedSword ; Tempered Sword
|
CPY.b #$02 : BEQ .isSword ; Tempered Sword
|
||||||
|
|
||||||
CPY.b #$3B : BEQ .isSilverArrowBow ; Silver Arrow Bow
|
CPY.b #$3B : BEQ .isSilverArrowBow ; Silver Arrow Bow
|
||||||
CPY.b #$2A : BEQ .isRedBoomerang ; Red Boomerang
|
CPY.b #$2A : BEQ .isRedBoomerang ; Red Boomerang
|
||||||
@@ -29,7 +29,9 @@ ItemDowngradeFixMain:
|
|||||||
CPY.b #$13 : BEQ .isShovel ; Shovel
|
CPY.b #$13 : BEQ .isShovel ; Shovel
|
||||||
CPY.b #$29 : BEQ .isMushroom ; Mushroom
|
CPY.b #$29 : BEQ .isMushroom ; Mushroom
|
||||||
|
|
||||||
.done
|
CPY.b #$00 : BEQ .isUncleSwordShield ; Fighter's Sword & Shield
|
||||||
|
|
||||||
|
.done
|
||||||
STA [$00] ; thing we wrote over part 2
|
STA [$00] ; thing we wrote over part 2
|
||||||
.dontWrite
|
.dontWrite
|
||||||
RTS
|
RTS
|
||||||
@@ -56,18 +58,28 @@ RTS
|
|||||||
+
|
+
|
||||||
PLA
|
PLA
|
||||||
RTS
|
RTS
|
||||||
.isFightersSword
|
.isSword
|
||||||
.isMasterSword
|
|
||||||
.isTemperedSword
|
|
||||||
PHA
|
PHA
|
||||||
|
LDA HighestSword : STA $04
|
||||||
TYA ; load sword item
|
TYA ; load sword item
|
||||||
CMP.b #$49 : BNE + : LDA.b #$00 : + ; convert extra fighter's sword to normal one
|
CMP.b #$49 : BNE + : LDA.b #$00 : + ; convert extra fighter's sword to normal one
|
||||||
CMP.b #$50 : BNE + : LDA.b #$01 : + ; convert extra master sword to normal one
|
CMP.b #$50 : BNE + : LDA.b #$01 : + ; convert extra master sword to normal one
|
||||||
INC : CMP !HIGHEST_SWORD_LEVEL : !BGE + ; skip if highest is lower (this is an upgrade)
|
INC : CMP $04 : !BGE + ; skip if highest is lower (this is an upgrade)
|
||||||
LDA !HIGHEST_SWORD_LEVEL : DEC ; convert to item id
|
LDA $04 : DEC ; convert to item id
|
||||||
TAY : PLA : LDA !HIGHEST_SWORD_LEVEL ; put sword id into the thing to write
|
TAY : PLA : LDA $04 ; put sword id into the thing to write
|
||||||
JMP .done
|
JMP .done
|
||||||
+
|
+
|
||||||
PLA
|
PLA
|
||||||
JMP .done
|
JMP .done
|
||||||
;================================================================================
|
.isUncleSwordShield
|
||||||
|
PHA
|
||||||
|
LDA HighestSword
|
||||||
|
STA [$00] ; already set to 1 if we had no sword, always keep highest
|
||||||
|
LDA ShieldEquipment : BNE + ; keep our shield unless we have no shield
|
||||||
|
INC $00
|
||||||
|
INC A
|
||||||
|
STA [$00]
|
||||||
|
+
|
||||||
|
PLA
|
||||||
|
RTS
|
||||||
|
;================================================================================
|
||||||
|
|||||||
21
newitems.asm
21
newitems.asm
@@ -142,9 +142,6 @@ macro ValueShift()
|
|||||||
BRA ?start : ?end:
|
BRA ?start : ?end:
|
||||||
endmacro
|
endmacro
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
!CHALLENGE_TIMER = "$7EF454"
|
|
||||||
!GOAL_COUNTER = "$7EF418"
|
|
||||||
;--------------------------------------------------------------------------------
|
|
||||||
;carry clear if pass
|
;carry clear if pass
|
||||||
;carry set if caught
|
;carry set if caught
|
||||||
;incsrc eventdata.asm
|
;incsrc eventdata.asm
|
||||||
@@ -170,7 +167,7 @@ ProcessEventItems:
|
|||||||
SEP #$10 ; set 8-bit index registers
|
SEP #$10 ; set 8-bit index registers
|
||||||
|
|
||||||
LDA GoalItemRequirement : BEQ ++
|
LDA GoalItemRequirement : BEQ ++
|
||||||
LDA !GOAL_COUNTER : INC : STA !GOAL_COUNTER
|
LDA GoalCounter : INC : STA GoalCounter
|
||||||
CMP GoalItemRequirement : !BLT ++
|
CMP GoalItemRequirement : !BLT ++
|
||||||
LDA TurnInGoalItems : BNE ++
|
LDA TurnInGoalItems : BNE ++
|
||||||
JSL.l ActivateGoal
|
JSL.l ActivateGoal
|
||||||
@@ -192,7 +189,7 @@ AddReceivedItemExpandedGetItem:
|
|||||||
|
|
||||||
;JSR.w ProcessEventItems : CPX.b #$00 : BEQ ++
|
;JSR.w ProcessEventItems : CPX.b #$00 : BEQ ++
|
||||||
; ;JSL.l Main_ShowTextMessage_Alt
|
; ;JSL.l Main_ShowTextMessage_Alt
|
||||||
; LDA !GOAL_COUNTER : INC : STA !GOAL_COUNTER
|
; LDA GoalCounter : INC : STA GoalCounter
|
||||||
; LDA.b #$01 : STA $7F50XX
|
; LDA.b #$01 : STA $7F50XX
|
||||||
; JMP .done
|
; JMP .done
|
||||||
;++
|
;++
|
||||||
@@ -283,20 +280,20 @@ AddReceivedItemExpandedGetItem:
|
|||||||
JMP .done
|
JMP .done
|
||||||
+ CMP.b #$5B : BNE + ; Red Clock
|
+ CMP.b #$5B : BNE + ; Red Clock
|
||||||
REP #$20 ; set 16-bit accumulator
|
REP #$20 ; set 16-bit accumulator
|
||||||
LDA !CHALLENGE_TIMER : !ADD.l RedClockAmount : STA !CHALLENGE_TIMER
|
LDA ChallengeTimer : !ADD.l RedClockAmount : STA ChallengeTimer
|
||||||
LDA !CHALLENGE_TIMER+2 : ADC.l RedClockAmount+2 : STA !CHALLENGE_TIMER+2
|
LDA ChallengeTimer+2 : ADC.l RedClockAmount+2 : STA ChallengeTimer+2
|
||||||
SEP #$20 ; set 8-bit accumulator
|
SEP #$20 ; set 8-bit accumulator
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CMP.b #$5C : BNE + ; Blue Clock
|
+ CMP.b #$5C : BNE + ; Blue Clock
|
||||||
REP #$20 ; set 16-bit accumulator
|
REP #$20 ; set 16-bit accumulator
|
||||||
LDA !CHALLENGE_TIMER : !ADD.l BlueClockAmount : STA !CHALLENGE_TIMER
|
LDA ChallengeTimer : !ADD.l BlueClockAmount : STA ChallengeTimer
|
||||||
LDA !CHALLENGE_TIMER+2 : ADC.l BlueClockAmount+2 : STA !CHALLENGE_TIMER+2
|
LDA ChallengeTimer+2 : ADC.l BlueClockAmount+2 : STA ChallengeTimer+2
|
||||||
SEP #$20 ; set 8-bit accumulator
|
SEP #$20 ; set 8-bit accumulator
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CMP.b #$5D : BNE + ; Green Clock
|
+ CMP.b #$5D : BNE + ; Green Clock
|
||||||
REP #$20 ; set 16-bit accumulator
|
REP #$20 ; set 16-bit accumulator
|
||||||
LDA !CHALLENGE_TIMER : !ADD.l GreenClockAmount : STA !CHALLENGE_TIMER
|
LDA ChallengeTimer : !ADD.l GreenClockAmount : STA ChallengeTimer
|
||||||
LDA !CHALLENGE_TIMER+2 : ADC.l GreenClockAmount+2 : STA !CHALLENGE_TIMER+2
|
LDA ChallengeTimer+2 : ADC.l GreenClockAmount+2 : STA ChallengeTimer+2
|
||||||
SEP #$20 ; set 8-bit accumulator
|
SEP #$20 ; set 8-bit accumulator
|
||||||
JMP .done
|
JMP .done
|
||||||
+ CMP.b #$5E : BNE + ; Progressive Sword
|
+ CMP.b #$5E : BNE + ; Progressive Sword
|
||||||
@@ -323,7 +320,7 @@ AddReceivedItemExpandedGetItem:
|
|||||||
+ CMP.b #$6C : BNE + ; Goal Collectable (Multi/Power Star) Alternate Graphic
|
+ CMP.b #$6C : BNE + ; Goal Collectable (Multi/Power Star) Alternate Graphic
|
||||||
.multi_collect
|
.multi_collect
|
||||||
LDA GoalItemRequirement : BEQ ++
|
LDA GoalItemRequirement : BEQ ++
|
||||||
LDA !GOAL_COUNTER : INC : STA !GOAL_COUNTER
|
LDA GoalCounter : INC : STA GoalCounter
|
||||||
CMP GoalItemRequirement : !BLT ++
|
CMP GoalItemRequirement : !BLT ++
|
||||||
LDA TurnInGoalItems : BNE ++
|
LDA TurnInGoalItems : BNE ++
|
||||||
JSL.l ActivateGoal
|
JSL.l ActivateGoal
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ QuickSwap:
|
|||||||
BRA .store
|
BRA .store
|
||||||
|
|
||||||
.special_swap
|
.special_swap
|
||||||
LDA BowTracking : ORA #$01 : STA BowTracking
|
LDA InventoryTracking+1 : ORA #$01 : STA InventoryTracking+1
|
||||||
CPX.b #$02 : BEQ + ; boomerang
|
CPX.b #$02 : BEQ + ; boomerang
|
||||||
CPX.b #$01 : BEQ + ; bow
|
CPX.b #$01 : BEQ + ; bow
|
||||||
CPX.b #$05 : BEQ + ; powder
|
CPX.b #$05 : BEQ + ; powder
|
||||||
@@ -50,10 +50,10 @@ RTL
|
|||||||
RCode:
|
RCode:
|
||||||
LDX.w $0202
|
LDX.w $0202
|
||||||
LDA.b $F2 : BIT #$20 : BNE ++ ; Still holding L from a previous frame
|
LDA.b $F2 : BIT #$20 : BNE ++ ; Still holding L from a previous frame
|
||||||
LDA BowTracking : AND #$FE : STA BowTracking
|
LDA InventoryTracking+1 : AND #$FE : STA InventoryTracking+1
|
||||||
BRA +
|
BRA +
|
||||||
++
|
++
|
||||||
LDA BowTracking : BIT #$01 : BEQ +
|
LDA InventoryTracking+1 : BIT #$01 : BEQ +
|
||||||
RTS
|
RTS
|
||||||
-
|
-
|
||||||
+ CPX.b #$14 : BNE + : LDX.b #$00 ;will wrap around to 1
|
+ CPX.b #$14 : BNE + : LDX.b #$00 ;will wrap around to 1
|
||||||
@@ -65,10 +65,10 @@ RTS
|
|||||||
LCode:
|
LCode:
|
||||||
LDX.w $0202
|
LDX.w $0202
|
||||||
LDA.b $F2 : BIT #$10 : BNE ++ ; Still holding R from a previous frame
|
LDA.b $F2 : BIT #$10 : BNE ++ ; Still holding R from a previous frame
|
||||||
LDA BowTracking : AND #$FE : STA BowTracking
|
LDA InventoryTracking+1 : AND #$FE : STA InventoryTracking+1
|
||||||
BRA +
|
BRA +
|
||||||
++
|
++
|
||||||
LDA BowTracking : BIT #$01 : BEQ +
|
LDA InventoryTracking+1 : BIT #$01 : BEQ +
|
||||||
RTS
|
RTS
|
||||||
-
|
-
|
||||||
+ CPX.b #$01 : BNE + : LDX.b #$15 ; will wrap around to $14
|
+ CPX.b #$01 : BNE + : LDX.b #$15 ; will wrap around to $14
|
||||||
|
|||||||
31
sram.asm
31
sram.asm
@@ -161,10 +161,10 @@ CurrentGenericKeys: skip 1 ; Generic small keys
|
|||||||
;================================================================================
|
;================================================================================
|
||||||
; Tracking & Indicators ($7EF38C - $7EF3F0)
|
; Tracking & Indicators ($7EF38C - $7EF3F0)
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
InventoryTracking: skip 2 ; b r m p n s k f (bitfield)
|
InventoryTracking: skip 2 ; b r m p n s k f - - - - - - - q (bitfield)
|
||||||
; b = Blue Boomerang | r = Red Boomerang | m = Mushroom Current
|
; b = Blue Boomerang | r = Red Boomerang | m = Mushroom Current
|
||||||
; p = Magic Powder | n = Mushroom Past | s = Shovel
|
; p = Magic Powder | n = Mushroom Past | s = Shovel
|
||||||
; k = Inactive Flute | f = Active Flute
|
; k = Inactive Flute | f = Active Flute | q = Quickswap locked
|
||||||
BowTracking: skip 2 ; b s p - - - - - (bitfield)
|
BowTracking: skip 2 ; b s p - - - - - (bitfield)
|
||||||
; b = Bow | s = Silver Arrows Upgrade | p = Second Progressive Bow
|
; b = Bow | s = Silver Arrows Upgrade | p = Second Progressive Bow
|
||||||
; The front end writes two distinct progressive bow items. p
|
; The front end writes two distinct progressive bow items. p
|
||||||
@@ -250,8 +250,7 @@ BigKeysBigChests: skip 1 ; k k k k c c c c (packed integers)
|
|||||||
; k = Big Keys collected | c = Big Chests opened
|
; k = Big Keys collected | c = Big Chests opened
|
||||||
MapsCompasses: skip 1 ; m m m m c c c c (packed integers)
|
MapsCompasses: skip 1 ; m m m m c c c c (packed integers)
|
||||||
; m = Maps collected | c = Compasses collected
|
; m = Maps collected | c = Compasses collected
|
||||||
HeartPiecesPendants: skip 1 ; h h h h - - p p (packed integers)
|
PendantCounter: skip 1 ; Number of pendants collected (integer)
|
||||||
; h = Heart Pieces collected | p = Pendants collected
|
|
||||||
PreGTBKLocations: skip 1 ; Locations checked in GT before finding the big key
|
PreGTBKLocations: skip 1 ; Locations checked in GT before finding the big key
|
||||||
; b = Big Bomb Acquired | s = Silver Arrows Acquired
|
; b = Big Bomb Acquired | s = Silver Arrows Acquired
|
||||||
; c = GT locations collected before big key
|
; c = GT locations collected before big key
|
||||||
@@ -269,11 +268,12 @@ NMIFrames: skip 4 ; Frame counter incremented during NMI hook (32-
|
|||||||
ChestsOpened: skip 1 ; Number of chests opened. Doesn't count NPC, free standing items etc (integer)
|
ChestsOpened: skip 1 ; Number of chests opened. Doesn't count NPC, free standing items etc (integer)
|
||||||
StatsLocked: skip 1 ; Set to $01 when goal is completed; game stops counting stats.
|
StatsLocked: skip 1 ; Set to $01 when goal is completed; game stops counting stats.
|
||||||
MenuTime: skip 4 ; Total menu time in frames (32-bit integer)
|
MenuTime: skip 4 ; Total menu time in frames (32-bit integer)
|
||||||
HeartPieces: skip 1 ; Total number of heart pieces collected (integer)
|
HeartContainerCounter: skip 1 ; Total number of heart containers collected (integer)
|
||||||
DeathCounter: skip 1 ; Number of deaths (integer)
|
DeathCounter: skip 1 ; Number of deaths (integer)
|
||||||
skip 1 ; Reserved
|
skip 1 ; Reserved
|
||||||
FluteCounter: skip 1 ; Number of times fluted (integer)
|
FluteCounter: skip 1 ; Number of times fluted (integer)
|
||||||
skip 6 ;
|
skip 4 ;
|
||||||
|
RNGItem: skip 2 ; RNG Item
|
||||||
SwordlessBosses: skip 1 ; Number of bosses killed without a sword (integer)
|
SwordlessBosses: skip 1 ; Number of bosses killed without a sword (integer)
|
||||||
FaerieRevivalCounter: skip 1 ; Number of faerie revivals (integer)
|
FaerieRevivalCounter: skip 1 ; Number of faerie revivals (integer)
|
||||||
ChallengeTimer: skip 4 ; Timer used for OHKO etc
|
ChallengeTimer: skip 4 ; Timer used for OHKO etc
|
||||||
@@ -287,7 +287,9 @@ DamageCounter: skip 2 ; Damage taken by player (16-bit integer)
|
|||||||
MagicCounter: skip 2 ; Magic used by player (16-bit integer)
|
MagicCounter: skip 2 ; Magic used by player (16-bit integer)
|
||||||
HighestMail: skip 1 ; Highest mail level
|
HighestMail: skip 1 ; Highest mail level
|
||||||
SmallKeyCounter: skip 1 ; Total Number of small keys collected (integer)
|
SmallKeyCounter: skip 1 ; Total Number of small keys collected (integer)
|
||||||
skip 48 ; Unused
|
HeartPieceCounter: skip 1 ; Total Number of heartpieces collected (integer)
|
||||||
|
CrystalCounter: skip 1 ; Total Number of crystals collected (integer)
|
||||||
|
skip 46 ; Unused
|
||||||
ServiceSequence: skip 1 ; Service sequence value. See servicerequest.asL
|
ServiceSequence: skip 1 ; Service sequence value. See servicerequest.asL
|
||||||
skip 49 ; Unused
|
skip 49 ; Unused
|
||||||
; \ Dungeon locations checked counters (integers)
|
; \ Dungeon locations checked counters (integers)
|
||||||
@@ -466,7 +468,7 @@ assert TemperedGoldBosses = $7EF425, "TemperedGoldBosses labeled at incorrec
|
|||||||
assert FighterMasterBosses = $7EF426, "FighterMasterBosses labeled at incorrect address"
|
assert FighterMasterBosses = $7EF426, "FighterMasterBosses labeled at incorrect address"
|
||||||
assert BigKeysBigChests = $7EF427, "BigKeysBigChests labeled at incorrect address"
|
assert BigKeysBigChests = $7EF427, "BigKeysBigChests labeled at incorrect address"
|
||||||
assert MapsCompasses = $7EF428, "MapsCompasses labeled at incorrect address"
|
assert MapsCompasses = $7EF428, "MapsCompasses labeled at incorrect address"
|
||||||
assert HeartPiecesPendants = $7EF429, "HeartPiecesPendants labeled at incorrect address"
|
assert PendantCounter = $7EF429, "PendantCounter labeled at incorrect address"
|
||||||
assert PreGTBKLocations = $7EF42A, "PreGTBKLocations labeled at incorrect address"
|
assert PreGTBKLocations = $7EF42A, "PreGTBKLocations labeled at incorrect address"
|
||||||
assert RupeesSpent = $7EF42B, "RupeesSpent labeled at incorrect address"
|
assert RupeesSpent = $7EF42B, "RupeesSpent labeled at incorrect address"
|
||||||
assert SaveQuits = $7EF42D, "SaveQuits labeled at incorrect address"
|
assert SaveQuits = $7EF42D, "SaveQuits labeled at incorrect address"
|
||||||
@@ -481,9 +483,10 @@ assert NMIFrames = $7EF43E, "NMIFrames labeled at incorrect address
|
|||||||
assert ChestsOpened = $7EF442, "ChestsOpened labeled at incorrect address"
|
assert ChestsOpened = $7EF442, "ChestsOpened labeled at incorrect address"
|
||||||
assert StatsLocked = $7EF443, "StatsLocked labeled at incorrect address"
|
assert StatsLocked = $7EF443, "StatsLocked labeled at incorrect address"
|
||||||
assert MenuTime = $7EF444, "MenuTime labeled at incorrect address"
|
assert MenuTime = $7EF444, "MenuTime labeled at incorrect address"
|
||||||
assert HeartPieces = $7EF448, "HeartPieces labeled at incorrect address"
|
assert HeartContainerCounter = $7EF448, "HeartContainerCounter labeled at incorrect address"
|
||||||
assert DeathCounter = $7EF449, "DeathCounter labeled at incorrect address"
|
assert DeathCounter = $7EF449, "DeathCounter labeled at incorrect address"
|
||||||
assert FluteCounter = $7EF44B, "FluteCounter labeled at incorrect address"
|
assert FluteCounter = $7EF44B, "FluteCounter labeled at incorrect address"
|
||||||
|
assert RNGItem = $7EF450, "FluteCounter labeled at incorrect address"
|
||||||
assert SwordlessBosses = $7EF452, "SwordlessBosses labeled at incorrect address"
|
assert SwordlessBosses = $7EF452, "SwordlessBosses labeled at incorrect address"
|
||||||
assert FaerieRevivalCounter = $7EF453, "FaerieRevivalCounter labeled at incorrect address"
|
assert FaerieRevivalCounter = $7EF453, "FaerieRevivalCounter labeled at incorrect address"
|
||||||
assert ChallengeTimer = $7EF454, "ChallengeTimer labeled at incorrect address"
|
assert ChallengeTimer = $7EF454, "ChallengeTimer labeled at incorrect address"
|
||||||
@@ -492,10 +495,13 @@ assert BootsTime = $7EF45C, "BootsTime labeled at incorrect address
|
|||||||
assert FluteTime = $7EF460, "FluteTime labeled at incorrect address"
|
assert FluteTime = $7EF460, "FluteTime labeled at incorrect address"
|
||||||
assert MirrorTime = $7EF464, "MirrorTime labeled at incorrect address"
|
assert MirrorTime = $7EF464, "MirrorTime labeled at incorrect address"
|
||||||
assert ChestTurnCounter = $7EF468, "ChestTurnCounter labeled at incorrect address"
|
assert ChestTurnCounter = $7EF468, "ChestTurnCounter labeled at incorrect address"
|
||||||
|
assert CapacityUpgrades = $7EF469, "CapacityUpgrades labeled at incorrect address"
|
||||||
assert DamageCounter = $7EF46A, "DamageCounter labeled at incorrect address"
|
assert DamageCounter = $7EF46A, "DamageCounter labeled at incorrect address"
|
||||||
assert MagicCounter = $7EF46C, "MagicCounter labeled at incorrect address"
|
assert MagicCounter = $7EF46C, "MagicCounter labeled at incorrect address"
|
||||||
assert HighestMail = $7EF46E, "HighestMail labeled at incorrect address"
|
assert HighestMail = $7EF46E, "HighestMail labeled at incorrect address"
|
||||||
assert SmallKeyCounter = $7EF46F, "SmallKeyCounter labeled at incorrect address"
|
assert SmallKeyCounter = $7EF46F, "SmallKeyCounter labeled at incorrect address"
|
||||||
|
assert HeartPieceCounter = $7EF470, "HeartPieceCounter labeled at incorrect address"
|
||||||
|
assert CrystalCounter = $7EF471, "CrystalCounter labeled at incorrect address"
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
assert ServiceSequence = $7EF4A0, "ServiceSequence labeled at incorrect address"
|
assert ServiceSequence = $7EF4A0, "ServiceSequence labeled at incorrect address"
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
@@ -550,6 +556,9 @@ assert RomName = $7F1000, "RomName at incorrect address"
|
|||||||
; ServiceSequence: 7ef419 -> 7ef418 (two bytes reserved)
|
; ServiceSequence: 7ef419 -> 7ef418 (two bytes reserved)
|
||||||
; SwordsShields: 7ef422 -> swords using HighestSword
|
; SwordsShields: 7ef422 -> swords using HighestSword
|
||||||
; PreMirrorLocations: 7ef432 -> 7ef434, PreBoots and PreMirror now 2 bytes
|
; PreMirrorLocations: 7ef432 -> 7ef434, PreBoots and PreMirror now 2 bytes
|
||||||
|
; Heart Pieces: 7ef429 -> 7ef470
|
||||||
|
; Pendant counter: 7ef429, now an integer
|
||||||
|
; SwordlessBosses: 7ef452, now an integer
|
||||||
;
|
;
|
||||||
; DungeonLocations values and labels moved to block right before ChestKeys block
|
; DungeonLocations values and labels moved to block right before ChestKeys block
|
||||||
; starting at address 7ef472
|
; starting at address 7ef472
|
||||||
|
|||||||
@@ -627,19 +627,19 @@ RTL
|
|||||||
; out: A(b) - sum of bits
|
; out: A(b) - sum of bits
|
||||||
; caller is responsible for setting 8-bit mode and preserving X and Y
|
; caller is responsible for setting 8-bit mode and preserving X and Y
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
CountBits:
|
;CountBits:
|
||||||
PHX
|
; PHX
|
||||||
TAX ; Save a copy of value
|
; TAX ; Save a copy of value
|
||||||
LSR #4 ; Shift down hi nybble, Leave <3> in C
|
; LSR #4 ; Shift down hi nybble, Leave <3> in C
|
||||||
PHA ; And save <7:4> in Stack
|
; PHA ; And save <7:4> in Stack
|
||||||
TXA ; Recover value
|
; TXA ; Recover value
|
||||||
AND.b #$07 ; Put out <2:0> in X
|
; AND.b #$07 ; Put out <2:0> in X
|
||||||
TAX ; And save in X
|
; TAX ; And save in X
|
||||||
LDA.l NybbleBitCounts, X ; Fetch count for <2:0>
|
; LDA.l NybbleBitCounts, X ; Fetch count for <2:0>
|
||||||
PLX ; get <7:4>
|
; PLX ; get <7:4>
|
||||||
ADC.l NybbleBitCounts, X ; Add count for S & C
|
; ADC.l NybbleBitCounts, X ; Add count for S & C
|
||||||
PLX
|
; PLX
|
||||||
RTL
|
;RTL
|
||||||
|
|
||||||
; Look up table of bit counts in the values $00-$0F
|
; Look up table of bit counts in the values $00-$0F
|
||||||
NybbleBitCounts:
|
NybbleBitCounts:
|
||||||
|
|||||||
Reference in New Issue
Block a user