Exporting DAT symbols. How?

I need the addresses of DAT symbols in another object. I've tried obj#symbol, and that didn't work. So I defined a stand-in for the symbol as a CONstant in the object containing the DAT:
The compiler flagged symbol in the CON, saying that it was undefined. So, thinking it may have been a first-pass issue, I moved the CON section after the DAT section. 'Same problem.
I'm stumped. There has to be a way to do this. If not, there needs to be.
-Phil
CON exported_constant = (@symbol - @asm_start) >> 2 ... DAT org 0 asm_start ... ... symbol ...
The compiler flagged symbol in the CON, saying that it was undefined. So, thinking it may have been a first-pass issue, I moved the CON section after the DAT section. 'Same problem.
I'm stumped. There has to be a way to do this. If not, there needs to be.
-Phil
Comments
You do it with a method.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Help to build the Propeller wiki - propeller.wikispaces.com
Play Defender - Propeller version of the classic game
Prop Room Robotics - my web store for Roomba spare parts in the UK
Post Edited (CardboardGuru) : 1/16/2008 8:29:01 AM GMT
Steven
Not for a constant. That's run time only. Basically the issue is that PropTool compiles each object seperately, with all constant addresses relative to the position of the object. At run time the compiler can use @@ to add in the object start address to make absolute addresses, but at compile time, PropTool doesn't know what address the object will be loaded at.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Help to build the Propeller wiki - propeller.wikispaces.com
Play Defender - Propeller version of the classic game
Prop Room Robotics - my web store for Roomba spare parts in the UK
-Phil
@ can be used only in the DAT-constant context. And it does not provide the address, but a relative byte number wrt the object...
Edit: eg at the end of this: http://forums.parallax.com/showthread.php?p=670831
Post Edited (deSilva) : 1/16/2008 8:59:32 AM GMT
I don't need the absolute runtime address and well understand why I can't have it at compile time if I did need it. An object-relative address will do, as will the assembly address relative to the org, both of which are known at compile time.
-Phil
I THINK the sequence is:
- evaluate SIMPLE constant expressions
- evaluate constant expressions with @dat, to allow computing storage space using evaluated constants..
The basis problem however is, that you will never succeed in statically exporting those second kind of constants
-Phil
Why use PropTool at all? There are several alternative assemblers out there, and if they don't do what you need, you could modify one.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Help to build the Propeller wiki - propeller.wikispaces.com
Play Defender - Propeller version of the classic game
Prop Room Robotics - my web store for Roomba spare parts in the UK
If this is to be able to create instructions for calls into the LMM kernel, the solution proposed for traditional LMM was a well-defined jump vector at the start of cog. The problem there is that every LMM call becomes a jump-to-a-jump and unnecessary execution time and cog space is used up.
One improvement would be to scan the LMM Code and look for calls into the LMM kernel ( avoiding any constants which look like calls ) and fixup those using the jump data in the table but that is a lot of extra work and there are a number of issues with that to overcome. It's a lot of complexity for what should be a simple problem.
My conclusion is that the ideal way of doing this is to have the LMM Compiler also generate the LMM kernel, then it knows what cog addresses are used, or it is that 'prone to error' data tabe which has to be manually updated whenever the LMM kernel changes - "Ugh" indeed, although it would be much easier if the PropTool generated some listing file.
Oh, well. I'm determined to put the kernel code in its own object, if I have to count the lines to each label by hand!
-Phil
Addendum: The light just went off, after I reread "jump vector" in your post. That's it! If you make indirect jumps via the jump vector, it doesn't cost anything, timewise. I've been thinking direct jumps all this time. (I'd still like a listing file, though, and the ability to export DAT symbols.)
Zero time cost. Well done again.
-Phil
-Phil