5. How routines are encoded
A routine is required to begin at an address in memory which can be represented by a packed address (for instance, in Version 5 it must occur at a byte address which is divisible by 4).
Execution of instructions begins from the byte after this header information. There is no formal ’end-marker’ for a routine (it is simply assumed that execution eventually results in a return taking place).
In Version 6, there is a “main” routine (whose packed address is stored in the word at
$06 in the header) called when the game starts up. It is illegal to return from this routine.
In all other Versions, the word at
$06 contains the byte address of the first instruction to execute. The Z-machine starts in an environment with no local variables from which, again, a return is illegal.