1 | SAP file divides into two parts. First part (in text format) describes |
---|
2 | player/music type. Second part (in binary format) contains player and music |
---|
3 | data formed into Atari Binary File Format. This format has two bytes header |
---|
4 | FF,FF. Next two bytes tell loader, where to load data, and next two bytes |
---|
5 | describes where the data end. |
---|
6 | Init data block ($02E2,$02E3) is not supported. |
---|
7 | |
---|
8 | A little example: |
---|
9 | |
---|
10 | FF FF 00 20 05 20 01 42 A3 04 D5 |
---|
11 | \___/ \_________/ \____________/ |
---|
12 | A B C |
---|
13 | |
---|
14 | A - Binary file header identification (always FF FF) |
---|
15 | B - Load addres (StartAddr, EndAddr in LO,HI order - $2000 to $2005) |
---|
16 | C - Data (that will be loaded from StartAddr) |
---|
17 | |
---|
18 | This example will load values 01,42,A3,04,D5 into memory from $2000 to |
---|
19 | $2005. |
---|
20 | |
---|
21 | |
---|
22 | Player Description format (first part of .sap file) |
---|
23 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
24 | This description (in text format) is loaded line per line. Each line contains |
---|
25 | command with parameters. Other lines which are not recognized are treated as |
---|
26 | comment lines. Right now only these commands are supported: |
---|
27 | |
---|
28 | TYPE - player type |
---|
29 | PLAYER - address of player part which will be executed in 1/50 sec |
---|
30 | intervals |
---|
31 | MUSIC - address with data |
---|
32 | INIT - address of player part which will init player |
---|
33 | SONGS - number of songs |
---|
34 | DEFSONG - first song which will be played when .sap will be loaded |
---|
35 | FASTPLAY - number of lines between each call of playing routine (312 by |
---|
36 | default, which is one screen - 1/50 of sec.). For example for |
---|
37 | double-speed tune put here the value 156 (312/2). 99% of tunes |
---|
38 | are single-speed which means that you don't have to define the |
---|
39 | FASTPLAY variable for them. Works for player TYPE "B". |
---|
40 | |
---|
41 | commands PLAYER, MUSIC, INIT contain addresses in hexadecimal format: |
---|
42 | |
---|
43 | PLAYER A000 |
---|
44 | PLAYER 1234 |
---|
45 | MUSIC F400 |
---|
46 | |
---|
47 | commands SONGS, DEFSONG contain decimal numbers: |
---|
48 | |
---|
49 | SONGS 10 |
---|
50 | DEFSONG 9 |
---|
51 | |
---|
52 | command TYPE contains single character which describes player type. Right now |
---|
53 | only the following characters are supported: |
---|
54 | |
---|
55 | TYPE C |
---|
56 | TYPE B |
---|
57 | TYPE M |
---|
58 | TYPE S |
---|
59 | TYPE D |
---|
60 | TYPE R |
---|
61 | |
---|
62 | TYPE C - player from CMC (Chaos Music Composer). In this case, also these |
---|
63 | commands must appear: PLAYER, MUSIC, SONGS, and DEFSONG. Player will |
---|
64 | be initialized as follows: |
---|
65 | |
---|
66 | lda #$70 |
---|
67 | ldx #<MUSIC |
---|
68 | ldy #>MUSIC |
---|
69 | jsr PLAYER+6 |
---|
70 | lda #$00 |
---|
71 | ldx #DEFSONG |
---|
72 | jsr PLAYER+6 |
---|
73 | |
---|
74 | in 1/50 intervals will be executed: |
---|
75 | |
---|
76 | jsr PLAYER+3 |
---|
77 | |
---|
78 | TYPE M - player from ???????? (this player was used by composers like Adam |
---|
79 | Gilmore, David Whittaker, etc). In this case, also these commands |
---|
80 | must appear: PLAYER, INIT, SONGS, and DEFSONG. Player will be |
---|
81 | initialized as follows: |
---|
82 | |
---|
83 | lda #DEFSONG |
---|
84 | jsr INIT |
---|
85 | |
---|
86 | in 1/50 intervals will be executed: |
---|
87 | |
---|
88 | jsr PLAYER |
---|
89 | |
---|
90 | TYPE B - any player. In this case, also these commands must appear: PLAYER, |
---|
91 | INIT, SONGS, and DEFSONG. Player will be initialized as follows: |
---|
92 | |
---|
93 | lda #DEFSONG |
---|
94 | jsr INIT |
---|
95 | |
---|
96 | in 1/50 intervals will be executed: |
---|
97 | |
---|
98 | jsr PLAYER |
---|
99 | |
---|
100 | TYPE B is right now exactly the same like TYPE M but this |
---|
101 | distinguish is for future SAP releases. |
---|
102 | |
---|
103 | TYPE S - SoftSynth. Like type "C", this type is temporary, and is used only |
---|
104 | for special type of songs, that where composed using program |
---|
105 | SoftSynth. |
---|
106 | TYPE D - Digital. In SAP file with this type, must be also defined commands |
---|
107 | "INIT" and "PLAYER". "PLAYER" (like in type "B") sets address of |
---|
108 | procedure that will be called in 1/50s intervals and (like in type |
---|
109 | "B") must end with RTS opcode. INIT this time is a bit different. It |
---|
110 | sets address of procedure that will be called (with number of song |
---|
111 | in register A) to initialize program, but it can't end with RTS. It |
---|
112 | should start playing digis in endless loop. In SAP player there are |
---|
113 | emulated two ANTIC registers $D40A and $D40B that can help playing |
---|
114 | samples. D40B register increases its contents each two screen lines. |
---|
115 | D40A holds CPU till the end of actually created line. SAP emulates |
---|
116 | Atari in PAL with disabled screen. It means that we have 312 PAL |
---|
117 | lines, while each lines has 105 CPU cycles and 9 cycles of memory |
---|
118 | refresh (114 cycles per line). |
---|
119 | |
---|
120 | Planned features: |
---|
121 | TYPE R - Registers. In this type, binary part is not an Atari binary file. |
---|
122 | This part contains values that will be directly written to Pokey |
---|
123 | registers ($D200-$D208) in 1/50s intervals. |
---|
124 | TIME xx:xx - song duration |
---|
125 | |
---|
126 | How to create .SAP file |
---|
127 | ~~~~~~~~~~~~~~~~~~~~~~~ |
---|
128 | First of all we need to rip music from a game or a demo and save it in atari |
---|
129 | binary file. Next we can create text file with commands (described above), |
---|
130 | then we can make .sap file by linking thwse two files. We can do that using |
---|
131 | DOS command "copy", e.g.: |
---|
132 | |
---|
133 | copy /b music.txt+music.bin music.sap |
---|
134 | |
---|
135 | The file is done now! |
---|
136 | If you didn't find that song in ASMA, feel free to send it to pg@pinknet.cz |
---|
137 | with all needed information (see ASMA.TXT for detailed information). The song |
---|
138 | should be included in the nearest ASMA update. |
---|