| |
Format name
: The player 4.0A and 4.0B
Created by : Jarno Paananen (Guru/Sahara
Surfers)
Sources :
* 3 P40A files sent by Gryzor ! (thx)
* 3 P40B files sent by Gryzor ! (thx)
|
OFFSET
|
SIZE (bytes)
|
COMMENT
|
|
0
-
-
4
5
-
6
7
8
-
Ch
-
10h
-
|
4
-
-
1
1
-
1
1
4
-
4
-
4
-
|
- "P40A" Id
"P40B" Id
Note: It's the only difference I've found !
- Real number of pattern
- Size of pattern list (PatSize)
(number of pattern to play)
- Number of sample (NOS)
- ?????????? (00h)
- tracks data address (TDA)
add 4 bytes .. the size of a dword
- tracks table address (TTA)
add 4 bytes
- samples data address (SDA)
add 4 bytes
|
The following is repeated NOS times
with 16 bytes description for one sample
|
14h
-
18h
1Ah
-
1Eh
20h
22h
23h
|
4
-
2
4
-
2
2
1
1
|
- THIS sample data address
(first is 00000000h !, so, add SDA+4 ...)
- Sample size (/2)
- loop start address
(same shit as data address)
- Loop Size / 2
- finetune *74 ?!?
- ?!?!? (00h)
- volume (0->40h) |
Note: The sample address can be
the same for several samples !. The player saves only once the same
samples
|
?!?
-
-
-
-
?!?
-
-
?!?
-
|
PatSize*8
-
-
-
-
?!?
-
-
?!?
-
|
- Pattern list
it consists of a list of 4 word which are the address of each track.
Add TTA to each address to find the conresponding data of a track
- two bytes set to $FFFF. A "refer-to" as to specify for sure the
end of the pattern list .. I guess :))
- track datas. Each track is 64 notes. One note is 4 bytes long
... most of the time :) |
Note Packing :
* case 1 : (flag byte set to 0)
- flag byte set to 0
/
| Sample
| Number
| / /\
| | | |
0000-0000 0000-0000 0000-0000 0000-0000
| | | | | | | |
\ / \/ \ / \ /
relative effect effect info byte
note value
number
|
info byte:
This is a signed byte. Two cases follow ..
case 1: (this byte is > 00h)
it is, then, the number of empty lines that follow after this note.
case 2: (this byte is >= 80h)
it is the number of time this note is repeated.
case 3: Heh ... not a case actually, merely
noting that if this byte is null, then nothing happens :)
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
* case 2 : (flag byte set to 1)
- flag byte set to 1
/
|
|
|
|
0000-0000 0000-0000 0000-0000 0000-0000
| | | | | |
\ / \ / \ /
empty number \ /
of lines starting address
to repeat
|
some explanations are needed, I guess :) :
So, if the first byte is 80h, the second byte is the number of lines one
will have to repeat. Those "have to be repeated lines" are at the "starting
address" specified by the last two bytes. Dont forget to add TDA + 4 bytes
to this value to really have the address in the file. As an exemple, if
you have N lines to repeat from address A, you have to point at A and
read N notes and put them in this track. Remember that each note is 4
bytes !. Also, remember that the note at the corresponding address can
have a not-null info-byte !. Thus, the empty lines or the repeat lines
are to be counted !
For all those cases:
Effects with volume slide (5,6,A) are recoded. In fact, if the effect
value is > 80h, then it's a slide up. (e.g. : A81 is A10 and A01 stays
A01). I've only encountered this thing with A command ... I'm only suspecting
it's the same for effects 5 and 6
Arpeggio effect number is 8h in this format
relative note number: (Protracker)
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
|
become : (P40)
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
|
Follow Sample datas stored
like Protracker. Nothing is packed..
|
|