Code: Select all
SOUNDTRACKER TECHNICAL REFERENCE
--------------------------------
(C) 1993 RAMSOFT
Document revision 1.0 (30/07/93)
UNCOMPILED SONGS STRUCTURE
Start address= 25000 (61A8h)
Lenght= 3009 (0BC1h)+576 (0240h)x[number of patterns]
Start = uncompiled samples
Start + 1950 (079Eh) = positions map
Start + 2462 (099Eh) = song's lenght in patterns
Start + 2463 (099Fh) = uncompiled ornaments
Start + 3007 (0BBFh) = delay value
Start + 3008 (0BC0h) = patterns lenght
Start + 3009 (0BC1h) = patterns data
UNCOMPILED SAMPLES STRUCTURE
Length= 130 (82h) bytes per sample
Bytes 00-31 (00h-1Fh) = envelope values (volumes)
Bytes 32-63 (20h-3Fh) = noise values
Bytes 64-127 (40h-7Fh) = addition for effects
Byte 128 (80h) = repeat value
Byte 129 (81h) = repeat lenght value
Note: bit 4 of additions is for sign.
UNCOMPILED POSITIONS MAP STRUCTURE
Lenght= 2 bytes per positions
Byte 1 = pattern number in position
Byte 2 = height of pattern in this position
UNCOMPILED ORNAMENT STRUCTURE
Lenght= 32 (20h) bytes per ornament
Positive values = normal
Negative values = obtained with one's complement
UNCOMPILED PATTERN STRUCTURE
Lenght= 576 (0240h) bytes per pattern
Lenght of location data= 9 bytes (3 bytes per channel)
Channel data sequence= A,B,C.
Byte n.1: bits 0-2 = octave number
bit 3 = flat note flag (0=no;1=yes)
bits 4-6 = note name (0=A;7=G)
bit 7 = rest flag
Byte n.2: bits 0-3 = effect selected number
bits 4-7 = sample number
Byte n.3: bits 0-3 = low part of effect or ornament number
bits 4-7 = high part of effect
----------------------------------------------------------------
COMPILED SONG STRUCTURE
Start = delay value
Start + 1 = offset of positions map
Start + 3 = offset of compiled ornaments
Start + 5 = offset of patterns data
Start + 27 (1Bh) = compiled samples
Note: every offset must be added to 'Start' address.
COMPILED POSITIONS MAP STRUCTURE
Byte 1 = song's lenght in patterns
Remaining bytes are the same as uncompiled.
End marker = 255 (FFh)
COMPILED ORNAMENTS STRUCTURE
Lenght of compiled ornament = 33 (21h) bytes
Byte 1 = ornament number
Remaining bytes are the same as uncompiled.
Note:ornaments are stored from number 0 (empty ornament)
COMPILED PATTERNS DATA STRUCTURE
Lenght of each pattern data = 7 bytes
Byte 1 = pattern number
Bytes 2/3 = offset of channel A data
Bytes 4/5 = offset of channel B data
Bytes 6/7 = offset of channel C data
COMPILED SAMPLES STRUCTURE
Lenght of compiled sample = 99 (63h) bytes
Byte 1 (01h) = sample number
Bytes 02-97 (02h-61h) = 32 (20h) groups of 3 bytes; each group
holds the values for envelope,noise
and addition for effects
Byte 98 (62h) = repeat value
Byte 99 (63h) = repeat lenght value
Each group of 3 bytes is arranged as below:
Byte n.1: bits 0-3 = envelope value (volume)
bits 4-7 = high part of addition for effects
Byte n.2: bits 0-4 = noise value
bit 5 = addition for effects sign
bit 6 = envelope mask setting
bit 7 = noise mask setting
Byte n.3: bits 0-8 = low part of addition for effects
CODES MEANING ON CHANNEL DATA
If: code<96 (60h) => bits 0-4 = note in semitones (00=C-1)
code<112 (70h) => bits 0-4 = sample number
code<128 (80h) => bits 0-4 = ornament number
code=128 (80h) => rest (shuts channel)
code=129 (81h) => empty location
code=130 (82h) => selects ornament 0
code<143 (8Fh) => selects effect
code=255 (FFh) => end channel data
Codes between 161 (A1h) and 224 (E0h),by subtracting 161 (A1h),
tell the number of empty locations after the subsequent code.
-----------------------------------------------------------------------------
Converted from Tasword II with Ramsoft TAS2TXT
it should be noted that the uncompiled SNG data is laid out in memeory slightly different to that in the document above BUT it is what i observed on a zx spectrum
Code: Select all
;=================
;
;SONG DATA FORMAT IS SET OUT BELOW
;
;SECTION IS PARTLY HERE FOR REFERENCE
;
;AND PARTLY TO PROVIDE ADDRESS 'LABELS'
;
;FOR THE CODE ABOVE
;
SONG_DATA_START: EQU 28282
;THIS LAYOUT DIFFERS FROM THE DOCUMENTATION
; BUT MATCHED THAT OBSERVED ON A ZX SPECTRUM
;UNCOMPILED PATTERN STRUCTURE
;
; Lenght= 576 (0240h) bytes per pattern
; Lenght of location data= 9 bytes (3 bytes per channel)
; Channel data sequence= A,B,C.
;
; Byte n.1: bits 0-2 = octave number
; bit 3 = flat note flag (0=no;1=yes)
; bits 4-6 = note name (0=A;7=G)
; bit 7 = rest flag
;
; Byte n.2: bits 0-3 = effect selected number
; bits 4-7 = sample number
;
; Byte n.3: bits 0-3 = low part of effect or ornament number
; bits 4-7 = high part of effect
PATTERN_DATA: EQU SONG_DATA_START
; UNCOMPILED SAMPLES STRUCTURE
;
; Length= 130 (82h) bytes per sample
;
; Bytes 00-31 (00h-1Fh) = envelope values (volumes)
; Bytes 32-63 (20h-3Fh) = noise values
; Bytes 64-127 (40h-7Fh) = addition for effects
; Byte 128 (80h) = repeat value
; Byte 129 (81h) = repeat lenght value
;
; Note: bit 4 of additions is for sign.
SAMPLES: EQU SONG_DATA_START+ (576*31) ;31 PATTERNS @ 576 BYTES EACH
SAMPLE_1: EQU SAMPLES
SAMPLE_1_ENVELOPE: EQU SAMPLE_1 ;ENVELOPE VALUES
SAMPLE_1_NOISE: EQU SAMPLE_1+32
SAMPLE_1_ADDITION: EQU SAMPLE_1+64 ;ADDITION FOR EFFECT
SAMPLE_1_REPEAT: EQU SAMPLE_1+128 ;REPEAT VALUE
SAMPLE_1_LENGTH: EQU SAMPLE_1+129 ;REPEAT LENGTH
SAMPLE_2: EQU SAMPLE_1+130
SAMPLE_3: EQU SAMPLE_2+130
SAMPLE_4: EQU SAMPLE_3+130
SAMPLE_5: EQU SAMPLE_4+130
SAMPLE_6: EQU SAMPLE_5+130
SAMPLE_7: EQU SAMPLE_6+130
SAMPLE_8: EQU SAMPLE_7+130
SAMPLE_9: EQU SAMPLE_8+130
SAMPLE_A: EQU SAMPLE_9+130
SAMPLE_B: EQU SAMPLE_A+130
SAMPLE_C: EQU SAMPLE_B+130
SAMPLE_D: EQU SAMPLE_C+130
SAMPLE_E: EQU SAMPLE_D+130
SAMPLE_F: EQU SAMPLE_E+130
; UNCOMPILED POSITIONS MAP STRUCTURE
;
; Lenght= 2 bytes per positions
;
; Byte 1 = pattern number in position
; Byte 2 = height of pattern in this position
POSITIONS_MAP: EQU SAMPLES + 1950 ;15 SAMPLES @ 130 BYTES EACH
SONG_LENGTH: EQU POSITIONS_MAP + 512 ;256 (0 - 255) * 2 BYTES PER POSITION.
; UNCOMPILED ORNAMENT STRUCTURE
;
; Lenght= 32 (20h) bytes per ornament
;
; Positive values = normal
; Negative values = obtained with 2'S COMPLIMENT.
ORNAMENTS: EQU SONG_LENGTH + 1
DELAY_VALUE: EQU ORNAMENTS + 544 ;(16 * 32 BYTES (ORNS ARE 32 BYTES + 32 EMPTY BYTES)))
PATTERNS_LENGTH: EQU DELAY_VALUE +1