If your program contains both functions compiled into p-code and functions compiled into machine code, it is possible that a machine code function will call a p-code function. When this happens, your program must stop executing machine code and turn control over to the p-code interpreter, which then begins executing the p-code.
To enable this transition from machine code to p-code, a p-code function normally contains a “native entry point” at its beginning, which consists of a few machine code instructions. For example,
myfunc: // native entry point
MOV AX,DS // possible Windows preamble
NOP
CALL __PcodeCallFC
DB __index
_PCODE_myfunc: // p-code entry point
DW ????
LdcW1
.
.
.
These are the instructions generated when a function called myfunc() is compiled into p-code. When myfunc() is called from a machine code function, those machine code instructions at the top are executed first. They transfer control to the p-code interpreter, which continues execution with the p-code instructions starting at the label _PCODE_myfunc. Note that the label _PCODE_myfunc is not actually generated by the compiler. It is specified here for illustration purposes only.
When a p-code function is called by another p-code function, the native entry point is bypassed and execution begins immediately with the first p-code instruction.