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