EarthBound/Map Tile Buffer: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
m (→‎Auxiliary Data: Fix stub tag)
(→‎Auxiliary Data: Finish documenting by filling out auxiliary data)
Line 21: Line 21:
==Auxiliary Data<span class="anchor" id="AuxiliaryData"></span>==
==Auxiliary Data<span class="anchor" id="AuxiliaryData"></span>==


{{stub}}
''Note: None of this coordinate data appears to ever be used in an unmodified EarthBound ROM.''
 
* <tt>$7E4390-$7E439F</tt>: For each buffer grid column (left-to-right), a one-byte map x tile coordinate of the left side of the last row loaded starting in that buffer grid column.
* <tt>$7E43A0-$7E43AF</tt>: For each buffer grid row (top-to-bottom), a one-byte map y tile coordinate of the last row loaded into that buffer grid row.
* <tt>$7E43B0-$7E43BF</tt>: For each buffer grid column (left-to-right), a one-byte map x tile coordinate of the last column loaded into that buffer grid column.
* <tt>$7E43C0-$7E43CF</tt>: For each buffer grid row (top-to-bottom), a one-byte map y tile coordinate of the top of the last column loaded starting in that buffer grid row.
 
[[Category:EarthBound|Map Tile Buffer]]
[[Category:EarthBound|Map Tile Buffer]]

Revision as of 15:47, 7 November 2023

This is a sub-page of EarthBound.

Map Tile Buffer
Game EarthBound
Start Address 0x00F000
End Address 0x00F1FF
# of Entries 256
Entry Length 2 bytes (0x02)
Total Length 512 bytes (0x0200)
Back to the RAM map

Buffer storing a wrapping grid of map tiles around the player location. Used to reference Tile Arrangement Chunks and Tileset Collision Data.

Format

Each entry represents a four-tile-by-four-tile chunk of map tiles. The value is an integer index into Decompressed Tile Arrangement Data and is also used to index into Tileset Collision Data. Entries representing a chunk off the "edge" of the map or from map sector with a tileset different from the current map tileset will always have the value #$0000.

The 2-byte entries are stored in a row-by-row 16x16 grid. The first row is 16 entries (32 bytes) in consecutive order, stored left-to-right, followed by the second row, etc. To index into the grid, map tile coordinates are divided by 4 (to account for representing four-tile-by-four-tile chunks) and modded by 16. Thus the offset for a specific entry can be found using the formula buffer_offset = tile_x / 4 % 16 * 2 + tile_y / 4 % 16 * 32.

Auxiliary Data

Note: None of this coordinate data appears to ever be used in an unmodified EarthBound ROM.

  • $7E4390-$7E439F: For each buffer grid column (left-to-right), a one-byte map x tile coordinate of the left side of the last row loaded starting in that buffer grid column.
  • $7E43A0-$7E43AF: For each buffer grid row (top-to-bottom), a one-byte map y tile coordinate of the last row loaded into that buffer grid row.
  • $7E43B0-$7E43BF: For each buffer grid column (left-to-right), a one-byte map x tile coordinate of the last column loaded into that buffer grid column.
  • $7E43C0-$7E43CF: For each buffer grid row (top-to-bottom), a one-byte map y tile coordinate of the top of the last column loaded starting in that buffer grid row.