Each boxes represents a byte here, each time you go down a box, it is address+1.
☐ - EHHHYXyy \Header data
☐ - yyyxxxxx |
☐ - DRllllll |
☐ - LLLLLLLL /
☐ - TTTTTTTT \Tile data (TTTTTTTT = tile number
☐ - YXPCCCTT /YXPCCCTT = tile properties
☐ - TTTTTTTT \Tile data again (this can repeat based on how many tiles)
☐ - YXPCCCTT /
⋮
☐ - Terminating byte (contains the value $FF)
Taken from this.
Header data (4 bytes):
EHHHYXyy E = end of data, 0 = no, 1 = yes. When writing this, have this clear. HHH = what layer %010 (2) = layer 1 %011 (3) = layer 2 %101 (5) = layer 3 Y = Y position, bit 5 (screen bit, if set, 1 screen downwards) X = X position, bit 5 (screen bit, if set, 1 screen to the right) yy = Y position, bits 3-4 yyyxxxxx yyy = Y position, bits 0-2 xxxxx = X position, bits 0-4 DRllllll D = Direction: %0 = horizontal %1 = vertical. R = RLE bit. Repeats a tile N times if set. llllll = Length (number of bytes), bits 8-13. This is the number of total bytes (excluding the header and the terminating byte) to write, minus 1, therefore it is (NumberOfTiles*2)-1. If RLE is set, then this length value equals to (NumberOfTiles-1)*2 LLLLLLLL LLLLLLLL = length (number of bytes), bits 0-7. Same as above |