## ALP Programming Guide and Reference

[prev][next][parent][TOC]

### Data Allocation

Data allocation statements allow you to reserve storage for your program data. To initiate a data allocation statement, an Old-Style-Allocation- Directive may be used, but in modes other than M510 it is preferable to use a Scalar-TypeName or UserDefined-TypeName, which the assembler treats as a pseudo-directive. To introduce consistency into the descriptions, all such variations will be referred to as the Allocation-TypeName.

The Allocation-TypeName that you select determines the data-type of the allocated storage. An optional symbolic name may be associated with the storage, and the storage may also be initialized with specific values if so desired.

Syntax

    [ Name ]   Allocation - TypeName   Initializer   [ ,   Initializer   . . . ]

Allocation-TypeName:
Old-Style-Allocation-Directive
Scalar-TypeName
Record-TypeName
Structure-TypeName
Union-TypeName
Typedef-TypeName

Old-Style-Allocation-Directive: one of

    DB DW DD DF DQ DT

Remarks

The various fields of the data allocation statement are described as follows:

Name If the Name entry is present, it must be specified as a valid Identifier unique to the scope in which it appears. If the allocation statement is assembled into an open segment, the assembler converts the identifier to a Data-LabelName to allow referencing the storage by a symbolic variable name. If the allocation statement is assembled into the body of a STRUCT or UNION type definition, then the assembler converts the identifier to a Structure-FieldName or Union-FieldName.

Allocation-TypeName If the Allocation-TypeName is specified as a Typedef- TypeName, the assembler resolves it to its underlying data type to determine what type of initialization is to be performed.

If the Allocation-TypeName entry resolves to a Scalar-TypeName or a pointer to some other type, then the Initializer field must be specified using an expression syntax that can be resolved to a Scalar-Initializer- ExpressionType. See the following section on Initialization of Scalar Types for a full description of this topic.

If the Allocation-TypeName entry resolves to a Record-TypeName, Structure- TypeName, or Union-TypeName, then the Initializer field must be specified using the Compound-Initializer syntax. See the following section on Initialization of Aggregate Types for a full description of this topic.

If the Allocation-TypeName entry resolves to an array of any other type, then the Initializer field must be specified using the Compound-Initializer syntax. See the following section on Initialization of Vector Types for a full description of this topic.

Initializer Each Initializer entry is an Expression that must resolve to an Initializer-ExpressionType appropriate for the type of data described by the Allocation-TypeName field.

Each Initializer entry may also be duplicated by making it the operand of a Duplicative-Expression. When assembling in ALP mode however, the DUP operator is considered obsolete and its use is discouraged. Instead, a Typedef-TypeName associated with the declaration of a true array should be used in the Allocation-TypeName field along with the appropriate compound initializer.