This is the original uncompiled module of Sound Tracker Pro, an AY music editor for ZX Spectrum, author Stanislav Kuzin (KSA). It was developed by improving the capabilities of Sound Tracker, so in many ways it retained backward compatibility with it.
Just like ST1, the STF module file is a dump of the editor's memory from the address 25000, but pre-prepared for saving and compressed. It may contain some patterns and all internal structures, samples and ornaments.
The original files on TR-DOS disks can be identified by the extension 'F' with the download address 25000.
One of the disadvantages of the source Sound Tracker is the large size of uncompiled modules. The KSA solution turned out to be quite straightforward: excluding not used in positions' list patterns and packing the data using the RLE method.
The packing algorithm may not be very successful, since after unpacking usually more data is obtained than necessary. However, this does not lead to a failure, and the extra data can simply be ignored.
The RLE type compression method is applied. In order to understand how to unpack a compressed block, it is enough to study it bit by bit using the following pseudocode.
first byte – to the stack | |||
next byte | |||
bit0 | |||
1 | {bit1 | ||
1 | {bit2 | ||
1 | {(bit3-7)-1->[decompression buffer]x2 times | ||
} | |||
0 | {first byte from the stack to [decompression buffer], end | ||
} | |||
} | |||
0 | {bit2-4->B,bit5-7->C,move C bytes from [decompression buffer-(B*256+next byte)] to [decompression buffer] | ||
} | |||
} | |||
0 | {bit1 | ||
1 | {bit2 | ||
1 | {bit3-7->C,move (C+1) bytes to [decompression buffer] | ||
} | |||
0 | {bit3-7->B,next byte->C,move C bytes from [decompression buffer-(B*256+next byte)] to [decompression buffer] | ||
} | |||
} | |||
0 | {bit2 | ||
1 | {bit3-7->C,next byte->[decompression buffer]x(C+3) times | ||
} | |||
0 | {bit3-7->B,next byte->C,next byte->[decompression buffer]x(BC+3) times | ||
} | |||
} | |||
} |
The patterns' bodies have the same size and follow each other in the editor's memory. It's determining the patterns used in the positions' list before compression, and only they get into the saved file.
All the used patterns turn out to be next to each other after unpacking (for example, if the second pattern is not used, then the first pattern will be immediately followed by the third one in the unpacked data). Therefore, the reverse operation is performed in the native editor's memory: the unpacked patterns are moved in their places.
Offset | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
0x0000 | Samples 1-15 (15 items), 0x82 bytes each:
| ||||||||||
0x079E | 256 positions (byte pairs "pattern_number[1..31]:transposition[-128..127])", patterns removed before compression if they absent in this list, next patterns moved to their place, and vice versa, all moved back after unpacking. | ||||||||||
0x099E | The number of active positions has been reduced by 1. | ||||||||||
0x099F | Empty zero ornament? (32 zeros). | ||||||||||
0x09B1 | Ornaments 1-15 (15 items), 32 bytes each:
| ||||||||||
0x0B9F | Empty zero ornament? (32 zeros). | ||||||||||
0x0BBF | Playback speed. | ||||||||||
0x0BC0 | Patterns lengths (total 31 patterns). | ||||||||||
0x0BDF | Loop position. | ||||||||||
0x0BE0 | Title (25 chars). | ||||||||||
0x0BF9 | Patterns (3 bytes per channel's line, 3*3*64=576 bytes per pattern), unused patterns are removed before compressing (see upper). Pattern channel's line format:
|
This is the 48K mode adaptation of Sound Tracker Pro, made in 1998 by Oleg Ivanov (Saruman).
Saves uncompiled modules with extension 'f' and load address 25000. I haven't looked inside yet, but due the program docs, they should have the structure of an unpacked STF module.