250
Section 3: Assembler
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
OFFSET — Begin a Structure Template Section
Syntax
OFFSET [
address]
Description
address
Specifies the base address of the section. It is an absolute
expression that cannot contain any forward, external, or undefined
references.
The OFFSET directive begins a structure template section. If
address is
specified, the section begins at that address; otherwise, it begins at absolute
address zero. This type of section is used in conjunction with the DS directive to
define labels suitable for structure field references. These labels are not included
in the object file’s symbol table.
Since structure template sections 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. Any section directive will end a
structure template section.
Example
OFFSET
; struct node {
visited
DS.B
1
; char visited;
DS.W
0
; struct position {
pos.x
DS.B
2
; short int x;
pos.y
DS.B
2
; short int y;
DS.W
0
; } pos;
left
DS.B
4
; struct node *left;
right
DS.B
4
; struct node *right;
ORG
$1000
; };
MOVE.B
#1,_n+visited
; n.visited = 1;
MOVEA.L
_p,A0
; p
−
>right = NULL;
CLR.L
(right,A0)
;
This example illustrates how the OFFSET directive is used to define a set of
structure field labels. The DS directive is used to allocate space and maintain
proper alignment.