10 Commits

Author SHA1 Message Date
0263546e46 Fix mixing progressive/non-progressive swords and shields 2022-10-08 15:36:41 -07:00
Lexi Rose
48ccf03ac8 Merge pull request #170 from cassidoxa/ammo_capacity
Combine starting max ammo and capacity upgrade in SRAM into single, flat ammo capacity values
2022-10-01 08:08:26 -05:00
cassidoxa
f8d9be201a tables.asm: Add GFX pointer to table in utilities.asm 2022-09-09 19:30:16 -04:00
cassidoxa
031e3965b2 Requires frontend changes
Change SRAM ammo capacity upgrades to flatly represent max capacity
2022-08-08 13:42:19 -04:00
Lexi Rose
aba3ec930d Merge pull request #169 from cassidoxa/validate_sram
Compute checksum for extended SRAM
2022-08-01 08:40:19 -05:00
cassidoxa
95ee31f7c9 Remove some hard coded addresses for MVN instructions 2022-07-29 22:04:13 -04:00
cassidoxa
d8846a4ba9 Add backup save that gets checked and loaded if main save is corrupt
Add suffixes to instructions in save.asm
Disable HDMA, NMI, and joypad during extended save DMA
2022-07-29 20:57:54 -04:00
cassidoxa
10079a539b Compute checksum for extended SRAM
Validate SRAM on file screen load and delete if checksum incorrect
2022-07-25 22:19:06 -04:00
Lexi Rose
0e6e5d5b45 Merge pull request #167 from cassidoxa/elder_submodule
Check submodule during goal NPC interaction to prevent it from firing when menu is open
2022-07-14 22:40:37 -05:00
cassidoxa
9e5e9a17ed Check submodule during goal NPC interaction to prevent it from firing
when menu is open (via kan)
2022-07-05 12:49:00 -04:00
12 changed files with 308 additions and 241 deletions

View File

@@ -2,36 +2,26 @@
; Capacity Logic ; Capacity Logic
;================================================================================ ;================================================================================
IncrementBombs: IncrementBombs:
LDA BombCapacityUpgrades ; get bomb upgrades LDA.l BombCapacity : BEQ + ; Skip if we can't have bombs
!ADD.l StartingMaxBombs : BEQ + ; Skip if we can't have bombs DEC
DEC CMP.l BombsEquipment : !BLT +
LDA.l BombsEquipment
CMP BombsEquipment CMP.b #99 : !BGE +
INC : STA.l BombsEquipment
!BLT + +
LDA BombsEquipment
CMP.b #99 : !BGE +
INC : STA BombsEquipment
+
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
IncrementArrows: IncrementArrows:
LDA ArrowCapacityUpgrades ; get arrow upgrades LDA.l ArrowCapacity : DEC
!ADD.l StartingMaxArrows : DEC CMP.l CurrentArrows : !BLT +
LDA.l CurrentArrows
CMP CurrentArrows CMP.b #99 : !BGE +
INC : STA.l CurrentArrows
!BLT + +
LDA CurrentArrows
CMP.b #99 : !BGE +
INC : STA CurrentArrows
+
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CompareBombsToMax: CompareBombsToMax:
LDA BombCapacityUpgrades ; get bomb upgrades LDA.l BombCapacity
!ADD.l StartingMaxBombs CMP.l BombsEquipment
CMP BombsEquipment
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -50,6 +50,8 @@ RTL
RTS RTS
+ +
SEP #$20 SEP #$20
LDA.b $11
BNE .done
LDA.b #$96 LDA.b #$96
LDY.b #$01 LDY.b #$01

View File

@@ -89,16 +89,17 @@ OnAga2Defeated:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnFileCreation: OnFileCreation:
; Copy initial SRAM state from ROM to cart SRAM ; Copy initial SRAM state from ROM to cart SRAM
; If the inital SRAM table is move these addresses must be changed
PHB PHB
LDA.w #$03D7 ; \ LDA.w #$03D7 ; \
LDX.w #$B000 ; | Copies from beginning of inital sram table up to file name LDX.w #$B000 ; | Copies from beginning of inital sram table up to file name
LDY.w #$0000 ; | (exclusively) LDY.w #$0000 ; | (exclusively)
MVN $70, $30 ; / MVN SRAMBank, SRAMTableBank ; /
; Skip file name and validity value ; Skip file name and validity value
LDA.w #$010C ; \ LDA.w #$010C ; \
LDX.w #$B3E3 ; | Rando-Specific Assignments & Game Stats block LDX.w #$B3E3 ; | Rando-Specific Assignments & Game Stats block
LDY.w #$03E3 ; | LDY.w #$03E3 ; |
MVN $70, $30 ; / MVN SRAMBank, SRAMTableBank ; /
PLB PLB
; resolve instant post-aga if standard ; resolve instant post-aga if standard

View File

