BackbuttonMinimum CodeFile Requirements

This section describes the minimum CodeFile requirements that must be met for a program to be executed on an LX100 by the MCP on 5.0.

The CodeFile must have these 3 things,

The minimum program does not use any UnSafe or UpLevel constructs. It does not Freeze as a Library. It has no parameters and is executed at Lex Level 2. It does not have an FPB. It uses the MCP default values for any stack attributes.

Segment Zero

These items are required in Segment Zero.

CodeFile Segment Zero - Required Items
Word Field Name Values Description
0 S0ProgWordV  
[47:8] S0LevelNumberF 4 = Seg0_Level4 Indicates the version of the layout of Seg0.
2 S0EntryPointV The SDI of the PCW for the Program Entrypoint
6 S0ExecuteInfoV
[15:8] S0CodeGenLevelF 6 = S0DeltaV
8 S0CompileInfoV
[31:8] S0LanguageNoF 0 = S0AlgolTypeV
[23:8] S0MarkLevelF COMPILETIME(20)
[9:10] S0CycleF COMPILETIME(21)
18 S0D1DescV
[39:20] S0NumberOfEntriesF The number of Entries in the Segment Dictionary. Each entry is 8 bytes, a 2 byte (Flags and Tag) and a 6 Byte Word.
[19:20] S0SegNumF The Sector Address of the Start of the Segment Dictionary.

This is the test program code which creates Segment Zero.

%  Create the Segment Zero Control Information

SegZero[S0ProgWordV]:=0 & Seg0_Level4V S0LevelNumberF;
SegZero[S0EntryPointV]:=EntrySDI;
SegZero[S0ExecuteInfoV]:=0 & S0DeltaV S0CodeGenLevelF;
SegZero[S0CompileInfoV]:=0 &    S0AlgolTypeV S0LanguageNoF
                           & CompileTime(20) S0MarkLevelF
                           & CompileTime(21) S0CycleF;
SegZero[S0D1DescV]:=0 & D1Address S0SegNumF
                      & D1Entries S0NumberOfEntriesF;

Skeleton Segment Dictionary

A skeleton Segment Dictionary, which is loaded into memory using a Read with Tags operation, must be provided in the CodeFile. Its codefile address and the number of entries are stored in Segment Zero Word [18] S0D1DescV.

Each entry consists of 8 bytes,

<tag byte><flag byte><segdesc>

The first byte is used to set the Tag. The second byte is used for Binder information. The remaining 6 bytes are the Segment and Data Descriptor Word contents.

The first entry of the Segment Dictionary is overwritten with the D[1] Stack MSCW.

The MCP expects that the second entry contains a data Descriptor to the Line Dictionary, which holds the Source to Code mapping information (LineInfo).

The Segment Dictionary must contain a PCW to the EntryPoint Code at the index given by S0EntryPointV in Segment Zero. The PCW contains the SDI of the Code Segment, and so it must also be present in the skeleton Segment Dictionary.

Code Segments

The Code Segments are described by Segment Descriptors which are stored in the Segment Dictionary. The AddressF fieldof the Descriptor contains the CodeFile relative Disk Sector Address, and the LengthF contains the number of Words in the Segment.

A Code Segment must start on a 30 Word Sector Boundary and it must not span an Area Boundary.

The Code is generated without Tags. When the Code is read in from the CodeFIle, the Memory Tags are set to 3.

The Operands for some Operators, such as MPCW and LT48 must be aligned on a 48 Bit Word Boundary.