psx.wiki

BGD (BG Map Data)

Map of cell numbers that makes up a BG plane of the 2D system.

BGD (BG Map Data)
Extension.BGD
ID0x23
Version0x00

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

The header is two words:1

Table 1: BGD file header
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

References


  1. ^ a b c Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-27, Figures 192 to 194.

  2. ^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-28, Figures 195 to 198.

Categories: File formats