3 field – ARM VERSION 1.2 User Manual

Page 298

Advertising
background image

Directives Reference

7-16

Copyright © 2000, 2001 ARM Limited. All rights reserved.

ARM DUI 0068B

7.3.3

FIELD

The

FIELD

directive describes space within a storage map that has been defined using the

MAP

directive.

#

is a synonym for

FIELD

.

Syntax

{label} FIELD expr

where:

label

is an optional label. If specified,

label

is assigned the value of the storage

location counter,

{VAR}

. The storage location counter is then incremented

by the value of

expr

.

expr

is an expression that evaluates to the number of bytes to increment the
storage counter.

Usage

If a storage map is set by a

MAP

directive that specifies a base-register, the base register

is implicit in all labels defined by following

FIELD

directives, until the next

MAP

directive.

These register-relative labels can be quoted in load and store instructions (see MAP on
page 7-15).

Note

You must be careful when using

MAP

,

FIELD

, and register-relative labels. See Describing

data structures with MAP and FIELD directives on page 2-51 for more information.

Example

The following example shows how register-relative labels are defined using the

MAP

and

FIELD

directives.

MAP 0,r9 ; set {VAR} to the address stored in r9
FIELD 4 ; increment {VAR} by 4 bytes
Lab FIELD 4 ; set Lab to the address [r9 + 4]
; and then increment {VAR} by 4 bytes
LDR r0,Lab ; equivalent to LDR r0,[r9,#4]

Advertising