My thanks to both the people who responded to my query. Rolf's suggestion is a good one, since it is easy enough to compute the new address of a function after it has been moved. With -O2 it calls via a register variable, and is completely position-independent. It has the minor disadvantage of needing extra code to figure out the address of any function to be called, and RAM space is dreadfully tight in the smaller machines.
Bill Knight's suggestion is excellent if the code is to be RAM-resident, since it is completely transparent. However, my need is for code which is not normally used, but is moved to RAM during a code update, to reprogram the flash. With restricted RAM space it is not practical for me to leave the code in RAM at all times. I'd still like to find a way to produce the PC-relative call, since it is a perfect solution. If it exists as a legal opcode, surely there should be a way to access it? -- Rick Jenkins <r...@hartmantech.com> Hartman Technica http://www.hartmantech.com Phone +1 (403) 230-1987 voice & fax 221 35 Avenue. N.E., Calgary, Alberta, Canada T2E 2K5