Various file formats used across projects.

ICN is a 1-bit graphics format.

The ICN file contains a series of bits equivalent to pixels in a 8x8 tile. The data for each tile is made up of 64 bits, or 8 bytes, in which each bit is a pixel. An ICN is the first half of a chr file. This is the standard format for Varvara ecosystem, to view and edit icn files, try Noodle.



24x24 ICN Sprite
0003 6331 397b 77f8 c0f0 f7ff fff0 8003
1c7e feff 0f07 078e f860 0c07 0300 301f
071f 7cf8 f007 7fff dcc0 c000 70f8 f8b0
0f07 4143 677f 7f3e ffe3 87cf cfcf 8703
84c4 8406 0efe fcf8 	


Uint8 tile[8] = {0x00, 0x3c, 0x42, 0x7e, 0x40, 0x42, 0x3c, 0x00};

draw_icn(Uint32 *dst, int x, int y, Uint8 *sprite, int fg, int bg)
	int v, h;
	for(v = 0; v < 8; v++)
		for(h = 0; h < 8; h++) {
			int ch1 = (sprite[v] >> (7 - h)) & 0x1;
			put_pixel(dst, x + h, y + v, ch1);

CHR is a 2-bit graphics format.

The CHR file contains a series of bits equivalent to pixels in a 8x8 tile. The data for each tile is made up of 128 bits, where the first 64 bits are the first channel, the next 64 bits the second channel, and where the channels overlap result in a total of 4 colors including the background.

ch1 + ch2hex

This is the standard format for the Famicom and Varvara ecosystems, to view and edit chr files, try Nasu. To convert images from the tga format, use tgachr.

Uint8 tile[16] = {
	0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x00

draw_chr(Uint32 *dst, int x, int y, Uint8 *sprite)
	int v, h;
	for(v = 0; v < 8; v++)
		for(h = 0; h < 8; h++) {
			int ch1 = ((sprite[v] >> h) & 0x1);
			int ch2 = (((sprite[v + 8] >> h) & 0x1) << 1);
			put_pixel(dst, x + 7 - h, y + v, ch1 + ch2);

NMT is a 2-bit graphics nametable format.

The NMT file contains a series of cells referencing addresses to sprites in a spritesheet, typically icn tiles or chr tiles. A cell is 3 bytes long, the first two bytes are the address starting from the beginning of the spritesheet, followed by a color byte. This format is used in Nasu.

Cell(3 bytes)

GLY is a 1-bit inline graphic format.

Gly is an inline graphics format, similar to sixels, used to draw graphics inside text files from visible ASCII characters, in which each character represents 4 vertical pixels on 16 pixels high columns. Gly assets are supported by Left, and can be generated in Noodle.

asciiy*44 pixels

The format resides entirely in within the 0x3f-0x7f range of the ascii table. At the end of each row, 0x0a denotes the end of a line. For example, a 32px high sprite, will have two line breaks. The Y position is set in increments of 4 pixels vertically for a total of 16 vertical pixels, the 0x20 advances the rendering by 1 pixel horizontally.

GLY Example

Each line begins with an escape code, the escape code is not display at the start of each line in the following example.

?^n~ GOb CWa ASa @Ua} NVa ?Va{ GTaq CTa{ ATa @Ta} @Ta @Ta} @Ta @Ta{ @Taq @Ta{ @Ta @Ta} @Ta @Ta @Ta @Tm~ @Td @\g @T_p @R_q @P_p HQg DSk~ BWa @O` 
N^n~ _w _w _w HVkw Oax GVkw @_w ?Rmx GS_w @Rkw Oax HVkw _w GVkw @Oax ?Rkw GS_w @Rmx _w _w _w N^n~ _s _q _p Og Oc Oa N^`   


Draw a gly string in Uxntal with the screen's auto byte is set to auto-y(0x02):

@draw-gly ( chr -- )

	( cmds )
	LDAk #20 NEQ ?&no-x .Screen/x DEI2k INC2 ROT DEO2 INC2 !&w &no-x
	LDAk #20 LTH ?&end
	( opcode )
	.Screen/y DEI2
	#00 STHkr #30 AND #24 SFT OVR2 ADD2 .Screen/y DEO2
		STHkr OVR SFT #01 AND .Screen/pixel DEO
		INC GTHk ?&loop
	.Screen/y DEO2
	INC2 !&w


UFX is a proportional font format.

The UFX file begins with 256 bytes corresponding to the width(in pixels) of each of the 256 glyphs in the spritesheet, followed by the pixel data in the .icn format for each character.

.uf18x8(1 tile)0x0900
.uf216x16(4 tiles)0x2100
.uf324x24(9 tiles)0x4900

The pixel data for each glyph is stored in a series of 8x8 tiles, the drawing order goes vertically as to be able to skip extra draw calls for narrow characters if needed:


A naive uf2 character drawing routine in Uxntal is about 50 bytes, with the screen's auto byte set to #15:

@draw-uf2 ( text* -- )

	#15 .Screen/auto DEO
		LDAk #20 SUB #00 SWP
			DUP2 #50 SFT2 ;font/glyphs ADD2 .Screen/addr DEO2
			;font ADD2 LDA #00 SWP .Screen/x DEI2 ADD2
		#01 .Screen/sprite DEOk DEO
		.Screen/x DEO2
		INC2 LDAk ,&while JCN


The empty pixel data of the first 32 invisible characters are typically removed. You will find this filetype in the Uxn ecosystem, namely in Left. Uf2 fonts can be viewed and edited with Turye.

Truevision TGA is a raster graphics file format created by Truevision.

TGA files are currently used as the standard image transfer format between Varvara and the host operating system.

LengthField nameDescription
1 byteID lengthLength of the image ID field
1 byteColor map typeWhether a color map is included
1 byteImage typeCompression and color types
5 bytesColor map specificationDescribes the color map
2 bytesX-originabsolute x of lower-left corner
2 bytesY-originabsolute y of lower-left corner
2 bytesImage widthwidth in pixels
2 bytesImage heightheight in pixels
1 bytePixel depthbits per pixel
1 byteImage descriptorbits 3-0 give the alpha channel depth, bits 5-4 give direction

Image ID length

0–255 The number of bytes that the image ID field consists of. The image ID field can contain any information, but it is common for it to contain the date and time the image was created or a serial number.

Color map type

Image type

Enumerated in the lower three bits, with the fourth bit as a flag for RLE. Some possible values are:

Image type 1 and 9: Depending on the Pixel Depth value, image data representation is an 8, 15, or 16 bit index into a color map that defines the color of the pixel. Image type 2 and 10: The image data is a direct representation of the pixel color. For a Pixel Depth of 15 and 16 bit, each pixel is stored with 5 bits per color. If the pixel depth is 16 bits, the topmost bit is reserved for transparency. For a pixel depth of 24 bits, each pixel is stored with 8 bits per color. A 32-bit pixel depth defines an additional 8-bit alpha channel. Image type 3 and 11: The image data is a direct representation of grayscale data. The pixel depth is 8 bits for images of this type.

Color map specification

In case that not the entire color map is actually used by the image, a non-zero first entry index allows to store only a required part of the color map in the file.