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.

Super Mario Bros. 2 (NES)/Level Data

From Data Crystal
Jump to navigation Jump to search

This is a sub-page of Super Mario Bros. 2 (NES).

Level Data
Game Super Mario Bros. 2
Start Address 0x0101C9
End Address 0x012433
# of Entries ?
Entry Length variable
Total Length 0x00226b
Back to the ROM map

Explanation of Level Data

Level data in the game is made up of two different object types: normal and special. Normal objects includ clouds, hills, vines, etc. Special objects typically dictate how to draw terrain like the ground or caves. If the high nybble of the first byte of an object is F, then it is a special object, otherwise it's a normal object.

Normal objects are stored as two bytes. The first byte is the YX value (Y is the number of tiles down from the preceeding object and X is the number of tiles from the left edge of the page) and the second byte is the object type. For example, the bytes "13 2A" refer to an object type 2A which is located 1 tile down from the preceeding object (or top of the screen, if it's the first object) and 3 tiles from the left edge of the screen. If the first part of the first byte is an F (e.g. F0, F1, F2, ..., FF), then the byte represents a special object instead of the YX coordinate of a normal object.

Special objects are stored a little differently. The first byte is F? where ? is the special object number (0 thru F). Special objects can have 1, 2, or no parameters. The parameter bytes immediately follow the F? byte.

The next object after a door object acts as its pointer and does not show up in the game. This "door pointer" tells the game where the door leads. The next object after a door should always be a regular object, but the special object F5 is also allowed to be a door pointer.

Explanation of Parameters

Door Pointers

For objects acting as door pointers, the first parameter (YX coordinate) is what world you go to (0 = World 1, 1 = World 2, etc...), and the second parameter (object type) is what area in the world you go to. I don't know what happens if the first parameter is greater than the number of worlds in the game (ie. greater than 6 since we start counting Worlds as 0 being the first).

Special objects

  • F0 affects the ground setting (high, low, pits, etc.). It has one parameter. Different parameter values produce different terrain effects.
  • F1 affects the ground setting (high, low, pits, etc.). It has one parameter. Different parameter values produce different terrain effects.
  • F2 means the next object's X coordinate will be skipped forward one page. It has no parameters.
  • F3 means the next object's X coordinate will be skipped forward two pages. It has no parameters.
  • F4 means to start a new object layer. The next object will be placed as though it were the first object (i.e. it's YX coordinate byte's reference point will be the top left of the first page. It has no parameters.
  • F5 is an area pointer. It has two parameters. These parameters act the same way as door parameters do: the first says what world to go to and the second tells what area in the world to go to.
  • F6 affects the look of the ground (rock, sand, grass, etc.). It has one parameter that dictates which tiles to use to draw the ground.
  • F7 thru FE are unused(?)
  • FF has no parameters. It marks the end of data for the current level.