EarthBound/Gas Station Screen Graphics Data: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
(→‎Subentries: Identify decompressed lengths)
(→‎Decompressed Format: Document decompressed formats)
 
Line 26: Line 26:


===Decompressed Format===
===Decompressed Format===
====Tilemap Data====
Once decompressed, the tilemap data contains a single 32x32 tile [https://snes.nesdev.org/wiki/Tilemaps SNES tilemap], designating a static image covering the entire screen. 2-byte tile entries are arranged in rows, with 32 entries for the left-to-right tiles at the top of the screen, followed by the next row, etc.


{{stub}}
For each 2-byte tile entry:
 
<code>VH0000CCCCCCCCCC</code>
 
* <tt>V</tt> (bit <tt>0x8000</tt>): '''V'''ertical flip. If set, tile will be flipped vertically from how it is stored in tile character data. ''Not set for any tiles.''
* <tt>H</tt> (bit <tt>0x4000</tt>): '''H'''orizontal flip. If set, tile will be flipped horizontally from how it is stored in tile character data.
* <tt>0000</tt> (bit <tt>0x3C00</tt>): Would be the BG Priority Bit and Palette selection, but both are unusable for gas station screen graphics, making these bits always <code>0000</code>. BG Priority Bit is meaningless because only a single background layer is used (other than a subscreen used for combining the static animation via color math) and no sprites, so there is nothing to display the tile in front of or behind. The Palette selection must always be zero because the gas station screen uses [https://snes.nesdev.org/wiki/Backgrounds#Mode_3 Mode 3] background layer 1, in which tiles draw from all colors in CGRAM as a single large palette.
* <tt>CCCCCCCCCC</tt> (bits <tt>0x03FF</tt>): Tile '''c'''haracter selection. Character index into tile character data. ''Always between 0 and 611 (inclusive) for all tiles because unmodified EarthBound only uses 612 tile characters out of the available 768.''
 
====Tile Character Data====
Once decompressed, the tile character data contains up to 768 8-bits-per-pixel 8x8 [https://snes.nesdev.org/wiki/Tiles SNES graphics tiles], followed by a one-byte null terminator (<code>00</code>). Additionally, like with [[EarthBound/Map_Data/Compressed_Tileset_Character_Data#DecompressedFormat|map tileset character data]], the first tile (index <tt>000</tt>) is completely transparent.
 
====Palettes====
Once decompressed, the palettes subentries each contain a complete set of 256 2-byte [[Super_Nintendo:Color|colors]] (512 bytes) to replace the entire contents of [https://snes.nesdev.org/wiki/Palettes SNES CGRAM]. Because the gas station screen uses [https://snes.nesdev.org/wiki/Backgrounds#Mode_3 Mode 3] background layer 1, all of CGRAM is treated as a single 256-color palette.
 
Colors 32 to 47 (inclusive) are not used by any normal background tiles on layer 1 and are instead reserved for use by the static animation via background tiles on layer 2. Per [https://snes.nesdev.org/wiki/Backgrounds#Mode_3 Mode 3] logic, these colors are therefore treated as a single 16-color palette. The SNES allows layer 1 tiles to use any colors in all of CGRAM and layer 2 tiles to use colors from the first 8 16-color palettes (first half of CGRAM), but the animated fade between static and the gas station image assumes the static only uses colors 32 to 47 and that nothing else uses those colors.
 
[[Category:EarthBound|Gas Station Screen Graphics Data]]

Latest revision as of 20:15, 3 June 2024

Gas Station Screen Graphics Data
Game EarthBound
Start Address 0x2157D3
End Address 0x21ACDE
Total Length 21772 bytes (0x550c)
Back to the ROM map

Compressed raw graphics data for the game intro gas station screen.

Subentries

Address End Address Description Compressed length Decompressed length
0x2157d3 0x215d32 Tilemap Data 1376 bytes (0x0560) 2048 bytes (0x0800)
0x215d33 0x21abb6 Tile Character Data 20100 bytes (0x4e84) 49153 bytes (0xc001)
0x21abb7 0x21ac5c Palettes 1 166 bytes (0x00a6) 512 bytes (0x0200)
0x21ac5d 0x21acde Palettes 2 130 bytes (0x0082) 512 bytes (0x0200)

Format

Contains 4 individually compressed subentries for tilemap data, tile character data, and 2 separate entries for palettes. See Compression Format. For the 2 palettes entries, Palettes 1 is the initial palettes used on load of the screen, and Palettes 2 is an alternate set of palettes used during the flashing animation.

Decompressed Format

Tilemap Data

Once decompressed, the tilemap data contains a single 32x32 tile SNES tilemap, designating a static image covering the entire screen. 2-byte tile entries are arranged in rows, with 32 entries for the left-to-right tiles at the top of the screen, followed by the next row, etc.

For each 2-byte tile entry:

VH0000CCCCCCCCCC

  • V (bit 0x8000): Vertical flip. If set, tile will be flipped vertically from how it is stored in tile character data. Not set for any tiles.
  • H (bit 0x4000): Horizontal flip. If set, tile will be flipped horizontally from how it is stored in tile character data.
  • 0000 (bit 0x3C00): Would be the BG Priority Bit and Palette selection, but both are unusable for gas station screen graphics, making these bits always 0000. BG Priority Bit is meaningless because only a single background layer is used (other than a subscreen used for combining the static animation via color math) and no sprites, so there is nothing to display the tile in front of or behind. The Palette selection must always be zero because the gas station screen uses Mode 3 background layer 1, in which tiles draw from all colors in CGRAM as a single large palette.
  • CCCCCCCCCC (bits 0x03FF): Tile character selection. Character index into tile character data. Always between 0 and 611 (inclusive) for all tiles because unmodified EarthBound only uses 612 tile characters out of the available 768.

Tile Character Data

Once decompressed, the tile character data contains up to 768 8-bits-per-pixel 8x8 SNES graphics tiles, followed by a one-byte null terminator (00). Additionally, like with map tileset character data, the first tile (index 000) is completely transparent.

Palettes

Once decompressed, the palettes subentries each contain a complete set of 256 2-byte colors (512 bytes) to replace the entire contents of SNES CGRAM. Because the gas station screen uses Mode 3 background layer 1, all of CGRAM is treated as a single 256-color palette.

Colors 32 to 47 (inclusive) are not used by any normal background tiles on layer 1 and are instead reserved for use by the static animation via background tiles on layer 2. Per Mode 3 logic, these colors are therefore treated as a single 16-color palette. The SNES allows layer 1 tiles to use any colors in all of CGRAM and layer 2 tiles to use colors from the first 8 16-color palettes (first half of CGRAM), but the animated fade between static and the gas station image assumes the static only uses colors 32 to 47 and that nothing else uses those colors.