Famitracker NSF Driver not working

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
puppydrum64
Posts: 160
Joined: Sat Apr 24, 2021 7:25 am

Famitracker NSF Driver not working

Post by puppydrum64 »

So I tried using the Famitracker NSF driver in order to create a ROM file that can play music, however I'm running into issues depending on how I try to save it using the Export NSF option. First, the Export as iNES ROM image does not work with expansion audio, nor does it give me the source code for the ROM so I cannot modify it. It would be nice if I was given a .asm file along with the ROM image but Famitracker won't do that.

Exporting the .asm file doesn't come with the header, vectors, or anything needed to make it a game that the NES can run. Those files that are necessary appear to be within the rest of the download of the nsf driver. The readme.txt file tells me to do the following:

ca65 nsf_wrap.s -D INC_MUSIC
ld65 -C nsf.cfg -o music.nsf nsf_wrap.o

I tried that and this is what I get:

https://ibb.co/0QHJydH

The song I'm using to test the driver DOES have DPCM so this error message doesn't make any sense.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: Famitracker NSF Driver not working

Post by unregistered »

Hi. I don’t use cc65, but it seems to me that the a way to fix these error/warning messages is to open C:\cc65\cfg\nes.cfg with a text editor, like notepad (in Notepad, click View>“Status Bar” so there is a check next to “Status Bar”), then go down to line #65 and somehow add a STARTUP segment bc it is clearly missing one.

In famitracker I don’t think I ever used the Export NSF option. (Maybe I did, don’t remember… it’s been so long.) Anyways, Famitracker will not spout out an entire NES ROM with a header and everything. It DID give me an asm file of my song and I was able to include that in our game.

———-EDIT:
Sigh, I was wrong. For famitone2, you have to, using Famitracker, click File\”Export text”. Next, you use famitone2’s text2data program to convert that text file into an asm file that can be finally included into your game.

So, I exported text from Famitracker and then converted that text to asm data with text2data.exe (is a part of the famitone2 music engine… can work for NESASM, ca65, and asm6; but, the asm file it gives can only work with the famitone2 music engine).
———-

Famitracker doesn’t program games; it is created to make music files that you can include in a game. 🙂


Note: I’m using the free music engine Famitone2. Famitone2 comes with a help file that explains how to use Famitracker to export your song and then include that song file in your game. :) I’m sure your music engine has a similar help file. :)
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: Famitracker NSF Driver not working

Post by unregistered »

This post is to correct myself… talks about “Export text”.
unregistered wrote: Tue May 11, 2021 9:06 am ———-EDIT:
Sigh, I was wrong. For famitone2, you have to, using Famitracker, click File\”Export text”.
Now, I remember that “Export text” is not under Famitracker’s File menu. File\”Export text” is from famitone2’s readme.txt file; but that file, at least in the famitone2 version I have, is out of date with the more recent versions of Famitracker. So, “Export text” is still an option somewhere in Famitracker, I hope at least. :)
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Famitracker NSF Driver not working

Post by tepples »

"Export Text" is still in FamiTracker 0.4.6, j0CC-FamiTracker 0.6.1, and current Dn-FamiTracker.
puppydrum64
Posts: 160
Joined: Sat Apr 24, 2021 7:25 am

Re: Famitracker NSF Driver not working

Post by puppydrum64 »

unregistered wrote: Tue May 11, 2021 9:06 am Hi. I don’t use cc65, but it seems to me that the a way to fix these error/warning messages is to open C:\cc65\cfg\nes.cfg with a text editor, like notepad (in Notepad, click View>“Status Bar” so there is a check next to “Status Bar”), then go down to line #65 and somehow add a STARTUP segment bc it is clearly missing one.

In famitracker I don’t think I ever used the Export NSF option. (Maybe I did, don’t remember… it’s been so long.) Anyways, Famitracker will not spout out an entire NES ROM with a header and everything. It DID give me an asm file of my song and I was able to include that in our game.

———-EDIT:
Sigh, I was wrong. For famitone2, you have to, using Famitracker, click File\”Export text”. Next, you use famitone2’s text2data program to convert that text file into an asm file that can be finally included into your game.

So, I exported text from Famitracker and then converted that text to asm data with text2data.exe (is a part of the famitone2 music engine… can work for NESASM, ca65, and asm6; but, the asm file it gives can only work with the famitone2 music engine).
———-

Famitracker doesn’t program games; it is created to make music files that you can include in a game. 🙂


Note: I’m using the free music engine Famitone2. Famitone2 comes with a help file that explains how to use Famitracker to export your song and then include that song file in your game. :) I’m sure your music engine has a similar help file. :)
What's supposed to go in the STARTUP sequence?
puppydrum64
Posts: 160
Joined: Sat Apr 24, 2021 7:25 am

Re: Famitracker NSF Driver not working

Post by puppydrum64 »

; The label that contains a pointer to the music data
; A simple way to handle multiple songs is to move this
; to RAM and setup a table of pointers to music data
ft_music_addr:
.word * + 2 ; This is the point where music data is stored

I'm not really understanding this part either. It seems like I'm supposed to use a zero page entry to point to the song I want to play. In my music.asm file, it has the following:

ft_song_list:
.word ft_song_0

I'm guessing I'm supposed to do this then:

LDA #<(ft_song_0)
STA pointerLo
LDA #>(ft_song_0)
STA pointerHi

