[Coco] Making 6809 position independent

David Broman davbrdavbr at hotmail.com
Wed Oct 29 14:02:46 EDT 2025


If you want your data to move around with your code, you'll need to use PC-relative addressing for your loads & stores.

I think LOADM"FILE",xxx loads the binary, applying the offset xxx to the original load address.  So you'd need to know the original load address to calculate the offset to get it to load where you want to.  Or make the original load address 0, perhaps, to make it easier.

-----Original Message-----
From: Coco <coco-bounces at maltedmedia.com> On Behalf Of Allen Huffman via Coco
Sent: Wednesday, October 29, 2025 10:01 AM
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Cc: Allen Huffman <alsplace at pobox.com>
Subject: [Coco] Making 6809 position independent

Surely I knew this, because I wrote OS-9/6809 code which has to be position independent… But…

As long as I avoid things like JMP (unless jumping to a fixed location such as in ROM), should my code be loadable anywhere in BASIC?

I completely forget how to do this. I have built a routine to load at &H7F00 but I want it to be loadable anywhere — such as a lower address for a 16K system.

Can someone here remind me how that worked? I recall

LOADM “FILE”,xxx

…or something. It’s been way too long for me!

		— A


-- 
Coco mailing list
Coco at maltedmedia.com
https://pairlist5.pair.net/mailman/listinfo/coco


More information about the Coco mailing list