FamiTone - audio library (release)

Discuss NSF files, FamiTracker, MML tools, or anything else related to NES music.

Moderator: Moderators

User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: FamiTone - audio library (release)

Post by thefox »

sdm wrote:FT_BASE_ADR = $0300 ;page in RAM, should be $xx00

In my code, I noticed that it is about 128 bytes.
The documentation (readme.txt) lists the non-zp memory usage as 186 bytes for FamiTone2 (v1.15).
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
sdm
Posts: 410
Joined: Tue Apr 11, 2006 4:08 am
Location: Poland

Re: FamiTone - audio library (release)

Post by sdm »

Is it possible to have all the famitone code with music and sfx in the UNROM bank? (one of those switchable). Currently I have in $ E000 (bank not switchable). Do not know if it's possible at all in the famitone?
User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

Re: FamiTone - audio library (release)

Post by dougeff »

Personally, I would prefer the famitone code in the fixed bank, and the data in switchable banks. But I suppose you could also put the code in the switchable bank.

The only thing you CAN'T put in the switchable bank (UNROM style) is DPCM samples.
nesdoug.com -- blog/tutorial on programming for the NES
sdm
Posts: 410
Joined: Tue Apr 11, 2006 4:08 am
Location: Poland

Re: FamiTone - audio library (release)

Post by sdm »

I have a problem running Famitone, which has music/sfx data in the switch bank:

Code: Select all

	.bank 12		;UNROM bank switchable
	.org $8000
MUSIC:
	.include "music.asm"
SFX:
	.include "sfx.asm"
;------------------------------------------------
	.bank 14		;UNROM bank fixed (last, non-switchable)
	.org $C000

	.include "famitone2.asm"
;------------------------------------------------
NMI:              	;NMI code in the last bank

	JSR FamiToneUpdate
:------------------------------------------------
;This code is also in the last bank:
	LDA #$6
	STA Bank_TBL+6		;Change to bank contains MUSIC & SFX

	lda #01			;FAMITONE INIT.
	ldx #low(Muzyka)
	ldy #high(Muzyka)
	jsr FamiToneInit

	ldx #LOW(SFX)
	ldy #HIGH(SFX)
	jsr FamiToneSfxInit

	lda #0			;FAMITONE (song nr.)
	JSR FamiToneMusicPlay

	LDA #$0
	STA Bank_TBL		;back to code bank

User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

Re: FamiTone - audio library (release)

Post by dougeff »

JSR FamiToneUpdate
You should be switching music data banks IN before you call FamiToneUpdate. Are you?
nesdoug.com -- blog/tutorial on programming for the NES
sdm
Posts: 410
Joined: Tue Apr 11, 2006 4:08 am
Location: Poland

Re: FamiTone - audio library (release)

Post by sdm »

I do not know what's wrong: / Can you check the code?
Attachments
famitone_unrom.zip
(48.06 KiB) Downloaded 248 times
User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

Re: FamiTone - audio library (release)

Post by dougeff »

What was your problem again?

Did you resolve it?
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

Re: FamiTone - audio library (release)

Post by dougeff »

I looked at your code, and (as I suggested), you need to switch banks before calling FamiToneUpdate. Using your code...


Code: Select all

Forever:

	JSR VBWait
	JSR ReadPad
	JSR SeeCTRL
LDA #$6 ;has the music data
STA Bank_TBL+6
	JSR FamiToneUpdate
LDA #$0
STA Bank_TBL
	JMP Forever
because, it currently gets stuck in an infinite loop the first time it jumps to FamiToneUpdate, because the music data isn't in place.
nesdoug.com -- blog/tutorial on programming for the NES
Post Reply