Assembly-Time Symbol Directives
4-22
The .tag directive assigns a label to a structure. This simplifies the sym-
bolic representation and also provides the ability to define structures that
contain other structures. The .tag directive does not allocate memory, and
the structure tag (stag) must be defined before it is used.
type .struct ; structure tag definition
X .int
Y .int
T_LEN .endstruct
COORD .tag type ; declare COORD (coordinate)
ADD COORD.Y, A
.bss COORD, T_LEN ; actual memory allocation
-
The .union /.endunion directives create a symbolic template that can be
used repeatedly, providing a way to manipulate several different kinds of
data in the same storage area. The union sets up a C-like union definition.
While it does not allocate any memory, it allows alternate definitions of size
and type that may be temporarily stored in the same memory space.
The .tag directive assigns a label to the union, and is associated with the
beginning of the union. A union can be defined and given a tag, and later it
can be declared as a member of a structure by using the .tag directive. A
union may also be declared without a tag, in which case all of its members
will be entered in the symbol table, and each member must have a unique
name. A union may also be defined within a structure, in which case any
reference to such a union will be in association with the structure that en-
closes it. For example:
.data
s2_tag .struct
;structure tag definition
.union
;union is first structure member
.struct
;structure is union member
h1
.half
;h1, h2, and w1
h2
.uhalf
;exist in the same memory
.endstruct
w1
.word
;word is another union member
.endunion
w2
.word
;second structure member
s2_len .endstruct
XYZ
.tag
s2_tag
.bss
XYZ,s2_len
;declare instance of structure
ADD
XYZ.h2, A
Summary of Contents for TMS320C54x
Page 38: ......
Page 39: ......
Page 40: ......
Page 41: ......
Page 42: ......
Page 43: ......
Page 44: ......
Page 45: ......
Page 46: ......
Page 47: ......
Page 48: ......
Page 49: ......
Page 50: ......
Page 51: ......
Page 52: ......
Page 53: ......
Page 54: ......
Page 55: ......
Page 56: ......
Page 57: ......
Page 58: ......
Page 59: ......
Page 60: ......
Page 61: ......
Page 62: ......
Page 276: ......
Page 277: ......
Page 278: ......
Page 279: ......
Page 280: ......
Page 281: ......
Page 282: ......
Page 283: ......
Page 284: ......
Page 285: ......
Page 286: ......
Page 287: ......
Page 288: ......
Page 289: ......
Page 290: ......
Page 291: ......
Page 292: ......
Page 293: ......
Page 294: ......
Page 295: ......
Page 296: ......
Page 297: ......
Page 298: ......
Page 299: ......
Page 300: ......
Page 301: ......
Page 302: ......