Arrays, combined with structures, can make complex data structuring simple:

    BankAccount STRUC
    HolderName  FIELD  CHAR[32]
    HolderAddr  FIELD  CHAR[32]
    Balance     FIELD  Amount
    ODLimit     FIELD  Amount
                ENDSTRUC

You can select individual elements from an array by specifying the index to be used in brackets:

    LDB MyAccount.HolderName[0]

The assembler defines arrays as zero-based, so the fragment above loads the first character of MyAccount’s HolderName. Because the assembler must know the address to load at assembly time, the expression within the square brackets must evaluate to a constant at assembly time. For example, the following is invalid because Index isn’t an assembly-time constant:

    Index   DV      BYTE
            LDB     MyAccount.HolderName[Index]

However, if Index were defined symbolically, the assembler can compute the correct address to encode in the instruction at assembly time:

    Index   EQU     20
            LDB     MyAccount.HolderName[Index]