For a change I've decided to try my hand at NES programming. So, the first thing I've done is display a static screen with a graphic centered in the middle. Also, I have a DPCM player and a famitracker driver installed.
The problem is that either one disables the other depending on the configuration of the code, but if I run the DPCM player code after the Famitracker init, the DPCM sample plays fine on top of the music. However, I don't want that. I want the DPCM sample to play before the Famitracker driver starts playing.
I just haven't been able to figure out what the problem is. I wonder if you guys have any suggestions. I've also tried hacking the Famitracker binary NSF code as well. Here is the code configuration that I'm using.
Initialize both players
JSR DPCM_PLAY ; Play DPCM sample.
LDA #$01 ; A failed attempt at waiting for
STA TIMER ; 01 frames for the Famitracker driver to play.
JSR FRAMEWAIT ; Wait for x number of frames.
LDA #$01 ; Enable the play routine in the NMI.
STA MUSICCHECK
LDA #$00 ; Load A with tune number
JSR $AC00 ; Call Famitracker driver init code.
END:
JMP END ; Continuous end loop at the end of reset.
FRAMEWAIT: ; Wait for x amount of frames depending on what
CLC ; the variable "TIMER" contains.
ADC TIMER
FRAMEWAIT_WAIT:
CMP TIMER
BNE FRAMEWAIT_WAIT
RTS
DPCM_PLAY: ; Basic unrolled code to play the
LDA #$09 ; DPCM sample.
STA $4010
LDA #$40
STA $4011
LDA #$00
STA $4012
LDA #$A0
STA $4013
LDA #$0F
STA $4015
LDA #$1F
STA $4015
RTS
The problem is that either one disables the other depending on the configuration of the code, but if I run the DPCM player code after the Famitracker init, the DPCM sample plays fine on top of the music. However, I don't want that. I want the DPCM sample to play before the Famitracker driver starts playing.
I just haven't been able to figure out what the problem is. I wonder if you guys have any suggestions. I've also tried hacking the Famitracker binary NSF code as well. Here is the code configuration that I'm using.
Code:
Initialize both players
JSR DPCM_PLAY ; Play DPCM sample.
LDA #$01 ; A failed attempt at waiting for
STA TIMER ; 01 frames for the Famitracker driver to play.
JSR FRAMEWAIT ; Wait for x number of frames.
LDA #$01 ; Enable the play routine in the NMI.
STA MUSICCHECK
LDA #$00 ; Load A with tune number
JSR $AC00 ; Call Famitracker driver init code.
END:
JMP END ; Continuous end loop at the end of reset.
FRAMEWAIT: ; Wait for x amount of frames depending on what
CLC ; the variable "TIMER" contains.
ADC TIMER
FRAMEWAIT_WAIT:
CMP TIMER
BNE FRAMEWAIT_WAIT
RTS
DPCM_PLAY: ; Basic unrolled code to play the
LDA #$09 ; DPCM sample.
STA $4010
LDA #$40
STA $4011
LDA #$00
STA $4012
LDA #$A0
STA $4013
LDA #$0F
STA $4015
LDA #$1F
STA $4015
RTS