source: tags/asma-3.4/Docs/Sap.txt

Last change on this file was 58, checked in by pfusik, 15 years ago

Imported ASMA 3.3

File size: 7.0 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 year 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-1994"
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            1.
40DEFSONG   - first song which will be played when .sap is loaded (i.e. the
41            main game theme). This value is counted from zero (if there are 5
42            songs in the file and the last is the default, the value will be
43            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 song put here the value 156 (312/2). 99% of songs
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 - song 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
57MUSIC 1234
58INIT 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
89         initialized as follows:
90
91         lda #DEFSONG
92         jsr INIT
93
94         in 1/50 intervals will be executed:
95
96         jsr PLAYER
97
98TYPE S - SoftSynth. Like type "C", this type is temporary, and is used only
99         for special type of songs, that were composed using program
100         SoftSynth.
101TYPE D - Digital. In SAP file with this type, there must be also defined
102         commands "INIT" and "PLAYER". "PLAYER" (like in type B) sets
103         address of procedure that will be called in 1/50s intervals and
104         (like in type B) must end with RTS opcode. INIT this time is a bit
105         different. It sets address of procedure that will be called (with
106         number of song in register A) to initialize program, but it can't
107         end with RTS. It should start playing digis in endless loop. In SAP
108         player two ANTIC registers $D40A and $D40B are emulated. They help
109         playing samples. D40B register increases its contents each two
110         screen lines. D40A holds CPU till the end of actually drawn line.
111         SAP emulates Atari in PAL with disabled screen. It means that we
112         have 312 lines per screen, each taking 105 CPU cycles and 9 cycles
113         of memory refresh (114 cycles per line).
114
115One more type is recognized by SAP player - TYPE M. Right now it's exactly
116the same as TYPE B but this differentiation is for future SAP releases.
117
118Planned features:
119TYPE R - Registers. In this type, binary part is not an Atari binary file.
120         This part contains values that will be directly written to Pokey
121         registers ($D200-$D208) in 1/50s intervals (or intervals defined
122         with FASTPLAY tag).
123TIME mm:ss.ttt [LOOP]- Song duration in minutes, seconds and thousandths. In
124                       files with subsongs the TIME tag may occur more times
125                       (eg. 3 times if there are 3 subsongs total). The
126                       optional LOOP string can be added if the song loops in
127                       an endless loop.
128
129Example of the header:
130SAP
131AUTHOR "Jakub Husak"
132NAME "Inside"
133DATE "1990"
134SONGS 3
135TYPE B
136INIT 0F80
137PLAYER 247F
138TIME 06:37.62
139TIME 02:34.02 LOOP
140TIME 00:15.40 LOOP
141
142Second part - binary data
143~~~~~~~~~~~~~~~~~~~~~~~~~
144This part contains player and music data represented in Atari binary file
145format. This format has two bytes header FF,FF. The following two bytes tell
146the loader where to load data, and next two bytes tell where the data end.
147Init data block ($02E2,$02E3) is not supported.
148
149A little example:
150
151FF FF 00 20 04 20 01 42 A3 04 D5
152\___/ \_________/ \____________/
153  A        B            C
154
155A - Binary file header identification (always FF FF)
156B - Load addres (StartAddr, EndAddr in LO,HI order - $2000 to $2004)
157C - Data (that will be loaded from StartAddr)
158
159This example will load values 01,42,A3,04,D5 into memory from $2000 to $2004.
160
161
162How to create .SAP file
163~~~~~~~~~~~~~~~~~~~~~~~
164First of all we need to rip music from a game or a demo and save it in Atari
165binary file. Next we can create a text file with description (as described
166above), then we can make .sap file by linking these two files. We can do that
167using DOS command "copy", e.g.:
168
169copy /b music.txt+music.bin music.sap
170
171The file is made now!
172If you didn't find that song in ASMA, feel free to send it to pg@dspaudio.com
173with all needed information (see ASMA.TXT for details). The song should be
174then included in the nearest ASMA update.
Note: See TracBrowser for help on using the repository browser.