User Tools

Site Tools


docs:callingtheplayer

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:callingtheplayer [2018/02/12 16:06]
ftc
docs:callingtheplayer [2018/03/04 15:23]
ftc
Line 1: Line 1:
 ====== Using a defMON tune in your own program ====== ====== Using a defMON tune in your own program ======
  
-Once you have finished a tune in defMON and packed it you can use it in your own programs. The interface is more or less the same as in 90% of all other sid tunes out there, but there are nevertheless some things that may be pointed out.+Once you have finished a tune in defMON and packed it you can use it in your own programs. The interface is more or less the same as in 90% of all other sid tunes out there, at least if you are going to play a single speed tune. There are nevertheless some things that may be worth pointing out.
  
 When you include the tune in your assembler project, make sure to place it at address $1000. Something like: When you include the tune in your assembler project, make sure to place it at address $1000. Something like:
Line 29: Line 29:
 </code> </code>
  
-This assumes that the tune is a single speed tune. In case your tune is a multi speed tune, that needs to be updated more often, things are slightly more complicated. Let's say you did a four speed tune, that needs to be updated four times each frame. Then you call "jsr $1003" the FIRST time. The other three times you need to call "jsr $1006" instead. Calls to $1003 parses sequence data and update sounds. Calls to $1006 only updates the sounds. If you would call $1003 four times each frame you would get the undesired result of playing the song data four times as quick, which is not what you want when playing multi speed tunes. +This assumes that the tune is a single speed tune. In case your tune is a multi speed tune, that needs to be updated more often, things are slightly more complicated. Let's say you did a four speed tune, that needs to be updated four times each frame. Then you call "jsr $1003" the FIRST time. The other three times you need to call "jsr $1006" instead. Calls to $1003 parses sequence data and update sounds. Calls to $1006 only updates the sounds. If you would call $1003 four times each frame you would get the undesired result of playing the song data four times as quick, which is not what you want when playing multi speed tunes. So, basically, you always call $1003 once each frame, and then $1006 the other times. The table below summarises this: 
 + 
 +^ Multispeed       ^ Call $1003  ^ Call $1006     ^ 
 +| 1x               | Once        | Never          | 
 +| 2x               | Once        | Once           | 
 +| 4x               | Once        | Three times    | 
 +| 8x               | Once        | Seven times    | 
 + 
  
-So if you wanna play an 8x tune, you call $1003 once and $1006 seven times, each frame. For a 2x tune, you call $1003 once and $1006 once, each frame. 
docs/callingtheplayer.txt · Last modified: 2018/03/04 15:23 by ftc