dougeff wrote:Nope. Not here.
I'm of course aware that I cannot switch the bank in the place that I quoted.
That's why I asked whether it should be changed at
@update_sound: because the code that I quoted has
jmp @update_sound.
dougeff wrote:So, I think...
have the music data bank in place for most of the music update, then right about line 700
You're sure this isn't too late?
Why doesn't/shouldn't the bank switch need to be done here (line 581)?
Code: Select all
@update_sound:
;;;;;;;;;; HERE ;;;;;;;;;;
;convert envelope and channel output data into APU register values in the output buffer
lda FT_CH1_NOTE
beq @ch1cut
clc
adc FT_CH1_NOTE_OFF
Is there anything between line 581 and line 696 that still needs the bank to point to the music data?
dougeff wrote:however, other places might need a specific bank. like initializing the music, initializing the sfx, setting the song, setting a sfx, playing a dmc sample, etc. will need to have the correct data in place, or it will crash.
That's of course clear. But in this case, it's a mundane issue: Before I call a music or sound function, I simply set the corresponding bank.
But in FamiToneUpdate, music and sound are mixed, so I have to insert a macro call into "famitone2.s" itself. And here, one needs to know the internal workings of the code to do it right.
dougeff wrote:Look on the bright side. If (when) it crashes, you will know you forgot to put in the right bank. That will help you figure it out.
Forgetting is not an issue. I have wrapper functions for that stuff, so I simply need to call my own PlayMusic or PlaySound function for the regular stuff and it will take care of setting the correct bank.
The issue is whether this one code piece that needs to go
into one of the FamiTone functions, namely FamiToneUpdate, is correct and works according to FamiTone's inner implementation. (I.e. switching the bank to sound if a later code part still reads music data from ROM would be a bug introduced by me.)