Difference between revisions of "G-Mode Save Station"

From A complete guide to Super Metroid speedrunning
Jump to: navigation, search
(Relevant Locations)
Line 5: Line 5:
 
The game stores lists for each PLM, located in bank $84, of pointers to functions, and arguments for those functions. These are called instruction lists. There is a section of RAM from $1D27 through $1D76 where the game loads these pointers for running functions related to processing PLMs. For the save station, the pointer is loaded into $1D75 (probably because the game starts at the top of this range and works downwards. Since save rooms have two PLMs that are processed when entering the room: first the door, and then the save station. TODO: fact check this). In G-Mode PLMs aren't processed, and when Samus steps on the save station, $1D75 starts increasing by $02 every other frame, starting with whatever PLM instruction the game was last trying to execute. When entering a save room, $1D75 will contain $AFEC, which is the sleep instruction.
 
The game stores lists for each PLM, located in bank $84, of pointers to functions, and arguments for those functions. These are called instruction lists. There is a section of RAM from $1D27 through $1D76 where the game loads these pointers for running functions related to processing PLMs. For the save station, the pointer is loaded into $1D75 (probably because the game starts at the top of this range and works downwards. Since save rooms have two PLMs that are processed when entering the room: first the door, and then the save station. TODO: fact check this). In G-Mode PLMs aren't processed, and when Samus steps on the save station, $1D75 starts increasing by $02 every other frame, starting with whatever PLM instruction the game was last trying to execute. When entering a save room, $1D75 will contain $AFEC, which is the sleep instruction.
  
When X-Ray is activated, and G-Mode left, the game will look at whatever value is in $1D75, and interpret those two bytes as a location in bank $84. This means for items, you'll need to stop on a correct byte in order to be granted the item. Every item in the game has three variants: normal, hidden, and in a chozo orb, and either of these will work for obtaining the item. However, they are so far apart in the ROM that it is irrelevant. Therefore, using the one that appears first in the ROM (the normal, not hidden or orb variant) makes the most sense, since the game will either crash or do something else unexpected if X-Ray is not pressed in the two-frame window.
+
When X-Ray is activated, and G-Mode left, the game will look at whatever value is in $1D75, and interpret those two bytes as a location of a pointer in bank $84. This means for items, you'll need to stop on a correct byte in order to be granted the item. Every item in the game has three variants: normal, hidden, and in a chozo orb, and either of these will work for obtaining the item. However, they are so far apart in the ROM that it is irrelevant. Therefore, using the one that appears first in the ROM (the normal, not hidden or orb variant) makes the most sense, since the game will either crash or do something else unexpected if X-Ray is not pressed in the two-frame window.
  
 
It is also possible to spawn energy refill and map stations (though unusable as they will spawn too close to the floor, on the left tile of the bottom of the save station), Samus Eaters (Vileplumes), shot blocks, door caps, and basically any other PLM. It is also possible to execute a lot of other code, with mostly unknown or undocumented results (or most likely, a crash).
 
It is also possible to spawn energy refill and map stations (though unusable as they will spawn too close to the floor, on the left tile of the bottom of the save station), Samus Eaters (Vileplumes), shot blocks, door caps, and basically any other PLM. It is also possible to execute a lot of other code, with mostly unknown or undocumented results (or most likely, a crash).

Revision as of 03:09, 3 April 2023

During G-Mode, the game behaves in some ways as though X-ray scope were still active. The most noticeable are that the game does not process PLMs or projectiles. Stepping on a save station in G-Mode, and subsequently activating X-Ray to leave G-Mode, can execute a wide amount of code, most often crashing the game if done blindly, but can grant Samus any item in the game. This is used in the Glitched RBO world record route to obtain Gravity Suit.

Functioning

