Repository navigation
SRAM Re-work - #159
Merged
Merged
SRAM Re-work#159
Conversation
Changes to save.asm and fileselect.asm to account for new WRAM buffer at $7F6000 saved at $700500, length $1000. Moves and additions noted at bottom of sram.asm, to be removed later.
Added items, equipment, and tracking/indicators Added playername changes Removed some defines
Refactored highest sword, shield, and mail counting Refactored how heart pieces, heart containers, and crystals are counted Moved quickswap lock bit to high byte of InventoryTracking Fixed sword and shield item downgrade Added PreFluteLocations counter
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.
Removed mask from rupeelimit.asm as total item counter is now a 16-bit value Commented out CountBits in utilities.asm in previous commit as I've allocated a counter byte in SRAM
Full file name has also been moved to the beginning of the new save space at $7F6000 in WRAM and $700500 in SRAM
Fixed comments related to OpenMode, left open as default
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
Adjust service request stuff Change chest keys to "collected" keys
Swap locations checked with absorbed keys to match door rando
Change some label names to be clearer Fix some of the progress flags and dungeon bitfields
Add flag if compass HUD count has been displayed in SRAM Move low hearts fix from tables.asm to bugfixes.asm Rearrange dungeon stats in SRAM to match door rando ROM
Remove comments, general cleanup
Changes to save.asm and fileselect.asm to account for new WRAM buffer at $7F6000 saved at $700500, length $1000. Moves and additions noted at bottom of sram.asm, to be removed later.
Added items, equipment, and tracking/indicators Added playername changes Removed some defines
Refactored highest sword, shield, and mail counting Refactored how heart pieces, heart containers, and crystals are counted Moved quickswap lock bit to high byte of InventoryTracking Fixed sword and shield item downgrade Added PreFluteLocations counter
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.
Removed mask from rupeelimit.asm as total item counter is now a 16-bit value Commented out CountBits in utilities.asm in previous commit as I've allocated a counter byte in SRAM
Full file name has also been moved to the beginning of the new save space at $7F6000 in WRAM and $700500 in SRAM
Fixed comments related to OpenMode, left open as default
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
Adjust service request stuff Change chest keys to "collected" keys
Swap locations checked with absorbed keys to match door rando
Change some label names to be clearer Fix some of the progress flags and dungeon bitfields
Add flag if compass HUD count has been displayed in SRAM Move low hearts fix from tables.asm to bugfixes.asm Rearrange dungeon stats in SRAM to match door rando ROM
Remove comments, general cleanup
Add sprite item pot data block
Added pushpc/pullpc to sram.asm
Move compass count ram init to compasses.asm Rename WRAMEquipment and SRAMEquipment to EquipmentWRAM/SRAM
Data in initialsramtable.asm gets copied to SRAM on save file init Frontend will be responsible for setting this, requires frontend changes Changed some label names to disambiguate WRAM and SRAM labels Deleted open mode
cassidoxa
force-pushed
the
sram_rework
branch
from
February 4, 2022 03:01
2de29ad to
3c6c45d
Compare
Fix vanilla sword + shield item Fix how progressive items handled Clean up compasses.asm
Fix BowTracking documentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR makes substantial changes to the layout of SRAM which autotracking and third party devs need to be made aware of. It also makes changes to the data tables in the ROM in bank $30 ($30B000 - PC 0x183000) which will require the frontend to calculate an initial SRAM state (written once on save file initialization) and write it to the ROM. This replaces certain flags such as PreOpenPyramid and OpenMode. Other features and miscellaneous fixes are also included. Most of the line changes here are simply addresses given labels and some adjustments for packed integers using whole bytes, etc.
Three new modules have been added and included: sram.asm, initsramtable.asm and ram.asm. The last one is still a work in progress, but was added for the sake of not adding more defines.
I. Values moved and changed in SRAM
There is a new buffer in WRAM from $7F6000 to $7F6FFF which is saved at $700500-$701500 in the cart SRAM, where the second and third save files used to be stored. There is also now a version number in the ROM stored at an unused hardware vector at $7FE0 (PC address) which is burned into SRAM at $701FFC, two 16 bit integers (currently 1 and 1, to be incremented to 1 and 2.)
The following values are moved or changed, the addresses for the WRAM copy will be used here:
Capacity Upgrades collected (currently only from chests): $7EF452 -> $7EF469
File Name (full, first four still at vanilla): $7EF3E3 -> $7F6000[0x18]
Shop Purchase Counts: $7EF302 -> $7F64B8[0x5F]
Goal Counter: $7EF418[0x02] (now two bytes)
Highest Mail: $7EF424 -> $7EF46E
Highest Shield: $7EF422 (now full byte. Shields removed from general flags at $7EF416)
Highest Sword: Still at $7EF417, no longer at $7EF422
Small Key Counter: $7EF424 -> $7EF46F
Service Sequence Block: $7EF4A0[0x08] (Allocated full 8 bytes)
Pre Mirror Locations: $7EF432 -> $7EF434[0x02]
Pre Boots Locations: $7EF432[0x02] (now two bytes)
Heart Pieces Collected: $7EF429 -> $7EF470
Heart Containers Collected: $7EF448
Pendant Counter: $7EF429 (now full byte)
Swordless Boss Kills: $7EF452 (now full byte)
Pre-GT Big Key locations: $7EF42A (now full byte)
Total Items Collected counter: $7EF423[0x02] (now two bytes)
Bombs Acquired: Previously at $7EF42A, now occupies the $02 bit in the high byte
of inventory tracking at $7EF38C
Shop Purchase Counts: $7EF302 -> $7F64B8
Dungeon Locations Checked: Moved to $7EF4C0, aligned integers indexable by $040C >> 1
Collected Keys: $7EF4E0 (now all collected keys except for vanilla pot and enemy drops)
Password moved from $702000 in cart SRAM to $703000
II. Values Added to SRAM
The following new allocations have been added to SRAM:
Aga 2 Duck: $7EF40F (used in lieu of checking pyramid overworld data)
Pre Flute Locations: $7EF436[0x02]
AbsorbedKeys: $7EF4B0[0x10] (unused, for door rando compatibility)
RoomPotData: $7F6018[0x250] (unused)
SpritePotData: $7F6268[0x250] (unused)
Private Use Block: $7F6518[0x200]
Compass Counts Seen: $7EF403[0x02] (flag for autotrackers, same shape as vanilla bit flags)
Dungeon prizes collected: $7EF472[0x02] (same layout as dungeon map/compass bitfields, set based on dungeon id when prize is collected)
III. Miscellaneous
IV. ram.asm
This module is yet to be filled out. Currently only holds total compass counts for dungeons which are initialized once on boot, starting at $7F5410 and indexable by $040C >> 1.
V. Initial SRAM Table
Addresses and values of note in the initial SRAM table ($30B000 - $30B4FF, PC 0x183000-0x1834FF). All starting equipment can be set the same as with the old StartingEquipment table from address $30B340. Values in little endian:
-Aga tower curtain room: $30B060, 0x183060 ($8000 to open curtains)
-Skull woods curtain room: $30B092, 0x183092 ($8000 to open curtains)
-Pre-opening Kak bomb hut & brewery: $30B20C, 0x18320C ($F000, $F000 - always set this)
-Lumberjack screen: $30B282, 0x183282 ($20 for instant post-aga)
-Hyrule Castle Screen: $30B29B, 0x18329B ($20 to open gate for open mode)
-Pyramid Screen: $30B2DB, 0x1832DB ($20 to pre-open pyramid)
-DDM West Screen: $30B2C3, 0x1832C3 ($20 to pre-open GT)
-Starting Sword: Write same value to $30B359, 0x183359 and $30B417, 0x183417
-Starting Shield: Write same value to $30B35A, 0x18335A and $30B422, 0x183422
-Starting Mail: Write same value to $30B35B, 0x18335B and $30B46E, 0x18346E
-Starting Rupees: Write same value to $30B360, 0x183360 and $30B362, 0x183362
-Starting Health: Write same value to $30B36C, 0x18336C and $30B36D, 0x18336D
-Starting (current, hud) Small Keys: Write $FF to $30B36F, 0x18336F always (need to mind this address if ever starting in a dungeon)
-Starting Pendants: Write to bit flags at $30B374, 0x183374 and integer counter at $30B429, 0x183429
-Initial Ability Flags: Write $68 to $30B379, 0x183379 by default. Set bit $04 with starting boots, bit $02 with starting flippers
-Starting Crystals: Write to bit flags at $30B37A, 0x18337A and integer counter at $30B471, 0x183471
-Init Inventory Tracking: $30B38C, 0x18338C (see sram.asm. Need to set for: boomerangs, mushroom/powder, shovel/flute)
-Init Bow Tracking: $30B38E, 0x18338E (see sram.asm)
-Init Progress Indicator: $30B3C5, 0x1833C5 (set $00 for standard, $02 for open, $03 for open instant post-Aga, $80 for standard instant post-Aga)
-Init Progress Flags: $30B3C6, 0x1833C6 (set $00 for standard, $14 for open)
-Init Starting Entrance: $30B3C8, 0x1833C8 (set $00 for standard, $01 for open)
-Init Challenge timer: For timed modes, write 32-bit integer to $30B454, 0x183454 ($A5E0, $0001 = 30 minutes)
VI. tables.asm
-Moved ByrnaCaveSpikeDamage from $308186 (PC 0x180186) to $308195 (PC 0x180195) to make room for 16-bit goal counter.
-Removed SRAM Trace.
-Removed a number of labels related to starting items, equipment, world state, and overworld event data including OpenMode.
-Added ForceFileName flag
-Allocated length of full 16 entries for ItemSubstitutionRules
-Added CompassTotalsRom table at $30F000-$30F00F (PC 0x187000-0x18700F) for use by HUD compass counts.
-Added BallNChainDungeon flag from door rando at $30EFFF (PC 0x186FFF)