5.8.20. DCB or = directive

The DCB directive allocates one or more bytes of memory, and defines the initial runtime contents of the memory. = is a synonym for DCB.

Syntax

The syntax of DCB is:

{label} DCB expression{,expression}...

where:

expression

is either:

  • A numeric expression that evaluates to an integer in the range –128 to 255. See Numeric expressions.

  • A quoted string. The characters of the string are loaded into consecutive bytes of store.

Usage

You must use the DATA directive if you use DCB to define labeled data within Thumb code. Refer to DATA directive for more information.

If DCB is followed by an instruction, use an ALIGN directive to ensure that the instruction is aligned. Refer to ALIGN directive for more information.

See also:

Example

Unlike C strings, ARM assembler strings are not null-terminated. You can construct a null-terminated C string using DCB as follows:


C_string  DCB  "C_string",0

Copyright © 1997, 1998 ARM Limited. All rights reserved.ARM DUI 0041C
Non-Confidential