1 | SAP file divides into two parts. First part (in text format) describes |
---|
2 | player/music type and contains credits for the song. Second part (in binary |
---|
3 | format) contains player and music data formed into Atari Binary File format. |
---|
4 | |
---|
5 | |
---|
6 | First part - text info |
---|
7 | ~~~~~~~~~~~~~~~~~~~~~~ |
---|
8 | For identification of the format, it always starts with "SAP" string. |
---|
9 | After that the credits follow. However, this is not fixed order, just a |
---|
10 | recommendation. Each line should end with EOL string (0D 0A). |
---|
11 | |
---|
12 | Credits tags: |
---|
13 | AUTHOR "" - Name of composer. For ASMA purposes, the name should consist of |
---|
14 | real name and nickname (scene handle) in parentheses. No scene |
---|
15 | group allowed. If song was composed by more authors, use "&". |
---|
16 | Examples: |
---|
17 | AUTHOR "Dariusz Duma (Dhor)" |
---|
18 | AUTHOR "Lukasz Sychowicz (X-Ray) & Piotr Swierszcz (Samurai)" |
---|
19 | NAME "" - Song title. No restrictions, except for it shouldn't contain |
---|
20 | quotation marks. Use apostrophes instead. |
---|
21 | Example: |
---|
22 | NAME "Jocky Wilson's Darts Challenge" |
---|
23 | DATE "" - Copyright year or yrar of creation. If exact date is known, it can |
---|
24 | also be included in DD/MM/YYYY format. |
---|
25 | Examples: |
---|
26 | DATE "1986" |
---|
27 | DATE "1993-94" |
---|
28 | DATE "28/08/1997" |
---|
29 | DATE "12/2001" |
---|
30 | |
---|
31 | After that the player info follows: |
---|
32 | TYPE - player type (see below) |
---|
33 | PLAYER - address of player part which will be executed in 1/50 sec |
---|
34 | intervals (or as defined with FASTPLAY) |
---|
35 | MUSIC - address with music data (for C type) |
---|
36 | INIT - address of player part which will init player (for all types |
---|
37 | except C) |
---|
38 | SONGS - number of songs. If SONGS tag not defined, the default value is |
---|
39 | 0. |
---|
40 | DEFSONG - first song which will be played when .sap will be loaded (i.e. |
---|
41 | the main game theme). This value is counted from zero (if there |
---|
42 | are 5 songs in the file and the last is the default, the value |
---|
43 | will be DEFSONG 4). The default is 0 if DEFSONG not defined. |
---|
44 | FASTPLAY - number of lines between each call of playing routine (312 by |
---|
45 | default, which is one screen - 1/50 of sec.). For example for |
---|
46 | double-speed tune put here the value 156 (312/2). 99% of tunes |
---|
47 | are single-speed which means that you don't have to define the |
---|
48 | FASTPLAY variable for them. Works for player TYPE "B". |
---|
49 | Another values recommended: 104 (triple speed), 78 (quadruple |
---|
50 | speed) |
---|
51 | STEREO - tune uses dual POKEY configuration. |
---|
52 | |
---|
53 | commands PLAYER, MUSIC, INIT contain addresses in hexadecimal format. Both |
---|
54 | lower- and uppercase characters are allowed for the number. |
---|
55 | |
---|
56 | PLAYER A000 |
---|
57 | PLAYER 1234 |
---|
58 | MUSIC f42e |
---|
59 | |
---|
60 | commands SONGS, DEFSONG contain decimal numbers: |
---|
61 | |
---|
62 | SONGS 10 |
---|
63 | DEFSONG 9 |
---|
64 | |
---|
65 | command TYPE contains single character which describes player type. The |
---|
66 | following player types are supported: |
---|
67 | |
---|
68 | TYPE C - player from CMC (Chaos Music Composer). In this case, also these |
---|
69 | commands must appear: PLAYER, MUSIC. Additionaly you can define |
---|
70 | SONGS and DEFSONG. Player will be initialized as follows: |
---|
71 | |
---|
72 | lda #$70 |
---|
73 | ldx #<MUSIC |
---|
74 | ldy #>MUSIC |
---|
75 | jsr PLAYER+3 |
---|
76 | lda #$00 |
---|
77 | ldx #DEFSONG |
---|
78 | jsr PLAYER+3 |
---|
79 | |
---|
80 | in 1/50 intervals will be executed: |
---|
81 | |
---|
82 | jsr PLAYER+6 |
---|
83 | |
---|
84 | This is just internal structure already contained in SAP player, you |
---|
85 | don't have to add this code to the CMC player. |
---|
86 | |
---|
87 | TYPE B - any player. In this case, also these commands must appear: PLAYER, |
---|
88 | INIT. Additionaly you can define SONGS and DEFSONG. Player will be initialized as follows: |
---|
89 | |
---|
90 | lda #DEFSONG |
---|
91 | jsr INIT |
---|
92 | |
---|
93 | in 1/50 intervals will be executed: |
---|
94 | |
---|
95 | jsr PLAYER |
---|
96 | |
---|
97 | TYPE S - SoftSynth. Like type "C", this type is temporary, and is used only |
---|
98 | for special type of songs, that were composed using program |
---|
99 | SoftSynth. |
---|
100 | TYPE D - Digital. In SAP file with this type, there must be also defined |
---|
101 | commands "INIT" and "PLAYER". "PLAYER" (like in type B) sets |
---|
102 | address of procedure that will be called in 1/50s intervals and |
---|
103 | (like in type B) must end with RTS opcode. INIT this time is a bit |
---|
104 | different. It sets address of procedure that will be called (with |
---|
105 | number of song in register A) to initialize program, but it can't |
---|
106 | end with RTS. It should start playing digis in endless loop. In SAP |
---|
107 | player two ANTIC registers $D40A and $D40B are emulated. They help |
---|
108 | playing samples. D40B register increases its contents each two |
---|
109 | screen lines. D40A holds CPU till the end of actually drawn line. |
---|
110 | SAP emulates Atari in PAL with disabled screen. It means that we |
---|
111 | have 312 lines per screen, each taking 105 CPU cycles and 9 cycles |
---|
112 | of memory refresh (114 cycles per line). |
---|
113 | |
---|
114 | One more type is recognized by SAP player - TYPE M. Right now it's exactly |
---|
115 | the same as TYPE B but this differentiation is for future SAP releases. |
---|
116 | |
---|
117 | Planned features: |
---|
118 | TYPE R - Registers. In this type, binary part is not an Atari binary file. |
---|
119 | This part contains values that will be directly written to Pokey |
---|
120 | registers ($D200-$D208) in 1/50s intervals (or intervals defined |
---|
121 | with FASTPLAY tag). |
---|
122 | TIME xx:xx - Song duration. This is actually already supported by SAP WinAMP |
---|
123 | plug-in. It's still unclear how will subsongs be handled with |
---|
124 | TIME tag. Possibly it will also support tenths or hundredths of |
---|
125 | second (xx:xx.x or xx:xx.xx). |
---|
126 | |
---|
127 | Example of the header: |
---|
128 | SAP |
---|
129 | AUTHOR "Jakub Husak" |
---|
130 | NAME "Inside" |
---|
131 | DATE "1990" |
---|
132 | SONGS 3 |
---|
133 | DEFSONG 0 |
---|
134 | TYPE B |
---|
135 | INIT 0F80 |
---|
136 | PLAYER 247F |
---|
137 | |
---|
138 | |
---|
139 | Second part - binary data |
---|
140 | ~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
141 | This part contains player and music data represented in Atari binary file |
---|
142 | format. This format has two bytes header FF,FF. The following two bytes tell |
---|
143 | the loader where to load data, and next two bytes tell where the data end. |
---|
144 | Init data block ($02E2,$02E3) is not supported. |
---|
145 | |
---|
146 | A little example: |
---|
147 | |
---|
148 | FF FF 00 20 04 20 01 42 A3 04 D5 |
---|
149 | \___/ \_________/ \____________/ |
---|
150 | A B C |
---|
151 | |
---|
152 | A - Binary file header identification (always FF FF) |
---|
153 | B - Load addres (StartAddr, EndAddr in LO,HI order - $2000 to $2004) |
---|
154 | C - Data (that will be loaded from StartAddr) |
---|
155 | |
---|
156 | This example will load values 01,42,A3,04,D5 into memory from $2000 to $2004. |
---|
157 | |
---|
158 | |
---|
159 | How to create .SAP file |
---|
160 | ~~~~~~~~~~~~~~~~~~~~~~~ |
---|
161 | First of all we need to rip music from a game or a demo and save it in Atari |
---|
162 | binary file. Next we can create a text file with description (as described |
---|
163 | above), then we can make .sap file by linking these two files. We can do that |
---|
164 | using DOS command "copy", e.g.: |
---|
165 | |
---|
166 | copy /b music.txt+music.bin music.sap |
---|
167 | |
---|
168 | The file is made now! |
---|
169 | If you didn't find that song in ASMA, feel free to send it to pg@dspaudio.com |
---|
170 | with all needed information (see ASMA.TXT for details). The song should be |
---|
171 | then included in the nearest ASMA update. |
---|