Define first_music_cmd

This replaces the uses of $d0 in the audio engine with proper constants.
This commit is contained in:
mid-kid 2018-11-21 12:12:22 +01:00
parent 4e3ed078f9
commit 725cee7371
3 changed files with 7 additions and 6 deletions

View File

@ -1136,9 +1136,9 @@ ReadNoiseSample:
ParseMusic: ParseMusic:
; parses until a note is read or the song is ended ; parses until a note is read or the song is ended
call GetMusicByte ; store next byte in a call GetMusicByte ; store next byte in a
cp endchannel_cmd ; is the song over? cp endchannel_cmd
jr z, .endchannel jr z, .endchannel
cp $d0 ; is it a note? cp first_music_cmd
jr c, .readnote jr c, .readnote
; then it's a command ; then it's a command
.readcommand .readcommand
@ -1350,7 +1350,7 @@ ParseMusicCommand:
; reload command ; reload command
ld a, [wCurMusicByte] ld a, [wCurMusicByte]
; get command # ; get command #
sub $d0 ; first command sub first_music_cmd
ld e, a ld e, a
ld d, 0 ld d, 0
; seek command pointer ; seek command pointer

View File

@ -24,11 +24,11 @@
const CHAN3 ; 2 const CHAN3 ; 2
const CHAN4 ; 3 const CHAN4 ; 3
NUM_MUSIC_CHANS EQU const_value NUM_MUSIC_CHANS EQU const_value
NUM_NOISE_CHANS EQU const_value
const CHAN5 ; 4 const CHAN5 ; 4
const CHAN6 ; 5 const CHAN6 ; 5
const CHAN7 ; 6 const CHAN7 ; 6
const CHAN8 ; 7 const CHAN8 ; 7
NUM_NOISE_CHANS EQU const_value - NUM_MUSIC_CHANS
NUM_CHANNELS EQU const_value NUM_CHANNELS EQU const_value
; channel_struct members (see macros/wram.asm) ; channel_struct members (see macros/wram.asm)

View File

@ -21,12 +21,13 @@ ENDM
; MusicCommands indexes (see audio/engine.asm) ; MusicCommands indexes (see audio/engine.asm)
enum_start $d8 enum_start $d8
first_music_cmd EQU __enum__ + -8
enum notetype_cmd ; $d8
octave: MACRO octave: MACRO
db notetype_cmd - (\1) db first_music_cmd + 8 - (\1)
ENDM ENDM
enum notetype_cmd ; $d8
notetype: MACRO notetype: MACRO
db notetype_cmd db notetype_cmd
db \1 ; note_length db \1 ; note_length