202
Section 3: Assembler
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
.struct — Begin a Structure Template Section
Syntax
.struct [
label]
Description
label
Specifies a label that is used for documentation purposes. It is not
entered in the symbol table.
The .struct directive begins a structure template section. This type of section is
used in conjunction with the .space and .align directives to define labels suitable
for structure field references. These labels are not included in the object file’s
symbol table.
Structure template sections begin at absolute address zero. Since they are
dummy sections, they cannot contain any object code. Also, they cannot be
nested; however, fields of a nested structure can be treated as part of the
enclosing structure. The .ends directive is used to end a structure template
section and resume the previously active section.
Example
.struct node
; struct node {
visited:
.space 1
; char visited;
.align 2
; struct position {
pos.x:
.space 2
; short int x;
pos.y:
.space 2
; short int y;
.align 4
; } pos;
left:
.space 4
; struct node *left;
right:
.space 4
; struct node *right;
.ends
; };
move.b
#1,_n+visited
; n.visited = 1;
movea.l
_p,a0
; p
−
>right = NULL;
clr.l
(right,a0)
;
This example illustrates how the .struct and .ends directives are used to define
a set of structure field labels. The .space and .align directives are used to
allocate space and maintain proper alignment, respectively.