BackbuttonMulti Dimension Arrays

A Multi Dimension Array occupies 1 Stack Cell for the Untouched_DD MOM Descriptor. 

The Untouched_DD is created by calling the MCP ArrayDec Intrinsic, which adds the information for the other dimensions into the MCP's Array Index Table (AIT). The Compiler stores the Untouched_DD returned by ArrayDec into the appropriate Stack Cell.

0026 (02,0010) 5 000000 200014 MULTIEBCDICARRAY (EBCDIC array) Untouched,
                                                 Length=2 (AIT index=20) 
0025 (02,000F) 5 000000 20000F MULTIHEXARRAY (Hex array) Untouched,
                                              Length=2 (AIT index=15) 
0024 (02,000E) 5 000000 20000A MULTIDOUBLEARRAY (Double array) Untouched,
                                                 Length=2 (AIT index=10) 
0023 (02,000D) 5 000000 200005 MULTISINGLEARRAY (Real array) Untouched,
                                                 Length=2 (AIT index=5) 

ArrayDec is used to allocate several different types of  data structure, however ,this section only describes the allocation of  Multi Dimension Arrays of these simple types,

The declaration of ArrayDec is in the MCP at 4709950, 

PROCEDURE ARRAYDEC (SIRW_TO_MOM,NO_OF_DIMS,TYPE_INFO); 
 VALUE SIRW_TO_MOM, NO_OF_DIMS, TYPE_INFO; 
 REAL NO_OF_DIMS; 
 WORD SIRW_TO_MOM, TYPE_INFO; 

Although ArrayDec is declared as a PROCEDURE, in this case it acts as a FUNCTION which returns an Untouched_DD for the MOM Descriptor. 

SI:=HIST_TOP-NO_OF_DIMS;               // Index of 1st Dimension, below the MSCW 
   ...
THIS_STACK[SI]:=IDD;                   // Store the Untouched_DD for the MOM
   ...
MOVE_THIS_AR_DOWN (NO_OF_DIMS - 1);    // Move the MSCW & RCW down to above the cell
EXIT; % must EXIT after moving my AR.  // which will become the TOS after the exit.  

This means that after calling ArrayDec the Untouched_DD returned by ArrayDec must be stored into it's proper stack location.

The three parameters declared for ArrayDec are,

  1. An SIRW to the Untouched MOM Descriptor (SIRW_TO_MOM).
  2. The Number of Dimensions (NO_OF_DIMS).
  3. Information about the type of array being declared (See the layout of TYPE_INFO).

The number of elements in each dimension are passed beneath the MSCW of the ArrayDec call, one word for each dimension.

  Ebcdic Array MultiEbcdicArray[0:1,0:2];
(02,0010) = MULTIEBCDICARRAY
               0003:0012:2  LT48               BE
               0003:0013                       000000000002 (3"0000000000000002")
               0003:0014:0  LT48               BE
               0003:0015                       000000000003 (3"0000000000000003")
               0003:0016:0  MKSN               DF
               0003:0016:1  NAMC  (01,0004)    6004  ARRAYDEC
               0003:0016:3  NAMC  (02,0010)    5010
               0003:0016:5  STFF               AF
               0003:0017:0  LT8   2            B202
               0003:0017:2  LT8   20           B214
               0003:0017:4  ENTR               AB
               0003:0017:5  NAMC  (02,0010)    5010
               0003:0018:1  OVRD               BA

The maximum number of Dimensions is 16 (See ArrayDec at 4714296).

The compiler stacks the dimension words before calling ArrayDec, and then ArrayDec deletes them, by moving it's MSCW & RCW, to the cell above the Return Value(Untouched_DD). The Compiler has nothing to delete, only having to do something with the Return Value(Untouched_DD) on the Top of Stack.

This is an example of a call to ArrayDec,

Dimensions.SetToBeginning;
While Dimensions.Next(Elements) Do
  CodeSegment.LT48(Elements);
CodeSegment.MKSN;
CodeSegment.NMC1(D1_Stack.MCPIntrinsicSDI(ArrayDecV));
CodeSegment.LNMC(LL,Displacement);
CodeSegment.STFF;
CodeSegment.LT48(Dimensions.Count);
CodeSegment.LT48(0 & ElementSize ChrSzF
                   & 1 NoOfItemsF);
CodeSegment.ENTR;

ArrayDec Integerizes the Dimensions.