Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Composing > Relocatable music routine
2022-09-12 13:28
Mixer

Registered: Apr 2008
Posts: 460
Relocatable music routine

There are plenty of music routines, which can be compiled from source or relocated by self modifying some of the code, but has anyone written a fully relocatable music routine?

Something that you can just load to any address and it'll work.(Obviously the complexity of the player is a factor, but let's say something like GT)
2022-09-12 13:34
tlr

Registered: Sep 2003
Posts: 1814
The song data for Antony Crowther's player (as used by him and Ben Daglish) is fully relocatable, but the player is not.
2022-09-12 13:37
Gordian

Registered: May 2022
Posts: 101
Quoting Mixer
There are plenty of music routines [...] relocated by self modifying some of the code


Did you know Sidreloc tool?
https://www.linusakesson.net/software/sidreloc/index.php
2022-09-12 13:43
Krill

Registered: Apr 2002
Posts: 3098
Quoting Mixer
Something that you can just load to any address and it'll work.(Obviously the complexity of the player is a factor, but let's say something like GT)
Not aware of anything like that, but given that there usually is an init call before calling the player itself periodically, that init routine could determine the base address and modify the actual player and song data code (much like a dynamic library loader would do).

There would be no overhead for playing the song itself, but of course some memory overhead for the relocation stuff.
2022-09-12 14:00
Mixer

Registered: Apr 2008
Posts: 460
@Gordian: Yes.

@Krill: I'd do it pretty much like that as well. The weird thing I'd like to try is to relocate the music many times on the fly, just to be able to use memory more flexibly, and to avoid loading.
2022-09-12 14:20
tlr

Registered: Sep 2003
Posts: 1814
Quoting Mixer
The weird thing I'd like to try is to relocate the music many times on the fly, just to be able to use memory more flexibly, and to avoid loading.

Then you have one more constraint, the code must be relocatable while running, i.e no absolute pointers in the state variables.
2022-09-12 15:47
Spinball

Registered: Sep 2002
Posts: 89
i am quite shure that nebula implemented selfrelocating on init for some player (JCH?) back in the days.
2022-09-12 20:37
Case

Registered: Aug 2002
Posts: 143
I am pretty sure that JCH released his own relocation tool, along with one to split the music into 4 or 5 parts that could be spread throught memory.

I also remember there being a relocation tool for sid-chip scratchers.

But as started previously due to the complexity, tables etc. they cannot be just loaded to a memory location and work.
2022-09-13 08:27
ChristopherJam

Registered: Aug 2004
Posts: 1424
Technically the 103 bytes of code for Rozzo is completely relocatable - the state variables are all in zero page. But there are four instructions that read from the 152 bytes of song data (notes, durations & frequencies) that would need patching if you wanted to move that as well.

(and yes, obviously this is an extremely minimal player - fixed ADSR, only wave $21, no modulation or filters, and gate off three frames before note end)
2022-09-14 02:49
ws

Registered: Apr 2012
Posts: 251
Just because i asked this myself a while ago briefly and thought scanning memory for my own code would be the simplest: what would be the fastest way to find out the code's own base adress?
Something like briefy writing code to an empty place like the tape buffer, jsr there and read the return adress from stack?
2022-09-14 05:39
ChristopherJam

Registered: Aug 2004
Posts: 1424
   jsr here
here:
   pla
   tax
   pla

will put the address of here-1 into AAXX and restore the stack pointer to the value it had before the JSR was executed.
 
... 15 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
krissz
Case/Padua
VanessaE/Digital Aud..
csabanw
Rhythm/G★P
iAN CooG/HVSC
Guests online: 132
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Codeboys & Endians  (9.7)
4 Mojo  (9.6)
5 Coma Light 13  (9.6)
6 Edge of Disgrace  (9.6)
7 Signal Carnival  (9.6)
8 Wonderland XIV  (9.5)
9 Uncensored  (9.5)
10 Comaland 100%  (9.5)
Top onefile Demos
1 Nine  (9.7)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.5)
6 Scan and Spin  (9.5)
7 Onscreen 5k  (9.5)
8 Grey  (9.5)
9 Dawnfall V1.1  (9.5)
10 Rainbow Connection  (9.5)
Top Groups
1 Artline Designs  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Performers  (9.3)
5 Censor Design  (9.3)
Top Musicians
1 Rob Hubbard  (9.7)
2 Jeroen Tel  (9.7)
3 Stinsen  (9.7)
4 LMan  (9.7)
5 Linus  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2025
Page generated in: 0.133 sec.