From ae0b57635cca1a5a91f78c2ae9049a13ebe678ab Mon Sep 17 00:00:00 2001 From: cassidy Date: Mon, 6 Dec 2021 01:13:15 -0500 Subject: [PATCH] Remove defines from LTTP_RND_GeneralBugfixes Replace more labels Add ROM version and reserve extra 16 bytes in unused hardware vector in LTTP_RND_GeneralBugfixes Move IncrementChestCounter to ChestPrep in newitems.asm Remove IncrementChestCounter hook which was getting overwritten More revisions to sram.asm --- LTTP_RND_GeneralBugfixes.asm | 43 ++------ hooks.asm | 8 +- init.asm | 2 - inventory.asm | 190 +++++++++++++++-------------------- newitems.asm | 16 ++- sram.asm | 7 +- 6 files changed, 106 insertions(+), 160 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index b66ba93..1c4bc96 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -2,6 +2,7 @@ ; The Legend of Zelda, A Link to the Past - Randomizer General Development & Bugfixes ;================================================================================ lorom + ;================================================================================ ;org $00FFC0 ; <- 7FC0 - Bank00.asm : 9173 (db "THE LEGEND OF ZELDA " ; 21 bytes) @@ -41,28 +42,7 @@ dw !ROM_VERSION_HIGH !BLT = "BCC" !BGE = "BCS" -; Rando Specific SRAM assignments -!NPC_FLAGS = "$7EF410" -!NPC_FLAGS_2 = "$7EF411" -!MAP_OVERLAY = "$7EF414" ; [w] -!PROGRESSIVE_SHIELD = "$7EF416" ; ss-- ---- -!HUD_FLAG = "$7EF416" ; --h- ---- -!FORCE_PYRAMID = "$7EF416" ; ---- p--- -!IGNORE_FAIRIES = "$7EF416" ; ---- -i-- -!SHAME_CHEST = "$7EF416" ; ---s ---- -!HAS_GROVE_ITEM = "$7EF416" ; ---- ---g general flags, don't waste these -!HIGHEST_SWORD_LEVEL = "$7EF417" ; --- -sss -;$7EF418 - Goal Item Counter -;$7EF419 - Service Sequence -;$7EF420 - $7EF46D - Stat Tracking Bank 1 (overlaps with RNG Item Flags) -;$7EF4A0 - $7EF4A7 - Service Request Block -;$700500 - $70050F - Extended File Name -;$701000 - $70100F - Password (incorporate into log header) -;$702000 - $702014 - Rom title copy (incorporate into log header) - - !MS_GOT = "$7F5031" -!DARK_WORLD = "$7EF3CA" !REDRAW = "$7F5000" !GANON_WARP_CHAIN = "$7F5032"; @@ -114,7 +94,6 @@ incsrc heartpieces.asm incsrc npcitems.asm incsrc utilities.asm incsrc flipperkill.asm -incsrc previewdatacopy.asm incsrc pendantcrystalhud.asm incsrc potions.asm incsrc shopkeeper.asm @@ -335,21 +314,21 @@ warnpc $B08000 ;RAM ;$7EC900[0x1F00]: BIGRAM buffer ;$7EF000[0x500]: SRAM mirror First 0x500 bytes of SRAM +; See sram.asm for labels and assignments ;$7F5000[0x800]: Rando's main free ram region ; See tables.asm for specific assignments -;$7F6000[0x500]: Free RAM (reclaimed from damage table) Not allocated yet -;$7F6000[0x500]: SRAM buffer save 2 0x500 -;$7F6500[0xB00]: SRAM mirror for last 0xB00 bytes of SRAM (extended sram) +;$7F6000[0x1000]: SRAM buffer mapped to vanilla save slots 1 and 2 +; See sram.asm for labels and assignments ;$7F7667[0x6719] - free ram ;================================================================================ ;SRAM Map -;$70:0000 ( 4K) Game state -; 0000-04FF Vanilla Slot 1 (mirrored at 0x7EF000) -; See earlier in this file for rando specific assignments -; 0500-0FFF Ext Slot 1 (not yet mirrored) -; See earlier in this file for rando specific assignments -;$70:1000 (20K) Log entries -;$70:6000 ( 8K) Scratch buffers +;See sram.asm for rando-specific assignments +;$70:0000 (5K) Game state +; 0000-04FF Vanilla Slot 1 (mirrored at $7EF000) +; 0500-14FF Ext Slot 1 (mirrored at $7F6000) +;$70:2000 (0x25) ROM Name and version number +;$70:3000 (0x16) Password +;$70:6000 (8K) Scratch buffers ;================================================================================ ;org $0080DC ; <- 0xDC - Bank00.asm:179 - Kill Music ;db #$A9, #$00, #$EA diff --git a/hooks.asm b/hooks.asm index 74b0adc..61caee3 100755 --- a/hooks.asm +++ b/hooks.asm @@ -541,10 +541,6 @@ org $0288D1 ; <- 108D1 - Bank02.asm : 1690 (STZ $0646) JSL.l IndoorSubtileTransitionCounter NOP #2 ;-------------------------------------------------------------------------------- -org $07B574 ; <- 3B574 - Bank07.asm : 8519 (LDA.b #$01 : STA $02E9) -JSL.l IncrementChestCounter -NOP -;-------------------------------------------------------------------------------- ;org $05FC7E ; <- 2FC7E - sprite_dash_item.asm : 118 (LDA $7EF36F : INC A : STA $7EF36F) ;JSL.l IncrementSmallKeys ;-------------------------------------------------------------------------------- @@ -2101,7 +2097,7 @@ JSL.l ItemCheck_TreeKid2 org $06AF9B ; <- 32F9B - FluteBoy_Chillin : 73 : LDA $7EF34C : CMP.b #$02 : BCS .player_has_flute ;NOP #8 -LDA !HAS_GROVE_ITEM : AND.b #$01 +LDA HasGroveItem : AND.b #$01 db #$D0 ; BNE org $06B062 ; <- 33062 - FluteAardvark_InitialStateFromFluteState : 225 : LDA $7EF34C : AND.b #$03 : !BGE #$05 @@ -2472,7 +2468,7 @@ org $00DF62 ; <- Bank00.asm:4672 (LDX.w #$0000 : LDY.w #$0040) JML ReloadingFloors NOP : NOP ReloadingFloorsResume: -org $00DF6E ; <- A few instructions later, right after JSR Do3To4High16Bit +org $00DF6E ; <- A few instructions later, right after JSR Do3To.high16Bit ReloadingFloorsCancel: ;================================================================================ diff --git a/init.asm b/init.asm index cdd7d66..b774183 100644 --- a/init.asm +++ b/init.asm @@ -1,5 +1,3 @@ -RomVersionSRAM = $701FFC - ;-------------------------------------------------------------------------------- ; Init_Primary ;-------------------------------------------------------------------------------- diff --git a/inventory.asm b/inventory.asm index 322f0a4..4851e73 100644 --- a/inventory.asm +++ b/inventory.asm @@ -1,17 +1,16 @@ ;================================================================================ ; Inventory Updates ;================================================================================ -; Item Tracking Slot ; InventoryTracking -; brmpnskf -------q -; b = blue boomerang | -; r = red boomerang | -; m = mushroom current | -; p = magic powder | -; n = mushroom past | -; s = shovel | -; k = fake flute | -; f = working flute | +; brmpnskf ------oq +; b = blue boomerang | - +; r = red boomerang | - +; m = mushroom current | - +; p = magic powder | - +; n = mushroom past | - +; s = shovel | - +; k = fake flute | o = any bomb acquired from item location +; f = working flute | q = quickswap locked ;-------------------------------------------------------------------------------- ; BowTracking ; Item Tracking Slot #2 @@ -35,8 +34,8 @@ ProcessMenuButtons: BIT #$20 : BNE .sel_pressed ; check for P1 Select button LDA $F0 : BIT #$20 : BNE .sel_held .sel_unheld - LDA !HUD_FLAG : AND #$20 : BEQ + - LDA !HUD_FLAG : AND #$DF : STA !HUD_FLAG ; select is released, unset hud flag + LDA HudFlag : AND #$20 : BEQ + + LDA HudFlag : AND #$DF : STA HudFlag ; select is released, unset hud flag LDA $1B : BEQ + ; skip if outdoors LDA.b #$20 : STA $012F ; menu select sound + @@ -45,11 +44,8 @@ ProcessMenuButtons: .sel_held CLC ; no buttons RTL - ;.l_pressed - ;JSL.l SpawnAngryCucco -;RTL .sel_pressed - LDA !HUD_FLAG : ORA #$20 : STA !HUD_FLAG ; set hud flag + LDA HudFlag : ORA #$20 : STA HudFlag ; set hud flag LDA.b #$20 : STA $012F ; menu select sound JSL.l ResetEquipment RTL @@ -178,8 +174,6 @@ RTL ;-------------------------------------------------------------------------------- ; AddInventory: ;-------------------------------------------------------------------------------- -!LOCK_STATS = "$7EF443" - macro TopHalf(address) LDA
: !ADD #$10 : STA
endmacro @@ -193,16 +187,16 @@ macro BottomHalf(address) endmacro ;-------------------------------------------------------------------------------- ;FullInventoryExternal: -; LDA !LOCK_STATS : BEQ + : RTL : + +; LDA StatsLocked : BEQ + : RTL : + ; PHA : PHX : PHP : JMP AddInventory_fullItemCounts ;-------------------------------------------------------------------------------- FullInventoryExternal: - LDA !LOCK_STATS : BEQ + : RTL : + + LDA StatsLocked : BEQ + : RTL : + PHA : PHX : PHP : JMP AddInventory_incrementCounts ;-------------------------------------------------------------------------------- -!SHAME_CHEST = "$7EF416" ; ---s ---- AddInventory: PHA : PHX : PHP + PHA : LDA DummyValue : PLA CPY.b #$0C : BNE + ; Blue Boomerang LDA InventoryTracking : ORA #$80 : STA InventoryTracking JMP .incrementCounts @@ -248,7 +242,7 @@ AddInventory: + .incrementCounts - LDA !LOCK_STATS : BEQ + : JMP .done : + + LDA StatsLocked : BEQ + : JMP .done : + ; don't count any of this stuff CPY.b #$20 : BNE + : JMP .itemCounts : + ; Crystal @@ -292,79 +286,63 @@ AddInventory: .dungeonCounts LDA $1B : BNE + : JMP .fullItemCounts : + - ; ==BEGIN INDOOR-ONLY SECTION - - ;REP #$20 ; Set 16-bit Accumulator - ;LDA $A0 ; load room ID - ;CMP.w #$0010 : BNE + ; Ganon Fall Room - I think this got taken out - ;!SHAME_CHEST = "$7EF416" ; ---s ---- - ;LDA !SHAME_CHEST : ORA.w #$0010 : STA !SHAME_CHEST - ;+ SEP #$20 ; Set 8-bit Accumulator LDA $040C ; get dungeon id CMP.b #$00 : BNE + ; Sewers (Escape) + LDA SewersLocations : INC : STA SewersLocations + LDA HCLocations : INC : STA HCLocations BRA ++ + CMP.b #$02 : BNE + ; Hyrule Castle (Escape) ++ CPY.b #$32 : BNE ++ : JMP .itemCounts : ++ ; Ball & Chain Guard's Big Key - %TopHalf($7EF434) + LDA HCLocations : INC : STA HCLocations + LDA SewersLocations : INC : STA SewersLocations JMP .fullItemCounts + CMP.b #$04 : BNE + ; Eastern Palace - LDA $7EF436 : INC : AND #$07 : TAX - LDA $7EF436 : AND #$F8 : STA $7EF436 - TXA : ORA $7EF436 : STA $7EF436 + LDA EPLocations : INC : STA EPLocations JMP .fullItemCounts + CMP.b #$06 : BNE + ; Desert Palace - LDA $7EF435 : !ADD #$20 : STA $7EF435 + LDA DPLocations : INC : STA DPLocations JMP .fullItemCounts + CMP.b #$08 : BNE + ; Agahnim's Tower - LDA $7EF435 : INC : AND #$03 : TAX - LDA $7EF435 : AND #$FC : STA $7EF435 - TXA : ORA $7EF435 : STA $7EF435 + LDA CTLocations : INC : STA CTLocations JMP .fullItemCounts + CMP.b #$0A : BNE + ; Swamp Palace - %BottomHalf($7EF439) + LDA SPLocations : INC : STA SPLocations JMP .fullItemCounts + CMP.b #$0C : BNE + ; Palace of Darkness - %BottomHalf($7EF434) + LDA PDLocations : INC : STA PDLocations JMP .fullItemCounts + CMP.b #$0E : BNE + ; Misery Mire - %BottomHalf($7EF438) + LDA MMLocations : INC : STA MMLocations JMP .fullItemCounts + CMP.b #$10 : BNE + ; Skull Woods - %TopHalf($7EF437) + LDA SWLocations : INC : STA SWLocations JMP .fullItemCounts + CMP.b #$12 : BNE + ; Ice Palace - %TopHalf($7EF438) + LDA IPLocations : INC : STA IPLocations JMP .fullItemCounts + CMP.b #$14 : BNE + ; Tower of Hera - LDA $7EF435 : !ADD #$04 : AND #$1C : TAX - LDA $7EF435 : AND #$E3 : STA $7EF435 - TXA : ORA $7EF435 : STA $7EF435 + LDA THLocations : INC : STA THLocations JMP .fullItemCounts + CMP.b #$16 : BNE + ; Thieves' Town - %BottomHalf($7EF437) + LDA TTLocations : INC : STA TTLocations JMP .fullItemCounts + CMP.b #$18 : BNE + ; Turtle Rock - %TopHalf($7EF439) + LDA TRLocations : INC : STA TRLocations JMP .fullItemCounts + CMP.b #$1A : BNE + ; Ganon's Tower - LDA $7EF436 : !ADD #$08 : STA $7EF436 + LDA GTLocations : INC : STA GTLocations LDA BigKeyField : AND #$04 : BNE ++ JSR .incrementGTowerPreBigKey ++ - ;JMP .fullItemCounts + ; == END INDOOR-ONLY SECTION .fullItemCounts - ;CPY.b #$3B : BNE + ; Skip Total Counts for Repeat Silver Arrows - ; LDA $7EF42A : BIT #$20 : BEQ + : BRA .itemCounts - ;+ - LDA BootsEquipment : BNE + ; Check for Boots LDA PreBootsLocations : INC : STA PreBootsLocations ; Increment Pre Boots Counter + @@ -377,7 +355,7 @@ AddInventory: LDA PreFluteLocations : INC : STA PreFluteLocations ; Increment Pre Mirror Counter + - LDA $7EF423 : INC : STA $7EF423 ; Increment Item Total + LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total .itemCounts @@ -462,12 +440,12 @@ AddInventory: ;JSR .incrementHeartContainer JMP .done + CPY.b #$27 : BNE + ; 1 Bomb - ;JSR .maybeIncrementBombs + JSR .maybeIncrementBombs JMP .done + CPY.b #$28 : BNE + ; 3 Bombs - ;JSR .maybeIncrementBombs + JSR .maybeIncrementBombs JMP .done - + CPY.b #$29 : BNE + ; Musoroom + + CPY.b #$29 : BNE + ; Mushroom JSR .incrementY JMP .done + CPY.b #$2A : !BLT + ; Items $2A - $2D @@ -475,7 +453,7 @@ AddInventory: JSR .incrementY JMP .done + CPY.b #$31 : BNE + ; 10 Bombs - ;JSR .maybeIncrementBombs + JSR .maybeIncrementBombs JMP .done + CPY.b #$32 : BNE + ; Big Key JSR .incrementBigKey @@ -516,9 +494,9 @@ AddInventory: JSR .stampBoots JSR .incrementA JMP .done - + CPY.b #$4C : BNE + ; Bomb Capacity Upgrade + + CPY.b #$4C : BNE + ; 50 Bomb Capacity Upgrade JSR .incrementCapacity - ;JSR .maybeIncrementBombs + JSR .maybeIncrementBombs JMP .done + CPY.b #$4D : !BLT + ; Items $4D - $4F - Capacity Upgrades CPY.b #$50 : !BGE + @@ -528,6 +506,14 @@ AddInventory: LDX #$02 JSR .incrementSword JMP .done + + CPY.b #$51 : BNE + ; 5 Bomb Capacity Upgrade + LDX #$02 + JSR .maybeIncrementBombs + JMP .done + + CPY.b #$52 : BNE + ; 10 Bomb Capacity Upgrade + LDX #$02 + JSR .maybeIncrementBombs + JMP .done + CPY.b #$51 : !BLT + ; Items $51 - $54 - Capacity Upgrades CPY.b #$55 : !BGE + JSR .incrementCapacity @@ -577,49 +563,42 @@ RTL ; WHICH BEE IS BOTTLED? ; MAKE SURE FAIRY FOUNTAINS DON'T FUCK THE COUNTS UP -!NMI_TIME = "$7EF43E" - -!SWORD_TIME = "$7EF458" -!BOOTS_TIME = "$7EF45C" -!FLUTE_TIME = "$7EF460" -!MIRROR_TIME = "$7EF464" - .stampSword REP #$20 ; set 16-bit accumulator - LDA !SWORD_TIME : BNE + - LDA !SWORD_TIME+2 : BNE + - LDA !NMI_TIME : STA !SWORD_TIME - LDA !NMI_TIME+2 : STA !SWORD_TIME+2 + LDA SwordTime : BNE + + LDA SwordTime+2 : BNE + + LDA NMIFrames : STA SwordTime + LDA NMIFrames+2 : STA SwordTime+2 + SEP #$20 ; set 8-bit accumulator RTS .stampBoots REP #$20 ; set 16-bit accumulator - LDA !BOOTS_TIME : BNE + - LDA !BOOTS_TIME+2 : BNE + - LDA !NMI_TIME : STA !BOOTS_TIME - LDA !NMI_TIME+2 : STA !BOOTS_TIME+2 + LDA BootsTime : BNE + + LDA BootsTime+2 : BNE + + LDA NMIFrames : STA BootsTime + LDA NMIFrames+2 : STA BootsTime+2 + SEP #$20 ; set 8-bit accumulator RTS .stampFlute REP #$20 ; set 16-bit accumulator - LDA !FLUTE_TIME : BNE + - LDA !FLUTE_TIME+2 : BNE + - LDA !NMI_TIME : STA !FLUTE_TIME - LDA !NMI_TIME+2 : STA !FLUTE_TIME+2 + LDA FluteTime : BNE + + LDA FluteTime+2 : BNE + + LDA NMIFrames : STA FluteTime + LDA NMIFrames+2 : STA FluteTime+2 + SEP #$20 ; set 8-bit accumulator RTS .stampMirror REP #$20 ; set 16-bit accumulator - LDA !MIRROR_TIME : BNE + - LDA !MIRROR_TIME+2 : BNE + - LDA !NMI_TIME : STA !MIRROR_TIME - LDA !NMI_TIME+2 : STA !MIRROR_TIME+2 + LDA MirrorTime : BNE + + LDA MirrorTime+2 : BNE + + LDA NMIFrames : STA MirrorTime + LDA NMIFrames+2 : STA MirrorTime+2 + SEP #$20 ; set 8-bit accumulator RTS @@ -684,36 +663,30 @@ RTS RTL .incrementKey - PHA : PHX - LDA $7EF424 : INC : AND #$3F : TAX - LDA $7EF424 : AND #$C0 : STA $7EF424 - TXA : ORA $7EF424 : STA $7EF424 - PLX : PLA + LDA SmallKeyCounter : INC : STA SmallKeyCounter RTS .incrementCompass - %BottomHalf($7EF428) + %BottomHalf(MapsCompasses) RTS .incrementBigKey - LDA $7EF427 : !ADD #$10 : STA $7EF427 + %TopHalf(BigKeysBigChests) RTS .incrementGTowerPreBigKey - LDA $7EF42A : INC : AND #$1F : TAX - LDA $7EF42A : AND #$E0 : STA $7EF42A - TXA : ORA $7EF42A : STA $7EF42A + LDA PreGTBKLocations : INC : STA PreGTBKLocations RTS -;.maybeIncrementBombs -; LDA $7EF42A : AND #$80 : BNE + -; LDA $7EF42A : ORA #$80 : STA $7EF42A -; JSR .incrementY -; + -;RTS +.maybeIncrementBombs + LDA InventoryTracking+1 : AND #$02 : BNE + + LDA InventoryTracking+1 : ORA #$02 : STA InventoryTracking+1 + JSR .incrementY + + +RTS .incrementMap - LDA $7EF428 : !ADD #$10 : STA $7EF428 + %TopHalf(MapsCompasses) RTS .incrementBossSwordLong @@ -723,16 +696,17 @@ RTL .incrementBossSword LDA SwordEquipment BNE + : - - %TopHalf($7EF452) : RTS + LDA SwordlessBossKills : INC : STA SwordlessBossKills + RTS + CMP #$FF : BEQ - + CMP #$01 : BNE + - %TopHalf($7EF425) : RTS + %TopHalf(SwordBossKills) : RTS + CMP #$02 : BNE + - %BottomHalf($7EF425) : RTS + %BottomHalf(SwordBossKills) : RTS + CMP #$03 : BNE + - %TopHalf($7EF426) : RTS + %TopHalf(SwordBossKills+1) : RTS + CMP #$04 : BNE + - %BottomHalf($7EF426) + %BottomHalf(SwordBossKills+1) + RTS ;-------------------------------------------------------------------------------- @@ -865,7 +839,7 @@ LoadKeys: LDA CurrentGenericKeys RTL + - LDA SewerKeys, X + LDA DungeonKeys, X RTL ;-------------------------------------------------------------------------------- @@ -878,7 +852,7 @@ SaveKeys: PLA : STA CurrentGenericKeys RTL + - PLA : STA SewerKeys, X + PLA : STA DungeonKeys, X RTL ;-------------------------------------------------------------------------------- diff --git a/newitems.asm b/newitems.asm index d27836f..c66ceb2 100755 --- a/newitems.asm +++ b/newitems.asm @@ -155,14 +155,14 @@ ProcessEventItems: LDA $02D8 CMP.b #$E0 : BNE + REP #$30 ; set 16-bit accumulator & index registers - LDA $7EF450 : ASL : TAX + LDA RNGItem : ASL : TAX LDA.l EventDataOffsets, X : !ADD #EventDataTable : STA $00 SEP #$20 ; set 8-bit accumulator LDA.b #$AF : STA $02 JSL.l LoadDialogAddressIndirect - LDA $7EF450 : INC : STA $7EF450 + LDA RNGItem : INC : STA RNGItem SEP #$10 ; set 8-bit index registers @@ -373,7 +373,7 @@ AddReceivedItemExpandedGetItem: JMP .done + CMP.b #$A0 : !BLT + : CMP.b #$B0 : !BGE + ; Free Small Key AND #$0F : TAX - LDA SewerKeys, X : INC : STA SewerKeys, X ; Increment Key Count + LDA DungeonKeys, X : INC : STA DungeonKeys, X ; Increment Key Count CPX.b #$00 : BNE ++ STA HyruleCastleKeys ; copy HC to sewers @@ -400,8 +400,6 @@ RTL ; #$90 - Big Keys ; #$A0 - Small Keys ;-------------------------------------------------------------------------------- -!HIGHEST_ARMOR_SHIELD_SWORD = "$7EF416" ; ss-- ---- -!RNG_ITEM = "$7EF450" !SCRATCH_AREA = "$7F5020" !SINGLE_INDEX_TEMP = "$7F5020" !SINGLE_INDEX_OFFSET_TEMP = "$7F5021" @@ -966,7 +964,6 @@ RTL LDA.b #$24 : STA $7EC723 RTL ;-------------------------------------------------------------------------------- -!RNG_ITEM = "$7EF450" !SCRATCH_AREA = "$7F5020" !SINGLE_INDEX_TEMP = "$7F5020" !SINGLE_INDEX_OFFSET_TEMP = "$7F5021" @@ -1004,7 +1001,7 @@ RTL ;-------------------------------------------------------------------------------- CheckSingleItem: LSR #3 : TAX - LDA.l !RNG_ITEM, X : STA !SINGLE_INDEX_BITMASK_TEMP ; load value to temporary + LDA.l RNGItem, X : STA !SINGLE_INDEX_BITMASK_TEMP ; load value to temporary PHX LDA !SINGLE_INDEX_TEMP : AND #$07 : TAX ; load 0-7 part into X LDA !SINGLE_INDEX_BITMASK_TEMP @@ -1022,7 +1019,7 @@ MarkRNGItemSingle: ;STA !SINGLE_INDEX_TEMP LSR #3 : STA !SINGLE_INDEX_OFFSET_TEMP : TAX - LDA.l !RNG_ITEM, X + LDA.l RNGItem, X STA.l !SINGLE_INDEX_BITMASK_TEMP LDA.l !SINGLE_INDEX_TEMP : AND #$07 : TAX ; load 0-7 part into X LDA.b #01 @@ -1037,7 +1034,7 @@ MarkRNGItemSingle: LDA.l !SINGLE_INDEX_OFFSET_TEMP : TAX PLA ORA.l !SINGLE_INDEX_BITMASK_TEMP - STA.l !RNG_ITEM, X + STA.l RNGItem, X RTS ;-------------------------------------------------------------------------------- GetRNGItemMulti: @@ -1114,6 +1111,7 @@ JML.l StatsFinalPrep ;-------------------------------------------------------------------------------- ChestPrep: LDA.b #$01 : STA $02E9 + JSL.l IncrementChestCounter LDA.l ServerRequestMode : BEQ + JSL.l ChestItemServiceRequest RTL diff --git a/sram.asm b/sram.asm index 12f7ee5..48fa221 100644 --- a/sram.asm +++ b/sram.asm @@ -1,4 +1,3 @@ -org 0 ;================================================================================ ; SRAM Labels & Assertions ;-------------------------------------------------------------------------------- @@ -9,6 +8,7 @@ org 0 ; $7F6000 - $7F6FFF in WRAM maps to the next 4k bytes, occupying the 2nd and 3rd vanilla ; save file locations. ($700500 - $701500) ;-------------------------------------------------------------------------------- +org 0 ; This module writes no bytes. Asar gives bank cross errors without this. ;================================================================================ ; Room Data ($7EF000 - $7EF27F @@ -365,7 +365,8 @@ ExtendedFileNameSRAM: skip 24 ; We read and write the file name directly from skip $1AE8 ; 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. -VERSIONSRAM: skip 4 ; ALTTPR ROM version (32 bytes) +RomVersionSRAM: skip 4 ; ALTTPR ROM version. Low byte is the version, high byte writes + ; $01 for now (32-bits total) skip 4071 ; PasswordSRAM: skip 16 ; Password value (16 bytes) @@ -573,7 +574,7 @@ assert InventoryTrackingSRAM = $70038C, "InventoryTracking labeled at incorrect assert BowTrackingSRAM = $70038E, "BowTracking labeled at incorrect address" assert ExtendedFileNameSRAM = $700500, "ExtendedFilenameSRAM labeled at incorrect address" assert RomNameSRAM = $702000, "RomNameSRAM at incorrect address" -assert VERSIONSRAM = $702015, "VERSIONSRAM at incorrect address" +assert RomVersionSRAM = $702015, "RomVersionSRAM at incorrect address" assert PasswordSRAM = $703000, "PasswordSRAM at incorrect address" ;--------------------------------------------------------------------------------