Jump to content
  • 0

cl65 to No Particular Address



EXAMPLE: In my assembly, I have


.org    $8000
.export LOADADDR = *

myData:      .byte 0         ; I.E. poke $8000, 5

Main:  do stuff                ; I.E. sys $8001


So I think this forces me to do this in BASIC:




POKE $8000, V

SYS $8001

Because when I try this:




POKE $9000, V

SYS $9001

It doesn't work.

This seems to mean that the linker is linking to absolute addresses, even though I try to load it to a different address.

So.  How do I write my code so that it's all relative addresses?

Ah, is it because I have a JMP in my code, and JMPs are **ABSOLUTE** so the linker **HAS** to assign an address..... hah that's probably it.  So since I'm not doing any math, I can try to replace that with a BVC or something.

But, is there something else I don't know?

Thanks all.

Edited by rje
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Many, many 65C02 instructions use absolute addressing. You would have to code your entire program to use relative addresses, ZP addresses, and ZP indirection, and you would still likely have, at the very least, regions of memory that were forbidden because the program needed them for variables.

The alternative, as Matt suggests, would be an OS to handle this for you, implementing some kind of virtual page table. I'm not actually sure how that would work without also having a hardware memory controller to aid with the mapping, which the X16 will not have and is not being considered, because c'mon, it's a 64K address space with bank switching on an 8KB window. It'd be like bolting the automatic transmission from a Nissan Sentra onto your 1HP push lawn mower. I'm sure someone is working on that Youtube video, but it's a bit much for the base X16. 😛

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

Please review our Terms of Use