Next draft of sram.asm. Save/SRAM changes to save, init, and password

Deleted previewdatacopy.asm which was for SRAM Trace which we no longer
support. Password moved to $703000. 32-bits at $FFE0 in ROM (unused
hardware vector) now burned into $702015 in SRAM with ROM name.
This commit is contained in:
cassidy
2021-12-06 00:33:29 -05:00
parent 640e94153d
commit 774aeb5e73
5 changed files with 128 additions and 157 deletions

View File

@@ -24,7 +24,7 @@ Init_Primary:
LDX #$00 LDX #$00
- -
LDA $702000, X : CMP $00FFC0, X : BNE .clear LDA RomNameSRAM, X : CMP $00FFC0, X : BNE .clear
INX INX
CPX #$15 : !BLT - CPX #$15 : !BLT -
BRA .done BRA .done
@@ -38,7 +38,7 @@ Init_Primary:
SEP #$30 ; set 8-bit accumulator & index registers SEP #$30 ; set 8-bit accumulator & index registers
LDX #$00 LDX #$00
- -
LDA $00FFC0, X : STA $702000, X LDA $00FFC0, X : STA RomNameSRAM, X
INX INX
CPX #$15 : !BLT - CPX #$15 : !BLT -
LDX #$00 LDX #$00

View File

@@ -1,7 +1,5 @@
!PASSWORD_CODE_POSITION = "$C8" !PASSWORD_CODE_POSITION = "$C8"
!PASSWORD_SELECTION_POSITION = "$C9" !PASSWORD_SELECTION_POSITION = "$C9"
!PASSWORD_SRAM = "$701000"
Module_Password: Module_Password:
LDA $11 LDA $11
@@ -39,7 +37,7 @@ Password_EndInit:
LDX.b #$0F LDX.b #$0F
LDA.b #$00 LDA.b #$00
- -
STA.l !PASSWORD_SRAM, X STA.l PasswordSRAM, X
DEX : BPL - DEX : BPL -
+ +
@@ -108,7 +106,7 @@ Password_Main:
BRA + BRA +
++ ++
LDX !PASSWORD_CODE_POSITION LDX !PASSWORD_CODE_POSITION
STA !PASSWORD_SRAM,X STA PasswordSRAM,X
TXA : INC A : AND.b #$0F : STA !PASSWORD_CODE_POSITION TXA : INC A : AND.b #$0F : STA !PASSWORD_CODE_POSITION
BNE ++ BNE ++
STZ $012E STZ $012E
@@ -166,7 +164,7 @@ ValidatePassword:
;check for incomplete password ;check for incomplete password
LDX #$0F LDX #$0F
- -
LDA.l !PASSWORD_SRAM, X : BNE + LDA.l PasswordSRAM, X : BNE +
JMP .incorrect JMP .incorrect
+ +
DEX : BPL - DEX : BPL -
@@ -229,7 +227,7 @@ PasswordToKey:
LDA.w #$000B : STA $04 LDA.w #$000B : STA $04
- -
LDX $00 LDX $00
LDA !PASSWORD_SRAM, X : DEC : AND #$001F LDA PasswordSRAM, X : DEC : AND #$001F
LDY $04 LDY $04
-- : BEQ + : ASL : DEY : BRA -- : + ; Shift left by Y -- : BEQ + : ASL : DEY : BRA -- : + ; Shift left by Y
XBA XBA
@@ -343,7 +341,7 @@ UpdatePasswordTiles:
REP #$30 ; set 16-bit both REP #$30 ; set 16-bit both
LDX.w #$000F LDX.w #$000F
- -
LDA.l !PASSWORD_SRAM, X : AND.w #$00FF : TXY LDA.l PasswordSRAM, X : AND.w #$00FF : TXY
ASL #3 : STA $00 ASL #3 : STA $00
TYA : ASL #4 : STA $03 TYA : ASL #4 : STA $03
LDX $00 : LDA.l HashAlphabetTilesWithBlank, X LDX $00 : LDA.l HashAlphabetTilesWithBlank, X

View File

