Skip to content

Commit

Permalink
Improve clarity of Tile Data page (#570)
Browse files Browse the repository at this point in the history
Some suggestions by @bbbbbr, thank you!
  • Loading branch information
ISSOtm authored Sep 27, 2024
1 parent 4dd33d4 commit 664a947
Showing 1 changed file with 40 additions and 50 deletions.
90 changes: 40 additions & 50 deletions src/Tile_Data.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,59 +14,49 @@ objects behind it to show through.

There are three "blocks" of 128 tiles each:

<table>
<thead>
<tr>
<th rowspan="2">Block</th>
<th rowspan="2">VRAM Address</th>
<th colspan="3">Corresponding Tile IDs</th>
</tr>
<tr>
<td>Objects</td>
<td>BG/Win if LCDC.4=1</td>
<td>BG/Win if LCDC.4=0</td>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>$8000&ndash;$87FF</td>
<td>0&ndash;127</td>
<td>0&ndash;127</td>
<td></td>
</tr>
<tr>
<td>1</td>
<td>$8800&ndash;$8FFF</td>
<td>128&ndash;255</td>
<td>128&ndash;255</td>
<td>
128&ndash;255 <br />
(or -128&ndash;-1)
</td>
</tr>
<tr>
<td>2</td>
<td>$9000&ndash;$97FF</td>
<td colspan="2">(Can't use)</td>
<td>0&ndash;127</td>
</tr>
</tbody>
</table>
<div class="table-wrapper" style="text-align: center;"><table><thead>
<tr>
<th rowspan=2>Tile IDs for...</th>
<th>Block 0</th>
<th>Block 1</th>
<th>Block 2</th>
</tr>
<tr>
<th>$8000–87FF</th>
<th>$8800–8FFF</th>
<th>$9000–97FF</th>
</tr>
</thead><tbody>
<tr>
<td><strong>Objects</strong></td>
<td>0–127</td>
<td>128–255</td>
<td>—</td>
</tr>
<tr>
<td><strong>BG/Win</strong>, if LCDC.4=1</td>
<td>0–127</td>
<td>128–255</td>
<td>—</td>
</tr>
<tr>
<td><strong>BG/Win</strong>, if LCDC.4=0</td>
<td>—</td>
<td>128–255</td>
<td>0–127</td>
</tr>
</tbody></table></div>

Tiles are always indexed using an 8-bit integer, but the addressing method may differ:

- The "**$8000 method**" uses \$8000 as its base pointer and uses an unsigned addressing, meaning that tiles 0-127 are in block 0, and tiles 128-255 are in block 1.
- The "**$8800 method**" uses \$9000 as its base pointer and uses a signed addressing, meaning that tiles 0-127 are in block 2, and tiles -128 to -1 are in block 1; or, to put it differently, "$8800 addressing" takes tiles 0-127 from block 2 and tiles 128-255 from block 1.

(You can notice that block 1 is shared by both addressing methods)

Tiles are always indexed using an 8-bit integer, but the addressing
method may differ. The "$8000 method" uses \$8000 as its base pointer
and uses an unsigned addressing, meaning that tiles 0-127 are in block
0, and tiles 128-255 are in block 1. The "$8800 method" uses \$9000 as
its base pointer and uses a signed addressing, meaning that tiles 0-127
are in block 2, and tiles -128 to -1 are in block 1, or to put it differently,
"$8800 addressing" takes tiles 0-127 from block 2
and tiles 128-255 from block 1. (You can notice that block 1 is shared
by both addressing methods)
Objects always use "$8000 addressing", but the BG and Window can use either mode, controlled by [LCDC bit 4](<#LCDC.4 — BG and Window tile data area>).

Objects always use "$8000 addressing", but the BG and Window can use either
mode, controlled by [LCDC bit 4](<#LCDC.4 — BG and Window tile data area>).
## Data format

Each tile occupies 16 bytes, where each line is represented by 2 bytes:

Expand Down

0 comments on commit 664a947

Please sign in to comment.