User:Cassidymoen!2979/SRAM Map: Difference between revisions
(Some cleanup) |
(Rough Draft) |
||
Line 2: | Line 2: | ||
== Overview == | == Overview == | ||
This document is intended to be an SRAM reference for the randomizer base ROM. The base ROM expands the SRAM size to 32k and removes the last two save files. | This document is intended to be an SRAM reference for the randomizer base ROM. The base ROM expands the SRAM size to 32k and removes the last two save files. Credit to MathOnNapkins, the editors of the vanilla ALttP wiki, and the randomizer ROM developers who have documented nearly all of this information elsewhere. | ||
== | == Checksum == | ||
The SRAM save loading routing relies upon an inverse checksum. | The SRAM save loading routing relies upon an "inverse" checksum. Changes to any byte in the SRAM between '''$00''' and '''$4FE''' must be added or subtracted to this checksum or the save file will be deleted. The checksum can be computed by adding every word between the beginning of the file and '''$4FE''' and subtracting the sum from '''0x5A5A''', using overflowing arithmetic for both operations. | ||
== SRAM Map == | == SRAM Map == | ||
Line 51: | Line 51: | ||
'''Note 2:''' Jumping into deep water without flippers and being placed back on land on the Hobo and Zora's Domain maps are known to overwrite '''$302''' and '''$304''' respectively. This has no effect if a shop item can always be repurchased, but will lead to unintended behavior if the item can only be purchased a limited amount of times. | '''Note 2:''' Jumping into deep water without flippers and being placed back on land on the Hobo and Zora's Domain maps are known to overwrite '''$302''' and '''$304''' respectively. This has no effect if a shop item can always be repurchased, but will lead to unintended behavior if the item can only be purchased a limited amount of times. | ||
=== | === '''$340''' to '''$38B''' - Items & Equipment === | ||
{| | {| border="1" align="center" cellpadding="4" cellspacing="0" style="margin: 0 0 1em 1em; background: #f7f8ff; border: 1px #8888cc solid; border-collapse: collapse; font-size: 95%" | ||
|- style=background:#ccccff | |||
!Address | !Address | ||
!Item | !Item | ||
Line 59: | Line 60: | ||
!style="width:15%"|Notes | !style="width:15%"|Notes | ||
|- | |- | ||
| | |'''$340''' | ||
|Bow | |Bow | ||
|0 - Nothing | |0 - Nothing | ||
Line 66: | Line 67: | ||
|3 - Silver Arrow Bow | |3 - Silver Arrow Bow | ||
|4 - Bow & Silver Arrows | |4 - Bow & Silver Arrows | ||
|- | |- | ||
| | |- | ||
|'''$341''' | |||
|Boomerang | |Boomerang | ||
|0 - Nothing | |0 - Nothing | ||
Line 74: | Line 75: | ||
|2 - Red Boomerang | |2 - Red Boomerang | ||
|- | |- | ||
| | |'''$342''' | ||
|Hookshot | |Hookshot | ||
|0 - Nothing | |0 - Nothing | ||
|1 - Hookshot | |1 - Hookshot | ||
|- | |- | ||
| | |'''$343''' | ||
|Bombs| | |Bombs| | ||
|How many bombs you have | |How many bombs you have | ||
|colspan="4" class="spacerCell"| | |colspan="4" class="spacerCell"| | ||
|Can exceed | |Can exceed '''0x32''' (50), up to '''0xFF''' (255). | ||
|- | |- | ||
| | |'''$344''' | ||
|Magic Powder | |Magic Powder | ||
|0 - Nothing | |0 - Nothing | ||
Line 91: | Line 92: | ||
|2 - Magic Powder | |2 - Magic Powder | ||
|- | |- | ||
| | |'''$345''' | ||
|Fire Rod | |Fire Rod | ||
|0 - Nothing | |0 - Nothing | ||
|1 - Fire Rod | |1 - Fire Rod | ||
|- | |- | ||
| | |'''$346''' | ||
|Ice Rod | |Ice Rod | ||
|0 - Nothing | |0 - Nothing | ||
|1 - Ice Rod | |1 - Ice Rod | ||
|- | |- | ||
| | |'''$347''' | ||
|Bombos Medallion | |Bombos Medallion | ||
|0 - Nothing | |0 - Nothing | ||
|1 - Bombos Medallion | |1 - Bombos Medallion | ||
|- | |- | ||
| | |'''$348''' | ||
|Ether Medallion | |Ether Medallion | ||
|0 - Nothing | |0 - Nothing | ||
|1 - Ether Medallion | |1 - Ether Medallion | ||
|- | |- | ||
| | |'''$349''' | ||
|Quake Medallion | |Quake Medallion | ||
|0 - Nothing | |0 - Nothing | ||
|1 - Quake Medallion | |1 - Quake Medallion | ||
|- | |- | ||
| | |'''$34A''' | ||
|Lamp | |Lamp | ||
|0 - Nothing | |0 - Nothing | ||
|1 - Lamp | |1 - Lamp | ||
|- | |- | ||
| | |'''$34B''' | ||
|Magic Hammer | |Magic Hammer | ||
|0 - Nothing | |0 - Nothing | ||
|1 - Magic Hammer | |1 - Magic Hammer | ||
|- | |- | ||
| | |'''$34C''' | ||
|Flute | |Flute | ||
|0 - Nothing | |0 - Nothing | ||
Line 133: | Line 134: | ||
|3 - Flute & Bird | |3 - Flute & Bird | ||
|- | |- | ||
| | |'''$34D'''||Bug Catching Net||0 - Nothing||1 - Bug Catching Net | ||
|- | |- | ||
| | |'''$34E'''||Book of Mudora||0 - Nothing||1 - Book of Mudora | ||
|-| | |-| | ||
| | |'''$34F'''||Bottles||0 - Nothing||1 - Bottle 1 ('''$7EF35C''')||2 - Bottle 2 ('''$7EF35D''')||3 - Bottle 3 ('''$7EF35E''')||4 - Bottle 4 ('''$7EF35F''') | ||
|- | |- | ||
| | |'''$350'''||Cane of Somaria||0 - Nothing||1 - Cane of Somaria | ||
|- | |- | ||
| | |'''$351'''||Cane of Byrna||0 - Nothing||1 - Cane of Byrna | ||
|- | |- | ||
| | |'''$352'''||Magic Cape||0 - Nothing||1 - Magic Cape | ||
|- | |- | ||
| | |'''$353'''||Magic Mirror||0 - Nothing||1 - Magic Scroll||2 - Magic Mirror | ||
|- | |- | ||
| | |'''$354'''||Gloves||0 - Nothing||1 - Power Glove||2 - Titan's Mitt | ||
|- | |- | ||
| | |'''$355'''||Pegasus Boots||0 - Nothing||1 - Pegasus Boots||colspan="3"| ||See '''$379'''. | ||
|- | |- | ||
| | |'''$356'''||Zora's Flippers||0 - Nothing||1 - Zora's Flippers||colspan="3" | ||See '''$379'''. | ||
|- | |- | ||
| | |'''$357'''||Moon Pearl||0 - Nothing||1 - Moon Pearl | ||
|- | |- | ||
| | |'''$358'''||Unused | ||
|- | |- | ||
| | |'''$359'''||Sword||0 - No sword||1 - Fighter's Sword||2 - Master Sword||3 - Tempered Sword||4 - Golden Sword|| | ||
|- | |- | ||
| | |'''$35A'''||Shield||0 - No shield||1 - Blue Shield||2 - Hero's Shield||3 - Mirror Shield|| || | ||
|- | |- | ||
| | |'''$35B'''||Armor||0 - Green Mail||1 - Blue Mail||2 - Red Mail|| || | ||
|- | |- | ||
|rowspan="2"| | |rowspan="2"|'''$35C''' to '''$35F'''||rowspan="2"|Bottle Contents||0 - No bottle||1 - Mushroom||2 - Empty bottle||3 - Red Potion||4 - Green Potion | ||
|- | |- | ||
|5 - Blue Potion||6 - Fairy||7 - Bee||8 - Good Bee | |5 - Blue Potion||6 - Fairy||7 - Bee||8 - Good Bee | ||
|- | |- | ||
| | |'''$360''' to '''$361'''||Wallet Capacity||colspan="5"| ||rowspan="2"| | ||
|- | |- | ||
| | |'''$362''' to '''$363'''||Rupee Count | ||
|} | |} | ||
{|border="1" align="center" cellpadding="4" cellspacing="0" style="margin: 0 0 1em 1em; background: #f7f8ff; border: 1px #8888cc solid; border-collapse: collapse; font-size: 95%" | |||
|- style=background:#ccccff | |||
!Item | !Item | ||
!Address | !Address | ||
Line 191: | Line 187: | ||
|- | |- | ||
|Compass1 | |Compass1 | ||
| | |'''$364''' | ||
|rowspan="3"|Unused | |rowspan="3"|Unused | ||
|rowspan="3"|Unused | |rowspan="3"|Unused | ||
Line 202: | Line 198: | ||
|- | |- | ||
|BigKey1 | |BigKey1 | ||
| | |'''$366''' | ||
|- | |- | ||
|Dungeon map1 | |Dungeon map1 | ||
| | |'''$368''' | ||
|- | |- | ||
|Compass2 | |Compass2 | ||
| | |'''$365''' | ||
|rowspan="3"|Misery Mire. | |rowspan="3"|Misery Mire. | ||
|rowspan="3"|Dark Palace | |rowspan="3"|Dark Palace | ||
|rowspan="3"|Swamp Palace | |rowspan="3"|Swamp Palace | ||
|rowspan="3"|Hyrule Castle 2 | |rowspan="3"|Hyrule Castle 2 | ||
|rowspan="3"|Desert Palace | |rowspan="3"|Desert Palace | ||
|rowspan="3"|Eastern Palace | |rowspan="3"|Eastern Palace | ||
|rowspan="3"|Hyrule Castle | |rowspan="3"|Hyrule Castle | ||
|rowspan="3"|Sewer Passage | |rowspan="3"|Sewer Passage | ||
|- | |- | ||
|BigKey2 | |BigKey2 | ||
| | |'''$367''' | ||
|- | |- | ||
|Dungeon map2 | |Dungeon map2 | ||
| | |'''$369''' | ||
|} | |} | ||
Wishing Pond Rupee | Wishing Pond Rupee '''$36A''' | ||
* | * Unused | ||
Heart pieces collected: | Heart pieces collected: | ||
* | *'''$36B'''. Number of heart pieces (out of four) you have earned | ||
Health: | Health: '''$36C''' | ||
* | * Health Capacity. Each increment of '''$08}} is worth one heart. | ||
* | * '''$04''' is a half heart. The max is generally '''$A0'''. The game is coded to not accept health values beyond this. | ||
* | *'''$36D'''. Actual Health. Same as above, but this reflects your current health status rather than potential. | ||
Magic Power: | Magic Power: '''$36E''' | ||
* Magic power ranges from | * Magic power ranges from '''$0''' to '''$80''' (128). Each small bottle refills '''$10'''. Setting Magic above '''$80''' causes the magic meter to glitch and you can't use special items. | ||
Keys: | Keys: '''$36F''' | ||
* Number of Keys you have in the dungeon you are currently in | * Number of Keys you have in the dungeon you are currently in. If you're in a non-keyed dungeon it will generally read '''$FF'''. | ||
Bomb Upgrades: | Bomb Upgrades: '''$370''' | ||
* Number of | * Number of bombs you can hold above the default value (10). | ||
Arrow Upgrades: | Arrow Upgrades: '''$371''' | ||
* Number of | * Number of arrows you can hold above the default value (30) | ||
Hearts filler: | Hearts filler: '''$372''' | ||
* Write to this location to fill in a set number of hearts. Make sure to write in a multiple of | * Write to this location to fill in a set number of hearts. Make sure to write in a multiple of '''$08''' Otherwise, you will end up filling the whole life meter. | ||
Magic filler: | Magic filler: '''$373''' | ||
* Write to this location how much magic power you want filled up. The maximum effective value is | * Write to this location how much magic power you want filled up. The maximum effective value is '''$80'''. | ||
Pendants: | Pendants: '''$374''' | ||
* Bit 0: Red | * Bit 0: Red Pendant | ||
* Bit 1: Blue | * Bit 1: Blue Blue Pendant | ||
* Bit 2: Green | * Bit 2: Green Green Pendant | ||
Bomb filler: | Bomb filler: '''$375''' | ||
* Write to this location to add X bombs to your arsenal. It will not exceed your maximum, as defined with | * Write to this location to add X bombs to your arsenal. It will not exceed your maximum, as defined with '''$370'''. | ||
Arrow filler: | Arrow filler: '''$376''' | ||
* Write to this location to add X arrows to your arsenal. It will not exceed your maximum, as defined with | * Write to this location to add X arrows to your arsenal. It will not exceed your maximum, as defined with '''$371'''. | ||
Arrows: | Arrows: '''$377''' | ||
????: | ????: '''$378''' | ||
* ???? | * ???? | ||
Ability Flags: | Ability Flags: '''$379''' | ||
* Bit 0: | * Bit 0: | ||
* Bit 1: Swim | * Bit 1: Swim | ||
Line 281: | Line 276: | ||
* Bit 7: ---- | * Bit 7: ---- | ||
Crystals: | Crystals: '''$37A''' | ||
* Bit 0: | * Bit 0: Crystal 6 | ||
* Bit 1: | * Bit 1: Crystal 1 | ||
* Bit 2: | * Bit 2: Crystal 5 | ||
* Bit 3: | * Bit 3: Crystal 7 | ||
* Bit 4: | * Bit 4: Crystal 2 | ||
* Bit 5: | * Bit 5: Crystal 4 | ||
* Bit 6: | * Bit 6: Crystal 3 | ||
Magic | Magic Consumption: '''$$37B''' | ||
* | * '''$0''': Normal Consumption | ||
* | * '''$1''': 1/2 Consumption | ||
* | * '''$2''': 1/4 Consumption | ||
Keys earned per dungeon: | Keys earned per dungeon: (TODO: confirm this and other keys-related values for rando) | ||
* | * '''$37C''' = Sewer Passage | ||
* | * '''$37D''' = Hyrule Castle | ||
* | * '''$37E''' = Eastern Palace | ||
* | * '''$37F''' = Desert Palace | ||
* | * '''$380''' = Hyrule Castle 2 | ||
* | * '''$381''' = Swamp Palace | ||
* | * '''$382''' = Dark Palace | ||
* | * '''$383''' = Misery Mire | ||
* | * '''$384''' = Skull Woods | ||
* | * '''$385''' = Ice Palace | ||
* | * '''$386''' = Tower of Hera | ||
* | * '''$387''' = Gargoyle's Domain | ||
* | * '''$388''' = Turtle Rock | ||
* | * '''$389''' = Ganon's Tower | ||
* | * '''$38A''' = Unused | ||
* | * '''$38B''' = Unused | ||
== Game Event Information == | == Game Event Information == | ||
Progress Indicator | Progress Indicator '''$3C5''': (TODO: Check these for rando) | ||
* | * '''$0''' = Unset, Will put Link in his bed state at the beginning of the game. (Also can't use sword or shield) | ||
* | * '''$1''' = You have a sword and start in the castle on start up. | ||
* | * '''$2''' = Indicates you have completed the first Hyrule Castle dungeon. | ||
* | * '''$3''' = Indicates you have beaten Agahnim and are now searching for crystals. | ||
* | * '''$4''' and above = meaningless. Though, you could write code using them to expand the event system perhaps. | ||
Progress Flags | Progress Flags '''$3C6''' (bitflags): | ||
* Progress flags in the vanilla game. Usually set to '''$18''' or '''$20''' in randomizer. | |||
* | |||
Map Icons Indicator 2 '''$3C7''': | |||
Starting Entrance to use: | * Presumed to be unused in randomizer. | ||
Starting Entrance to use: '''$3C8''': Abbreviations: | |||
* LH = Link's House; | * LH = Link's House; | ||
* SA = Sanctuary; | * SA = Sanctuary; | ||
Line 351: | Line 331: | ||
* PP = Pyramid of Power in DW; | * PP = Pyramid of Power in DW; | ||
* | * '''0''' = Start the game in Link's house always. | ||
* | * '''1''' = SA. | ||
* | * '''2''' = Start in Zelda's Cell (entrance index sanc?). | ||
* | * '''3''' = Secret passage under HC garden (near dying uncle). | ||
* | * '''5''' = LH or SA or MC. | ||
Progress Indicator 3 (bitwise) | Progress Indicator 3 (bitwise) '''$3C9}}: | ||
* | * '''0''' = If set, means the bum gave you his bottle already. | ||
* | * '''1''' = If set, means that the salesman in the village sold you a bottle already | ||
* | * '''2''' = | ||
* | * '''3''' = Flute Boy (DW) has been arborated | ||
* | * '''4''' = Thief's Chest has been opened by the middle aged guy | ||
* | * '''5''' = After you save the Smithy's partner, this bit gets set. | ||
* | * '''6''' | ||
* | * '''7''' = Means Smithies have your sword. Once they give it back it's no longer set. (so nonpermanent) | ||
Lightworld / Darkworld | Lightworld / Darkworld '''$3CA''': | ||
* | * '''0''' | ||
* | * '''1''' | ||
* | * '''2''' | ||
* | * '''3''' | ||
* | * '''4''' | ||
* | * '''5''' | ||
* | * '''6''' = If set, we're in dark world. Otherwise, in light world. | ||
* | * '''7''' | ||
Unused? | Unused? '''$3CB''': | ||
* ????? | * ????? | ||
'''$3CC'''['''0x01'''] - (Tagalong) | |||
* Tagalong Indicator (who is following you, if anyone?) (value based) | * Tagalong Indicator (who is following you, if anyone?) (value based) | ||
Note: Don't use a value of {{0x|0F}} or larger here, as it will likely crash the game. | Note: Don't use a value of {{0x|0F}} or larger here, as it will likely crash the game. | ||
* | * '''0x00''' = Tagalong disabled | ||
* | * '''0x01''' = Princess Zelda | ||
* | * '''0x02''' = ??? | ||
* | * '''0x03''' = ??? | ||
* | * '''0x04''' = Old Man? | ||
* | * '''0x05''' = Zelda (invisible) bitching at you about coming to rescue her. | ||
* | * '''0x06''' = Blind masquerading as a Maiden | ||
* | * '''0x07''' = Missing Dwarf (smithyfrog as I call him) in DW | ||
* | * '''0x08''' = Missing Dwarf in LW | ||
* | * '''0x09''' = Middle Aged Guy w/ Sign | ||
* | * '''0x0A''' = Kiki the monkey | ||
* | * '''0x0B''' = ??? | ||
* | * '''0x0C''' = Thief's chest | ||
* | * '''0x0D''' = Super Bomb | ||
* | * '''0x0E''' = Activated in reaction to acquiring the Master Sword. Used to trigger a telepathic message from Zelda indicating that Agahnim's goons have come for her at Sanctuary. | ||
'''$03CD'''['''0x02'''] - | |||
* Cached Y coordinate of Tagalong after it has been lost by the player. Applies to the old man and to the super bomb, at the very least. This is intended to be used not as a save game variable, but rather as a means of picking the Tagalong back up by getting in contact with it. | * Cached Y coordinate of Tagalong after it has been lost by the player. Applies to the old man and to the super bomb, at the very least. This is intended to be used not as a save game variable, but rather as a means of picking the Tagalong back up by getting in contact with it. | ||
'''$03CF'''['''0x02'''] - | |||
* Cached X coordinate of Tagalong after it has been lost by the player. Applies to the old man and to the super bomb, at the very least. This is intended to be used not as a save game variable, but rather as a means of picking the Tagalong back up by getting in contact with it. | * Cached X coordinate of Tagalong after it has been lost by the player. Applies to the old man and to the super bomb, at the very least. This is intended to be used not as a save game variable, but rather as a means of picking the Tagalong back up by getting in contact with it. | ||
'''$3D1''': | |||
* ???? | * ???? | ||
'''$3D2''': | |||
'''$3D3''': | |||
* Set to 0 normally. Set to | * Set to 0 normally. Set to '''$80''' if a Super Bomb is going off. | ||
'''$3D4''' to '''$3D8''': | |||
* ???? | * ???? | ||
Player's Name | Player's Name '''$3D9}} to '''$3E4}}: | ||
* See appendix for listing of character codes. Note each of the six letters is represented by a 16-bit number. | * See appendix for listing of character codes. Note each of the six letters is represented by a 16-bit number. | ||
Validity (Checksum) of the File: | Validity (Checksum) of the File: | ||
'''$3E5''' to '''$3E6''': | |||
* There is a subroutine in the ROM that checks to make sure this value is | * There is a subroutine in the ROM that checks to make sure this word value is '''0x55AA'''. If changed, the save file will be deleted when the game boots. | ||
'''$3E7''' to '''$402''' (?) = Deaths totals for each dungeon. Each number is 16 bit. Thanks to Euclid for helping verify this! | |||
* | * '''$3E7''' = Sewers | ||
* | * '''$3E9''' = Hyrule Castle | ||
* | * '''$3EB''' = Eastern Palace | ||
* | * '''$3ED''' = Desert Palace | ||
* | * '''$3EF''' = Hyrule Castle 2 | ||
* | * '''$3F1''' = Swamp Palace | ||
* | * '''$3F3''' = Dark Palace | ||
* | * '''$3F5''' = Misery Mire | ||
* | * '''$3F7''' = Skull Woods | ||
* | * '''$3F9''' = Ice Palace | ||
* | * '''$3FB''' = Tower of Hera | ||
* | * '''$3FD''' = Gargoyle's Domain | ||
* | * '''$3FF''' = Turtle Rock | ||
* | * '''$401''' = Ganon's Tower | ||
Life/Save Counter: | Life/Save Counter: '''$403}} to '''$404''' | ||
* Counts the number of times your saved or died in the game, before you beat it. | * Counts the number of times your saved or died in the game, before you beat it. | ||
PostGame Death Counter: | PostGame Death Counter: '''$405''' to '''$406''' | ||
* When you start the game this is written to with the value -1 ({{0x|FFFF}}). On the game select screen, it will only display a number if this is not {{0x|FFFF}}. The max displayable number is 999. | * When you start the game this is written to with the value -1 ({{0x|FFFF}}). On the game select screen, it will only display a number if this is not {{0x|FFFF}}. The max displayable number is 999. | ||
When you beat the game, the number of times you died gets recorded here. | When you beat the game, the number of times you died gets recorded here. | ||
Presumed to be unused: | Presumed to be unused: '''$407''' to '''$4FD''' | ||
* ???? | * ???? | ||
Inverse Checksum: | Inverse Checksum: '''$4FE''' to '''$4FF''' | ||
TODO: These character values are very different in JP1.0 | |||
Character Codes: | Character Codes: | ||
Line 562: | Line 524: | ||
Special characters (not normally accessible. This is by far an incomplete listing) | Special characters (not normally accessible. This is by far an incomplete listing) | ||
{| | {|border="1" align="center" cellpadding="4" cellspacing="0" style="margin: 0 0 1em 1em; background: #f7f8ff; border: 1px #8888cc solid; border-collapse: collapse; font-size: 95%" | ||
|- style=background:#ccccff | |||
|- | |- | ||
| | |'''$A0''' | ||
|small right Arrow | |small right Arrow | ||
|- | |- | ||
| | |'''$A1''' | ||
|"'" (apostrophe) | |"'" (apostrophe) | ||
|- | |- | ||
| | |'''$A2''' | ||
|HPiece Again | |HPiece Again | ||
|- | |- | ||
| | |'''$A3''' | ||
|"empty right hand heart cont." | |"empty right hand heart cont." | ||
|- | |- | ||
| | |'''$A4''' | ||
|see | |see | ||
|- | |- | ||
| | |'''$A7''' | ||
|- | |- | ||
| | |'''$A5''' | ||
|Same As | |Same As | ||
|- | |- | ||
| | |'''$A7''' | ||
|- | |- | ||
| | |'''$A6''' | ||
|"Quarter Heart piece, top right corner." | |"Quarter Heart piece, top right corner." | ||
|- | |- | ||
| | |'''$A7''' | ||
|"Heart piece,left half" | |"Heart piece,left half" | ||
|- | |- | ||
| | |'''$A8''' | ||
|"Heart piece, right half" | |"Heart piece, right half" | ||
|- | |- | ||
| | |'''$A9''' | ||
|blank | |blank | ||
|- | |- | ||
| | |'''$AA''' | ||
|"left Arrow" | |"left Arrow" | ||
|} | |} | ||
Line 604: | Line 567: | ||
SNES Button Alphabet: | SNES Button Alphabet: | ||
{| | {|border="1" align="center" cellpadding="4" cellspacing="0" style="margin: 0 0 1em 1em; background: #f7f8ff; border: 1px #8888cc solid; border-collapse: collapse; font-size: 95%" | ||
|- style=background:#ccccff | |||
|- | |- | ||
| | |'''$AB''' | ||
|A | |A | ||
|- | |- | ||
| | |'''$AC''' | ||
|B | |B | ||
|- | |- | ||
| | |'''$AD''' | ||
|X | |X | ||
|- | |- | ||
| | |'''$AE''' | ||
|Y | |Y | ||
|- | |- | ||
| | |'''$AF''' | ||
|I | |I | ||
|- | |- | ||
| | |'''$B1''' | ||
|blank^ | |blank^ | ||
|} | |} | ||
^This code is not the canon encoding of this character. ex. | ^This code is not the canon encoding of this character. ex. '''AF''' is the proper "I". 08 is not. | ||
Revision as of 20:35, 26 March 2020
Overview
This document is intended to be an SRAM reference for the randomizer base ROM. The base ROM expands the SRAM size to 32k and removes the last two save files. Credit to MathOnNapkins, the editors of the vanilla ALttP wiki, and the randomizer ROM developers who have documented nearly all of this information elsewhere.
Checksum
The SRAM save loading routing relies upon an "inverse" checksum. Changes to any byte in the SRAM between $00 and $4FE must be added or subtracted to this checksum or the save file will be deleted. The checksum can be computed by adding every word between the beginning of the file and $4FE and subtracting the sum from 0x5A5A, using overflowing arithmetic for both operations.
SRAM Map
$000 to $24F - Room Data
There are 296 ($128) rooms in in the ROM. Each room's data occupies one word, or two bytes.
High Byte d d d d b k c/k c/r
Low Byte c c c c q q q q
- c - chest, big key chest, or big key lock. Any combination of them totaling to 6 is valid.
- q - quadrants visited:
- k - key or item (such as a 300 rupee gift)
- d - door opened (either unlocked, bombed or other means)
- r - special rupee tiles, whether they've been obtained or not.
- b - boss battle won
The quadrant bits corresponds to quadrants 4, 3, 2, and 1 in that order which is also how the quadrants are laid out on a tile from left to right (upper left, upper right, lower left, lower right), so if quadrants 4 and 1 have been "seen" by Link, then qqqq will look like 1001.
$250 to $27F - Unused
$280 to $2FF - Overworld Event Information
Each area occupies one byte.
? h o ? ? ? s ?
- o - If set, the area will draw its designated overlay when you enter it. e.g. If you're triggered misery mire then the entrance shows up there the next time you enter that area. You can view overlays in the latest release of Hyrule Magic (v0.963). Other overlays include stairs leading underground, and the removal of the weather vane after it has exploded.
- s - If set, the area will draw its secondary overlay when you enter it.
- h - If set, heart piece has been collected in this area already. Also used for a handful of other sprites.
- ? - Unknown, possibly unused.
$300 to $33F - Shop Purchase Counts
The randomizer ROM uses new shop code to handle loading and configuration of shops which allows the higher-level item and entrance randomizers to use clean, convenient abstractions for changing them. Through these abstractions, the randomizer can dictate a certain number of times that a shop item can be re-purchased (e.g. you can only buy capacity upgrades seven times.) The bytes here (except for $300 which is currently unknown) are used to count how many times a single item in a shop has been purchased. They are dynamically assigned at generation time, which is to say that any single byte should not be considered statically bound to a certain item in a shop. Take-Any caves as well as the old man with the sword in Retro world state are considered shops in this context.
Note 1: This is noted as a "temporary home" for the shop purchase counts in the base rom's source code
Note 2: Jumping into deep water without flippers and being placed back on land on the Hobo and Zora's Domain maps are known to overwrite $302 and $304 respectively. This has no effect if a shop item can always be repurchased, but will lead to unintended behavior if the item can only be purchased a limited amount of times.
$340 to $38B - Items & Equipment
Address | Item | Values | Notes | ||||
---|---|---|---|---|---|---|---|
$340 | Bow | 0 - Nothing | 1 - Bow | 2 - Bow & Arrows | 3 - Silver Arrow Bow | 4 - Bow & Silver Arrows | |
$341 | Boomerang | 0 - Nothing | 1 - Blue Boomerang | 2 - Red Boomerang | |||
$342 | Hookshot | 0 - Nothing | 1 - Hookshot | ||||
$343 | How many bombs you have | Can exceed 0x32 (50), up to 0xFF (255). | |||||
$344 | Magic Powder | 0 - Nothing | 1 - Mushroom | 2 - Magic Powder | |||
$345 | Fire Rod | 0 - Nothing | 1 - Fire Rod | ||||
$346 | Ice Rod | 0 - Nothing | 1 - Ice Rod | ||||
$347 | Bombos Medallion | 0 - Nothing | 1 - Bombos Medallion | ||||
$348 | Ether Medallion | 0 - Nothing | 1 - Ether Medallion | ||||
$349 | Quake Medallion | 0 - Nothing | 1 - Quake Medallion | ||||
$34A | Lamp | 0 - Nothing | 1 - Lamp | ||||
$34B | Magic Hammer | 0 - Nothing | 1 - Magic Hammer | ||||
$34C | Flute | 0 - Nothing | 1 - Shovel | 2 - Flute | 3 - Flute & Bird | ||
$34D | Bug Catching Net | 0 - Nothing | 1 - Bug Catching Net | ||||
$34E | Book of Mudora | 0 - Nothing | 1 - Book of Mudora | ||||
$34F | Bottles | 0 - Nothing | 1 - Bottle 1 ($7EF35C) | 2 - Bottle 2 ($7EF35D) | 3 - Bottle 3 ($7EF35E) | 4 - Bottle 4 ($7EF35F) | |
$350 | Cane of Somaria | 0 - Nothing | 1 - Cane of Somaria | ||||
$351 | Cane of Byrna | 0 - Nothing | 1 - Cane of Byrna | ||||
$352 | Magic Cape | 0 - Nothing | 1 - Magic Cape | ||||
$353 | Magic Mirror | 0 - Nothing | 1 - Magic Scroll | 2 - Magic Mirror | |||
$354 | Gloves | 0 - Nothing | 1 - Power Glove | 2 - Titan's Mitt | |||
$355 | Pegasus Boots | 0 - Nothing | 1 - Pegasus Boots | See $379. | |||
$356 | Zora's Flippers | 0 - Nothing | 1 - Zora's Flippers | See $379. | |||
$357 | Moon Pearl | 0 - Nothing | 1 - Moon Pearl | ||||
$358 | Unused | ||||||
$359 | Sword | 0 - No sword | 1 - Fighter's Sword | 2 - Master Sword | 3 - Tempered Sword | 4 - Golden Sword | |
$35A | Shield | 0 - No shield | 1 - Blue Shield | 2 - Hero's Shield | 3 - Mirror Shield | ||
$35B | Armor | 0 - Green Mail | 1 - Blue Mail | 2 - Red Mail | |||
$35C to $35F | Bottle Contents | 0 - No bottle | 1 - Mushroom | 2 - Empty bottle | 3 - Red Potion | 4 - Green Potion | |
5 - Blue Potion | 6 - Fairy | 7 - Bee | 8 - Good Bee | ||||
$360 to $361 | Wallet Capacity | ||||||
$362 to $363 | Rupee Count |
Item | Address | Bit 0 | Bit 1 | Bit 2 | Bit 3 | Bit 4 | Bit 5 | Bit 6 | Bit 7 |
---|---|---|---|---|---|---|---|---|---|
Compass1 | $364 | Unused | Unused | Ganon's Tower | Turtle Rock | Gargoyle's domain | Tower of Hera | Ice Palace | Skull Woods. |
BigKey1 | $366 | ||||||||
Dungeon map1 | $368 | ||||||||
Compass2 | $365 | Misery Mire. | Dark Palace | Swamp Palace | Hyrule Castle 2 | Desert Palace | Eastern Palace | Hyrule Castle | Sewer Passage |
BigKey2 | $367 | ||||||||
Dungeon map2 | $369 |
Wishing Pond Rupee $36A
- Unused
Heart pieces collected:
- $36B. Number of heart pieces (out of four) you have earned
Health: $36C
- Health Capacity. Each increment of $08}} is worth one heart.
- $04 is a half heart. The max is generally $A0. The game is coded to not accept health values beyond this.
- $36D. Actual Health. Same as above, but this reflects your current health status rather than potential.
Magic Power: $36E
- Magic power ranges from $0 to $80 (128). Each small bottle refills $10. Setting Magic above $80 causes the magic meter to glitch and you can't use special items.
Keys: $36F
- Number of Keys you have in the dungeon you are currently in. If you're in a non-keyed dungeon it will generally read $FF.
Bomb Upgrades: $370
- Number of bombs you can hold above the default value (10).
Arrow Upgrades: $371
- Number of arrows you can hold above the default value (30)
Hearts filler: $372
- Write to this location to fill in a set number of hearts. Make sure to write in a multiple of $08 Otherwise, you will end up filling the whole life meter.
Magic filler: $373
- Write to this location how much magic power you want filled up. The maximum effective value is $80.
Pendants: $374
- Bit 0: Red Pendant
- Bit 1: Blue Blue Pendant
- Bit 2: Green Green Pendant
Bomb filler: $375
- Write to this location to add X bombs to your arsenal. It will not exceed your maximum, as defined with $370.
Arrow filler: $376
- Write to this location to add X arrows to your arsenal. It will not exceed your maximum, as defined with $371.
Arrows: $377
????: $378
- ????
Ability Flags: $379
- Bit 0:
- Bit 1: Swim
- Bit 2: Run / Dash
- Bit 3: Pull
- Bit 4: ----
- Bit 5: Talk
- Bit 6: Read
- Bit 7: ----
Crystals: $37A
- Bit 0: Crystal 6
- Bit 1: Crystal 1
- Bit 2: Crystal 5
- Bit 3: Crystal 7
- Bit 4: Crystal 2
- Bit 5: Crystal 4
- Bit 6: Crystal 3
Magic Consumption: $$37B
- $0: Normal Consumption
- $1: 1/2 Consumption
- $2: 1/4 Consumption
Keys earned per dungeon: (TODO: confirm this and other keys-related values for rando)
- $37C = Sewer Passage
- $37D = Hyrule Castle
- $37E = Eastern Palace
- $37F = Desert Palace
- $380 = Hyrule Castle 2
- $381 = Swamp Palace
- $382 = Dark Palace
- $383 = Misery Mire
- $384 = Skull Woods
- $385 = Ice Palace
- $386 = Tower of Hera
- $387 = Gargoyle's Domain
- $388 = Turtle Rock
- $389 = Ganon's Tower
- $38A = Unused
- $38B = Unused
Game Event Information
Progress Indicator $3C5: (TODO: Check these for rando)
- $0 = Unset, Will put Link in his bed state at the beginning of the game. (Also can't use sword or shield)
- $1 = You have a sword and start in the castle on start up.
- $2 = Indicates you have completed the first Hyrule Castle dungeon.
- $3 = Indicates you have beaten Agahnim and are now searching for crystals.
- $4 and above = meaningless. Though, you could write code using them to expand the event system perhaps.
Progress Flags $3C6 (bitflags):
- Progress flags in the vanilla game. Usually set to $18 or $20 in randomizer.
Map Icons Indicator 2 $3C7:
- Presumed to be unused in randomizer.
Starting Entrance to use: $3C8: Abbreviations:
- LH = Link's House;
- SA = Sanctuary;
- MC = Mountain Cave;
- PP = Pyramid of Power in DW;
- 0 = Start the game in Link's house always.
- 1 = SA.
- 2 = Start in Zelda's Cell (entrance index sanc?).
- 3 = Secret passage under HC garden (near dying uncle).
- 5 = LH or SA or MC.
Progress Indicator 3 (bitwise) $3C9}}:
- 0 = If set, means the bum gave you his bottle already.
- 1 = If set, means that the salesman in the village sold you a bottle already
- 2 =
- 3 = Flute Boy (DW) has been arborated
- 4 = Thief's Chest has been opened by the middle aged guy
- 5 = After you save the Smithy's partner, this bit gets set.
- 6
- 7 = Means Smithies have your sword. Once they give it back it's no longer set. (so nonpermanent)
Lightworld / Darkworld $3CA:
- 0
- 1
- 2
- 3
- 4
- 5
- 6 = If set, we're in dark world. Otherwise, in light world.
- 7
Unused? $3CB:
- ?????
$3CC[0x01] - (Tagalong)
- Tagalong Indicator (who is following you, if anyone?) (value based)
Note: Don't use a value of Template:0x or larger here, as it will likely crash the game.
- 0x00 = Tagalong disabled
- 0x01 = Princess Zelda
- 0x02 = ???
- 0x03 = ???
- 0x04 = Old Man?
- 0x05 = Zelda (invisible) bitching at you about coming to rescue her.
- 0x06 = Blind masquerading as a Maiden
- 0x07 = Missing Dwarf (smithyfrog as I call him) in DW
- 0x08 = Missing Dwarf in LW
- 0x09 = Middle Aged Guy w/ Sign
- 0x0A = Kiki the monkey
- 0x0B = ???
- 0x0C = Thief's chest
- 0x0D = Super Bomb
- 0x0E = Activated in reaction to acquiring the Master Sword. Used to trigger a telepathic message from Zelda indicating that Agahnim's goons have come for her at Sanctuary.
$03CD[0x02] -
- Cached Y coordinate of Tagalong after it has been lost by the player. Applies to the old man and to the super bomb, at the very least. This is intended to be used not as a save game variable, but rather as a means of picking the Tagalong back up by getting in contact with it.
$03CF[0x02] -
- Cached X coordinate of Tagalong after it has been lost by the player. Applies to the old man and to the super bomb, at the very least. This is intended to be used not as a save game variable, but rather as a means of picking the Tagalong back up by getting in contact with it.
$3D1:
- ????
$3D2:
$3D3:
- Set to 0 normally. Set to $80 if a Super Bomb is going off.
$3D4 to $3D8:
- ????
Player's Name $3D9}} to $3E4}}:
- See appendix for listing of character codes. Note each of the six letters is represented by a 16-bit number.
Validity (Checksum) of the File: $3E5 to $3E6:
- There is a subroutine in the ROM that checks to make sure this word value is 0x55AA. If changed, the save file will be deleted when the game boots.
$3E7 to $402 (?) = Deaths totals for each dungeon. Each number is 16 bit. Thanks to Euclid for helping verify this!
- $3E7 = Sewers
- $3E9 = Hyrule Castle
- $3EB = Eastern Palace
- $3ED = Desert Palace
- $3EF = Hyrule Castle 2
- $3F1 = Swamp Palace
- $3F3 = Dark Palace
- $3F5 = Misery Mire
- $3F7 = Skull Woods
- $3F9 = Ice Palace
- $3FB = Tower of Hera
- $3FD = Gargoyle's Domain
- $3FF = Turtle Rock
- $401 = Ganon's Tower
Life/Save Counter: $403}} to $404
- Counts the number of times your saved or died in the game, before you beat it.
PostGame Death Counter: $405 to $406
- When you start the game this is written to with the value -1 (Template:0x). On the game select screen, it will only display a number if this is not Template:0x. The max displayable number is 999.
When you beat the game, the number of times you died gets recorded here.
Presumed to be unused: $407 to $4FD
- ????
Inverse Checksum: $4FE to $4FF
TODO: These character values are very different in JP1.0
Character Codes:
Alpha-numeric
00 = A 01 = B 02 = C 03 = D 04 = E 05 = F 06 = G 07 = H 08 = I^ 09 = J 0A = K 0B = L 0C = M 0D = N OE = O OF = P 10 = ?? 20 = Q 21 = R 22 = S 23 = T 24 = U 25 = V 26 = W 27 = X 28 = Y 29 = Z |
2A = a 2B = b 2C = c 2D = d 2E = e 2F = f 40 = g 41 = h 42 = k 43 = j 44 = i 45 = l 46 = m 47 = n 48 = o 49 = p 4A = q 4B = r 4C = s 4D = t 4E = u 4F = v 60 = w 61 = x 62 = y 63 = z |
64 = 0 65 = 1 66 = 2 67 = 3 68 = 4 69 = 5 6A = 6 6B = 7 6C = 8 6D = 9 6E = "?" 6F = "!" 80 = " = " 81 = "." 82 = "," 85 = "(" 86 = ")" |
Special characters (not normally accessible. This is by far an incomplete listing)
$A0 | small right Arrow |
$A1 | "'" (apostrophe) |
$A2 | HPiece Again |
$A3 | "empty right hand heart cont." |
$A4 | see |
$A7 | |
$A5 | Same As |
$A7 | |
$A6 | "Quarter Heart piece, top right corner." |
$A7 | "Heart piece,left half" |
$A8 | "Heart piece, right half" |
$A9 | blank |
$AA | "left Arrow" |
SNES Button Alphabet:
$AB | A |
$AC | B |
$AD | X |
$AE | Y |
$AF | I |
$B1 | blank^ |
^This code is not the canon encoding of this character. ex. AF is the proper "I". 08 is not.