SPNU118Z September 1995 – March 2023 66AK2E05 , 66AK2H06 , 66AK2H12 , 66AK2H14 , AM1705 , AM1707 , AM1802 , AM1806 , AM1808 , AM1810 , AM5K2E04 , OMAP-L132 , OMAP-L137 , OMAP-L138 , SM470R1B1M-HT , TMS470R1A288 , TMS470R1A384 , TMS470R1A64 , TMS470R1B1M , TMS470R1B512 , TMS470R1B768
Declare Structure Type
[stag] .struct [expr]
[mem0]
element [expr0]
[mem1] element [expr1]
. . .
[memn] .tag
stag [exprn]
. . .
[memN] element [exprN]
[size] .endstruct
label .tag stag
The .struct directive assigns symbolic offsets to the elements of a data structure definition. This allows you to group similar data elements together and let the assembler calculate the element offset. This is similar to a C structure or a Pascal record. The .struct directive does not allocate memory; it merely creates a symbolic template that can be used repeatedly.
The .endstruct directive terminates the structure definition.
The .tag directive gives structure characteristics to a label, simplifying the symbolic representation and providing the ability to define structures that contain other structures. The .tag directive does not allocate memory. The structure tag (stag) of a .tag directive must have been previously defined.
Parameters used with the .struct, .endstruct, and .tag directives are:
The following examples show various uses of the .struct, .tag, and .endstruct directives.
1 REAL_REC .struct ; stag
2 00000000 NOM .int ; member1 = 0
3 00000004 DEN .int ; member2 = 1
4 00000008 REAL_LEN .endstruct ; real_len = 4
5
6 00000000 E59F0004 LDR R0, REAL_A
7 00000004 E5904004 LDR R4, [R0, #REAL_REC.DEN]
8 00000008 E0811004 ADD R1, R1, R4
9 00000000 .bss REAL, REAL_LEN ; allocate mem rec
10 0000000c 00000000- REAL_A .word REAL
11
12 CPLX_REC .struct
13 00000000 REALI .tag REAL_REC ; stag
14 00000008 IMAGI .tag REAL_REC ; member1 = 0
15 00000010 CPLX_LEN .endstruct ; cplx_len = 8
16
17 COMPLEX .tag CPLX_REC ; assign structure
18 ; attribute
19 00000010 COMPLEX .space CPLX_LEN ; allocate space
20 00000020 E51F4018 LDR R4, COMPLEX.REALI ; access structure
21 00000024 E0811004 ADD R1, R1, R4
1 .struct ; no stag puts mems into
2 ; global symbol table
3 00000000 X .int ; create 3 dim templates
4 00000004 Y .int
5 00000008 Z .int
6 0000000C .endstruct
1 BIT_REC .struct ; stag
2 00000000 STREAM .string 64
3 00000040 BIT7 .field 7 ; bit7 = 64
4 00000040 BIT8 .field 9 ; bit9 = 64
5 00000042 BIT10 .field 10 ; bit10 = 64
6 00000044 X_INT .int ; x_int = 68
7 00000048 BIT_LEN .endstruct ; length = 72