@@ -1,66 +0,0 @@
;================================================================================
; RTPreview SRAM Hook
;--------------------------------------------------------------------------------
MaybeWriteSRAMTrace:
LDA EnableSRAMTrace : AND.l TournamentSeedInverse : BEQ +
JSL.l WriteStatusPreview
+
RTL
;--------------------------------------------------------------------------------
WriteStatusPreview:
PHA
LDA $4300 : PHA ; preserve DMA parameters
LDA $4301 : PHA ; preserve DMA parameters
LDA $4302 : PHA ; preserve DMA parameters
LDA $4303 : PHA ; preserve DMA parameters
LDA $4304 : PHA ; preserve DMA parameters
LDA $4305 : PHA ; preserve DMA parameters
LDA $4306 : PHA ; preserve DMA parameters
;--------------------------------------------------------------------------------
LDA #$80 : STA $4300 ; set DMA transfer direction B -> A, bus A auto increment, single-byte mode
STA $4301 ; set bus B source to WRAM register
LDA #$40 : STA $2181 ; set WRAM register source address
LDA #$F3 : STA $2182
LDA #$7E : STA $2183
STZ $4302 ; set bus A destination address to SRAM
LDA #$1E : STA $4303
LDA #$70 : STA $4304
LDA #$80 : STA $4305 ; set transfer size to 0x180
LDA #$01 : STA $4306 ; STZ $4307
LDA #$01 : STA $420B ; begin DMA transfer
;--------------------------------------------------------------------------------
PLA : STA $4306 ; restore DMA parameters
PLA : STA $4305 ; restore DMA parameters
PLA : STA $4304 ; restore DMA parameters
PLA : STA $4303 ; restore DMA parameters
PLA : STA $4302 ; restore DMA parameters
PLA : STA $4301 ; restore DMA parameters
PLA : STA $4300 ; restore DMA parameters
PLA
RTL
;--------------------------------------------------------------------------------
;WriteStatusPreview:
; PHA : PHX : PHP
;
; REP #$20 ; set 16-bit accumulator
; CLC
; LDX.b #$00
; -
; LDA $7EF340, X : STA $701E00, X
; LDA $7EF340+2, X : STA $701E00+2, X
; LDA $7EF340+4, X : STA $701E00+4, X
; TXA : ADC.b #$06 : TAX
; CPX #$24 : !BLT -
;
; SEP #$20 ; set 8-bit accumulator
; LDA $7EF374 : STA $701E24
; LDA $7EF37A : STA $701E25
;
; PLP : PLX : PLA
;RTL
;--------------------------------------------------------------------------------

View File

@@ -27,7 +27,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ClearExtendedWRAMSaveFile: ClearExtendedWRAMSaveFile:
STA $7EF400, X ; what we wrote over STA $7EF400, X ; what we wrote over
; STA $7F6000, X STA $7F6000, X
STA $7F6100, X STA $7F6100, X
STA $7F6200, X STA $7F6200, X
STA $7F6300, X STA $7F6300, X
@@ -68,7 +68,7 @@ CopyExtendedSaveFileToWRAM:
LDA #$05 : STA $4303 LDA #$05 : STA $4303
LDA #$70 : STA $4304 LDA #$70 : STA $4304
LDA #$00 : STA $4305 ; set transfer size to 0xB00 LDA #$00 : STA $4305 ; set transfer size to 0x1000
LDA #$10 : STA $4306 ; STZ $4307 LDA #$10 : STA $4306 ; STZ $4307
LDA #$01 : STA $420B ; begin DMA transfer LDA #$01 : STA $420B ; begin DMA transfer

175
sram.asm
View File

