| 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 apostroph instead.
|
|---|
| 21 | Example:
|
|---|
| 22 | NAME "Jocky Wilson's Darts Challenge"
|
|---|
| 23 | DATE "" - 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 |
|
|---|
| 30 | After that the player info follows:
|
|---|
| 31 | TYPE - player type
|
|---|
| 32 | PLAYER - address of player part which will be executed in 1/50 sec
|
|---|
| 33 | intervals (or as definet with FASTPLAY)
|
|---|
| 34 | MUSIC - address with music data (for type C)
|
|---|
| 35 | INIT - address of player part which will init player (for all types
|
|---|
| 36 | except C)
|
|---|
| 37 | SONGS - number of songs. If SONGS tag not defined, the default value is
|
|---|
| 38 | 0.
|
|---|
| 39 | DEFSONG - 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.
|
|---|
| 43 | FASTPLAY - 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)
|
|---|
| 50 | STEREO - tune uses dual POKEY configuration.
|
|---|
| 51 |
|
|---|
| 52 | commands PLAYER, MUSIC, INIT contain addresses in hexadecimal format. Both
|
|---|
| 53 | lower- and uppercase characters are allowed for the number.
|
|---|
| 54 |
|
|---|
| 55 | PLAYER A000
|
|---|
| 56 | PLAYER 1234
|
|---|
| 57 | MUSIC f42e
|
|---|
| 58 |
|
|---|
| 59 | commands SONGS, DEFSONG contain decimal numbers:
|
|---|
| 60 |
|
|---|
| 61 | SONGS 10
|
|---|
| 62 | DEFSONG 9
|
|---|
| 63 |
|
|---|
| 64 | command TYPE contains single character which describes player type. The
|
|---|
| 65 | following player types are supported:
|
|---|
| 66 |
|
|---|
| 67 | TYPE 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 |
|
|---|
| 86 | TYPE 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 |
|
|---|
| 96 | TYPE 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.
|
|---|
| 99 | TYPE 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 |
|
|---|
| 113 | One more type is recognized by SAP player - TYPE M. Right now it's exactly
|
|---|
| 114 | the same as TYPE B but this differentiation is for future SAP releases.
|
|---|
| 115 |
|
|---|
| 116 | Planned features:
|
|---|
| 117 | TYPE 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.
|
|---|
| 120 | TIME xx:xx - Song duration. This is actually already supported by SAP WinAMP
|
|---|
| 121 | plug-in
|
|---|
| 122 |
|
|---|
| 123 | Example of the header:
|
|---|
| 124 | SAP
|
|---|
| 125 | AUTHOR "Jakub Husak"
|
|---|
| 126 | NAME "Inside"
|
|---|
| 127 | DATE "1990"
|
|---|
| 128 | SONGS 3
|
|---|
| 129 | DEFSONG 0
|
|---|
| 130 | TYPE B
|
|---|
| 131 | INIT 0F80
|
|---|
| 132 | PLAYER 247F
|
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 | Second part - binary data
|
|---|
| 136 | ~~~~~~~~~~~~~~~~~~~~~~~~~
|
|---|
| 137 | This part contains player and music data represented in Atari binary file
|
|---|
| 138 | format. This format has two bytes header FF,FF. Next two bytes tell loader,
|
|---|
| 139 | where to load data, and next two bytes describes where the data end.
|
|---|
| 140 | Init data block ($02E2,$02E3) is not supported.
|
|---|
| 141 |
|
|---|
| 142 | A little example:
|
|---|
| 143 |
|
|---|
| 144 | FF FF 00 20 04 20 01 42 A3 04 D5
|
|---|
| 145 | \___/ \_________/ \____________/
|
|---|
| 146 | A B C
|
|---|
| 147 |
|
|---|
| 148 | A - Binary file header identification (always FF FF)
|
|---|
| 149 | B - Load addres (StartAddr, EndAddr in LO,HI order - $2000 to $2004)
|
|---|
| 150 | C - Data (that will be loaded from StartAddr)
|
|---|
| 151 |
|
|---|
| 152 | This example will load values 01,42,A3,04,D5 into memory from $2000 to $2004.
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 | How to create .SAP file
|
|---|
| 156 | ~~~~~~~~~~~~~~~~~~~~~~~
|
|---|
| 157 | First of all we need to rip music from a game or a demo and save it in atari
|
|---|
| 158 | binary file. Next we can create text file with commands (described above),
|
|---|
| 159 | then we can make .sap file by linking thwse two files. We can do that using
|
|---|
| 160 | DOS command "copy", e.g.:
|
|---|
| 161 |
|
|---|
| 162 | copy /b music.txt+music.bin music.sap
|
|---|
| 163 |
|
|---|
| 164 | The file is made now!
|
|---|
| 165 | If you didn't find that song in ASMA, feel free to send it to p
|
|---|
| 166 | g@dspaudio.com with all needed information (see ASMA.TXT for details). The
|
|---|
| 167 | song should be then included in the nearest ASMA update.
|
|---|