Tiny Stuff
Jump to navigation
Jump to search
- Company: David Mumper
- Extensions: .tny, .tn1, .tn2, .tn3, .tn4, .tn5, .tn6
Tiny Stuff is an image compression format used on the Atari ST. Here's the m68k assembly decompression routine from the original Tiny Stuff 3.0 package.
16-bit words are stored in big-endian order.
File format
typedef tinystuff_file { uint8_t resolution; /* 0 = low (320x200x16), 1 = medium (640x200x4), 2 = high (640x400x2) */ /* 3 = low and color animation is present, 4 = idem for medium, 5 = idem for high */ struct { uint8_t animation_limits; /* High nibble = start limit, low nibble = end limit */ uint8_t animation_dirspeed; /* negative = left, positive = right, timebase 1/60 */ uint16_t duration; /* number of iterations */ } optional_animation_info; /* if resolution < 3, this is not present */ uint16_t palette[16]; uint16_t number_of_control_bytes; uint16_t number_of_data_words; uint8_t control_bytes[]; uint16_t data_words[]; } tinystuff_file;
Decompression algorithm
Unlike most other RLE variants, the control bytes and data are stored non-interleaved.
x refers to the current control byte, d and d+1 refer to the current and next data word:
x < 0 -x literal words x == 0 d times d+1 x == 1 d literal words x > 1 x times d
Uncompressed data format
The uncompressed data consists of four sets of 20 vertical columns. Each column is 16-bits wide.
for (set=0; set<4; set++) for (column=set; column<80; column += 4) for (scanline=0; scanline<200; scanline++) { }
Medium and high resolution data are handled as if they were low resolution.