For example:
Code: Select all
MODULE M;
PROCEDURE p0;
END p0;
PROCEDURE p1;
END P1;
END M.
Here's my current approach, which relies on the existence of 'p1', which works for my current use case (I have verified that 'p1' follows 'p0' in code memory):
Code: Select all
IMPORT SYSTEM;
CONST RamAddr = 020040000H;
TYPE P = PROCEDURE;
VAR p0ram: P;
PROCEDURE copyProc;
VAR addrBegin, addrNext, p0RamAddr : INTEGER;
BEGIN
addrBegin := SYSTEM.ADR(p0); addrNext := SYSTEM.ADR(p1);
p0RamAddr := RamAddr;
SYSTEM.COPY(addrBegin, RamAddr, (addrNext - addrBegin) DIV 4);
p0ram := SYSTEM.VAL(P, p0RamAddr)
END copyProc;