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

Last change on this file since 34 was 34, checked in by pfusik, 24 years ago

Imported ASMA 2.1

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