source: trunk/asma/Docs/Sap.txt @ 49

Last change on this file since 49 was 38, checked in by pfusik, 23 years ago

Imported ASMA 2.3

File size: 6.9 KB
Line 
1SAP file divides into two parts. First part (in text format) describes
2player/music type and contains credits for the song. Second part (in binary
3format) contains player and music data formed into Atari Binary File format.
4
5
6First part - text info
7~~~~~~~~~~~~~~~~~~~~~~
8For identification of the format, it always starts with "SAP" string.
9After that the credits follow. However, this is not fixed order, just a
10recommendation. Each line should end with EOL string (0D 0A).
11
12Credits tags:
13AUTHOR "" - 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)"
19NAME "" - 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"
23DATE "" - 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
31After that the player info follows:
32TYPE      - player type (see below)
33PLAYER    - address of player part which will be executed in 1/50 sec
34            intervals (or as defined with FASTPLAY)
35MUSIC     - address with music data (for C type)
36INIT      - address of player part which will init player (for all types
37            except C)
38SONGS     - number of songs. If SONGS tag not defined, the default value is
39            0.
40DEFSONG   - 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.
44FASTPLAY  - 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)
51STEREO - tune uses dual POKEY configuration.
52
53commands PLAYER, MUSIC, INIT contain addresses in hexadecimal format. Both
54lower- and uppercase characters are allowed for the number.
55
56PLAYER A000
57PLAYER 1234
58MUSIC  f42e
59
60commands SONGS, DEFSONG contain decimal numbers:
61
62SONGS 10
63DEFSONG 9
64
65command TYPE contains single character which describes player type. The
66following player types are supported:
67
68TYPE 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
87TYPE 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
97TYPE 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.
100TYPE 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
114One more type is recognized by SAP player - TYPE M. Right now it's exactly
115the same as TYPE B but this differentiation is for future SAP releases.
116
117Planned features:
118TYPE 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).
122TIME 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
127Example of the header:
128SAP
129AUTHOR "Jakub Husak"
130NAME "Inside"
131DATE "1990"
132SONGS 3
133DEFSONG 0
134TYPE B
135INIT 0F80
136PLAYER 247F
137
138
139Second part - binary data
140~~~~~~~~~~~~~~~~~~~~~~~~~
141This part contains player and music data represented in Atari binary file
142format. This format has two bytes header FF,FF. The following two bytes tell
143the loader where to load data, and next two bytes tell where the data end.
144Init data block ($02E2,$02E3) is not supported.
145
146A little example:
147
148FF FF 00 20 04 20 01 42 A3 04 D5
149\___/ \_________/ \____________/
150  A        B            C
151
152A - Binary file header identification (always FF FF)
153B - Load addres (StartAddr, EndAddr in LO,HI order - $2000 to $2004)
154C - Data (that will be loaded from StartAddr)
155
156This example will load values 01,42,A3,04,D5 into memory from $2000 to $2004.
157
158
159How to create .SAP file
160~~~~~~~~~~~~~~~~~~~~~~~
161First of all we need to rip music from a game or a demo and save it in Atari
162binary file. Next we can create a text file with description (as described
163above), then we can make .sap file by linking these two files. We can do that
164using DOS command "copy", e.g.:
165
166copy /b music.txt+music.bin music.sap
167
168The file is made now!
169If you didn't find that song in ASMA, feel free to send it to pg@dspaudio.com
170with all needed information (see ASMA.TXT for details). The song should be
171then included in the nearest ASMA update.
Note: See TracBrowser for help on using the repository browser.