TIM (Screen Image Data): Difference between revisions
| Revision as of 02:22, 23 October 2026 RemmyLee (Hardware and system software pages from the Sony manuals) | Revision as of 02:27, 23 October 2026 RemmyLee (File format pages from the Sony File Formats manual) | ||
| Line 1: | Line 1: | ||
| + | --- | ||
| + | title: TIM (Screen Image Data) | ||
| + | type: format | ||
| + | summary: Image data that can be transferred directly to VRAM. | ||
| + | category: File formats | ||
| + | info: Extension = .TIM | ||
| + | info: ID = 0x10 | ||
| + | --- | ||
| + | |||
| + | ## Overview | ||
| + | |||
| + | The TIM file holds the standard images handled by the PlayStation. It can be transferred directly to VRAM.[^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: | ||
| + | |||
| + | Table: TIM image data modes | ||
| + | |||
| + | | PMODE | Mode | Use | | ||
| + | | --- | --- | --- | | ||
| + | | 0 | 4-bit CLUT | Sprite and texture data | | ||
| + | | 1 | 8-bit CLUT | Sprite and texture data | | ||
| + | | 2 | 15-bit direct | Sprite, texture and display data | | ||
| + | | 3 | 24-bit direct | Display data | | ||
| + | | 4 | Mixed | Several kinds of data in one file | | ||
| + | |||
| + | VRAM is organized in 16-bit units. Only 16-bit and 24-bit data can be transferred to the frame buffer for display.[^ff33] | ||
| + | |||
| + | Sprite and texture data can use any mode except 24-bit direct.[^ff33] | ||
| + | |||
| + | ## File Structure | ||
| + | |||
| + | A TIM file starts with a file header (ID). The FLAG, CLUT and pixel data blocks follow.[^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 blocks | ||
| + | |||
| + | | Block | Contents | | ||
| + | | --- | --- | | ||
| + | | ID | File ID and version number | | ||
| + | | FLAG | Pixel mode and CLUT flag | | ||
| + | | CLUT | Color lookup tables (only when CF is 1) | | ||
| + | | Pixel | Image data | | ||
| + | |||
| + | ## ID | ||
| + | |||
| + | The ID is one word.[^ff33] | ||
| + | |||
| + | Table: TIM file header | ||
| + | |||
| + | | Bits | Field | Value | | ||
| + | | --- | --- | --- | | ||
| + | | 0..7 | ID | 0x10 | | ||
| + | | 8..15 | Version No. | 0x00 | | ||
| + | | 16..31 | Reserved | All zero | | ||
| + | |||
| + | ## Flag | ||
| + | |||
| + | The flag word holds information about the file structure.[^ff34] | ||
| + | |||
| + | Table: TIM flag word | ||
| + | |||
| + | | Bits | Field | Contents | | ||
| + | | --- | --- | --- | | ||
| + | | 0..3 | PMODE | Pixel mode: 0 4-bit CLUT, 1 8-bit CLUT, 2 15-bit direct, 3 24-bit direct, 4 mixed | | ||
| + | | 4 | CF | 0 no CLUT section, 1 has CLUT section | | ||
| + | | 5..31 | Reserved | All zero | | ||
| + | |||
| + | A TIM file that holds several sprites and textures of different types has a PMODE of 4.[^ff34] | ||
| + | |||
| + | ## CLUT | ||
| + | |||
| + | A CLUT is a color palette. Image data in 4-bit and 8-bit mode uses it.[^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 block | ||
| + | |||
| + | | Field | Contents | | ||
| + | | --- | --- | | ||
| + | | bnum | Data length of the CLUT block in bytes, including the 4 bytes of bnum | | ||
| + | | DX | X coordinate in the frame buffer | | ||
| + | | DY | Y coordinate in the frame buffer | | ||
| + | | W | Size of the data in the horizontal direction | | ||
| + | | H | Size of the data in the vertical direction | | ||
| + | | 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] | ||
| + | |||
| + | CLUTs are located in the frame buffer. The CLUT block is handled as a rectangular frame buffer image, one entry per pixel.[^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 | ||
| + | |||
| + | One CLUT entry is one color.[^ff35] | ||
| + | |||
| + | Table: CLUT entry | ||
| + | |||
| + | | Bits | Field | Contents | | ||
| + | | --- | --- | --- | | ||
| + | | 0..4 | R | Red component (5 bits) | | ||
| + | | 5..9 | G | Green component (5 bits) | | ||
| + | | 10..14 | B | Blue component (5 bits) | | ||
| + | | 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 STP bit and the color combine as follows: | ||
| + | |||
| + | Table: STP bit function with R G B data | ||
| + | |||
| + | | STP/R,G,B | Translucent processing on | Translucent processing off | | ||
| + | | --- | --- | --- | | ||
| + | | 0/0,0,0 | Transparent | Transparent | | ||
| + | | 0/X,X,X | Not transparent | Not transparent | | ||
| + | | 1/X,X,X | Semi-transparent | Not transparent | | ||
| + | | 1/0,0,0 | Non-transparent black | Non-transparent black | | ||
| + | |||
| + | ## 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] | ||
| + | |||
| + | The pixel data block has the following fields: | ||
| + | |||
| + | Table: Pixel data block | ||
| + | |||
| + | | Field | Contents | | ||
| + | | --- | --- | | ||
| + | | bnum | Data length of the pixel data in bytes, including the 4 bytes of bnum | | ||
| + | | DX | Frame buffer x coordinate | | ||
| + | | DY | Frame buffer y coordinate | | ||
| + | | W | Size of the data in the horizontal direction, in 16-bit units | | ||
| + | | H | Size of the data in the vertical direction | | ||
| + | | 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] | ||
| + | |||
| + | 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 | ||
| + | |||
| + | The layout of one 16-bit item depends on the image data mode.[^ff36] | ||
| + | |||
| + | Each mode uses the following layout: | ||
| + | |||
| + | Table: Frame buffer data by mode | ||
| + | |||
| + | | Mode | Contents of one 16-bit item | | ||
| + | | --- | --- | | ||
| + | | 4-bit | pix0 in bits 0..3, pix1 in bits 4..7, pix2 in bits 8..11, pix3 in bits 12..15 (CLUT numbers) | | ||
| + | | 8-bit | pix0 in the low byte, pix1 in the high byte (CLUT numbers) | | ||
| + | | 16-bit | R in bits 0..4, G in bits 5..9, B in bits 10..14, STP in bit 15 | | ||
| + | | 24-bit | 3 items hold 2 pixels | | ||
| + | |||
| + | Pixels appear on the screen in order from the LSB side.[^ff36] | ||
| + | |||
| + | In 24-bit mode three 16-bit items hold two pixels:[^ff37] | ||
| + | |||
| + | Table: 24-bit pixel pair | ||
| + | |||
| + | | Item | Bits 8..15 | Bits 0..7 | | ||
| + | | --- | --- | --- | | ||
| + | | 0 | G0 | R0 | | ||
| + | | 1 | R1 | B0 | | ||
| + | | 2 | B1 | G1 | | ||
| + | |||
| + | R0, G0 and B0 are the left pixel. R1, G1 and B1 are the right pixel.[^ff37] | ||
| + | |||
| + | ## References | ||
| + | |||
| + | [^ff33]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-3. | ||
| + | [^ff34]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-4. | ||
| + | [^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. | ||
| + | [^ff37]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-7. | ||