Hi! On Thu, Feb 10, 2011 at 12:56:09PM +0100, Oliver Schmidt wrote: > There are several targets that need a small loader stub to be placed > somewhere safe which is than jumped to in order to load the new > program. However we surely don't want to introduced yet another linker > segment for that purpose ;-) On the other hand it is likely that one > needs absolute references into that loader stub. My solution goes like > this, using a JSR just as a simple example for an absolute reference: I've created myself a solution for the several extended memory drivers that were contributed some time ago, and I have to say that I like my solution more than yours:-) The basic code is of course the same but it differs in details. See c64-c256k.s for a larger example. --------------------------------------------------------------------------- TARGETLOC = $200 ; Target location for exec stub .proc execstub source: .org ::TARGETLOC entry: ... jsr mysub ... jmp <new program> .reloc .endproc .proc _exec ldx #.sizeof (stub) - 1 @L1: lda execstub::source,x sta execstub::entry,x dex bpl @L1 ... jmp execstub::entry .endproc --------------------------------------------------------------------------- A disadvantage of this approach is that placing the code at the end of the area doesn't work easily. Regards Uz -- Ullrich von Bassewitz uz@musoftware.de ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Thu Feb 10 18:12:16 2011
This archive was generated by hypermail 2.1.8 : 2011-02-10 18:12:19 CET