But I don't know what to do next. I can't JMP there since it's a data block. So now what?
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: Famitracker NSF Driver not working

Post by unregistered »

hi puppydrum64,

Sry, I haven’t a clue what goes in the STARTUP segment. That first paragraph was attempting to help you better understand the DOS error messages.
puppydrum64 wrote: Wed May 19, 2021 2:13 pm ; The label that contains a pointer to the music data
; A simple way to handle multiple songs is to move this
; to RAM and setup a table of pointers to music data
ft_music_addr:
.word * + 2 ; This is the point where music data is stored
I don’t now what music engine you are using.

Pointers in 6502 are 2 consecutive bytes (low byte, high byte). Then to use a pointer you can do:

Code: Select all

ldy #00
lda [pointerLo], y
;now the accumulator will be filled with the
;first byte of ft_song_0
Whatever music engine you are using should instruct you how to play ft_song_0. Maybe it, your music engine, wants ft_music_addr to be declared in RAM so that you can

Code: Select all

lda ft_song_0
sta ft_music_addr
lda ft_song_0+1 ; <loading the high byte
sta ft_music_addr+1
Remember that RAM can be successfully written to while your game is running. Writing to ROM while your game is running would be unsuccessful bc the byte in ROM written to would stay unchanged. However, ROM writes allow mappers to interpret that terrible attempt as mapper related (i.e. a bank change).

Maybe your music engine automatically runs a song pointed to by ft_music_addr?


EDIT: I seem to remember reading that you were attempting to create your own music engine. If that is the case, I definitely have no clue how to help with that path, sorry. :(
Last edited by unregistered on Wed May 19, 2021 4:39 pm, edited 1 time in total.
User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

Re: Famitracker NSF Driver not working

Post by dougeff »

unregistered wrote: Tue May 11, 2021 9:06 am Famitracker doesn’t program games; it is created to make music files that you can include in a game.
You can use the famitracker driver as a game music system, but you need to use the version that Shiru made, that allows sound effects to play.

Also, you need to (from Famitracker) do save NSF, then change the output format to .bin

That will put just the music data into a .bin, and then you need to include all the music driver .asm code (which should all be in the Shiru example).

This link, at the bottom, where it says "neslib + FamiTracker player"

https://shiru.untergrund.net/code.shtml

This example is cc65 for his neslib, but it will also work as a ca65 project. I'm sorry this couldn't be easier, but it is possible. I used it for Vigilante Ninja 2.

And since you asked me about VRC6, this is probably your only option. The Shiru example doesn't include the VRC6 module, but you can grab that from the famitracker website, driver asm code.

Edit.
I could probably post example of Shiru's famitracker + neslib + VRC6, but I don't have time to write a VRC6 song. Is there anyone out there willing to donate a VRC6 song to be part of an open source sample?
nesdoug.com -- blog/tutorial on programming for the NES
puppydrum64
Posts: 160
Joined: Sat Apr 24, 2021 7:25 am

Re: Famitracker NSF Driver not working

Post by puppydrum64 »

unregistered wrote: Wed May 19, 2021 4:28 pm hi puppydrum64,

Sry, I haven’t a clue what goes in the STARTUP segment. That first paragraph was attempting to help you better understand the DOS error messages.
puppydrum64 wrote: Wed May 19, 2021 2:13 pm ; The label that contains a pointer to the music data
; A simple way to handle multiple songs is to move this
; to RAM and setup a table of pointers to music data
ft_music_addr:
.word * + 2 ; This is the point where music data is stored
I don’t now what music engine you are using.

Pointers in 6502 are 2 consecutive bytes (low byte, high byte). Then to use a pointer you can do:

Code: Select all

ldy #00
lda [pointerLo], y
;now the accumulator will be filled with the
;first byte of ft_song_0
Whatever music engine you are using should instruct you how to play ft_song_0. Maybe it, your music engine, wants ft_music_addr to be declared in RAM so that you can

Code: Select all

lda ft_song_0
sta ft_music_addr
lda ft_song_0+1 ; <loading the high byte
sta ft_music_addr+1
Remember that RAM can be successfully written to while your game is running. Writing to ROM while your game is running would be unsuccessful bc the byte in ROM written to would stay unchanged. However, ROM writes allow mappers to interpret that terrible attempt as mapper related (i.e. a bank change).

Maybe your music engine automatically runs a song pointed to by ft_music_addr?


EDIT: I seem to remember reading that you were attempting to create your own music engine. If that is the case, I definitely have no clue how to help with that path, sorry. :(
I'm actually using the nsf driver itself. I've essentially converted it to work with ASM6 by swapping out the syntax
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: Famitracker NSF Driver not working

Post by unregistered »

Ahha! You’ve abandoned the NESASM canoe! The asm6 ship is quite a nice ride. :)
puppydrum64
Posts: 160
Joined: Sat Apr 24, 2021 7:25 am

Re: Famitracker NSF Driver not working

Post by puppydrum64 »

Yes but to use VRC6 sound it seems I will need to use cc65 instead
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: Famitracker NSF Driver not working

Post by unregistered »

puppydrum64 wrote: Wed May 19, 2021 8:12 pm Yes but to use VRC6 sound it seems I will need to use cc65 instead
That’s alright. You’re the captain; feel free to choose your vessel. :)
Post Reply