Sounds don't work in Unrom mapping

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
User avatar
OscarRichard
Posts: 24
Joined: Sun Jul 29, 2012 9:58 am
Location: Mexico
Contact:

Sounds don't work in Unrom mapping

Post by OscarRichard » Tue Jul 07, 2020 8:12 pm

I'm using UNROM mapping in my game (8 banks). The music works well, but I can't hear none of the sounds :? . I have put the music and sounds in a same bank and then in different banks and same problem. I'm using Famitone v 1.12 ( got from Shiru's website ) and Famitracker 0.4.6.

I got this in crt0-unrom.s

Code: Select all

.segment "ROM1"
	.if(FT_SFX_ENABLE)
sounds_data:
	.include "sounds.s"
	.endif
I have attached the whole file and famitone2.s

Any suggestions?
Attachments
crt0-unrom.s
(4.29 KiB) Downloaded 13 times
famitone2.s
(28.14 KiB) Downloaded 11 times

User avatar
dougeff
Posts: 2707
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Sounds don't work in Unrom mapping

Post by dougeff » Sat Jul 11, 2020 6:32 pm

If the song is paused or stopped, does the sfx play?
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
OscarRichard
Posts: 24
Joined: Sun Jul 29, 2012 9:58 am
Location: Mexico
Contact:

Re: Sounds don't work in Unrom mapping

Post by OscarRichard » Sat Jul 11, 2020 7:38 pm

dougeff wrote:
Sat Jul 11, 2020 6:32 pm
If the song is paused or stopped, does the sfx play?
It doesn't. Whether music and sounds are or not in a same bank.

User avatar
dougeff
Posts: 2707
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Sounds don't work in Unrom mapping

Post by dougeff » Sat Jul 11, 2020 7:57 pm

Well. It's not a conflict with the song then. There was a change in sfx code in famitone. I'm assuming you are using the nsf2data exe that came with this famitone code, and not a different version?

I do believe 1.15 is the newest version and it's sfx header looks like...

sounds:
.word @ntsc
.word @pal
@ntsc:
.word @sfx_ntsc_0
.word @sfx_ntsc_1
.word @sfx_ntsc_2
@pal:
.word @sfx_pal_0
.word @sfx_pal_1
.word @sfx_pal_2

but the earlier versions looked different.
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
OscarRichard
Posts: 24
Joined: Sun Jul 29, 2012 9:58 am
Location: Mexico
Contact:

Re: Sounds don't work in Unrom mapping

Post by OscarRichard » Sat Jul 11, 2020 8:31 pm

According to this: https://shiru.untergrund.net/code.shtml it says 1.15 but then i read in famitone2.s and it says:

Code: Select all

;FamiTone2 v1.12
Looks I'm still using that "version".

And yes and yes: I use that nfs2data exe and the sfx header looks exactly like that.
Any other differences?

User avatar
dougeff
Posts: 2707
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Sounds don't work in Unrom mapping

Post by dougeff » Sun Jul 12, 2020 10:19 am

It could be a problem with the initialization step. Yes... look at your crt0 file...

; We dont do this automaticly anymore.
;ldx #<music_data
;ldy #>music_data
;lda <NTSC_MODE
;jsr FamiToneInit

.if(FT_SFX_ENABLE)
ldx #<sounds_data
ldy #>sounds_data
jsr FamiToneSfxInit
.endif
You commented out the song data init, I would assume because the correct bank isn't in place and maybe you are doing this elsewhere.

But you left the sfx init in place... if the correct bank isn't in place, it would be grabbing the wrong pointer address. That's probably the error.

These things are pointers to the beginning of the table of sound effect addresses...

sounds:
.word @ntsc
.word @pal

Make sure the correct bank is in place when you call FamiToneSfxInit. Or else, instead of setting the pointer from this it would grab 2 random bytes from who knows where.
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
OscarRichard
Posts: 24
Joined: Sun Jul 29, 2012 9:58 am
Location: Mexico
Contact:

Re: Sounds don't work in Unrom mapping

Post by OscarRichard » Mon Jul 20, 2020 4:16 pm

A little bit late, but I resolved this by moving some code to another bank since I almost had no space left in the fixed one. Then I returned the sound code in the fixed bank in which I actually have (forcefully) the sound init and now worked along with the music. Both in different banks. :P

Post Reply