Login
Back to forumReply to this topicGo to last reply

Posted By

rudis
on 2012-01-08
08:43:53
 relocatable prg?

is there any way to produce relocatable code for prg?

Posted By

TLC
on 2012-01-08
09:39:52
 Re: relocatable prg?

"No": the 6502 doesn't support code relocation (by concept). Producing relocatable code isn't trivial on this platform.

"Yes": you can read about André Fachat's o65 format (http://www.6502.org/users/andre/o65/ ) which is produced by his assembler (xa) and the cc65 toolchain. A couple of systems already make use of this relocatable format (you can refer to the list on the page). Loading and running this format needs some loader code, which performs the actual relocation and finalizing work.

Posted By

Csabo
on 2012-01-08
11:51:53
 Re: relocatable prg?

The question might be a bit ambiguous. Could you clarify what it is that you'd like to do?

A piece of code can examine its own location (via the stack). Once that it's done, it could "correct itself" by changing the location of JMP/JSR opcodes. Or, if it's short enough, absolute jumps can be avoided altogether and (chained) branches can be used instead.

Posted By

rudis
on 2012-01-08
12:32:16
 Re: relocatable prg?

the goal might be to avoid absolute jumps. so , the code could load at any adress.

Posted By

TLC
on 2012-01-08
13:04:45
 Re: relocatable prg?

What's up with absolute memory references?

Memory indirect references (pointers)?



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024