Hi,
if you know where the function is located and you know its prototype then you can create a pointer to a function and load it with the address of the function you want to call. Why it is important to know the prototype of the function? Because there are different return codes for far and near function. (RTC/RTS)...Calling function is via CALL or JSR. Plus you need to know its parameters.
Moreover I'll deal with S12(X) device and not with MagniV (S12Z) device.
If called function is a far function. It has return code RTC.
void (* far far_function)(void);
If called function is a near function. It has return code RTS.
void (* near far_function)(void);
Note that pointer to a far function has following format :
offset_page
so if the function is located at address 0xPageOffset then you have to put adjusted number to a pointer.
Calling a far function in the code:
let function is at logical page 0x3E and its offset is 0x4444
then, written in two code lines:
far_function = (void(*far)()) 0x44443E
far_function();
Calling a near function in the code:
let function is at the address 0xCCCC
then, written in two lines:
near_function = (void(*near)()) 0xCCCC;
near_function();
I have written this answer without testing but believe it will help you.
When you solve such tasks I always suggest to step the code in assembler to see what is executed and whether there is nothing which can cause any issue. I mean also test execution of called function because it can use or set things which are not compatible with an idea and must be solved.
Best regards,
Ladislav