Question on ORG and PASM
cbmeeks
Posts: 634
in Propeller 1
I see this a lot in PASM code:
Basically, setting the code to start at address 0 (org 0) but then, later on...doing it again.
So, what is the purpose of that? I assume it's for space optimization or something like that.
Thanks.
org 0 blah.... blah.... blah... org 0 blah... blah... blah...
Basically, setting the code to start at address 0 (org 0) but then, later on...doing it again.
So, what is the purpose of that? I assume it's for space optimization or something like that.
Thanks.
Comments
So if you do a - say ORG 20 - it will NOT start your code at COG address 20 but will assemble it as if it would sit at address 20 but still load it at address 0 into the COG.
This sounds stupid, but is - as usual with @chip - a interesting feature.
Some of @chips video drivers did that, so that is where I found, stumbled upon, and smiled about it.
So in general you should always use ORG 0 in your PASM code.
But if you want to assemble PASM that will be relocated inside of a COG (like @chip does in his code) you can use ORG whatever to assemble the code as if it sits at whatever and move it inside your program to the real location, where then the code assembled to run at is working correct.
Enjoy!
Mike
But it is what it is...
Enjoy!
Mike