The player 6.0A Created by Jarno Paananen (Guru/Sahara Surfers) (1994) Analysed by Asle / ReDoX (asle@mygale.org) Source: - Own converted MODs with the packer (sent by Gryzor !) Note: Not much differencies with the version 5.0a .. . The sample can be delta and/or packed, and the pattern table is no more *2. that's about all. Enough I guess :), but all the work I did for version 5.0a is still usable ... great :). I'LL WELCOME ANY INFO ABOUT HOW TO DEPACK SAMPLES !!!. thanks :). Offset size (byte) Comment ------ ----------- ------- 0 2 (Smp_Addy) Address of the sample data 2 1 (NOP) number of pattern saved 3 1 (NOS) Number of sample (only the first 6 lower bits !) if bit 6 is set to 1, at least one sample is packed. if bit 7 is set to 1, ALL the samples are delta. (both cases are possible at the same time ...) Note: if bit 6 is set to 1 (packed samples), the 4 following bytes are the unpacked sample data size : 4 4 Size of the unpacked samples datas Then, dont forget to add 4 to all the following offsets. *************************************** * the following is repeated NOS times * * with 6 bytes description for 1 smp * ****************************************************** * 4 2 Sample size (/2) * 6 1 finetune (0->F) * 7 1 volume (0->40h) * 8 2 Loop Start / 2 * * ****************************************************** Note: The player removes what's beside the sample loop, so, it saves only the start address. If there's no loop, this value is $FFFF. Note: if the sample size is > $FF00 (this case is impossible under ptk !), you have to NOT this sample size and you'll get the number of sample you have to repeat (the datas are the same). The first possible value is 00 !. Note: if the sample is packed/delta , the finetune byte is changed in the same way as the number of sample upward : if bit 6 is set to 1, the sample is packed. if bit 7 is set to 1, the sample is delta. And here, too, both cases are possible at the same time. NOS*6+4 NOP*8 track table. Each pattern contains 4 tracks and here is the address of the four track per patterns. The first address is $0000. Note: According to the documentation of the packer, it supports the 'new' 100 pattern feature added by Noxious in their Ptk 2.*. The doc says that if the packing of the track data is higher than 64k, then this table is saved with DWORD (not just WORD). I've not yet encountered the case, but I guess there's a bit, somewhere, that states the fact because I cant see how we could know if it's saved on DWORD or only WORD ... . Dont forget that the actual size will be (NOP*16) for the following offsets. NOS*6+4 ? Pattern table. This table ends with $FF +NOP*8 NOS*6+4 Tracks datas. +NOP*8 (Pat_Size is the size of the pattern list) +Pat_Size Each track contains 64 notes. The size is between 4 and 256 bytes. Note description: (the same as P50A !) case 1: (flag bit set to 0) - flag bit set to 0 / | Sample | Number | / \ | | | 0000-0000 0000-0000 0000-0000 | | | | | | \ / \/ \ / relative effect effect note value number case 2: (flag byte set to 1) - flag byte set to 1 / | Sample | Number value | / \ / \ | | | | | 0000-0000 0000-0000 0000-0000 0000-0000 | | | | | | \ / \/ \ / relative effect effect note value number Note: 'value' is signed. if 'value' is < 80h, then follow 'value' empty rows. if 'value' is > 7Fh, then the current note is repeated 100h-'value' times case 3: (flag byte set to 1) - flag byte set to 1 / | | lines | / \ | | | 0000-0000 0000-0000 0000-0000 0000-0000 | | | | \ / \ / $80 number of bytes Note: Yop, that's the main packing goody ... . Well, if the first byte is $80, the second is the number of lines we'll have to repeat, and the last two bytes (a word in this case) is the number of bytes to go back to reach the starting point where to read our lines. Err, substract the number of byte to the current file pointer position (meaning after having read these 4 bytes) !. IMPORTANT!: while repeating notes, if you encounter the case 2 (empty rows or one line repeated), IT COUNTS ONLY FOR ONE LINE, whatever the number of empty/repeat row you'll have to do !!!. so much easier ... grrr. sample number: The last bit of the sample number is also the first of the relative note number. It's entirely possible considering the fact that the notes are *2 ... so this bit is never used by the note. effect: * Effects with volume slide (5,6,A) are signed. AFF -> A10 A01 -> A01. * Arpeggio effect number is 8h in this format. * If the effect is a pattern break/jump, the track ends !. relative note number (P60A): C-1 to B-1 : 02,04,06,08,0a,0c,0e,10,12,14,16,18 C-2 to B-2 : 1a,1c,1e,20,22,24,26,28,2a,2c,2e,30 C-3 to B-3 : 32,34,36,38,3a,3c,3e,40,42,44,46,48 becomes (PTK): C-1 to B-1 : 856,808,762,720,678,640,604,570,538,508,480,453 C-2 to B-2 : 428,404,381,360,339,320,302,285,269,254,240,226 C-3 to B-3 : 214,202,190,180,170,160,151,143,135,127,120,113 Information: When you encounter the effect command D or B (pattern break/jump), the track data ends, as stated upward. What's important, is that ALL the other tracks of THIS pattern have the same number of row as the one which ends with the break/jump. As an exemple, if track 0 has a pattern break at line 2, the 3 other tracks have ONLY 3 rows !. Follow Sample datas. Note: As described in the sample headers, all the samples are not always saved !. Refer up there to get the point :). Note: If the samples are delta, use the following formula ... heh, read carefully because it's a FAKE delta !. 'new' and 'old' are both unsigned bytes 'Sample_Data' is a table of signed bytes +-------------------------------------+ |old=0 | | | |for i=1 to Sample_Size | | new = (100h - Sample_Data[i]) + old| | Sample_Data[i] = new | | old = new | +-------------------------------------+