BGD (BG Map Data)
Map of cell numbers that makes up a BG plane of the 2D system.
| Extension | .BGD |
|---|---|
| ID | 0x23 |
| Version | 0x00 |
Overview
The BGD file provides the data that makes up a BG plane of the 2D system, where BG is any array of rectangular pixel data. The BGD file is used together with the TIM and CEL files of the same name, and the actual pixel images are carried by the TIM file. A BGD file has a header at the top and is divided into three blocks: HEADER, MAP and ATTR. The ATTR block may be omitted.1
HEADER
The header is two words:1
| Word | Bits | Field | Contents |
|---|---|---|---|
| 0 | 0..7 | ID | 0x23 |
| 0 | 8..15 | VERSION | 0x00 |
| 0 | 16..31 | FLAG | ATT and ATL |
| 1 | 0..7 | MAPW | Horizontal size of the BG map data (in cells) |
| 1 | 8..15 | MAPH | Vertical size of the BG map data (in cells) |
| 1 | 16..23 | CELLW | Horizontal size of the cell data (in pixels) |
| 1 | 24..31 | CELLH | Vertical size of the cell data (in pixels) |
The ATT bit of FLAG shows whether the file includes an ATTR block (0 not included, 1 included). The ATL bit gives the length of the ATTR data (0 8-bit, 1 16-bit).1
MAP Section
A map is a matrix of MAPH x MAPW cells that describes the order in which the cells are arranged. The cells are numbered from the top left in rows, so in an 8 x 8 map the first row holds positions 0 to 7 and the last row holds 56 to 63. The MAP section lists the number of the cell in the CEL file for each position in this order. Each cell number takes 16 bits.2
ATTR Section
Attribute data is additional information about the map, and it is arranged in the same order as the MAP. The ATL bit in the header gives its length of 8 bits or 16 bits. One word therefore holds four 8-bit or two 16-bit attributes.2