ref: 6fddb8ba85cff55599c53736f5780db01e98f745
parent: 3453e7ce9c71c73664b061af9b77346b608b9013
author: yenatch <[email protected]>
date: Tue Mar 4 16:41:30 EST 2014
Use struct macros for audio channels in wram.
--- a/wram.asm
+++ b/wram.asm
@@ -57,38 +57,14 @@
ENDM
-SECTION "tiles0",VRAM[$8000],BANK[0]
-VTiles0::
-SECTION "tiles1",VRAM[$8800],BANK[0]
-VTiles1::
-SECTION "tiles2",VRAM[$9000],BANK[0]
-VTiles2::
-SECTION "bgmap0",VRAM[$9800],BANK[0]
-VBGMap0::
-SECTION "bgmap1",VRAM[$9C00],BANK[0]
-VBGMap1::
+channel_struct: MACRO
+; Addresses are Channel1 ($c101).
-
-
-SECTION "WRAMBank0",WRAM0[$c000]
-
-SECTION "stack",WRAM0[$c0ff]
-Stack:: ; c0ff
- ds -$100
-
-
-SECTION "audio",WRAM0[$c100]
-MusicPlaying:: ; c100
-; nonzero if playing
- ds 1
-
-Channels::
-Channel1::
-Channel1MusicID:: ; c101
+\1MusicID:: ; c101
ds 2
-Channel1MusicBank:: ; c103
+\1MusicBank:: ; c103
ds 1
-Channel1Flags:: ; c104
+\1Flags:: ; c104
; 0: on/off
; 1: subroutine
; 2:
@@ -98,7 +74,7 @@
; 6:
; 7:
ds 1
-Channel1Flags2:: ; c105
+\1Flags2:: ; c105
; 0: vibrato on/off
; 1:
; 2: duty cycle on/off
@@ -108,7 +84,7 @@
; 6:
; 7:
ds 1
-Channel1Flags3:: ; c106
+\1Flags3:: ; c106
; 0: vibrato up/down
; 1:
; 2:
@@ -118,13 +94,13 @@
; 6:
; 7:
ds 1
-Channel1MusicAddress:: ; c107
+\1MusicAddress:: ; c107
ds 2
-Channel1LastMusicAddress:: ; c109
+\1LastMusicAddress:: ; c109
ds 2
; could have been meant as a third-level address
ds 2
-Channel1NoteFlags:: ; c10d
+\1NoteFlags:: ; c10d
; 0:
; 1:
; 2:
@@ -134,10 +110,10 @@
; 6:
; 7:
ds 1
-Channel1Condition:: ; c10e
+\1Condition:: ; c10e
; used for conditional jumps
ds 1
-Channel1DutyCycle:: ; c10f
+\1DutyCycle:: ; c10f
; uses top 2 bits only
; 0: 12.5%
; 1: 25%
@@ -144,17 +120,17 @@
; 2: 50%
; 3: 75%
ds 1
-Channel1Intensity:: ; c110
+\1Intensity:: ; c110
; hi: pressure
; lo: velocity
ds 1
-Channel1Frequency::
+\1Frequency::
; 11 bits
-Channel1FrequencyLo:: ; c111
+\1FrequencyLo:: ; c111
ds 1
-Channel1FrequencyHi:: ; c112
+\1FrequencyHi:: ; c112
ds 1
-Channel1Pitch:: ; c113
+\1Pitch:: ; c113
; 0: rest
; 1: C
; 2: C#
@@ -169,15 +145,15 @@
; b: A#
; c: B
ds 1
-Channel1Octave:: ; c114
+\1Octave:: ; c114
; 0: highest
; 7: lowest
ds 1
-Channel1StartingOctave:: ; c115
+\1StartingOctave:: ; c115
; raises existing octaves by this value
; used for repeating phrases in a higher octave to save space
ds 1
-Channel1NoteDuration:: ; c116
+\1NoteDuration:: ; c116
; number of frames remaining in the current note
ds 1
; c117
@@ -184,11 +160,11 @@
ds 1
; c118
ds 1
-Channel1LoopCount:: ; c119
+\1LoopCount:: ; c119
ds 1
-Channel1Tempo:: ; c11a
+\1Tempo:: ; c11a
ds 2
-Channel1Tracks:: ; c11c
+\1Tracks:: ; c11c
; hi: l
; lo: r
ds 1
@@ -195,18 +171,18 @@
; c11d
ds 1
-Channel1VibratoDelayCount:: ; c11e
+\1VibratoDelayCount:: ; c11e
; initialized at the value in VibratoDelay
; decrements each frame
; at 0, vibrato starts
ds 1
-Channel1VibratoDelay:: ; c11f
+\1VibratoDelay:: ; c11f
; number of frames a note plays until vibrato starts
ds 1
-Channel1VibratoExtent:: ; c120
+\1VibratoExtent:: ; c120
; difference in
ds 1
-Channel1VibratoRate:: ; c121
+\1VibratoRate:: ; c121
; counts down from a max of 15 frames
; over which the pitch is alternated
; hi: init frames
@@ -225,12 +201,12 @@
ds 1
; c127
ds 1
-Channel1CryPitch:: ; c128
+\1CryPitch:: ; c128
ds 1
-Channel1CryEcho:: ; c129
+\1CryEcho:: ; c129
ds 1
ds 4
-Channel1NoteLength:: ; c12e
+\1NoteLength:: ; c12e
; # frames per 16th note
ds 1
; c12f
@@ -241,24 +217,52 @@
ds 1
; c132
ds 1
-; end
+ENDM
+SECTION "tiles0",VRAM[$8000],BANK[0]
+VTiles0::
+SECTION "tiles1",VRAM[$8800],BANK[0]
+VTiles1::
+SECTION "tiles2",VRAM[$9000],BANK[0]
+VTiles2::
+SECTION "bgmap0",VRAM[$9800],BANK[0]
+VBGMap0::
+SECTION "bgmap1",VRAM[$9C00],BANK[0]
+VBGMap1::
+
+
+
+SECTION "WRAMBank0",WRAM0[$c000]
+
+SECTION "stack",WRAM0[$c0ff]
+Stack:: ; c0ff
+ ds -$100
+
+
+SECTION "audio",WRAM0[$c100]
+MusicPlaying:: ; c100
+; nonzero if playing
+ ds 1
+
+Channels::
+Channel1:: ; c101
+ channel_struct Channel1
Channel2:: ; c133
- ds 50
+ channel_struct Channel2
Channel3:: ; c165
- ds 50
+ channel_struct Channel3
Channel4:: ; c197
- ds 50
+ channel_struct Channel4
SFXChannels::
Channel5:: ; c1c9
- ds 50
+ channel_struct Channel5
Channel6:: ; c1fb
- ds 50
+ channel_struct Channel6
Channel7:: ; c22d
- ds 50
+ channel_struct Channel7
Channel8:: ; c25f
- ds 50
+ channel_struct Channel8
; c291
ds 1