How to detect the end of the song

You want to detect the end of the song ? For example, to convert SKS file into YM (for example !) ???? Ok, this is possible. Once again, no hardcoded functions. This one is really crap tricking. All apologize for this, but I found no other way to do it. Yet it remains very simple to code, just follow this algorithm :

(xxxx)16 means '16 bits number found at the offset xxxx'. (byte at xxxx=low byte byte at xxxx+1=high byte)

(xxxx)8 means '8 bits number found at the offset xxxx'.

ASM BASIC

STATE=0

LOOP: Play your song

If STATE=0 : if (009D)16 <> (283)16 then goto LOOP (00A6)16 <> (028C)16 STATE=1 : goto LOOP

If STATE=1 : if (0270)8 <> 0 then goto LOOP (0279)8 <> 0 if (0015)8 <> (0017)8 then goto LOOP (001E)8 <> (0020)8 STATE=2 : goto LOOP

If STATE=2 : if (0015)8 <> (0017)8 then goto LOOP (001E)8 <> (0020)8 STATE=0 Song End is now !

KILLING USELESS PARTS OF THE PLAYER

You're short in memory and you want to save it as much as possible ? STarKos is made for you, really :). In the BASIC and ASM players, the INITIALIZE code is at the end of the player. So you can simply destroy it. Just before is the STOP MUSIC code, but it's really tiny so you won't get much.

These addresses show you from where these codes begin : ASM BASIC STOPMUS &856 &868 INITMUS &872 &88D

Don't forget that you can also completely forget about the INITIALIZE code, by loading the player, your song, calling the INITIALIZE code, and saving your player (without the INITIALIZE code). This way, the player already got all the inits he needs. Of course, you won't be able to re-init the song, or use the player for another music, but demomakers will surely find this very useful.

documentations/software/starkos/howto.player.song.end.txt · Last modified: 2009/05/13 15:25 by grim