http://smilebasicsource.com/forum?fpid=19365#post_19365
'initialize some sprites SPSET 0,1 SPSET 1,2 'a function that will serve as our sprite callback, 'evaluated each time CALL SPRITE is executed DEF MYFUNC 'log the current ID 'note that it alternates, going through both id 0 and 1 each call '(you can use additional logging to verify this) ?CALLIDX VAR X, Y 'use OUT form of SPOFS to get position 'special var CALLIDX represents sprite ID being evaluated SPOFS CALLIDX OUT X, Y 'normal SPOFS using CALLIDX SPOFS CALLIDX, X+1, Y+1+CALLIDX 'just to differentiate sprites END 'attach MYFUNC to sprites SPFUNC 0, "MYFUNC" SPFUNC 1, "MYFUNC WHILE 1 VSYNC 'evaluate sprite callbacks in a loop CALL SPRITE 'since we attached MYFUNC which moves the sprite every frame 'the two sprites will move across the screen WEND