psx.wiki

TIM (Screen Image Data): Difference between revisions

Revision as of 02:27, 23 October 2026
RemmyLee
(File format pages from the Sony File Formats manual)
Revision as of 02:47, 23 October 2026
RemmyLee
(Formats: Sony paragraph voice; HMD, RSD extended files, full BS code book; sprite editor formats)
Line 10:Line 10:
## Overview## Overview
−The TIM file holds the standard images handled by the PlayStation. It can be transferred directly to VRAM.[^ff33]+The TIM file holds the standard images handled by the PlayStation, and it can be transferred directly to VRAM. It is used both for sprite patterns and for the material of 3D texture mapping.[^ff33]
−TIM data serves as sprite patterns and as texture material for 3D texture mapping.[^ff33]+A TIM file holds image data in one of the following modes:[^ff33][^ff34]
−A TIM file holds image data in one of the following modes:
−
Table: TIM image data modesTable: TIM image data modes
−| PMODE | Mode | Use |+| PMODE | Mode |
−| --- | --- | --- |+| --- | --- |
−| 0 | 4-bit CLUT | Sprite and texture data |+| 0 | 4-bit CLUT |
−| 1 | 8-bit CLUT | Sprite and texture data |+| 1 | 8-bit CLUT |
−| 2 | 15-bit direct | Sprite, texture and display data |+| 2 | 15-bit direct |
−| 3 | 24-bit direct | Display data |+| 3 | 24-bit direct |
−| 4 | Mixed | Several kinds of data in one file |+| 4 | Mixed |
−VRAM is organized in 16-bit units. Only 16-bit and 24-bit data can be transferred to the frame buffer for display.[^ff33]+The VRAM of the PlayStation is based on 16 bits. Only 16-bit and 24-bit data can therefore be transferred directly to the frame buffer for display. Sprite patterns and polygon texture data, however, can use any of the 4-bit, 8-bit and 16-bit modes.[^ff33]
−Sprite and texture data can use any mode except 24-bit direct.[^ff33]
−
## File Structure## File Structure
−A TIM file starts with a file header (ID). The FLAG, CLUT and pixel data blocks follow.[^ff33]+A TIM file has a file header (ID) at the top and consists of several blocks. Each item of data is a string of 32-bit binary data, and the data is little endian. In an item of several bytes the bottom byte therefore comes first and holds the lowest address.[^ff33]
−Each item is a string of 32-bit words.[^ff33]
−
−The data is little endian. The lowest byte of a word holds the lowest address.[^ff33]
−
−The blocks are as follows:
−
Table: TIM file blocksTable: TIM file blocks
Line 46:Line 36:
| ID | File ID and version number || ID | File ID and version number |
| FLAG | Pixel mode and CLUT flag || FLAG | Pixel mode and CLUT flag |
−| CLUT | Color lookup tables (only when CF is 1) |+| CLUT | Color lookup tables, present only when CF is 1 |
| Pixel | Image data || Pixel | Image data |
## ID## ID
−The ID is one word.[^ff33]+The file ID is one word with the following bit configuration:[^ff33][^ff34]
Table: TIM file headerTable: TIM file header
Line 63:Line 53:
## Flag## Flag
−The flag word holds information about the file structure.[^ff34]+The flag is 32 bits of data that describes the file structure. When a single TIM file holds several sprites and textures of different types, PMODE is 4 (mixed) because data of several types is intermingled.[^ff34]
Table: TIM flag wordTable: TIM flag word
Line 73:Line 63:
| 5..31 | Reserved | All zero || 5..31 | Reserved | All zero |
−A TIM file that holds several sprites and textures of different types has a PMODE of 4.[^ff34]
−
## CLUT## CLUT
−A CLUT is a color palette. Image data in 4-bit and 8-bit mode uses it.[^ff34]+A CLUT is a color palette, and it is used by image data in 4-bit and 8-bit mode. The CF flag in the FLAG block specifies whether the TIM file has a CLUT block. The block opens with its length in bytes (bnum), which is followed by its location in the frame buffer, its size and the entries themselves.[^ff34]
−The CLUT block opens with its length in bytes. Its frame buffer position, its size and the CLUT entries follow.[^ff34]
−
−The CLUT block has the following fields:
−
Table: CLUT blockTable: CLUT block
Line 94:Line 78:
| CLUT 1..n | CLUT entries, 16 bits each || CLUT 1..n | CLUT entries, 16 bits each |
−In 4-bit mode one CLUT has 16 entries. In 8-bit mode one CLUT has 256 entries.[^ff35]+In 4-bit mode one CLUT consists of 16 entries, and in 8-bit mode it consists of 256 entries. On the PlayStation CLUTs are located in the frame buffer, so the CLUT block is handled as a rectangular frame buffer image in which one entry is one pixel. A 4-bit CLUT is therefore an image 16 wide and 1 high, and an 8-bit CLUT is 256 wide and 1 high.[^ff35]
−CLUTs are located in the frame buffer. The CLUT block is handled as a rectangular frame buffer image, one entry per pixel.[^ff35]+One TIM file can hold several CLUTs. In this case the area in which the CLUTs are combined is placed in the CLUT block as a single item of image data.[^ff35]
−A 4-bit CLUT is an image 16 wide and 1 high. An 8-bit CLUT is an image 256 wide and 1 high.[^ff35]
−
−One TIM file can hold several CLUTs. They are combined into one image in the CLUT block.[^ff35]
−
### CLUT Entry### CLUT Entry
−One CLUT entry is one color.[^ff35]+One CLUT entry holds one color. Its structure is as follows:[^ff35]
Table: CLUT entryTable: CLUT entry
Line 115:Line 95:
| 15 | STP | Transparency control bit || 15 | STP | Transparency control bit |
−STP is valid when the data is used as sprite or texture data. It sets whether the pixel is transparent.[^ff35]+The transparency control bit (STP) is valid when the data is used as sprite or texture data. It controls whether the pixel is transparent in the sprite or polygon that is drawn. If STP is 1 the pixel is semi-transparent, and otherwise it is not transparent. However, a pixel whose R, G, B and STP are all 0 is a transparent color. The relationships are shown in the following table:[^ff35]
−The STP bit and the color combine as follows:
−
Table: STP bit function with R G B dataTable: STP bit function with R G B data
Line 130:Line 108:
## Pixel Data## Pixel Data
−Pixel data is the image itself. The frame buffer has a 16-bit structure, so the image data is divided into 16-bit units.[^ff35]+Pixel data is the substance of the image. The frame buffer of the PlayStation has a 16-bit structure, so the image data is broken up into 16-bit units. The pixel data block has the following structure:[^ff35][^ff36]
−The pixel data block has the following fields:
−
Table: Pixel data blockTable: Pixel data block
Line 145:Line 121:
| DATA 1..n | Frame buffer data, 16 bits each || DATA 1..n | Frame buffer data, 16 bits each |
−W counts 16-bit units. In 4-bit mode it is 1/4 of the image width, and in 8-bit mode it is 1/2.[^ff36]+Care is needed with the size of the pixel data. W counts 16-bit units, so in 4-bit mode it is 1/4 of the image width and in 8-bit mode it is 1/2. Consequently the width of a 4-bit image must be a multiple of 4, and the width of an 8-bit image must be an even number.[^ff36]
−The width of a 4-bit image must be a multiple of 4. The width of an 8-bit image must be an even number.[^ff36]
−
### Frame Buffer Data### Frame Buffer Data
−The layout of one 16-bit item depends on the image data mode.[^ff36]+The structure of one 16-bit item of frame buffer data depends on the image data mode. The table below gives the structure for each mode, and pixels appear on the screen in order from the LSB side.[^ff36][^ff37]
−Each mode uses the following layout:
−
Table: Frame buffer data by modeTable: Frame buffer data by mode
Line 164:Line 136:
| 24-bit | 3 items hold 2 pixels || 24-bit | 3 items hold 2 pixels |
−Pixels appear on the screen in order from the LSB side.[^ff36]+In 24-bit mode three items of 16-bit data correspond to two pixels. R0, G0 and B0 are the pixel on the left, and R1, G1 and B1 are the pixel on the right:[^ff37]
−In 24-bit mode three 16-bit items hold two pixels:[^ff37]
−
Table: 24-bit pixel pairTable: 24-bit pixel pair
Line 176:Line 146:
| 2 | B1 | G1 || 2 | B1 | G1 |
−R0, G0 and B0 are the left pixel. R1, G1 and B1 are the right pixel.[^ff37]
−
## References## References
−[^ff33]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-3.+[^ff33]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-3, Figures 150 to 152.
−[^ff34]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-4.+[^ff34]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-4, Figures 153 and 154.
[^ff35]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-5, Table 3-1.[^ff35]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-5, Table 3-1.
−[^ff36]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-6, Figure 157.+[^ff36]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-6, Figures 156 and 157.
[^ff37]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-7.[^ff37]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-7.