Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.

Metroid/Pointer format

From Data Crystal
< Metroid(Redirected from Metroid:Pointer format)
Jump to navigation Jump to search

This is a sub-page of Metroid.

Room data formats
Game Metroid
Start Address Varies by bank. See RAM Map
End Address Varies by bank. See ROM Map
# of Entries Varies with pointer data.
Entry Length 2 bytes.
Total Length Varies by bank. See ROM Map
Back to the ROM map

The information contained herein serves as a guide to the specific detailed inner workings of the ROM addresses for Metroid in regards to the data that the game uses for it's various pointers which it uses to tell itself where in the game's ROM to look for certain types of data. Metroid's system of pointers is, fortunately for ROM hackers, pretty straightforward and simple, and is used in the same manner for all data the game needs to retrieve, be that for levels, object definitions, etc. There are, however, a few minor differences from other games indicated below which need to be taken into account. The data contained herein is to be used in conjunction with Metroid's ROM Map and serves as an overall guide and reference.

Pointer Format

DE BC
  • DE: Fourth (D) and fifth (E) digits of ROM address value where data is located, after calculations.
  • BC: Second (B) and third (C) digits of ROM address value where data is located, after calulations.
  • X: A separate value to be added/subtracted to/from BC and DE to get the required pointer values. See "The X Files!" section...

Basic Explanation Of Format

  • A standard Metroid ROM in .NES format with the required sixteen-byte header used by emulators contains addresses between 00000 and 2000F, a five digit figure in hexadecimal which, for the purposes of this explanation, shall be represented by ABCDE. Finding the correct pointer table values for data located at whatever address ABCDE indicates is as simple as dropping the "A" digit (BCDE), adding/subtracting the value indicated by X (in HEXADECIMAL!) to/from the overall value of BCDE, splitting the four remaining digits containing the new value into two bytes (BC DE), and flinally flipping these bytes around (DE BC), which matches the above format. One would then locate the two-byte pointer table for the data that they were attemping to access from that location and input the values of DE and BC into those bytes.


The "X" Files!

  • Metroid's own pointer tables work a little bit differently than standard pointer tables in other games, as the values that one must add/subtract from BCDE are different depending on the bank and the data to be retrieved. These values are represented by "X" in the "Pointer Format" section. Fortunately, the known values to plug into "X" for any given cache of data and whether to add/subtract these values have been provided below, removing the guesswork Adding/subtracting the value of X to/from BCDE will eventually provide the correct values to use in the pointer. All values provided below are in hexadecimal, with decimal equivalents in parenthesis for reference, and assume that the data to be retrieved is in the same general overall area allocated for that data (Rooms, structures, tiles, etc.).

These values account for (A) the fact that data is banked into RAM at $8000, (B) the 16-byte ROM header, and (C) the ROM bank the data is contained in.

Room Data X Values

  • Brinstar Room Data: Add 3FF0 in hex. (16368)
  • Norfair Room Data: Subtract 10 in hex. (16)
  • Tourian Room Data: Subtract 4010 in hex. (16400)
  • Kraid Room Data: Add 7FF0 in hex. (32752)
  • Ridley Room Data: Add 3FF0 in hex. (16368)


Step By Step Instructions

  • ABCDE equals the five digits of an address where the data is located.
  • Drop the fifth "A" digit on the left, if it is present (so that ABCDE becomes BCDE).
  • Add/subtract the correct value of X in hexadecimal to/from the value of BCDE.
  • Split the new value of BCDE into two separate bytes (BC DE).
  • Flip the values around (DE BC).
  • Input the values of DE and BC into the 2 bytes of the selected pointer table.


Examples

  • Let's say that one wished to make a change in the pointer tables of Metroid so that the information that the area of Kraid uses to create Room 00 is not pulled from the information allocated specifically for Room 00 (located at 122C7) but is instead pulled from the data allocated for Kraid's last room (located at 12A43). Looking up the pointer table values for Kraid's Room 00 (located at 121E5 and 121E6), one would find that these contain the values B7 A2, as Room 00's pointer "points" to address 122C7. In order to force Room 00 of Kraid to read the information located at 12A43 instead, we would do the following:
  • ABCDE equals the respective digits of the required address, 124A3.
  • Drop the fifth "A" digit on the left, so that 12A43 becomes 2A43.
  • Add 7FF0 (The value of X for Kraid's Room Data) in hexadecimal to 2A43, so that 2A43 becomes AA33.
  • Split the value AA33 into two separate bytes (AA 33).
  • Flip the values around (33 AA).
  • Input the values of 33 and AA into locations 121E5 and 121E6, respectively.
And there you have it! Each and every time the game accesses Room 00 on it's internal map, the new room will show up. It will also work this way when one attempts to view/edit Room 00 of Kraid in MetEdit.


See also