summaryrefslogtreecommitdiff
path: root/audio/engine.asm
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2018-01-22 01:06:48 -0500
committerGitHub <noreply@github.com>2018-01-22 01:06:48 -0500
commitc60f1331fef22b886adf3472d2b4f348832cfaf7 (patch)
tree5a471fad61e406f5b3ca1aba67ced0186de01c52 /audio/engine.asm
parentf27f79488a460f0a89670f3611e1e9e175baf5d6 (diff)
parent7fba864883732ccecb1221ae7ff97492d112362a (diff)
Merge pull request #456 from Rangi42/master
OAM data documentation; move more content into data/; move palettes into gfx/; more code+script constants; consistent map naming
Diffstat (limited to 'audio/engine.asm')
-rw-r--r--audio/engine.asm42
1 files changed, 21 insertions, 21 deletions
diff --git a/audio/engine.asm b/audio/engine.asm
index 067e4ff87..b097648c2 100644
--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -40,7 +40,7 @@ _MapSetup_Sound_Off:: ; e8000
ld hl, Channels ; start of channel data
ld de, ChannelsEnd - Channels ; length of area to clear (entire sound wram area)
-.clearchannels ; clear Channel1-$c2bf
+.clearchannels
xor a
ld [hli], a
dec de
@@ -408,7 +408,7 @@ UpdateChannels: ; e8125
ret
.asm_e824d
- ld a, $3f
+ ld a, $3f ; sound length
ld [rNR31], a
xor a
ld [rNR30], a
@@ -1304,8 +1304,8 @@ ParseSFXOrRest: ; e8698
ld [hl], a
; are we on the last channel? (noise sampling)
ld a, [CurChannel]
- and $3
- cp $3
+ maskbits NUM_MUSIC_CHANS
+ cp CHAN4
ret z
; update hi frequency from next param
call GetMusicByte
@@ -1320,8 +1320,8 @@ GetNoiseSample: ; e86c5
; load ptr to sample header in NoiseSampleAddress
; are we on the last channel?
ld a, [CurChannel]
- and $3
- cp $3
+ and NUM_MUSIC_CHANS +- 1
+ cp CHAN4
; ret if not
ret nz
; update note duration
@@ -1668,7 +1668,7 @@ MusicEE; e883e
; if ????, jump
; get channel
ld a, [CurChannel]
- and $3 ; ch0-3
+ maskbits NUM_MUSIC_CHANS
ld e, a
ld d, 0
; hl = Channel1JumpCondition + channel id
@@ -1966,8 +1966,8 @@ Music_NoteType: ; e8963
add hl, bc
ld [hl], a
ld a, [CurChannel]
- and $3
- cp CHAN8 & $3
+ maskbits NUM_MUSIC_CHANS
+ cp CHAN4
ret z
; intensity
call Music_Intensity
@@ -2414,7 +2414,7 @@ SetLRTracks: ; e8b1b
push de
; store current channel in de
ld a, [CurChannel]
- and $3
+ maskbits NUM_MUSIC_CHANS
ld e, a
ld d, 0
; get this channel's lr tracks
@@ -2449,7 +2449,7 @@ _PlayMusic:: ; e8b30
call LoadMusicByte ; store first byte of music header in a
rlca
rlca
- and $3 ; get number of channels
+ maskbits NUM_MUSIC_CHANS
inc a
.loop
; start playing channels
@@ -2474,7 +2474,7 @@ _PlayMusic:: ; e8b30
; e8b79
-_PlayCryHeader:: ; e8b79
+_PlayCry:: ; e8b79
; Play cry de using parameters:
; CryPitch
; CryLength
@@ -2505,7 +2505,7 @@ _PlayCryHeader:: ; e8b79
; Top 2 bits contain the number of channels
rlca
rlca
- and 3
+ maskbits NUM_MUSIC_CHANS
; For each channel:
inc a
@@ -2530,8 +2530,8 @@ _PlayCryHeader:: ; e8b79
; No tempo for channel 4
ld a, [CurChannel]
- and 3
- cp 3
+ maskbits NUM_MUSIC_CHANS
+ cp CHAN4
jr nc, .start
; Tempo is effectively length
@@ -2669,7 +2669,7 @@ _PlaySFX:: ; e8c04
call LoadMusicByte
rlca ; top 2
rlca ; bits
- and $3
+ maskbits NUM_MUSIC_CHANS
inc a ; # channels -> # loops
.startchannels
push af
@@ -2722,7 +2722,7 @@ PlayStereoSFX:: ; e8ca6
call LoadMusicByte
rlca
rlca
- and 3 ; ch1-4
+ maskbits NUM_MUSIC_CHANS
inc a
.loop
@@ -2736,7 +2736,7 @@ PlayStereoSFX:: ; e8ca6
push de
; get tracks for this channel
ld a, [CurChannel]
- and 3 ; ch1-4
+ maskbits NUM_MUSIC_CHANS
ld e, a
ld d, 0
call GetLRTracks
@@ -2749,7 +2749,7 @@ PlayStereoSFX:: ; e8ca6
add hl, bc
ld [hl], a
- ld hl, Channel1Field30 - Channel1 ; $c131 - Channel1
+ ld hl, Channel1Field30 - Channel1
add hl, bc
ld [hl], a
@@ -2760,11 +2760,11 @@ PlayStereoSFX:: ; e8ca6
; ch3-4
ld a, [wSFXDuration]
- ld hl, Channel1Field2e - Channel1 ; $c12f - Channel1
+ ld hl, Channel1Field2e - Channel1
add hl, bc
ld [hl], a
- ld hl, Channel1Field2f - Channel1 ; $c130 - Channel1
+ ld hl, Channel1Field2f - Channel1
add hl, bc
ld [hl], a