>I have this function, like;
>void bogus(){
> //some code
>}
>And then, in an asm function, I would like to use bogus as a variable to
>read from. The way I understand it, bogus is nothing more than an address.
>So, I whould like something like:
>asm void myFunc(){
> move.l bogus, d0 //I want the address of the bogus function
>in the d0 register.
> //some more code..
>}
>How can I get this to work.
I don't know if the Metroworks assembler exactly follows the syntax of the
68K assembler that I am used to using, but the following should work with
one caveat:
lea bogus, a0
move.l a0, d0
The first instruction loads the "effective address" of the bogus function
into an address register (has to be an address reg, not a data reg). This is
the address that you're looking for -- the absolute address of the function.
If Palm apps were built using fixed addresses instead of being
position-independent, then the line "move.l #bogus, d0" would work. However,
"lea" is more general-purpose since the address is calculated at execution
time.
The caveat that I mentioned is whether the "lea" instruction is supported on
the processor that the Palm uses, but I would guess that it is. I spent most
of my time coding for the 68020 processor, which has a lot of more advanced
instructions than the Dragonball family.
Doug Gordon
GHCS Software
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/