Closed ghost closed 3 years ago
Thanks, this is quite helpful!
The music engine looks more similar to Gen 1 than Gen 2, so take a look at the pokered PR for it. One cue is that stereo_panning
is command $ee here, not $ef like in Gen 2, and its input is more complicated than just TRUE/FALSE. Here's the Gen 1 definition:
; arguments: left output enable mask, right output enable mask
const stereo_panning_cmd ; $ee
stereo_panning: MACRO
db stereo_panning_cmd
db (\1 << 4) | \2 ; this could just be "dn \1, \2" instead
ENDM
So db $EE, $46
would be stereo_panning 4, 6
, and db $EE, $29
would be stereo_panning 2, 9
.
@dannye Can you please take a look at this before merging?
I'm not convinced audio command $ee
is stereo panning. At least, command $ee
takes two parameter bytes, not one.
audio/songs/oakintro.asm
in pokegold-spaceworld is actually audio/music/routes2.asm
from pokered.
Here is an excerpt from pokered (with formatting for clarity):
note E_, 8
note F#, 2
note E_, 2
note D_, 2
note D_, 1
note E_, 1
Here is that same excerpt from pokegold-spaceworld:
note E_, 8
note F#, 2
note E_, 2
stereo_panning 4, 6
note D#, 6
note D_, 2
note D_, 1
note E_, 1
Notice there is an extra D#
for 6 ticks that is not in the original. This is not a real note.
The handler routine for command $ee
is at 3a:4a87
.
A little bit into that routine, at 3a:4a9e
, there is:
inc de
inc de
This skips right past two bytes after the $ee
command id. The two bytes are never read.
(The $ee
is at 3b:4763
. The two inc de
s move de
from $4764
to $4766
.)
There is a condition where the two inc de
s are skipped - when [$c1b5 + wCurChannel]
is non-zero.
In this case, 3a:4c65
is called twice, reading one of the two parameter bytes each time.
Audio command $ee
appears to be a conditional jump.
The two parameter bytes in the case of audio/songs/oakintro.asm
(AKA, routes 2), are $46, $45
.
They cause the channel to jump to 3b:4546
(Music_Route1_Ch2
), a totally different song.
It appears to be unknownmusic0xee
/MusicEE:
from pokecrystal.
@jd-0 Just change stereo_panning
to unknownmusic0xee
and this can be merged,
@jd-0 Please read my explanation of unknownmusic0xee
above. The command takes two parameter bytes, not one.
Used pret/pokecrystal #650 as reference. Unsure how to do "stereo_panning" for route1, line 165 and for oakintro, line 212