Assembler Directives and
.COMM Directive
.COMM Directive
The .COMM directive makes a storage request for a specified number of bytes.
Syntax
label .COMM [ num_bytes]
Parameters
label | Labels the location of the reserved storage. |
num_bytes An integer value for the number of bytes you want to reserve. The Assembler uses a default value of 4 if the
.COMM directive lacks a num_bytes parameter. Permissible values range from one to 0x3FFFFFFF.
Discussion
The .COMM directive declares a block of storage that can be thought of as a common block. You must label every .COMM directive. The linker associates the label with the subspace in which the .COMM directive is declared and allocates the necessary storage within that subspace.
.COMM always allocates its space in the $BSS$ subspace of the
$PRIVATE$ space. If the label of a .COMM directive appears in several object modules, the linker uses the maximum size specified in any module when it allocates the necessary storage in the current subspace.
Example
This example reserves 16 bytes of storage for mydata.
| .BSS |
mydata | .COMM 16 |
74 | Chapter 4 |