The P-Code is stored in big-endian format on disk. It contains a version code, an assembler version code, a compiler version code, a stack size and policy, a context count, a module table, a p-code segment table, and the p-code itself.
32-bit, unsigned, big-endian.
The Version Code defines the p-code version contained in the file. This document defines version 1 of the pcode.
32-bit, unsigned, big-endian.
The Ola Version Code indicates the version of the assembler which was used to create the file.
32-bit, unsigned, big-endian.
The Olc Version Code indicates the version of the compiler which was used to produce the input for the assembler.
2 16-bit, unsigned, big-endian.
The Stack Size entry (the first 16-bit field) defines what size stack to allocate upon initialization.
The Stack Policy entry (the second 16-bit field) defines what to do when the stack size is exceeded.
Currently the two policies are
32-bit, unsigned, big-endian.
The Context Count defines how many local nebuloid contexts are referenced in the pcode.
8-bit, null-terminated strings, empty string terminated.
The Module Table lists the modules referenced by the p-code.
It is used to ensure that all referenced modules are present at module load time. It is also used to enumerate module names.
32-bit, unsigned, big-endian. 8-bit, null-terminated strings.
The P-Code Segment Table lists p-code segments as a series of entries consisting of a 32-bit unsigned offset from the start-of-file followed by a string name. It is terminated by a null entry (32-bit zero, and a null string).
mostly 64-bit, mostly signed, big-endian
The P-Code itself is stored in big-endian format on disk and starts immediately following the P-Code Segment Table. It is terminated by the end-of-file.