The player 5.0A Created by Jarno Paananen (Guru/Sahara Surfers) (1993) Analysed by Asle / ReDoX (asle@mygale.org) Source: - Own converted MODs with the packer (sent by Gryzor !) Note: Arg !, such a note packing method !. Pfff ... it took me almost 10 hours to write (and debug) a depacker !. God, how can he use such a mess ?!?. Anyway, I'm not sure if it's the best crunching rate yet, but it certainly is good :). Somehow, I guess he did better with the P60A and P61A ... I'll tell you when I begin them :). I know, however, that it's possible to do yet a bit better ! (I did :). 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 7 is set to 1, ALL the samples are delta. *************************************** * 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 !. 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. NOS*6+4 ? Pattern table. Each value is (*2). This table ends +NOP*8 with $FF. 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: 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 (P50A): 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 ... 'new' and 'old' are both unsigned bytes 'Sample_Data' is a table of signed bytes +-------------------------------------+ |old=Sample_Data[0] | | | |for i=1 to Sample_Size | | new = old - Sample_Data[i] | | Sample_Data[i] = new | | old = new | +-------------------------------------+