Hi,so...I'm running this third or fourth time,but i don't know how to fix it(I mean,it's HAVE to be subroutine...)
I just using this code:
But game is crashing!
If i replace rts with jump to a label just after "jsr Music_Init"then it's working fine,but RTS is crashing game...
I noticed that RAM $100-$200 is randomly changed,but...debugger can't show what code is changing that RAM!
I just using this code:
Code:
jsr Music_Init
**Some code here**
Music_Init:
; ignore IRQs
sei
; This must be done BEFORE calling any routines, since
; it sets the stack pointer
ldx #$FF
txs
; Now init the music. First, select the song index
ldx #$00
; Then store the address of the intented music data, if any.
lda #LOW(songData1)
sta ft_music_addr
lda #HIGH(songData1)
sta ft_music_addr + 1
; Finally select the song inside the music data
lda #$0 ; track 0
ldx #$0 ; NTSC
jsr ft_music_init
; init default value for ppu_crtl flags + activate NMI
lda #PPU_CTRL_NMI
sta zpPpuCtrlFlags
sta PPU_CTRL
rts
**Some code here**
Music_Init:
; ignore IRQs
sei
; This must be done BEFORE calling any routines, since
; it sets the stack pointer
ldx #$FF
txs
; Now init the music. First, select the song index
ldx #$00
; Then store the address of the intented music data, if any.
lda #LOW(songData1)
sta ft_music_addr
lda #HIGH(songData1)
sta ft_music_addr + 1
; Finally select the song inside the music data
lda #$0 ; track 0
ldx #$0 ; NTSC
jsr ft_music_init
; init default value for ppu_crtl flags + activate NMI
lda #PPU_CTRL_NMI
sta zpPpuCtrlFlags
sta PPU_CTRL
rts
But game is crashing!
If i replace rts with jump to a label just after "jsr Music_Init"then it's working fine,but RTS is crashing game...
I noticed that RAM $100-$200 is randomly changed,but...debugger can't show what code is changing that RAM!