@@ -1,3 +1,4 @@
org 0
;================================================================================ ;================================================================================
; SRAM Labels & Assertions ; SRAM Labels & Assertions
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -19,11 +20,11 @@
; 4 (northwest), 3 (northeast), 2 (southwest), and 1 (southeast), which is the same ; 4 (northwest), 3 (northeast), 2 (southwest), and 1 (southeast), which is the same
; as they are laid out on the screen from left to right, top to bottom. ; as they are laid out on the screen from left to right, top to bottom.
; ;
; Example: We can use RoomData[$37].Low to read or write the pot key in the first ; Example: We can use RoomData[$37].high to read or write the pot key in the first
; floodable room in Swamp Palace ($04) ; floodable room in Swamp Palace ($04)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Low Byte: d d d d b k u r ; .high Byte: d d d d b k u r
; High Byte: c c c c q q q q ; .low Byte: c c c c q q q q
; ;
; d = Door opened (key, bomb wall, etc) ; d = Door opened (key, bomb wall, etc)
; b = Boss kill / Heart Piece ; b = Boss kill / Heart Piece
@@ -37,8 +38,9 @@
; q = Quadrant visits ; q = Quadrant visits
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
struct RoomData $7EF000 struct RoomData $7EF000
.Low: skip 1 .l
.High: skip 1 .low: skip 1
.high: skip 1
endstruct align 2 endstruct align 2
;================================================================================ ;================================================================================
@@ -48,7 +50,7 @@ endstruct align 2
; in WRAM (16-bits.) ; in WRAM (16-bits.)
; ;
; This label can be indexed with a plus symbol (e.g. The Hyrule Castle screen would ; This label can be indexed with a plus symbol (e.g. The Hyrule Castle screen would
; be OverworldData+$1B or OverworldData+27) ; be OverworldEventData+$1B or OverworldEventData+27)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; - i o - - - b - ; - i o - - - b -
; ;
@@ -56,7 +58,7 @@ endstruct align 2
; o = Overlay active ; o = Overlay active
; b = Secondary overlay active ; b = Secondary overlay active
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OverworldData = $7EF280 OverworldEventData = $7EF280
;================================================================================ ;================================================================================
; Items & Equipment ($7EF340 - $7EF38B) ; Items & Equipment ($7EF340 - $7EF38B)
@@ -68,7 +70,7 @@ OverworldData = $7EF280
; $00 = None ; $00 = None
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
base $7EF340 base $7EF340
SRAMEquipment: ; WRAMEquipment: ;
BowEquipment: skip 1 ; $01 = Bow | $02 = Bow & Arrows BowEquipment: skip 1 ; $01 = Bow | $02 = Bow & Arrows
; $03 = Silver Arrow Bow | $04 = Bow & Silver Arrows ; $03 = Silver Arrow Bow | $04 = Bow & Silver Arrows
BoomerangEquipment: skip 1 ; $01 = Blue | $02 = Red BoomerangEquipment: skip 1 ; $01 = Blue | $02 = Red
@@ -107,11 +109,11 @@ TargetRupees: skip 2 ; \ CurrentRupees will always increment or decre
CurrentRupees: skip 2 ; / TargetRupees if not equal (16-bit integer) CurrentRupees: skip 2 ; / TargetRupees if not equal (16-bit integer)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CompassField: skip 2 ; Dungeon item bitfields CompassField: skip 2 ; Dungeon item bitfields
BigKeyField: skip 2 ; Low byte: - - g r t h i s BigKeyField: skip 2 ; High byte: - - g r t h i s
MapField: skip 2 ; g = Ganon's Tower | r = Turtle Rock | t = Thieves' Town MapField: skip 2 ; g = Ganon's Tower | r = Turtle Rock | t = Thieves' Town
; h = Tower of Hera | i = Ice Palace | s = Skull Woods ; h = Tower of Hera | i = Ice Palace | s = Skull Woods
;------------------------------------------------ ;------------------------------------------------
; High Byte: m d s a t e h p ; Low Byte: m d s a t e h p
; m = Misery Mire | d = Palace of Darkness | s = Swamp Palace ; m = Misery Mire | d = Palace of Darkness | s = Swamp Palace
; a = Aga Tower | t = Desert Palace | e = Eastern Palace ; a = Aga Tower | t = Desert Palace | e = Eastern Palace
; h = Hyrule Castle | s = Sewer Passage ; h = Hyrule Castle | s = Sewer Passage
@@ -140,9 +142,9 @@ CrystalsField: skip 1 ; - 3 4 2 7 5 1 6 (bitfield)
MagicConsumption: skip 1 ; $00 = Normal | $01 = Half Magic | $02 = Quarter Magic MagicConsumption: skip 1 ; $00 = Normal | $01 = Half Magic | $02 = Quarter Magic
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Small keys earned per dungeon (integers) ; Small keys earned per dungeon (integers)
SewerKeys: skip 1 ; \ Hyrule Castle and Sewer keys typically increment DungeonKeys: ;
DungeonKeys: ; | and decrement together SewerKeys: skip 1 ;
HyruleCastleKeys: skip 1 ; / HyruleCastleKeys: skip 1 ;
EasternKeys: skip 1 ; Eastern Palace small keys EasternKeys: skip 1 ; Eastern Palace small keys
DesertKeys: skip 1 ; Desert Palace small keys DesertKeys: skip 1 ; Desert Palace small keys
CastleTowerKeys: skip 1 ; Agahnim's Tower small keys CastleTowerKeys: skip 1 ; Agahnim's Tower small keys
@@ -161,18 +163,20 @@ 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 - - - - - - - q (bitfield) InventoryTracking: skip 2 ; b r m p n s k f - - - - - - o 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 | q = Quickswap locked ; k = Inactive Flute | f = Active Flute | o = Any bomb acquired
; 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
; indicates whether the "second" has been found independent of ; indicates whether the "second" has been found independent of
; the first ; the first
ItemLimitCounts: skip 10 ; Keeps track of limited non-progressive items such as lamp. ItemLimitCounts: skip 24 ; Keeps track of limited non-progressive items such as lamp.
; See: ItemSubstitutionRules in tables.asm ; See: ItemSubstitutionRules in tables.asm
skip 43 ; ; Right now this is only used for three items but extra space is
skip 29 ; reserved
ProgressIndicator: skip 1 ; $00 = Pre-Uncle | $01 = Post-Uncle item | $02 = Zelda Rescued ProgressIndicator: skip 1 ; $00 = Pre-Uncle | $01 = Post-Uncle item | $02 = Zelda Rescued
; $03 = Agahnim 1 defeated ; $03 = Agahnim 1 defeated
; $04 and above don't do anything. $00-$02 used in standard mode ; $04 and above don't do anything. $00-$02 used in standard mode
@@ -197,7 +201,7 @@ FollowerIndicator: skip 1 ; $00 = No Follower | $01 = Zelda | $04 = Ol
FollowerXCoord: skip 2 ; \ Cached X and Y overworld coordinates of dropped follower FollowerXCoord: skip 2 ; \ Cached X and Y overworld coordinates of dropped follower
FollowerYCoord: skip 2 ; / (16-bit integers) FollowerYCoord: skip 2 ; / (16-bit integers)
DroppedFollowerIndoors: skip 1 ; $00 = Dropped follower outdoors | $01 = Dropped follower indoors DroppedFollowerIndoors: skip 1 ; $00 = Dropped follower outdoors | $01 = Dropped follower indoors
DroppedFollowerLayer: skip 1 ; $00 = Upper layer | $01 = Lower layer DroppedFollowerLayer: skip 1 ; $00 = Upper layer | $01 =.lower layer
FollowerDropped: skip 1 ; Set to $80 when a follower exists and has been dropped somewhere FollowerDropped: skip 1 ; Set to $80 when a follower exists and has been dropped somewhere
; $00 otherwise ; $00 otherwise
skip 5 ; Unused skip 5 ; Unused
@@ -212,10 +216,11 @@ GameCounter: skip 2 ; Number of deaths and save + quits (16-bit inte
PostGameCounter: skip 2 ; Initialized to $FFFF, replaced with GameCounter on goal completion PostGameCounter: skip 2 ; Initialized to $FFFF, replaced with GameCounter on goal completion
; Number is displayed on file select when not $FFFF. Max 999 (16-bit integer) ; Number is displayed on file select when not $FFFF. Max 999 (16-bit integer)
skip 13 ; skip 13 ;
NpcFlagsOne: skip 1 ; l - c s t k z o (bitfield) NpcFlags: skip 2 ; l - c s t k z o (bitfield)
; l = Library | c = Catfish | s = Sahasrahla | t = Stumpy ; l = Library | c = Catfish | s = Sahasrahla | t = Stumpy
; k = Sick Kid | z = King Zora | o = Old Man ; k = Sick Kid | z = King Zora | o = Old Man
NpcFlagsTwo: skip 1 ; b - p m f s b e (bitfield) ;
; b - p m f s b e (bitfield)
; b = Magic Bat | p = Potion Shop (Powder) | m = Lost Woods (Mushroom) ; b = Magic Bat | p = Potion Shop (Powder) | m = Lost Woods (Mushroom)
; f = Fairy (unused) | s = Smith | b = Bombos Tablet ; f = Fairy (unused) | s = Smith | b = Bombos Tablet
; e = Ether Tablet ; e = Ether Tablet
@@ -229,9 +234,11 @@ MapOverlay: skip 2 ; Used to reveal dungeon prizes on the map in mo
; | m = Misery Mire | d = Palace of Darkness | s = Swamp Palace ; | m = Misery Mire | d = Palace of Darkness | s = Swamp Palace
; | a = Aga Tower | t = Desert Palace | e = Eastern Palace ; | a = Aga Tower | t = Desert Palace | e = Eastern Palace
; / h = Hyrule Castle | s = Sewer Passage ; / h = Hyrule Castle | s = Sewer Passage
GeneralFlags: skip 1 ; - - h - p i - g (bitfield) HudFlag: ;
; h = HUD Flag | p = Force pyramid IgnoreFaeries: ;
; i = Ignore faeries | g = Has diggable grove item HasGroveItem: ;
GeneralFlags: skip 1 ; - - h - - i - g (bitfield)
; h = HUD Flag | i = ignore faeries | g = has diggable grove item
HighestSword: skip 1 ; Highest sword level (integer) HighestSword: skip 1 ; Highest sword level (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
@@ -242,9 +249,8 @@ 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 HighestShield: skip 1 ; Highest Shield level
TotalItemCounter: skip 2 ; Total items collected (integer) TotalItemCounter: skip 2 ; Total items collected (integer)
TemperedGoldBosses: skip 1 ; t t t t g g g g (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
FighterMasterBosses: skip 1 ; f f f f m m m m (packed integers)
; f = Fighter Sword boss kills | m = Master Sword boss kills ; f = Fighter Sword boss kills | m = Master Sword boss kills
BigKeysBigChests: skip 1 ; k k k k c c c c (packed integers) 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
@@ -255,7 +261,7 @@ PreGTBKLocations: skip 1 ; Locations checked in GT before finding the big
; 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
RupeesSpent: skip 2 ; Rupees spent (16-bit integer) RupeesSpent: skip 2 ; Rupees spent (16-bit integer)
SaveQuits: skip 1 ; Number of times player has saved and quit (integer) SaveQuitCounter: skip 1 ; Number of times player has saved and quit (integer)
LoopFrames: skip 4 ; Frame counter incremented during frame hook (32-bit integer) LoopFrames: skip 4 ; Frame counter incremented during frame hook (32-bit integer)
PreBootsLocations: skip 2 ; Number of locations checked before getting boots (integer) PreBootsLocations: skip 2 ; Number of locations checked before getting boots (integer)
PreMirrorLocations: skip 2 ; Number of locations checked before getting mirror (integer) PreMirrorLocations: skip 2 ; Number of locations checked before getting mirror (integer)
@@ -267,14 +273,14 @@ ScreenTransitions: skip 2 ; Number of screen transitions (16-bit integer)
NMIFrames: skip 4 ; Frame counter incremented during NMI hook (32-bit integer) NMIFrames: skip 4 ; Frame counter incremented during NMI hook (32-bit integer)
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) MenuFrames: skip 4 ; Total menu time in frames (32-bit integer)
HeartContainerCounter: skip 1 ; Total number of heart containers 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 4 ; skip 4 ;
RNGItem: skip 2 ; RNG Item RNGItem: skip 2 ; RNG Item
SwordlessBosses: skip 1 ; Number of bosses killed without a sword (integer) SwordlessBossKills: 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
SwordTime: skip 4 ; Time first sword found in frames (32-bit integer) SwordTime: skip 4 ; Time first sword found in frames (32-bit integer)
@@ -290,11 +296,13 @@ SmallKeyCounter: skip 1 ; Total Number of small keys collected (integer)
HeartPieceCounter: skip 1 ; Total Number of heartpieces collected (integer) HeartPieceCounter: skip 1 ; Total Number of heartpieces collected (integer)
CrystalCounter: skip 1 ; Total Number of crystals collected (integer) CrystalCounter: skip 1 ; Total Number of crystals collected (integer)
skip 46 ; Unused skip 46 ; Unused
ServiceSequence: skip 1 ; Service sequence value. See servicerequest.asL ServiceRequestReceive: ;
skip 49 ; Unused ServiceRequestTransmit: ;
ServiceRequest: skip 8 ; Service request block. See servicerequest.asm
skip 42 ; Unused
; \ Dungeon locations checked counters (integers) ; \ Dungeon locations checked counters (integers)
SewersLocations: skip 1 ; | Sewer Passage
HCLocations: skip 1 ; | Hyrule Castle HCLocations: skip 1 ; | Hyrule Castle
SewerLocations: skip 1 ; | Sewer Passage
EPLocations: skip 1 ; | Eastern Palace EPLocations: skip 1 ; | Eastern Palace
DPLocations: skip 1 ; | Desert Palace DPLocations: skip 1 ; | Desert Palace
CTLocations: skip 1 ; | Agahnim's Tower CTLocations: skip 1 ; | Agahnim's Tower
@@ -307,9 +315,9 @@ THLocations: skip 1 ; | Tower of Hera
TTLocations: skip 1 ; | Thieves' Town TTLocations: skip 1 ; | Thieves' Town
TRLocations: skip 1 ; | Turtle Rock TRLocations: skip 1 ; | Turtle Rock
GTLocations: skip 1 ; / Ganon's Tower GTLocations: skip 1 ; / Ganon's Tower
; \ Chest Key Counters. Only counts keys placed in chests. (integers) DungeonChestKeys: ; \ Chest Key Counters. Only counts keys placed in chests. (integers)
HCChestKeys: skip 1 ; | Hyrule Castle
SewerChestKeys: skip 1 ; | Sewer Passage SewerChestKeys: skip 1 ; | Sewer Passage
HCChestKeys: skip 1 ; | Hyrule Castle
EPChestKeys: skip 1 ; | Eastern Palace EPChestKeys: skip 1 ; | Eastern Palace
DPChestKeys: skip 1 ; | Desert Palace DPChestKeys: skip 1 ; | Desert Palace
CTChestKeys: skip 1 ; | Agahnim's Tower CTChestKeys: skip 1 ; | Agahnim's Tower
@@ -322,7 +330,7 @@ THChestKeys: skip 1 ; | Tower of Hera
TTChestKeys: skip 1 ; | Thieves' Town TTChestKeys: skip 1 ; | Thieves' Town
TRChestKeys: skip 1 ; | Turtle Rock TRChestKeys: skip 1 ; | Turtle Rock
GTChestKeys: skip 1 ; / Ganon's Tower GTChestKeys: skip 1 ; / Ganon's Tower
skip 2 ; Unused skip 2 ; Reserved, may be indexed into and have junk generic key data written
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. InverseChecksum: skip 2 ; Vanilla Inverse Checksum. Don't write unless computing checksum.
@@ -334,26 +342,44 @@ InverseChecksum: skip 2 ; Vanilla Inverse Checksum. Don't write unless c
; beginning at $700500 ; beginning at $700500
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
base $7F6000 ; $1000 byte buffer we place beginning at second save file base $7F6000 ; $1000 byte buffer we place beginning at second save file
ExtendedFileNameSRAM = $706000 ; We read and write the file name directly from and to SRAM
ExtendedFileNameWRAM: skip 24 ; File name, 12 word-length characters. ExtendedFileNameWRAM: skip 24 ; File name, 12 word-length characters.
VERSION: skip 4 ; $0000 = Default TODO RoomPotData: skip 592 ; Table for expanded pot shuffle. One word per room.
RoomPotData: skip 592 ; Table for expanded pot shuffle
PurchaseCounts: skip 96 ; Keeps track of shop purchases PurchaseCounts: skip 96 ; Keeps track of shop purchases
PrivateBlock: skip 512 ; Reserved for 3rd party developers
DummyValue: skip 1 ; $01 if you're a real dummy DummyValue: skip 1 ; $01 if you're a real dummy
;================================================================================
; Direct SRAM Assignments ($700000 - $7080000)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
base $7F1000 ; ; Label assignments for the actual cartridge SRAM, expanded to 32k. Used mainly
RomName: ; ROM name from $FFC0, burned in during init (21 bytes) ; for burning in values such as the ROM name directly or when we only have to read
; a small amount of data which is not currently in the WRAM mirror.
;--------------------------------------------------------------------------------
base $700000 ;
skip $0340 ;
SRAMEquipment: skip 76 ;
InventoryTrackingSRAM: skip 2 ;
BowTrackingSRAM: skip 2 ;
skip 368 ;
ExtendedFileNameSRAM: skip 24 ; We read and write the file name directly from and to SRAM (24 bytes)
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. ; If value in the ROM doesn't match SRAM, save is cleared.
VERSIONSRAM: skip 4 ; ALTTPR ROM version (32 bytes)
skip 4071 ;
PasswordSRAM: skip 16 ; Password value (16 bytes)
base off base off
;================================================================================
; Assertions
;================================================================================ ;================================================================================
; Vanilla Assertions ; Vanilla Assertions
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; All of these need to pass for the base rom to build or something is probably ; All of these need to pass for the base rom to build or something is probably
; very wrong. ; very wrong.
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
assert SRAMEquipment = $7EF340, "SRAMEquipment labeled at incorrect address" assert WRAMEquipment = $7EF340, "WRAMEquipment labeled at incorrect address"
assert BowEquipment = $7EF340, "BowEquipment labeled at incorrect address" assert BowEquipment = $7EF340, "BowEquipment labeled at incorrect address"
assert BoomerangEquipment = $7EF341, "BoomerangEquipment labeled at incorrect address" assert BoomerangEquipment = $7EF341, "BoomerangEquipment labeled at incorrect address"
assert HookshotEquipment = $7EF342, "HookshotEquipment labeled at incorrect address" assert HookshotEquipment = $7EF342, "HookshotEquipment labeled at incorrect address"
@@ -443,7 +469,7 @@ assert InverseChecksum = $7EF4FE, "InverseChecksum labeled at incorrect a
;================================================================================ ;================================================================================
; Randomizer Assertions ; Randomizer Assertions
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Trackers and other third party consumers may depend on these values ; Trackers and other third party consumers may depend on these values.
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
assert InventoryTracking = $7EF38C, "InventoryTracking labeled at incorrect address" assert InventoryTracking = $7EF38C, "InventoryTracking labeled at incorrect address"
assert BowTracking = $7EF38E, "BowTracking labeled at incorrect address" assert BowTracking = $7EF38E, "BowTracking labeled at incorrect address"
@@ -451,8 +477,7 @@ assert ItemLimitCounts = $7EF390, "ItemLimitCounts labeled at incorrect a
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
assert GameCounter = $7EF3FF, "GameCounter labeled at incorrect address" assert GameCounter = $7EF3FF, "GameCounter labeled at incorrect address"
assert PostGameCounter = $7EF401, "PostGameCounter labeled at incorrect address" assert PostGameCounter = $7EF401, "PostGameCounter labeled at incorrect address"
assert NpcFlagsOne = $7EF410, "NPCFlagsOne labeled at incorrect address" assert NpcFlags = $7EF410, "NPCFlags labeled at incorrect address"
assert NpcFlagsTwo = $7EF411, "NPCFlagsTwo labeled at incorrect address"
assert MapOverlay = $7EF414, "MapOverlay labeled at incorrect address" assert MapOverlay = $7EF414, "MapOverlay labeled at incorrect address"
assert GeneralFlags = $7EF416, "GeneralFlags labeled at incorrect address" assert GeneralFlags = $7EF416, "GeneralFlags labeled at incorrect address"
assert HighestSword = $7EF417, "HighestSword labeled at incorrect address" assert HighestSword = $7EF417, "HighestSword labeled at incorrect address"
@@ -462,16 +487,15 @@ assert ProgrammableItemTwo = $7EF41C, "ProgrammableItemTwo labeled at incorre
assert ProgrammableItemThree = $7EF41E, "ProgrammableItemThree labeled at incorrect address" assert ProgrammableItemThree = $7EF41E, "ProgrammableItemThree labeled at incorrect address"
assert BonkCounter = $7EF420, "BonkCounter labeled at incorrect address" assert BonkCounter = $7EF420, "BonkCounter labeled at incorrect address"
assert YAItemCounter = $7EF421, "YAItemCounter labeled at incorrect address" assert YAItemCounter = $7EF421, "YAItemCounter labeled at incorrect address"
assert HighestShield = $7EF422, "SwordsShields labeled at incorrect address" assert HighestShield = $7EF422, "HighestShield labeled at incorrect address"
assert TotalItemCounter = $7EF423, "TotalItemCounter labeled at incorrect address" assert TotalItemCounter = $7EF423, "TotalItemCounter labeled at incorrect address"
assert TemperedGoldBosses = $7EF425, "TemperedGoldBosses labeled at incorrect address" assert SwordBossKills = $7EF425, "SwordBossKills 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 PendantCounter = $7EF429, "PendantCounter 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 SaveQuitCounter = $7EF42D, "SaveQuitCounter labeled at incorrect address"
assert LoopFrames = $7EF42E, "LoopFrames labeled at incorrect address" assert LoopFrames = $7EF42E, "LoopFrames labeled at incorrect address"
assert PreBootsLocations = $7EF432, "PreBootsLocations labeled at incorrect address" assert PreBootsLocations = $7EF432, "PreBootsLocations labeled at incorrect address"
assert PreMirrorLocations = $7EF434, "PreMirrorLocations labeled at incorrect address" assert PreMirrorLocations = $7EF434, "PreMirrorLocations labeled at incorrect address"
@@ -482,12 +506,12 @@ assert ScreenTransitions = $7EF43C, "ScreenTransitions labeled at incorrect
assert NMIFrames = $7EF43E, "NMIFrames labeled at incorrect address" 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 MenuFrames = $7EF444, "MenuFrames labeled at incorrect address"
assert HeartContainerCounter = $7EF448, "HeartContainerCounter 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 RNGItem = $7EF450, "RNGItem labeled at incorrect address"
assert SwordlessBosses = $7EF452, "SwordlessBosses labeled at incorrect address" assert SwordlessBossKills = $7EF452, "SwordlessBossKills 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"
assert SwordTime = $7EF458, "SwordTime labeled at incorrect address" assert SwordTime = $7EF458, "SwordTime labeled at incorrect address"
@@ -503,10 +527,10 @@ assert SmallKeyCounter = $7EF46F, "SmallKeyCounter labeled at incorrect a
assert HeartPieceCounter = $7EF470, "HeartPieceCounter labeled at incorrect address" assert HeartPieceCounter = $7EF470, "HeartPieceCounter labeled at incorrect address"
assert CrystalCounter = $7EF471, "CrystalCounter labeled at incorrect address" assert CrystalCounter = $7EF471, "CrystalCounter labeled at incorrect address"
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
assert ServiceSequence = $7EF4A0, "ServiceSequence labeled at incorrect address" assert ServiceRequest = $7EF4A0, "ServiceRequest labeled at incorrect address"
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
assert HCLocations = $7EF4D2, "HCLocations labeled at incorrect address" assert SewersLocations = $7EF4D2, "SewersLocations labeled at incorrect address"
assert SewerLocations = $7EF4D3, "SewersLocations labeled at incorrect address" assert HCLocations = $7EF4D3, "HCLocations labeled at incorrect address"
assert EPLocations = $7EF4D4, "EPLocations labeled at incorrect address" assert EPLocations = $7EF4D4, "EPLocations labeled at incorrect address"
assert DPLocations = $7EF4D5, "DPLocations labeled at incorrect address" assert DPLocations = $7EF4D5, "DPLocations labeled at incorrect address"
assert CTLocations = $7EF4D6, "CTLocations labeled at incorrect address" assert CTLocations = $7EF4D6, "CTLocations labeled at incorrect address"
@@ -519,8 +543,8 @@ assert THLocations = $7EF4DC, "THLocations labeled at incorrect addre
assert TTLocations = $7EF4DD, "TTLocations labeled at incorrect address" assert TTLocations = $7EF4DD, "TTLocations labeled at incorrect address"
assert TRLocations = $7EF4DE, "TRLocations labeled at incorrect address" assert TRLocations = $7EF4DE, "TRLocations labeled at incorrect address"
assert GTLocations = $7EF4DF, "GTLocations labeled at incorrect address" assert GTLocations = $7EF4DF, "GTLocations labeled at incorrect address"
assert HCChestKeys = $7EF4E0, "HCChestKeys labeled at incorrect address" assert SewerChestKeys = $7EF4E0, "SewerChestKeys labeled at incorrect address"
assert SewerChestKeys = $7EF4E1, "SewerChestKeys labeled at incorrect address" assert HCChestKeys = $7EF4E1, "HCChestKeys labeled at incorrect address"
assert EPChestKeys = $7EF4E2, "EPChestKeys labeled at incorrect address" assert EPChestKeys = $7EF4E2, "EPChestKeys labeled at incorrect address"
assert DPChestKeys = $7EF4E3, "DPChestKeys labeled at incorrect address" assert DPChestKeys = $7EF4E3, "DPChestKeys labeled at incorrect address"
assert CTChestKeys = $7EF4E4, "ATChestKeys labeled at incorrect address" assert CTChestKeys = $7EF4E4, "ATChestKeys labeled at incorrect address"
@@ -535,13 +559,22 @@ assert TRChestKeys = $7EF4EC, "TRChestKeys labeled at incorrect addre
assert GTChestKeys = $7EF4ED, "GChestKeys labeled at incorrect address" assert GTChestKeys = $7EF4ED, "GChestKeys labeled at incorrect address"
assert FileMarker = $7EF4F0, "FileMarker labeled at incorrect address" assert FileMarker = $7EF4F0, "FileMarker labeled at incorrect address"
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
assert ExtendedFileNameWRAM = $7F6000, "Filename labeled at incorrect address" assert ExtendedFileNameWRAM = $7F6000, "ExtendedFilenameWRAM labeled at incorrect address"
assert VERSION = $7F6018, "VERSION labeled at incorrect address" assert RoomPotData = $7F6018, "RoomPotData labeled at incorrect address"
assert RoomPotData = $7F601C, "RoomPotData labeled at incorrect address" assert PurchaseCounts = $7F6268, "PurchaseCounts labeled at incorrect address"
assert PurchaseCounts = $7F626C, "PurchaseCounts labeled at incorrect address" assert PrivateBlock = $7F62C8, "PrivateBlock labeled at incorrect address"
assert DummyValue = $7F62CC, "DummyValue labeled at incorrect address" assert DummyValue = $7F64C8, "DummyValue labeled at incorrect address"
;================================================================================
; Direct SRAM Assertions
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
assert RomName = $7F1000, "RomName at incorrect address" assert SRAMEquipment = $700340, "SRAMEquipment labeled at incorrect address"
assert InventoryTrackingSRAM = $70038C, "InventoryTracking labeled at incorrect address"
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 PasswordSRAM = $703000, "PasswordSRAM at incorrect address"
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; MOVED TODO ; MOVED TODO
@@ -553,7 +586,7 @@ assert RomName = $7F1000, "RomName at incorrect address"
;HighestMail: 7ef424 -> 7ef470 ;HighestMail: 7ef424 -> 7ef470
;HighestShield: 7ef422 -> swords usingHighestSword, shields removed from general flags ;HighestShield: 7ef422 -> swords usingHighestSword, shields removed from general flags
; SmallKeyCounter: 7ef424 -> 7ef471 ; SmallKeyCounter: 7ef424 -> 7ef471
; ServiceSequence: 7ef419 -> 7ef418 (two bytes reserved) ; ServiceSequence: removed
; SwordsShields: 7ef422 -> swords usingHighestSword ; SwordsShields: 7ef422 -> swords usingHighestSword
; PreMirrorLocations: 7ef432 -> 7ef434, PreBoots and PreMirror now 2 bytes ; PreMirrorLocations: 7ef432 -> 7ef434, PreBoots and PreMirror now 2 bytes
; Heart Pieces: 7ef429 -> 7ef470 ; Heart Pieces: 7ef429 -> 7ef470
@@ -566,15 +599,21 @@ assert RomName = $7F1000, "RomName at incorrect address"
; bombs (?), silvers, and pre gtbk at $7ef42a now just pre gtbk ; bombs (?), silvers, and pre gtbk at $7ef42a now just pre gtbk
; ;
; whole file name now at $7F6000/706000, first four still at vanilla location ; whole file name now at $7F6000/706000, first four still at vanilla location
;
; password_sram: 701000 -> 703000
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; ADDED ; ADDED
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; ;
; PreFluteLocations = $7EF436 ; PreFluteLocations = $7EF436[0x02]
; VERSION = $7F6018 ; ServiceRequest = $7EF4A0[0x08]
; RoomPotData = $7F601C ; VERSION = $7F6018[0x04]
; PurchaseCounts = $7F601C ; RoomPotData = $7F601C[0x250]
; DummyValue = $7F607C ; PurchaseCounts = $7F601C[0x60]
; DummyValue = $7F607C[0x02]
; ;
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; TODO
;--------------------------------------------------------------------------------
; figure out why ChestsOpened is wrong
;