This is a general example which applies to all Cosmic compilers.
If the function is external to the program and already located at a specific address. e.g. An already programmed boot loader, ROM monitor or device driver. In that case you can use absolute addressing syntax the same as for a variable. :
extern void monitor(void) @0xf800;
This will generate a jsr or call to the specified address. However, absolute addressing does not actually locate functions or variables. This is done by the linker. So absolute addressing only works if the function is already located the specified address.
If you want to place/locate a function that is part of the current application at a fixed memory address then you need to perform two steps.
1) Create a new section. This can be accomplished using the "#pragma section" feature. e.g. The first pragma creates the new section .monit and starts allocating code into it and the second returns the section allocation back to the default .text:
#pragma section (monit)
#pragma section ()
2) Link the new section at the desired address. In this case, the function monitor() is created in a section named .monit instead of being included in the default .text section.
Now we need to tell the linker where to place this section in memory, with the following directive in the linker file:
+seg .monit -b 0xf800
monit.o # contains the function monitor()
placed before the object file that contains the function monitor().