The game stores lists for each PLM, located in bank $84, of pointers to functions, and arguments for those functions. These are called instruction lists. There is a section of RAM from $1D27 through $1D76 where the game loads these pointers for running functions related to processing PLMs. For the save station, the pointer is loaded into $1D75 (probably because the game starts at the top of this range and works downwards. Since save rooms have two PLMs that are processed when entering the room: first the door, and then the save station. TODO: fact check this). In G-Mode PLMs aren't processed, and when Samus steps on the save station, $1D75 starts increasing by $02 every other frame, starting with whatever PLM instruction the game was last trying to execute. When entering a save room, $1D75 will contain $AFEC, which is the sleep instruction.

When X-Ray is activated, and G-Mode left, the game will look at whatever value is in $1D75, and interpret those two bytes as a location of a pointer in bank $84. This means for items, you'll need to stop on a correct byte in order to be granted the item. Every item in the game has three variants: normal, hidden, and in a chozo orb, and either of these will work for obtaining the item. However, they are so far apart in the ROM that it is irrelevant. Therefore, using the one that appears first in the ROM (the normal, not hidden or orb variant) makes the most sense, since the game will either crash or do something else unexpected if X-Ray is not pressed in the two-frame window.

It is also possible to spawn energy refill and map stations (though unusable as they will spawn too close to the floor, on the left tile of the bottom of the save station), Samus Eaters (Vileplumes), shot blocks, door caps, and basically any other PLM. It is also possible to execute a lot of other code, with mostly unknown or undocumented results (or most likely, a crash).

Relevant Locations

$1D27 through $1D75 in RAM, though $1D75 seems to be the relevant address.