@@ -188,7 +188,7 @@ JSL.l AltBufferTable : NOP #8 ; Delete screen
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $0CCCCC ;<- 64CCC - Bank0C.asm : 1628 (JSL Intro_ValidateSram) / Bank02.asm : 75 (REP #$30) org $0CCCCC ;<- 64CCC - Bank0C.asm : 1628 (JSL Intro_ValidateSram) / Bank02.asm : 75 (REP #$30)
; Explanation: In JP 1.0 the code for Intro_ValidateSram was inline in Bank 0C ; Explanation: In JP 1.0 the code for Intro_ValidateSram was inline in Bank 0C
JML.l Validate_SRAM ;(Return via RTL. Original code JML'd to Intro_LoadSpriteStats which returns with RTL, but we want to skip that) JML.l ValidateSRAM ;(Return via RTL. Original code JML'd to Intro_LoadSpriteStats which returns with RTL, but we want to skip that)
org $0CCD57 ;<- 64D57 - Bank0C.asm : org $0CCD57 ;<- 64D57 - Bank0C.asm :
RTL ;Just in case anybody ever removes the previous hook RTL ;Just in case anybody ever removes the previous hook
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -299,12 +299,17 @@ BRA +
;================================================================================ ;================================================================================
; Extended SRAM Save file ; Extended SRAM Save file
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $0ccf08 ; <- Bank0C.asm : 2036 (LDA.w #$0007 : STA $7EC00D : STA $7EC013) org $0CCF08 ; <- Bank0C.asm : 2036 (LDA.w #$0007 : STA $7EC00D : STA $7EC013)
JSL CopyExtendedSaveFileToWRAM JSL CopyExtendedSaveFileToWRAM
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $008998 ; <- Bank00.asm : 1296 (LDX.w #$0000) org $008998 ; <- Bank00.asm : 1296 (LDX.w #$0000)
JSL CopyExtendedWRAMSaveFileToSRAM JSL CopyExtendedWRAMSaveFileToSRAM
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $00899C ; <- bank_00.asm : #_00899C (CLC)
JSL WriteSaveChecksumAndBackup
LDA.w #$01F3 : TCS : SEP #$30 : PLB : RTL ; Get the stack and data bank correct
padbyte $FF : pad $0089C2 ; Fill adjacent free rom forward. See bank_00.asm: #_0089C2
;--------------------------------------------------------------------------------
org $0CD7AB ; <- Bank0C.asm : 3342 (STA $700400, X) org $0CD7AB ; <- Bank0C.asm : 3342 (STA $700400, X)
JSL.l ClearExtendedSaveFile JSL.l ClearExtendedSaveFile
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -2807,4 +2812,4 @@ if !FEATURE_NEW_TEXT
JSL RenderCharSetColorExtended_init JSL RenderCharSetColorExtended_init
org $0EF285 org $0EF285
JSL RenderCharSetColorExtended_close : NOP JSL RenderCharSetColorExtended_close : NOP
endif endif

View File

@@ -15,6 +15,7 @@ fillword $0000 ; Zero out the table
fill $500 ; fill $500 ;
org $30B000 ; PC 0x183000 org $30B000 ; PC 0x183000
InitSRAMTable:
InitRoomDataWRAM: InitRoomDataWRAM:
org $30B060 ; PC 0x183060 org $30B060 ; PC 0x183060
InitATAltarRoom: dw $0000 ; aga curtains InitATAltarRoom: dw $0000 ; aga curtains
@@ -81,8 +82,8 @@ StartingHealth: db $18 ; PC 0x18336C
StartingMaximumHealth: db $18 ; PC 0x18336D StartingMaximumHealth: db $18 ; PC 0x18336D
StartingMagic: skip 1 ; PC 0x18336E StartingMagic: skip 1 ; PC 0x18336E
StartingSmallKeys: db $FF ; PC 0x18336F StartingSmallKeys: db $FF ; PC 0x18336F
StartingBombCapacityUpgrade: skip 1 ; PC 0x183370 StartingBombCapacity: db $0A ; PC 0x183370
StartingArrowCapacityUpgrade: skip 1 ; PC 0x183371 StartingArrowCapacity: db $1E ; PC 0x183371
InitHeartsFiller: skip 1 ; PC 0x183372 InitHeartsFiller: skip 1 ; PC 0x183372
InitMagicFiller: skip 1 ; PC 0x183373 InitMagicFiller: skip 1 ; PC 0x183373
StartingPendants: skip 1 ; PC 0x183374 StartingPendants: skip 1 ; PC 0x183374
@@ -150,13 +151,13 @@ org $30B414 ; PC 0x183414-0x183416
InitMapOverlay: dw $0000 InitMapOverlay: dw $0000
org $30B417 ; PC 0x183417 org $30B417 ; PC 0x183417
InitHighestSword: db $00 InitProgressiveSwords: db $00
org $30B414 ; PC 0x183418-0x183419 org $30B414 ; PC 0x183418-0x183419
InitGoalCounter: dw $0000 InitGoalCounter: dw $0000
org $30B422 ; PC 0x183422 org $30B422 ; PC 0x183422
InitHighestShield: db $00 InitProgressiveShields: db $00
org $30B428 ; PC 0x183428 org $30B428 ; PC 0x183428
InitMapsCompasses: db $00 InitMapsCompasses: db $00

View File

@@ -326,33 +326,16 @@ 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 .stampSword
JSR .incrementSword
JSR .incrementShield
JMP .done JMP .done
+ CPY.b #$01 : BNE + ; Master Sword + CPY.b #$01 : BNE + ; Master Sword
LDX #$02 JSR .stampSword
JSR .incrementSword
JMP .done JMP .done
+ CPY.b #$02 : BNE + ; Tempered Sword + CPY.b #$02 : BNE + ; Tempered Sword
LDX #$03 JSR .stampSword
JSR .incrementSword
JMP .done JMP .done
+ CPY.b #$03 : BNE + ; Golden Sword + CPY.b #$03 : BNE + ; Golden Sword
LDX #$04 JSR .stampSword
JSR .incrementSword
JMP .done
+ CPY.b #$04 : BNE + ; Fighter's Shield
LDX #$01
JSR .incrementShield
JMP .done
+ CPY.b #$05 : BNE + ; Red Shield
LDX #$02
JSR .incrementShield
JMP .done
+ CPY.b #$06 : BNE + ; Mirror Shield
LDX #$03
JSR .incrementShield
JMP .done JMP .done
+ CPY.b #$07 : !BLT + ; Items $07 - $0D + CPY.b #$07 : !BLT + ; Items $07 - $0D
CPY.b #$0E : !BGE + CPY.b #$0E : !BGE +
@@ -452,8 +435,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 .stampSword
JSR .incrementSword
JMP .done JMP .done
+ CPY.b #$4A : BNE + ; Flute (Active) + CPY.b #$4A : BNE + ; Flute (Active)
JSR .stampFlute JSR .stampFlute
@@ -472,8 +454,7 @@ AddInventory:
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 .stampSword
JSR .incrementSword
JMP .done JMP .done
+ CPY.b #$51 : BNE + ; 5 Bomb Capacity Upgrade + CPY.b #$51 : BNE + ; 5 Bomb Capacity Upgrade
LDX #$02 LDX #$02
@@ -491,12 +472,11 @@ AddInventory:
JSR .incrementBow JSR .incrementBow
JMP .done JMP .done
+ CPY.b #$5E : BNE + ; Progressive Sword + CPY.b #$5E : BNE + ; Progressive Sword
LDA SwordEquipment : INC : TAX JSR .stampSword
JSR .incrementSword LDA.l ProgressiveSwords : INC : STA.l ProgressiveSwords
JMP .done JMP .done
+ CPY.b #$5F : BNE + ; Progressive Shield + CPY.b #$5F : BNE + ; Progressive Shield
LDA ShieldEquipment : INC : TAX LDA.l ProgressiveShields : INC : STA.l ProgressiveShields
JSR .incrementShield
JMP .done JMP .done
+ CPY.b #$60 : BNE + ; Progressive Armor + CPY.b #$60 : BNE + ; Progressive Armor
LDA ArmorEquipment : INC : TAX LDA ArmorEquipment : INC : TAX
@@ -573,21 +553,6 @@ RTS
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
RTS RTS
.incrementSword
JSR .stampSword
LDA HighestSword
INC : STA $04 : CPX $04 : !BLT + ; don't increment unless we're getting a better sword
TXA : STA HighestSword
+
RTS
.incrementShield
LDA HighestShield
INC : STA $04 : CPX $04 : !BLT + ; don't increment unless we're getting a better shield
TXA : STA HighestShield
+
RTS
.incrementBow .incrementBow
LDA BowEquipment : BNE .dontCount ; Don't increment Y item count for extra bows LDA BowEquipment : BNE .dontCount ; Don't increment Y item count for extra bows
.incrementY .incrementY
@@ -695,7 +660,7 @@ RTS
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
Link_ReceiveItem_HUDRefresh: Link_ReceiveItem_HUDRefresh:
LDA BombsEquipment : BNE + ; skip if we have bombs LDA BombsEquipment : BNE + ; skip if we have bombs
LDA BombCapacityUpgrades : !ADD.l StartingMaxBombs : BEQ + ; skip if we can't have bombs LDA BombCapacity : BEQ + ; skip if we can't have bombs
LDA BombsFiller : BEQ + ; skip if we are filling no bombs LDA BombsFiller : BEQ + ; skip if we are filling no bombs
DEC : STA BombsFiller ; decrease bomb fill count DEC : STA BombsFiller ; decrease bomb fill count
LDA.b #$01 : STA BombsEquipment ; increase actual bomb count LDA.b #$01 : STA BombsEquipment ; increase actual bomb count
@@ -712,7 +677,7 @@ RTL
HandleBombAbsorbtion: HandleBombAbsorbtion:
STA BombsFiller ; 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 BombCapacityUpgrades : !ADD.l StartingMaxBombs : BEQ + ; skip if we can't have bombs LDA BombCapacity : 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

View File

@@ -60,7 +60,7 @@ RTS
RTS RTS
.isSword .isSword
PHA PHA
LDA HighestSword : STA $04 LDA SwordEquipment : 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
@@ -73,9 +73,11 @@ RTS
JMP .done JMP .done
.isUncleSwordShield .isUncleSwordShield
PHA PHA
LDA HighestSword : STA [$00] ; already set to 1 if we had no sword, always keep highest ; set sword to 1 if current sword is 0
LDA [$00] : BNE + : LDA.b #$01 : STA [$00] : +
INC $00 INC $00
LDA HighestShield : STA [$00] ; set shield to 1 if current shield is 0
LDA [$00] : BNE + : LDA.b #$01 : STA [$00] : +
PLA PLA
RTS RTS
;================================================================================ ;================================================================================

View File

@@ -208,13 +208,11 @@ AddReceivedItemExpandedGetItem:
LDA BowTracking : ORA #$40 : STA BowTracking ; mark silver bow on y-toggle LDA BowTracking : ORA #$40 : STA BowTracking ; mark silver bow on y-toggle
JMP .done JMP .done
+ CMP.b #$4C : BNE + ; 50 bombs + CMP.b #$4C : BNE + ; 50 bombs
;LDA.b #$07 : STA BombCapacityUpgrades ; upgrade bombs LDA.b #50 : STA BombCapacity ; upgrade bombs
LDA.b #50 : !SUB.l StartingMaxBombs : STA BombCapacityUpgrades ; upgrade bombs
LDA.b #50 : STA BombsFiller ; fill bombs LDA.b #50 : STA BombsFiller ; fill bombs
JMP .done JMP .done
+ CMP.b #$4D : BNE + ; 70 arrows + CMP.b #$4D : BNE + ; 70 arrows
;LDA #$07 : STA ArrowCapacityUpgrades ; upgrade arrows LDA.b #70 : STA ArrowCapacity ; upgrade arrows
LDA.b #70 : !SUB.l StartingMaxArrows : STA ArrowCapacityUpgrades ; upgrade arrows
LDA.b #70 : STA ArrowsFiller ; fill arrows LDA.b #70 : STA ArrowsFiller ; fill arrows
JMP .done JMP .done
+ CMP.b #$4E : BNE + ; 1/2 magic + CMP.b #$4E : BNE + ; 1/2 magic
@@ -232,19 +230,19 @@ AddReceivedItemExpandedGetItem:
LDA.b #$02 : STA SwordEquipment ; set master sword LDA.b #$02 : STA SwordEquipment ; set master sword
JMP .done JMP .done
+ CMP.b #$51 : BNE + ; +5 Bombs + CMP.b #$51 : BNE + ; +5 Bombs
LDA BombCapacityUpgrades : !ADD.b #$05 : STA BombCapacityUpgrades ; upgrade bombs +5 LDA BombCapacity : !ADD.b #$05 : STA BombCapacity ; upgrade bombs +5
LDA.l Upgrade5BombsRefill : STA BombsFiller ; fill bombs LDA.l Upgrade5BombsRefill : STA BombsFiller ; fill bombs
JMP .done JMP .done
+ CMP.b #$52 : BNE + ; +10 Bombs + CMP.b #$52 : BNE + ; +10 Bombs
LDA BombCapacityUpgrades : !ADD.b #$0A : STA BombCapacityUpgrades ; upgrade bombs +10 LDA BombCapacity : !ADD.b #$0A : STA BombCapacity ; upgrade bombs +10
LDA.l Upgrade10BombsRefill : STA BombsFiller ; fill bombs LDA.l Upgrade10BombsRefill : STA BombsFiller ; fill bombs
JMP .done JMP .done
+ CMP.b #$53 : BNE + ; +5 Arrows + CMP.b #$53 : BNE + ; +5 Arrows
LDA ArrowCapacityUpgrades : !ADD.b #$05 : STA ArrowCapacityUpgrades ; upgrade arrows +5 LDA ArrowCapacity : !ADD.b #$05 : STA ArrowCapacity ; upgrade arrows +5
LDA.l Upgrade5ArrowsRefill : STA ArrowsFiller ; fill arrows LDA.l Upgrade5ArrowsRefill : STA ArrowsFiller ; fill arrows
JMP .done JMP .done
+ CMP.b #$54 : BNE + ; +10 Arrows + CMP.b #$54 : BNE + ; +10 Arrows
LDA ArrowCapacityUpgrades : !ADD.b #$0A : STA ArrowCapacityUpgrades ; upgrade arrows +10 LDA ArrowCapacity : !ADD.b #$0A : STA ArrowCapacity ; upgrade arrows +10
LDA.l Upgrade10ArrowsRefill : STA ArrowsFiller ; fill arrows LDA.l Upgrade10ArrowsRefill : STA ArrowsFiller ; fill arrows
JMP .done JMP .done
+ CMP.b #$55 : BNE + ; Programmable Object 1 + CMP.b #$55 : BNE + ; Programmable Object 1
@@ -451,7 +449,7 @@ AddReceivedItemExpanded:
LDA.b #$4F : STA $02D8 LDA.b #$4F : STA $02D8
+++ : JMP .done +++ : JMP .done
++ : CMP.b #$5E : BNE ++ ; Progressive Sword ++ : CMP.b #$5E : BNE ++ ; Progressive Sword
LDA SwordEquipment : CMP.l ProgressiveSwordLimit : !BLT + LDA ProgressiveSwords : CMP.l ProgressiveSwordLimit : !BLT +
LDA.l ProgressiveSwordReplacement : STA $02D8 : JMP .done LDA.l ProgressiveSwordReplacement : STA $02D8 : JMP .done
+ : CMP.b #$00 : BNE + ; No Sword + : CMP.b #$00 : BNE + ; No Sword
LDA.b #$49 : STA $02D8 : JMP .done LDA.b #$49 : STA $02D8 : JMP .done
@@ -462,7 +460,7 @@ AddReceivedItemExpanded:
+ ; Everything Else + ; Everything Else
LDA.b #$03 : STA $02D8 : JMP .done LDA.b #$03 : STA $02D8 : JMP .done
++ : CMP.b #$5F : BNE ++ ; Progressive Shield ++ : CMP.b #$5F : BNE ++ ; Progressive Shield
LDA ShieldEquipment : CMP.l ProgressiveShieldLimit : !BLT + LDA ProgressiveShields : CMP.l ProgressiveShieldLimit : !BLT +
LDA.l ProgressiveShieldReplacement : STA $02D8 : JMP .done LDA.l ProgressiveShieldReplacement : STA $02D8 : JMP .done
+ : CMP.b #$00 : BNE + ; No Shield + : CMP.b #$00 : BNE + ; No Shield
LDA.b #$04 : STA $02D8 : JMP .done LDA.b #$04 : STA $02D8 : JMP .done

297
save.asm
View File

@@ -1,129 +1,218 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
Validate_SRAM: WriteSaveChecksumAndBackup:
REP #$30 ; vanilla behavior from $0CCD45, includes prize pack reset after save and quit LDX.w #$0000 : TXA : - ; Checksum first $04FE bytes
LDX #$00FE : - CLC : ADC.l SaveDataWRAM, X
STZ $0D00, X INX #2
STZ $0E00, X CPX.w #$04FE : BNE -
STZ $0F00, X LDX.w #$0000 : - ; Checksum extended save data
DEX #2 CLC : ADC.l ExtendedFileNameWRAM, X
BPL - INX #2
CPX.w #$0FFE : BNE -
STA.b $00
LDA.w #$5A5A
SEC : SBC.b $00
STA.l InverseChecksumSRAM
PHB
LDA.w #$14FF ; \
LDX.w #CartridgeSRAM&$FFFF ; | Copies $1500 bytes from beginning of cart SRAM to
LDY.w #SaveBackupSRAM&$FFFF ; | $704000
MVN SRAMBank, SRAMBank ; /
PLB
RTL
;--------------------------------------------------------------------------------
ValidateSRAM:
REP #$30
LDX.w #$0000 : TXA : - ; Checksum first $04FE bytes
CLC : ADC.l CartridgeSRAM, X
INX #2
CPX.w #$04FE : BNE -
LDX.w #$0000 : - ; Checksum extended save data
CLC : ADC.l ExtendedFileNameSRAM, X
INX #2
CPX.w #$0FFE : BNE -
STA.b $00
LDA.w #$5A5A
SEC : SBC.b $00
CMP.l InverseChecksumSRAM : BEQ .goodchecksum
LDX.w #$0000 : TXA : - ; Do the same for the backup save
CLC : ADC.l SaveBackupSRAM, X
INX #2
CPX.w #$04FE : BNE -
LDX.w #$0000 : -
CLC : ADC.l SaveBackupSRAM+$500, X
INX #2
CPX.w #$0FFE : BNE -
STA.b $00
LDA.w #$5A5A
SEC : SBC.b $00
CMP.l SaveBackupSRAM+$4FE : BEQ +
TDC : STA.l FileValiditySRAM ; Delete save by way of zeroing validity marker
BRA .goodchecksum : +
PHB
LDA.w #$14FF ; \
LDX.w #SaveBackupSRAM&$FFFF ; | Copies $1500 bytes from backup on cart SRAM to
LDY.w #CartridgeSRAM&$FFFF ; | main save location at $700000
MVN SRAMBank, SRAMBank ; /
PLB
.goodchecksum
LDX.w #$00FE : - ; includes prize pack reset after save and quit
STZ.w $0D00, X
STZ.w $0E00, X
STZ.w $0F00, X
DEX #2
BPL -
SEP #$30 SEP #$30
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ClearExtendedSaveFile: ClearExtendedSaveFile:
STA $700400, X ; what we wrote over STA.l $700400, X ; what we wrote over
STA $700500, X STA.l $700500, X
STA $700600, X STA.l $700600, X
STA $700700, X STA.l $700700, X
STA $700800, X STA.l $700800, X
STA $700900, X STA.l $700900, X
STA $700A00, X STA.l $700A00, X
STA $700B00, X STA.l $700B00, X
STA $700C00, X STA.l $700C00, X
STA $700D00, X STA.l $700D00, X
STA $700E00, X STA.l $700E00, X
STA $700F00, X STA.l $700F00, X
STA.l $701000, X
STA.l $701100, X
STA.l $701200, X
STA.l $701300, X
STA.l $701400, X
; Clear backup save
STA.l $704000, X
STA.l $704100, X
STA.l $704200, X
STA.l $704300, X
STA.l $704400, X
STA.l $704500, X
STA.l $704600, X
STA.l $704700, X
STA.l $704800, X
STA.l $704900, X
STA.l $704A00, X
STA.l $704B00, X
STA.l $704C00, X
STA.l $704D00, X
STA.l $704E00, X
STA.l $704F00, X
STA.l $705000, X
STA.l $705100, X
STA.l $705200, X
STA.l $705300, X
STA.l $705400, X
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ClearExtendedWRAMSaveFile: ClearExtendedWRAMSaveFile:
STA $7EF400, X ; what we wrote over STA.l $7EF400, X ; what we wrote over
STA $7F6000, X STA.l $7F6000, X
STA $7F6100, X STA.l $7F6100, X
STA $7F6200, X STA.l $7F6200, X
STA $7F6300, X STA.l $7F6300, X
STA $7F6400, X STA.l $7F6400, X
STA $7F6500, X STA.l $7F6500, X
STA $7F6600, X STA.l $7F6600, X
STA $7F6700, X STA.l $7F6700, X
STA $7F6800, X STA.l $7F6800, X
STA $7F6900, X STA.l $7F6900, X
STA $7F6A00, X STA.l $7F6A00, X
STA $7F6B00, X STA.l $7F6B00, X
STA $7F6C00, X STA.l $7F6C00, X
STA $7F6D00, X STA.l $7F6D00, X
STA $7F6E00, X STA.l $7F6E00, X
STA $7F6F00, X STA.l $7F6F00, X
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CopyExtendedSaveFileToWRAM: CopyExtendedSaveFileToWRAM:
PHA PHA
SEP #$30 SEP #$30
LDA $4300 : PHA ; preserve DMA parameters LDA.w $4300 : PHA ; preserve DMA parameters
LDA $4301 : PHA ; preserve DMA parameters LDA.w $4301 : PHA ; preserve DMA parameters
LDA $4302 : PHA ; preserve DMA parameters LDA.w $4302 : PHA ; preserve DMA parameters
LDA $4303 : PHA ; preserve DMA parameters LDA.w $4303 : PHA ; preserve DMA parameters
LDA $4304 : PHA ; preserve DMA parameters LDA.w $4304 : PHA ; preserve DMA parameters
LDA $4305 : PHA ; preserve DMA parameters LDA.w $4305 : PHA ; preserve DMA parameters
LDA $4306 : PHA ; preserve DMA parameters LDA.w $4306 : PHA ; preserve DMA parameters
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LDA #$00 : STA $4300 ; set DMA transfer direction A -> B, bus A auto increment, single-byte mode STZ.w $4200 ; Disable NMI, V/H, joypad
STZ.w $420C ; Disable HDMA
LDA.b #$00 : STA.w $4300 ; set DMA transfer direction A -> B, bus A auto increment, single-byte mode
LDA #$80 : STA $4301 ; set bus B source to WRAM register LDA.b #$80 : STA.w $4301 ; set bus B source to WRAM register
LDA #$00 : STA $2181 ; set WRAM register source address LDA.b #$00 : STA.w $2181 ; set WRAM register source address
LDA #$60 : STA $2182 LDA.b #$60 : STA.w $2182
LDA #$7F : STA $2183 LDA.b #$7F : STA.w $2183
STZ $4302 ; set bus A destination address to SRAM STZ.w $4302 ; set bus A destination address to SRAM
LDA #$05 : STA $4303 LDA.b #$05 : STA.w $4303
LDA #$70 : STA $4304 LDA.b #$70 : STA.w $4304
LDA #$00 : STA $4305 ; set transfer size to 0x1000 LDA.b #$00 : STA.w $4305 ; set transfer size to 0x1000
LDA #$10 : STA $4306 ; STZ $4307 LDA.b #$10 : STA.w $4306 ; STZ $4307
LDA #$01 : STA $420B ; begin DMA transfer LDA.b #$01 : STA.w $420B ; begin DMA transfer
;-------------------------------------------------------------------------------- LDA.b #$81 : STA.w $4200 ; Re-enable NMI and joypad
PLA : STA $4306 ; restore DMA parameters ;--------------------------------------------------------------------------------
PLA : STA $4305 ; restore DMA parameters PLA : STA.w $4306 ; restore DMA parameters
PLA : STA $4304 ; restore DMA parameters PLA : STA.w $4305 ; restore DMA parameters
PLA : STA $4303 ; restore DMA parameters PLA : STA.w $4304 ; restore DMA parameters
PLA : STA $4302 ; restore DMA parameters PLA : STA.w $4303 ; restore DMA parameters
PLA : STA $4301 ; restore DMA parameters PLA : STA.w $4302 ; restore DMA parameters
PLA : STA $4300 ; restore DMA parameters PLA : STA.w $4301 ; restore DMA parameters
REP #$30 PLA : STA.w $4300 ; restore DMA parameters
PLA REP #$30
STA $7EC00D ; what we wrote over PLA
STA $7EC00D ; what we wrote over
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CopyExtendedWRAMSaveFileToSRAM: CopyExtendedWRAMSaveFileToSRAM:
PHA PHA
PHB PHB
SEP #$30 SEP #$30
LDA #$00 : PHA : PLB LDA #$00 : PHA : PLB
LDA $4300 : PHA ; preserve DMA parameters LDA.w $4300 : PHA ; preserve DMA parameters
LDA $4301 : PHA ; preserve DMA parameters LDA.w $4301 : PHA ; preserve DMA parameters
LDA $4302 : PHA ; preserve DMA parameters LDA.w $4302 : PHA ; preserve DMA parameters
LDA $4303 : PHA ; preserve DMA parameters LDA.w $4303 : PHA ; preserve DMA parameters
LDA $4304 : PHA ; preserve DMA parameters LDA.w $4304 : PHA ; preserve DMA parameters
LDA $4305 : PHA ; preserve DMA parameters LDA.w $4305 : PHA ; preserve DMA parameters
LDA $4306 : PHA ; preserve DMA parameters LDA.w $4306 : PHA ; preserve DMA parameters
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LDA #$80 : STA $4300 ; set DMA transfer direction B -> A, bus A auto increment, single-byte mode STZ.w $4200 ; Disable NMI, V/H, joypad
STZ.w $420C ; Disable HDMA
LDA.b #$80 : STA.w $4300 ; set DMA transfer direction B -> A, bus A auto increment, single-byte mode
STA $4301 ; set bus B source to WRAM register STA.w $4301 ; set bus B source to WRAM register
LDA #$00 : STA $2181 ; set WRAM register source address LDA.b #$00 : STA.w $2181 ; set WRAM register source address
LDA #$60 : STA $2182 LDA.b #$60 : STA.w $2182
LDA #$7F : STA $2183 LDA.b #$7F : STA.w $2183
STZ $4302 ; set bus A destination address to SRAM STZ.w $4302 ; set bus A destination address to SRAM
LDA #$05 : STA $4303 LDA.b #$05 : STA.w $4303
LDA #$70 : STA $4304 LDA.b #$70 : STA.w $4304
LDA #$10 : STA $4305 ; set transfer size to 0xB00 LDA.b #$10 : STA.w $4305 ; set transfer size to 0xB00
LDA #$0B : STA $4306 ; STZ $4307 LDA.b #$0B : STA.w $4306 ; STZ $4307
LDA #$01 : STA $420B ; begin DMA transfer LDA.b #$01 : STA.w $420B ; begin DMA transfer
;-------------------------------------------------------------------------------- LDA.b #$81 : STA.w $4200 ; Re-enable NMI and joypad
PLA : STA $4306 ; restore DMA parameters ;--------------------------------------------------------------------------------
PLA : STA $4305 ; restore DMA parameters PLA : STA.w $4306 ; restore DMA parameters
PLA : STA $4304 ; restore DMA parameters PLA : STA.w $4305 ; restore DMA parameters
PLA : STA $4303 ; restore DMA parameters PLA : STA.w $4304 ; restore DMA parameters
PLA : STA $4302 ; restore DMA parameters PLA : STA.w $4303 ; restore DMA parameters
PLA : STA $4301 ; restore DMA parameters PLA : STA.w $4302 ; restore DMA parameters
PLA : STA $4300 ; restore DMA parameters PLA : STA.w $4301 ; restore DMA parameters
REP #$30 PLA : STA.w $4300 ; restore DMA parameters
PLB REP #$30
PLA PLB
LDX.w #$0000 : TXA ; what we wrote over PLA
RTL RTL

View File

@@ -10,6 +10,7 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
pushpc pushpc
org 0 ; This module writes no bytes. Asar gives bank cross errors without this. org 0 ; This module writes no bytes. Asar gives bank cross errors without this.
SaveDataWRAM = $7EF000
;================================================================================ ;================================================================================
; Room Data ($7EF000 - $7EF27F ; Room Data ($7EF000 - $7EF27F
@@ -125,8 +126,8 @@ MaximumHealth: skip 1 ; \ Max Health & Current Health
CurrentHealth: skip 1 ; / Max value for both is $A0 | $04 = half heart | $08 = heart CurrentHealth: skip 1 ; / Max value for both is $A0 | $04 = half heart | $08 = heart
CurrentMagic: skip 1 ; Current magic | Max value is $80 CurrentMagic: skip 1 ; Current magic | Max value is $80
CurrentSmallKeys: skip 1 ; Number of small keys held for current dungeon (integer) CurrentSmallKeys: skip 1 ; Number of small keys held for current dungeon (integer)
BombCapacityUpgrades: skip 1 ; \ Bomb & Arrow Capacity Upgrades BombCapacity: skip 1 ; \ Bomb & Arrow Capacity Upgrades
ArrowCapacityUpgrades: skip 1 ; / Indicates flatly how many can be held above vanilla max (integers) ArrowCapacity: skip 1 ; / Indicates flatly how many can be held (integers)
HeartsFiller: 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 MagicFiller: skip 1 ; Magic collected yet to be filled
PendantsField: skip 1 ; - - - - - g b r (bitfield) PendantsField: skip 1 ; - - - - - g b r (bitfield)
@@ -252,7 +253,7 @@ IgnoreFaeries: ;
HasGroveItem: ; HasGroveItem: ;
GeneralFlags: skip 1 ; - - h - - i - g (bitfield) GeneralFlags: skip 1 ; - - h - - i - g (bitfield)
; h = HUD Flag | i = ignore faeries | g = has diggable grove item ; h = HUD Flag | i = ignore faeries | g = has diggable grove item
HighestSword: skip 1 ; Highest sword level (integer) ProgressiveSwords: skip 1 ; Number of Progressive Swords obatined (integer)
GoalCounter: skip 2 ; Goal items collected (16-bit integer) GoalCounter: skip 2 ; Goal items collected (16-bit integer)
ProgrammableItemOne: skip 2 ; \ Reserved for programmable items ProgrammableItemOne: skip 2 ; \ Reserved for programmable items
ProgrammableItemTwo: skip 2 ; | ProgrammableItemTwo: skip 2 ; |
@@ -260,7 +261,7 @@ ProgrammableItemThree: skip 2 ; /
BonkCounter: skip 1 ; Number of times the player has bonked (integer) BonkCounter: skip 1 ; Number of times the player has bonked (integer)
YAItemCounter: skip 1 ; y y y y y a a a (packed integers) YAItemCounter: skip 1 ; y y y y y a a a (packed integers)
; Number of Y and A items collected represented as packed integers ; Number of Y and A items collected represented as packed integers
HighestShield: skip 1 ; Highest Shield level ProgressiveShields: skip 1 ; Number of Progressive Shields obtained
TotalItemCounter: skip 2 ; Total items collected (integer) TotalItemCounter: skip 2 ; Total items collected (integer)
SwordBossKills: skip 2 ; t t t t g g g g f f f f m m m m (packed integers) SwordBossKills: skip 2 ; t t t t g g g g f f f f m m m m (packed integers)
; t = Tempered Sword boss kills | g = Gold Sword boss kills ; t = Tempered Sword boss kills | g = Gold Sword boss kills
@@ -366,7 +367,7 @@ GTCollectedKeys: skip 1 ; / Ganon's Tower
skip 2 ; Reserved for previous table skip 2 ; Reserved for previous table
FileMarker: skip 1 ; $FF = Active save file | $00 = Inactive save file FileMarker: skip 1 ; $FF = Active save file | $00 = Inactive save file
skip 13 ; Unused skip 13 ; Unused
InverseChecksum: skip 2 ; Vanilla Inverse Checksum. Don't write unless computing checksum. InverseChecksumWRAM: skip 2 ; Vanilla Inverse Checksum. Don't write unless computing checksum.
;================================================================================ ;================================================================================
; Expanded SRAM ($7F6000 - $7F6FFF) ; Expanded SRAM ($7F6000 - $7F6FFF)
@@ -379,8 +380,7 @@ ExtendedFileNameWRAM: skip 24 ; File name, 12 word-length characters.
RoomPotData: skip 592 ; Table for expanded pot shuffle. One word per room. RoomPotData: skip 592 ; Table for expanded pot shuffle. One word per room.
SpritePotData: skip 592 ; Table for expanded pot shuffle. One word per room. SpritePotData: skip 592 ; Table for expanded pot shuffle. One word per room.
PurchaseCounts: skip 96 ; Keeps track of shop purchases PurchaseCounts: skip 96 ; Keeps track of shop purchases
PrivateBlock: skip 512 ; Reserved for 3rd party developers PrivateBlock: skip 513 ; Reserved for 3rd party developers
DummyValue: skip 1 ; $01 if you're a real dummy
;================================================================================ ;================================================================================
; Direct SRAM Assignments ($700000 - $7080000) ; Direct SRAM Assignments ($700000 - $7080000)
@@ -403,18 +403,29 @@ ProgressIndicatorSRAM: skip 1 ;
skip 19 ; skip 19 ;
FileNameVanillaSRAM: skip 8 ; First four characters of file name FileNameVanillaSRAM: skip 8 ; First four characters of file name
FileValiditySRAM: skip 2 ; FileValiditySRAM: skip 2 ;
skip 285 ; skip 283 ;
InverseChecksumSRAM: skip 2 ;
ExtendedFileNameSRAM: skip 24 ; We read and write the file name directly from and to SRAM (24 bytes) ExtendedFileNameSRAM: skip 24 ; We read and write the file name directly from and to SRAM (24 bytes)
skip $1AE4 ; skip $1AE4 ;
RomVersionSRAM: skip 4 ; ALTTPR ROM version. Low byte is the version, high byte writes RomVersionSRAM: skip 4 ; ALTTPR ROM version. Low byte is the version, high byte writes
; $01 for now (32-bits total) ; $01 for now (32-bits total)
RomNameSRAM: skip 21 ; ROM name from $FFC0, burned in during init (21 bytes) RomNameSRAM: skip 21 ; ROM name from $FFC0, burned in during init (21 bytes)
; If value in the ROM doesn't match SRAM, save is cleared. ; If value in the ROM doesn't match SRAM, save is cleared.
skip 4075 ;
PasswordSRAM: skip 16 ; Password value (16 bytes) PasswordSRAM: skip 16 ; Password value (16 bytes)
skip 8155 ;
SaveBackupSRAM: ; Backup copy of save ram. Game will attempt to use this if
; checksum on file select screen load fails.
base off base off
;================================================================================
; Bank Definitions
;--------------------------------------------------------------------------------
; If these move (most likely by placing initsramtable.asm somewhere else) these
; bank definitions need to be changed as well.
;================================================================================
SRAMBank = $70
SRAMTableBank = $30|$80
;================================================================================ ;================================================================================
; Assertions ; Assertions
;================================================================================ ;================================================================================
@@ -472,8 +483,8 @@ endmacro
%assertSRAM(CurrentHealth, $7EF36D) %assertSRAM(CurrentHealth, $7EF36D)
%assertSRAM(CurrentMagic, $7EF36E) %assertSRAM(CurrentMagic, $7EF36E)
%assertSRAM(CurrentSmallKeys, $7EF36F) %assertSRAM(CurrentSmallKeys, $7EF36F)
%assertSRAM(BombCapacityUpgrades, $7EF370) %assertSRAM(BombCapacity, $7EF370)
%assertSRAM(ArrowCapacityUpgrades, $7EF371) %assertSRAM(ArrowCapacity, $7EF371)
%assertSRAM(HeartsFiller, $7EF372) %assertSRAM(HeartsFiller, $7EF372)
%assertSRAM(MagicFiller, $7EF373) %assertSRAM(MagicFiller, $7EF373)
%assertSRAM(PendantsField, $7EF374) %assertSRAM(PendantsField, $7EF374)
@@ -515,7 +526,7 @@ endmacro
%assertSRAM(FollowerDropped, $7EF3D3) %assertSRAM(FollowerDropped, $7EF3D3)
%assertSRAM(FileNameVanillaWRAM, $7EF3D9) %assertSRAM(FileNameVanillaWRAM, $7EF3D9)
%assertSRAM(FileValidity, $7EF3E1) %assertSRAM(FileValidity, $7EF3E1)
%assertSRAM(InverseChecksum, $7EF4FE) %assertSRAM(InverseChecksumWRAM, $7EF4FE)
;================================================================================ ;================================================================================
; Randomizer Assertions ; Randomizer Assertions
@@ -536,14 +547,14 @@ endmacro
%assertSRAM(IgnoreFaeries, $7EF416) %assertSRAM(IgnoreFaeries, $7EF416)
%assertSRAM(HasGroveItem, $7EF416) %assertSRAM(HasGroveItem, $7EF416)
%assertSRAM(GeneralFlags, $7EF416) %assertSRAM(GeneralFlags, $7EF416)
%assertSRAM(HighestSword, $7EF417) %assertSRAM(ProgressiveSwords, $7EF417)
%assertSRAM(GoalCounter, $7EF418) %assertSRAM(GoalCounter, $7EF418)
%assertSRAM(ProgrammableItemOne, $7EF41A) %assertSRAM(ProgrammableItemOne, $7EF41A)
%assertSRAM(ProgrammableItemTwo, $7EF41C) %assertSRAM(ProgrammableItemTwo, $7EF41C)
%assertSRAM(ProgrammableItemThree, $7EF41E) %assertSRAM(ProgrammableItemThree, $7EF41E)
%assertSRAM(BonkCounter, $7EF420) %assertSRAM(BonkCounter, $7EF420)
%assertSRAM(YAItemCounter, $7EF421) %assertSRAM(YAItemCounter, $7EF421)
%assertSRAM(HighestShield, $7EF422) %assertSRAM(ProgressiveShields, $7EF422)
%assertSRAM(TotalItemCounter, $7EF423) %assertSRAM(TotalItemCounter, $7EF423)
%assertSRAM(SwordBossKills, $7EF425) %assertSRAM(SwordBossKills, $7EF425)
%assertSRAM(BigKeysBigChests, $7EF427) %assertSRAM(BigKeysBigChests, $7EF427)
@@ -640,7 +651,6 @@ endmacro
%assertSRAM(SpritePotData, $7F6268) %assertSRAM(SpritePotData, $7F6268)
%assertSRAM(PurchaseCounts, $7F64B8) %assertSRAM(PurchaseCounts, $7F64B8)
%assertSRAM(PrivateBlock, $7F6518) %assertSRAM(PrivateBlock, $7F6518)
%assertSRAM(DummyValue, $7F6718)
;================================================================================ ;================================================================================
; Direct SRAM Assertions ; Direct SRAM Assertions
@@ -654,9 +664,11 @@ endmacro
%assertSRAM(ProgressIndicatorSRAM, $7003C5) %assertSRAM(ProgressIndicatorSRAM, $7003C5)
%assertSRAM(FileNameVanillaSRAM, $7003D9) %assertSRAM(FileNameVanillaSRAM, $7003D9)
%assertSRAM(FileValiditySRAM, $7003E1) %assertSRAM(FileValiditySRAM, $7003E1)
%assertSRAM(InverseChecksumSRAM, $7004FE)
%assertSRAM(ExtendedFileNameSRAM, $700500) %assertSRAM(ExtendedFileNameSRAM, $700500)
%assertSRAM(RomNameSRAM, $702000)
%assertSRAM(RomVersionSRAM, $701FFC) %assertSRAM(RomVersionSRAM, $701FFC)
%assertSRAM(PasswordSRAM, $703000) %assertSRAM(RomNameSRAM, $702000)
%assertSRAM(PasswordSRAM, $702015)
%assertSRAM(SaveBackupSRAM, $704000)
pullpc pullpc

View File

@@ -110,11 +110,7 @@ org $308033 ; PC 0x180033
HeartBeep: HeartBeep:
db #$20 ; #$00 = Off - #$20 = Normal (default) - #$40 = Half Speed - #$80 = Quarter Speed db #$20 ; #$00 = Off - #$20 = Normal (default) - #$40 = Half Speed - #$80 = Quarter Speed
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $308034 ; PC 0x180034 - 0x180035 ; 0x180034 - 0x180035 (Unused)
StartingMaxBombs:
db #10 ; #10 = Default (10 decimal)
StartingMaxArrows:
db #30 ; #30 = Default (30 decimal)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $308036 ; PC 0x180036 - 0x180037 org $308036 ; PC 0x180036 - 0x180037
RupoorDeduction: RupoorDeduction:
@@ -332,15 +328,15 @@ db $00 ;
;Warp BL : 7A ;Warp BL : 7A
;Warp BR : 7B ;Warp BR : 7B
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $308080 ; PC 0x180080 - 0x180083 org $308080 ; PC 0x180080 - 0x180083 ; Default to fill on upgrade. Can be set to 0 to not fill.
Upgrade5BombsRefill: Upgrade5BombsRefill:
db #$00 db #$32
Upgrade10BombsRefill: Upgrade10BombsRefill:
db #$00 db #$32
Upgrade5ArrowsRefill: Upgrade5ArrowsRefill:
db #$00 db #$46
Upgrade10ArrowsRefill: Upgrade10ArrowsRefill:
db #$00 db #$46
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $308084 ; PC 0x180084 - 0x180085 org $308084 ; PC 0x180084 - 0x180085
PotionHealthRefill: PotionHealthRefill:
@@ -1068,8 +1064,14 @@ db $00, $00, $00
org $308358 org $308358
AllowAccidentalMajorGlitch: AllowAccidentalMajorGlitch:
db $00 db $00
;--------------------------------------------------------------------------------
; GFX pointer (0x180359 - 0x18035B)
; For 3rd party sprite stuff
;--------------------------------------------------------------------------------
org $308359
dl GfxPalettes
;================================================================================ ;================================================================================
; 0x180359 - 0x1814FF (unused) ; 0x18035C - 0x1814FF (unused)
;================================================================================ ;================================================================================
; $309500 (0x181500) - $309FFF (0x181FFF) original 0x39C bytes ; $309500 (0x181500) - $309FFF (0x181FFF) original 0x39C bytes
; Replacement Ending Sequence Text Data ; Replacement Ending Sequence Text Data

View File

@@ -58,7 +58,7 @@ RTL
+ +
LDA.b #$04 : RTL LDA.b #$04 : RTL
++ CMP.b #$FE : BNE ++ ; Progressive Sword ++ CMP.b #$FE : BNE ++ ; Progressive Sword
LDA HighestSword LDA ProgressiveSwords
CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA.l ProgressiveSwordReplacement LDA.l ProgressiveSwordReplacement
JMP GetSpriteID JMP GetSpriteID
@@ -72,7 +72,7 @@ RTL
LDA.b #$46 : RTL LDA.b #$46 : RTL
+ +
++ : CMP.b #$FF : BNE ++ ; Progressive Shield ++ : CMP.b #$FF : BNE ++ ; Progressive Shield
LDA HighestShield LDA ProgressiveShields
CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit
LDA.l ProgressiveShieldReplacement LDA.l ProgressiveShieldReplacement
JMP GetSpriteID JMP GetSpriteID
@@ -175,13 +175,13 @@ GetSpritePalette:
PHX PHX
PHB : PHK : PLB PHB : PHK : PLB
;-------- ;--------
TAX : LDA.l .gfxPalettes, X ; look up item gfx TAX : LDA.l GfxPalettes, X ; look up item gfx
PLB : PLX PLB : PLX
CMP.b #$F8 : !BGE .specialHandling CMP.b #$F8 : !BGE .specialHandling
RTL RTL
.specialHandling .specialHandling
CMP.b #$FD : BNE ++ ; Progressive Sword CMP.b #$FD : BNE ++ ; Progressive Sword
LDA HighestSword LDA ProgressiveSwords
CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA.l ProgressiveSwordReplacement LDA.l ProgressiveSwordReplacement
JMP GetSpritePalette JMP GetSpritePalette
@@ -194,7 +194,7 @@ RTL
+ ; Everything Else + ; Everything Else
LDA.b #$08 : RTL LDA.b #$08 : RTL
++ : CMP.b #$FE : BNE ++ ; Progressive Shield ++ : CMP.b #$FE : BNE ++ ; Progressive Shield
LDA HighestShield LDA ProgressiveShields
CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit
LDA.l ProgressiveShieldReplacement LDA.l ProgressiveShieldReplacement
JMP GetSpritePalette JMP GetSpritePalette
@@ -236,7 +236,7 @@ RTL
;DATA - Loot Identifier to Sprite Palette ;DATA - Loot Identifier to Sprite Palette
{ {
.gfxPalettes GfxPalettes:
db $00, $04, $02, $08, $04, $02, $08, $02 db $00, $04, $02, $08, $04, $02, $08, $02
db $04, $02, $02, $02, $04, $04, $04, $08 db $04, $02, $02, $02, $04, $04, $04, $08
@@ -306,13 +306,13 @@ IsNarrowSprite:
+ : JMP .continue + : JMP .continue
.notBottle .notBottle
CMP.b #$5E : BNE ++ ; Progressive Sword CMP.b #$5E : BNE ++ ; Progressive Sword
LDA HighestSword : CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit LDA ProgressiveSwords : CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA.l ProgressiveSwordReplacement LDA.l ProgressiveSwordReplacement
JSL.l IsNarrowSprite JSL.l IsNarrowSprite
JMP .done JMP .done
+ : JMP .continue + : JMP .continue
++ CMP.b #$5F : BNE ++ ; Progressive Shield ++ CMP.b #$5F : BNE ++ ; Progressive Shield
LDA HighestShield : BNE + : JMP .done ; No Shield LDA ProgressiveShields : BNE + : JMP .done ; No Shield
+ : CMP.l ProgressiveShieldLimit : !BLT .continue + : CMP.l ProgressiveShieldLimit : !BLT .continue
LDA.l ProgressiveShieldReplacement LDA.l ProgressiveShieldReplacement
JSL.l IsNarrowSprite JSL.l IsNarrowSprite