AnsweredAssumed Answered

Using pointers to __far function.

Question asked by John Dammeyer on Apr 7, 2016
Latest reply on Apr 25, 2016 by John Dammeyer

I am using the 5.1 Codewarrier compiler for the 9S12XDP512.  I want to be able to make the compiler generate a call that includes the page register.  In the code I have:

void (*__far OD_func)(PLONG p) = pDict->obj->p.pFunc;

In the data structure I've declared a union that includes

void (* __far pFunc)(PLONG p)


From the S12CPUV2.pdf document:

CALL oprx16,xysp, page    and the opcode should be 4B xb ee ff pg

where xb identifies which index format and which register is used. Trouble is I can't see what xb should be, so that the pg value is included in the instruction.  Here's what's generated by the compiler where fb is F3 which matches the index dscription table in the S12CPUV2.pdf document.


Currently the function is in the same page so it doesn't matter.  Also this doesn't work.  If I replace __far with __near it does work but generates a JSR instead of the call.



0035 4bf30002     CALL  [2,SP]


How do I do a paged call using a function pointer?