Bank $84 instruction list locations for individual items. Note that the value shown at left is not the correct pointer address to watch for in RAM but the start of the list, nor is the PLM ID number shown at right. The pointer to collect the item is near the end of each list and is $88F3 (pointer to the function $8488F3, which collects the item and displays the message box), followed by two bytes for the equipment value, and one byte for the message box number.

   ;;; $E099: Instruction list - PLM $EED7 (energy tank) ;;;
   ;;; $E0BE: Instruction list - PLM $EEDB (missile tank) ;;;
   ;;; $E0E3: Instruction list - PLM $EEDF (super missile tank) ;;;
   ;;; $E108: Instruction list - PLM $EEE3 (power bomb tank) ;;;
   ;;; $E12D: Instruction list - PLM $EEE7 (bombs) ;;;
   ;;; $E15B: Instruction list - PLM $EEEB (charge beam) ;;;
   ;;; $E189: Instruction list - PLM $EEEF (ice beam) ;;;
   ;;; $E1B7: Instruction list - PLM $EEF3 (hi-jump) ;;;
   ;;; $E1E5: Instruction list - PLM $EEF7 (speed booster) ;;;
   ;;; $E213: Instruction list - PLM $EEFB (wave beam) ;;;
   ;;; $E241: Instruction list - PLM $EEFF (spazer beam) ;;;
   ;;; $E26F: Instruction list - PLM $EF03 (spring ball) ;;;
   ;;; $E29D: Instruction - clear charge beam counter ;;;
   ;;; $E2A1: Instruction list - PLM $EF07 (varia suit) ;;;
   ;;; $E2D6: Instruction list - PLM $EF0B (gravity suit) ;;;
   ;;; $E30B: Instruction list - PLM $EF0F (x-ray scope) ;;;
   ;;; $E338: Instruction list - PLM $EF13 (plasma beam) ;;;
   ;;; $E366: Instruction list - PLM $EF17 (grapple beam) ;;;
   ;;; $E393: Instruction list - PLM $EF1B (space jump) ;;;
   ;;; $E3C1: Instruction list - PLM $EF1F (screw attack) ;;;
   ;;; $E3EF: Instruction list - PLM $EF23 (morph ball) ;;;
   ;;; $E41D: Instruction list - PLM $EF27 (reserve tank) ;;;
   ;;; $E44A: Instruction list - PLM $EF2B (energy tank, chozo orb) ;;;
   ;;; $E47C: Instruction list - PLM $EF2F (missile tank, chozo orb) ;;;
   ;;; $E4AE: Instruction list - PLM $EF33 (super missile tank, chozo orb) ;;;
   ;;; $E4E0: Instruction list - PLM $EF37 (power bomb tank, chozo orb) ;;;
   ;;; $E512: Instruction list - PLM $EF3B (bombs, chozo orb) ;;;
   ;;; $E54D: Instruction list - PLM $EF3F (charge beam, chozo orb) ;;;
   ;;; $E588: Instruction list - PLM $EF43 (ice beam, chozo orb) ;;;
   ;;; $E5C3: Instruction list - PLM $EF47 (hi-jump, chozo orb) ;;;
   ;;; $E5FE: Instruction list - PLM $EF4B (speed booster, chozo orb) ;;;
   ;;; $E63B: Instruction - FX Y velocity = FFE0h ;;;
   ;;; $E642: Instruction list - PLM $EF4F (wave beam, chozo orb) ;;;
   ;;; $E67D: Instruction list - PLM $EF53 (spazer beam, chozo orb) ;;;
   ;;; $E6B8: Instruction list - PLM $EF57 (spring ball, chozo orb) ;;;
   ;;; $E6F3: Instruction list - PLM $EF5B (varia suit, chozo orb) ;;;
   ;;; $E735: Instruction list - PLM $EF5F (gravity suit, chozo orb) ;;;
   ;;; $E777: Instruction list - PLM $EF63 (x-ray scope, chozo orb) ;;;
   ;;; $E7B1: Instruction list - PLM $EF67 (plasma beam, chozo orb) ;;;
   ;;; $E7EC: Instruction list - PLM $EF6B (grapple beam, chozo orb) ;;;
   ;;; $E826: Instruction list - PLM $EF6F (space jump, chozo orb) ;;;
   ;;; $E861: Instruction list - PLM $EF73 (screw attack, chozo orb) ;;;
   ;;; $E89C: Instruction list - PLM $EF77 (morph ball, chozo orb) ;;;
   ;;; $E8D7: Instruction list - PLM $EF7B (reserve tank, chozo orb) ;;;
   ;;; $E911: Instruction list - PLM $EF7F (energy tank, shot block) ;;;
   ;;; $E949: Instruction list - PLM $EF83 (missile tank, shot block) ;;;
   ;;; $E981: Instruction list - PLM $EF87 (super missile tank, shot block) ;;;
   ;;; $E9B9: Instruction list - PLM $EF8B (power bomb tank, shot block) ;;;
   ;;; $E9F1: Instruction list - PLM $EF8F (bombs, shot block) ;;;
   ;;; $EA32: Instruction list - PLM $EF93 (charge beam, shot block) ;;;
   ;;; $EA73: Instruction list - PLM $EF97 (ice beam, shot block) ;;;
   ;;; $EAB4: Instruction list - PLM $EF9B (hi-jump, shot block) ;;;
   ;;; $EAF5: Instruction list - PLM $EF9F (speed booster, shot block) ;;;
   ;;; $EB36: Instruction list - PLM $EFA3 (wave beam, shot block) ;;;
   ;;; $EB77: Instruction list - PLM $EFA7 (spazer beam, shot block) ;;;
   ;;; $EBB8: Instruction list - PLM $EFAB (spring ball, shot block) ;;;
   ;;; $EBF9: Instruction list - PLM $EFAF (varia suit, shot block) ;;;
   ;;; $EC41: Instruction list - PLM $EFB3 (gravity suit, shot block) ;;;
   ;;; $EC89: Instruction list - PLM $EFB7 (x-ray scope, shot block) ;;;
   ;;; $ECC9: Instruction list - PLM $EFBB (plasma beam, shot block) ;;;
   ;;; $ED0A: Instruction list - PLM $EFBF (grapple beam, shot block) ;;;
   ;;; $ED4A: Instruction list - PLM $EFC3 (space jump, shot block) ;;;
   ;;; $ED8B: Instruction list - PLM $EFC7 (screw attack, shot block) ;;;
   ;;; $EDCC: Instruction list - PLM $EFCB (morph ball, shot block) ;;;
   ;;; $EE0D: Instruction list - PLM $EFCF (reserve tank, shot block) ;;;

TODO: put the correct pointer value for each list here