piclist 2003\06\05\050934a >
Thread: Call a function address by variable value
www.piclist.com/techref/ubicom/devices.htm?key=sx
flavicon
face BY : Amir Shalem email (remove spam text)



is it possible in SX to do CALL or JMP to an address specficed in a
variable ?

something like this: (this doesn't work)

       callback        EQU     $08
       reset start

start   mov callback, myfunction
       call callback

myfunction
       ;do something
       ret


In C, its easy to do

void function() { return; }

typedef void (*ptr) (void);

void start() {
       ptr *pointer;

       pointer = function;
       (pointer)();
}

is it possible to do in SX asm ?

thanks,
       Amir.

--
http://www.piclist.com hint: To leave the PICList
spamBeGonepiclist-unsubscribe-request@spam@spamEraseMEmitvma.mit.edu>
<Pine.BSF.4.44_heb2.09.0306051148160.83749-100000@active.ath.cx>

See also: www.piclist.com/techref/ubicom/devices.htm?key=sx
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Call a function address by variable value

month overview.

new search...