It is currently Tue Nov 13, 2018 9:10 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: FamiToneUpdate problem
PostPosted: Fri Oct 26, 2018 2:10 pm 
Offline
User avatar

Joined: Wed Sep 05, 2018 11:13 am
Posts: 141
Location: Colorado
I created a little test project that played different sounds effects I created with Famitracker. Everything seemed to work well, so I moved the sound effects and famitone into my asteroids game, and suddenly the screen goes nuts.

The problem seems to be the call to
Code:
jsr FamiToneUpdate
inside the game loop. The total number of cycles used in the gameloop is about 5700. At first I thought I may have been using too many cycles or something, but I thought the gameloop had something like 16000 cycles (might be wrong about that).

If I comment out the call to FamiToneUpdate everything goes back to normal.

Any ideas or suggestions?

Thanks

_________________
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com


Top
 Profile  
 
PostPosted: Fri Oct 26, 2018 2:13 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6948
Location: Canada
Did you make sure that Famitone's allocated memory is not in the same location as memory you're using for your game?


Top
 Profile  
 
PostPosted: Fri Oct 26, 2018 2:19 pm 
Offline
User avatar

Joined: Wed Sep 05, 2018 11:13 am
Posts: 141
Location: Colorado
rainwarrior wrote:
Did you make sure that Famitone's allocated memory is not in the same location as memory you're using for your game?


You're right. It was pointed to the same address as my OAM.

Thanks!

_________________
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com


Top
 Profile  
 
PostPosted: Fri Oct 26, 2018 2:41 pm 
Offline
User avatar

Joined: Wed Sep 05, 2018 11:13 am
Posts: 141
Location: Colorado
rainwarrior wrote:
Did you make sure that Famitone's allocated memory is not in the same location as memory you're using for your game?


So I changed the memory it was using so it's not hitting OAM anymore, but I think it's messing up some other variables. How do I find some space to put the Famitone's memory? Should I modify my .cfg file to set aside some space for it?

Any suggestions?

Thanks

_________________
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com


Top
 Profile  
 
PostPosted: Fri Oct 26, 2018 3:06 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6948
Location: Canada
Did you adjust FT_TEMP or just FT_BASE_ADR?
FT_BASE_ADR points to a page in main RAM, but FT_TEMP also needs to point to 3 free bytes on the ZP.

Yes I would recommend using the CFG to make sure nothing goes into the page used by FT_BASE_ADR. (E.g. if it's at $700, make sure your RAM segments aren't allowed to use that area.)

For the ZP thing you could just reserve 3 bytes and export a label to it:
Code:
; with your other allocations
.segment "ZEROPAGE" : zeropage
ft_temp: .res 3

; in famitone2.s
.importzp ft_temp
FT_TEMP = ft_temp


Top
 Profile  
 
PostPosted: Fri Oct 26, 2018 3:57 pm 
Offline
User avatar

Joined: Wed Sep 05, 2018 11:13 am
Posts: 141
Location: Colorado
rainwarrior wrote:
Did you adjust FT_TEMP or just FT_BASE_ADR?
FT_BASE_ADR points to a page in main RAM, but FT_TEMP also needs to point to 3 free bytes on the ZP.

Yes I would recommend using the CFG to make sure nothing goes into the page used by FT_BASE_ADR. (E.g. if it's at $700, make sure your RAM segments aren't allowed to use that area.)

For the ZP thing you could just reserve 3 bytes and export a label to it:
Code:
; with your other allocations
.segment "ZEROPAGE" : zeropage
ft_temp: .res 3

; in famitone2.s
.importzp ft_temp
FT_TEMP = ft_temp



It's working now. I ended up reserving a page of space in my bss segment with a label instead of changing the .cfg file. I put 7 bytes on the zeropage. In your last post you said I only needed 3 bytes, but the comments inside the famitone code says it uses 7. Is that comment out of date or something?

Thanks for all your help

_________________
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com


Top
 Profile  
 
PostPosted: Fri Oct 26, 2018 4:04 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6948
Location: Canada
I don't know what version of Famitone you're using. If it says 7 then go with that. If it's inconsistent maybe tell the person who maintains it.


Top
 Profile  
 
PostPosted: Fri Oct 26, 2018 9:48 pm 
Offline
User avatar

Joined: Thu Mar 31, 2016 11:15 am
Posts: 415
Make sure Famitone's memory is set to all zeroes before initializing it. I recall having problems before when I didn't do that.


Top
 Profile  
 
PostPosted: Sat Oct 27, 2018 12:14 pm 
Offline
User avatar

Joined: Wed Sep 05, 2018 11:13 am
Posts: 141
Location: Colorado
pubby wrote:
Make sure Famitone's memory is set to all zeroes before initializing it. I recall having problems before when I didn't do that.


That's funny, it was playing a little tone when the game started up and I think that may have been why.

Thanks

_________________
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: Nioreh and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group