Repository navigation
Expand file tree
/
Copy pathStructs.asm
More file actions
104 lines (103 loc) · 5.36 KB
/
Copy pathStructs.asm
File metadata and controls
104 lines (103 loc) · 5.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
; ===========================================================================
; ║ ║
; ║ SONIC&K SOUND DRIVER ║
; ║ Modified SMPS Z80 Type 2 DAC ║
; ║ ║
; ===========================================================================
; Disassembled by MarkeyJester
; Routines, pointers and stuff by Linncaki
; Thoroughly commented and improved (including optional bugfixes) by Flamewing
; ===========================================================================
; Permission to use, copy, modify, and/or distribute this software for any
; purpose with or without fee is hereby granted.
;
; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
; OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
; ===========================================================================
; Structures
; ===========================================================================
; ---------------------------------------------------------------------------
; STRUCTURE zTrack
; A track structure is used to store the state of a single music or SFX track.
zTrack STRUCT DOTS
; Playback control bits:
; 0 (01h) Noise channel (PSG) or FM3 special mode (FM)
; 1 (02h) Do not attack next note
; 2 (04h) SFX is overriding this track
; 3 (08h) 'Alternate frequency mode' flag
; 4 (10h) 'Track is resting' flag
; 5 (20h) 'Pitch slide' flag
; 6 (40h) 'Sustain frequency' flag -- prevents frequency from changing again for the lifetime of the track
; 7 (80h) Track is playing
PlaybackControl: ds.b 1 ; S&K: 0
; Voice control bits:
; 0-1 FM channel assignment bits (00 = FM1 or FM4, 01 = FM2 or FM5, 10 = FM3 or FM6/DAC, 11 = invalid)
; 2 (04h) For FM/DAC channels, selects if reg/data writes are bound for part II (set) or part I (unset)
; 3 (08h) Unknown/unused
; 4 (10h) Unknown/unused
; 5-6 PSG Channel assignment bits (00 = PSG1, 01 = PSG2, 10 = PSG3, 11 = Noise)
; 7 (80h) PSG track if set, FM or DAC track otherwise
VoiceControl: ds.b 1 ; S&K: 1
TempoDivider: ds.b 1 ; S&K: 2
DataPointerLow: ds.b 1 ; S&K: 3
DataPointerHigh: ds.b 1 ; S&K: 4
Transpose: ds.b 1 ; S&K: 5
Volume: ds.b 1 ; S&K: 6
ModulationCtrl: ds.b 1 ; S&K: 7 ; Modulation is on if nonzero. If only bit 7 is set, then it is normal modulation; otherwise, this-1 is index on modulation envelope pointer table
VoiceIndex: ds.b 1 ; S&K: 8 ; FM instrument/PSG voice
StackPointer: ds.b 1 ; S&K: 9 ; For call subroutine coordination flag
AMSFMSPan: ds.b 1 ; S&K: 0Ah
DurationTimeout: ds.b 1 ; S&K: 0Bh
SavedDuration: ds.b 1 ; S&K: 0Ch ; Already multiplied by timing divisor
; ---------------------------------
; Alternate names for same offset:
SavedDAC: ; S&K: 0Dh ; For DAC channel
FreqLow: ds.b 1 ; S&K: 0Dh ; For FM/PSG channels
; ---------------------------------
FreqHigh: ds.b 1 ; S&K: 0Eh ; For FM/PSG channels
VoiceSongID: ds.b 1 ; S&K: 0Fh ; For using voices from a different song
; Nonzero while a DAC SFX owns FM6/DAC; prevents the music DAC track
; from queueing samples until the SFX releases the channel.
DACSFXPlaying:
Detune: ds.b 1 ; S&K: 10h/11h ; In S&K, some places used 11h instead of 10h
VolEnv: ds.b 1 ; S&K: 17h ; Used for dynamic volume adjustments
; ---------------------------------
; Alternate names for same offsets:
FMVolEnv: ; S&K: 18h
HaveSSGEGFlag: ds.b 1 ; S&K: 18h ; For FM channels, if track has SSG-EG data
FMVolEnvMask: ; S&K: 19h
SSGEGPointerLow: ds.b 1 ; S&K: 19h ; For FM channels, custom SSG-EG data pointer
PSGNoise: ; S&K: 1Ah
SSGEGPointerHigh: ds.b 1 ; S&K: 1Ah ; For FM channels, custom SSG-EG data pointer
; ---------------------------------
TLPtrLow: ds.b 1 ; S&K: 1Ch
TLPtrHigh: ds.b 1 ; S&K: 1Dh
NoteFillTimeout: ds.b 1 ; S&K: 1Eh
NoteFillMaster: ds.b 1 ; S&K: 1Fh
ModulationPtrLow: ds.b 1 ; S&K: 20h
ModulationPtrHigh: ds.b 1 ; S&K: 21h
; ---------------------------------
; Alternate names for same offset:
ModulationValLow: ; S&K: 22h
ModEnvSens: ds.b 1 ; S&K: 22h
; ---------------------------------
ModulationValHigh: ds.b 1 ; S&K: 23h
ModulationWait: ds.b 1 ; S&K: 24h
; ---------------------------------
; Alternate names for same offset:
ModulationSpeed: ; S&K: 25h
ModEnvIndex: ds.b 1 ; S&K: 25h
; ---------------------------------
ModulationDelta: ds.b 1 ; S&K: 26h
ModulationSteps: ds.b 1 ; S&K: 27h
LoopCounters: ds.b 2 ; S&K: 28h ; Might overflow into the following data
VoicesLow: ds.b 1 ; S&K: 2Ah ; Low byte of pointer to track's voices, used only if zUpdatingSFX is set
VoicesHigh: ds.b 1 ; S&K: 2Bh ; High byte of pointer to track's voices, used only if zUpdatingSFX is set
Stack_top: ds.b 4 ; S&K: 2Ch-2Fh ; Track stack; can be used by LoopCounters
zTrack ENDSTRUCT
; ---------------------------------------------------------------------------