You copied the Doc URL to your clipboard.

21.29 FIELD

The FIELD directive describes space within a storage map that has been defined using the MAP directive.


{label} FIELD expr



is an optional label. If specified, label isassigned the value of the storage location counter, {VAR}.The storage location counter is then incremented by the value of expr.


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


If a storage map is set by a MAP directivethat specifies a base-register, the base register isimplicit in all labels defined by following FIELD directives,until the next MAP directive. These register-relativelabels can be quoted in load and store instructions.

# is a synonym for FIELD.


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 bytesLab 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]

When using the MAP and FIELD directives, you must ensure that the values are consistent in both passes. The following example shows a use of MAP and FIELD that causes inconsistent values for the symbol x. In the first pass sym is not defined, so x is at 0x04+R9. In the second pass, sym is defined, so x is at 0x00+R0. This example results in an assembly error.

    MAP 0, r0    if :LNOT: :DEF: sym      MAP 0, r9      FIELD 4  ; x is at 0x04+R9 in first pass    ENDIFx   FIELD 4    ; x is at 0x00+R0 in second passsym LDR r0, x  ; inconsistent values for x results in assembly error
Was this page helpful? Yes No