Metroid/Item data format: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{game=Metroid}}
{{Infobox table|name=Item data format
{{Infobox table|name=Item data format
|game=Metroid
|game=Metroid

Revision as of 20:41, 9 September 2007

Template:Game=Metroid

Item data format
Game Metroid
Start Address Varies by bank. See ROM Map
End Address Varies by bank. See ROM Map
# of Entries Varies by bank. See ROM Map
Entry Length Varies.
Total Length Varies. See ROM Map
Back to the ROM map

The following describes the format of the data for items in the Metroid ROM. Some aspects of the game's behavior in regards to items (for example, how items work with passwords) may not be documented here.

There are five sets of entries: one for each level. Each entry can contain multiple items. All items in a single entry will appear in a single horizontal row of the map.

Entry Format

The following is the binary format for a single item data entry. Each pair of letters represents a byte, where the first letter represents the high nibble and the second letter represents the low nibble. Each entry can contain multiple items. The brackets indicate data that may or may not be present, depending on the types of objects represented and the number of items defined in the entry.

YY BB AA XX CC FT [II [yx]] 00 [ XX CC FT [II [yx]] 00 [XX CC FT [II [yx]] 00 [...]]]
  • XX: Map X coordinate for single item.
  • YY: Map Y coordinate for all items in this entry.
  • AA BB: Memory address (RAM) of next item data entry.
  • CC: Size of a "screen entry" (see Terminator below), or bytes between CC value for this item and that of the next item. A value of 0xFF indicates that this is the last item in the entry.
  • F: "Sprite Slot" value for enemy data. Disregarded for item data.
  • T: Item type (see below).
  • II: Power-up type (see below) or elevator destination. This data is not present for palette switches.
  • x: Screen x coordinate. Not present for palette switches or elevators.
  • y: Screen y coordinate. Not present for palette switches or elevators.
  • 00: Terminator. Always has a value of zero. Indicates end of data for an item.

The first three bytes (YY BB AA) are defined once per row of items. The remaining data (XX CC FT II yx 00) is repeated for each item. The II and yx values may not necessarily be present, depending on what type of item is being defined. There are some interesting things to note about item data, though they may not be necessary or relevant to ROM hacking.

The FT II yx data is the same exact format as used in Room data (see Room Format) for enemies (and is interpreted by the same exact program code). It is entirely possible to add items to a room in that room's enemy data, and even add enemies into the level's item data. Apparently, however, the programmers saw fit to make item data independent from room data, which allows the same screen to appear with different items or without items at all.

It would also probably be possible to place multiple items in the same room (see Terminator below).

Map Coordinates (YY, XX)

The y-coordinate is specified only once and applies to all items in the entry, hence all items in an entry must appear in the same row of the map. The x-coordinate is specified for each item.

Memory Address (AA BB)

This value specifies the memory address for the next item data entry. The memory address specified is a RAM address, which is offset from the ROM address. See Pointer Format. A value of 0xFFFF indicates that this is the last entry for the level.

Special Items

Special items, such as elevators and palette switches, have less data. Elevators are missing the last byte of data (screen coordinates). Palette swaps are missing the last two bytes (type and screen coordinates). There may be other special object types.

Item Types (T)

This specifies what type of object the data represents. The following are known possibilities. Other values are unknown or undefined. Hexadecimal values are used.

  • 0: Nothing
  • 1: Enemy
  • 2: Power-up
  • 4: Elevator
  • 6: Tourain Access Bridge
  • 7: Respawning Enemy
  • A: Palette Switch

Power-up Type (II)

This specifies what item the data represents. Values marked "Nothing" don't seem to manifest in the game. Values in parentheses aren't used in the game. Hexadecimal values are used.

  • 0: Maru Mari Bombs
  • 1: High Jump Boots
  • 2: Long Beam
  • 3: Screw Attack
  • 4: Maru Mari
  • 5: Varia
  • 6: Wave Beam
  • 7: Ice Beam
  • 8: Energy Tank
  • 9: Missile
  • A: (Dot Missile)
  • B: (Arrow Missile)
  • C: (Nothing)
  • D: (Nothing)
  • E: (Nothing)
  • F: (nothing)

Terminator (00)

This byte has a value of zero and must be present for the Metroid game program to run properly. It is probably possible to add data for a second item (or more) that will appear in the same screen by providing more FT II yx entries preceding the 00 terminator. In light of this understanding, it might be more appropriate to think of the data XX CC FT II yx, where the last three bytes can be repeated, as a screen entry rather than a simple item entry.

Examples

Long Beam/Bombs

The following defines the long beam and bombs from Brinstar.

YY BB AA   XX CC FT II yx 00   XX CC FT II yx 00
05 02 A4   07 06 02 02 37 00   19 FF 02 00 37 00
  • 05: Map Y position is 5
  • 02 A4: RAM address of next entry is A402.
  • 07: Map X position is 7
  • 06: Six bytes until next CC value.
  • 02: Object type 2: Power-up.
  • 02: Power-up type 2: Long beam.
  • 37: Screen position is three down and seven over.
  • 00: End of this item's data.
  • 19: Map X position for second item is 19 (hex).
  • FF: This is the last item in the entry.
  • 02: Object type 2: Item.
  • 00: Item type 2: Bombs.
  • 37: Screen position is three down and seven over.
  • 00: End of this item's data.

Elevator

The following data defines the elevator to Kraid's hideout from Brinstar.

YY BB AA   XX CC FT II 00
12 FF FF   07 FF 04 02 00
  • 12: Map Y position is 12 (hex).
  • FFFF: This is the last entry for Brinstar item data.
  • 07: Map X position is 7.
  • FF: This is the last item in this entry.
  • 04: Object type 4: Elevator.
  • 02: Destination is level 2: Kraid's hideout.
  • 00: The end.


See Also