<< Back to contents.

CharPad 2.3 User Manual - Subchrist Software, 2019.

CTM File Format, Version 1.

Used by CharPad 1.0 to record project data.

First comes the header, 20 bytes...

ID_STR [00-02] : 3 bytes : File ID string (ASCII) "CTM".
VERSION [03] : 1 byte : Format version number (1).
COLOURS [04-07] : 4 bytes : Screen colour, Char multi-colour 1, Char multi-colour 2, Char colour.
COLR_METH [08] : 1 byte : Colouring method (0 = Global, 1 = Per-tile, 2 = Per-tile-cell).
MCMODE [09] : 1 byte : Char multi-colour mode flag (1 = Yes).
MAP_WID [10-11] : 2 bytes : Map width (16 bits).
MAP_HEI [12-13] : 2 bytes : Map height (16 bits).
NUM_CHARS [14] : 1 byte : Character image quantity -1.
NUM_TILES [15] : 1 byte : Tile quantity -1.
RESERVED [16-19] : 4 bytes : Unused.

Then comes the data...

CHAR_DATA : NUM_CHARS * 8 bytes. : Character image data (one byte per pixel row).
TILE_DATA : NUM_TILES * 16 bytes. : Tile data (16 bytes per 4x4 tile).
CELL_COLOURS : NUM_TILES * 16 bytes. : Tile cell colour data (16 bytes per 4x4 tile, only exists if COLR_METH = 2).
TILE_COLOURS : NUM_TILES bytes. : Tile colour data (one byte per tile, only exists if COLR_METH = 1).
MAP_DATA : MAP_WID * MAP_HEI bytes. : Map data.

Notes...

16-bit values should always be interpreted as least significant byte first (LSBF).

The data for each character image (CHAR_DATA) consists of eight rows of pixels (one byte per row) starting with the top row.

The data for each tile (TILE_DATA, CELL_COLOURS) begins with the tile's top-left element and runs left-to-right, top-to-bottom (Z-pattern LRTB).

The data for the map (MAP_DATA) begins with the map's top-left element and runs left-to-right, top-to-bottom (Z-pattern LRTB).

File format limitations...

Max character images : 256
Max tiles : 256
Max maps : 1
Max tile size : 4x4 (fixed).
Max map width : 65535
Max map height : 65535

CharPad 1.0 limitations...

Max character images : 256
Max tiles : 256
Max maps : 1
Max tile size : 4x4 (fixed).
Max map width : 256
Max map height : 256

See also:-

CTM File Format, Version 2.
CTM File Format, Version 3.
CTM File Format, Version 4.
CTM File Format, Version 5.