4.9.10 DDW Directive

The DDW directive is used to initialize 32-bit words of program memory.

The directive takes a comma-separated list of arguments. Each argument can be a numeric value (e.g., 55), a character constant (e.g. 'T'), or a string (e.g. "level" or 'level'). Each argument or each character of a string argument is written as four bytes into consecutive program memory locations within the current psect.

In the following code:

PSECT myWords,class=CODE,delta=2
alabel:
  DDW  'X',1,2,398,0x8005FFFF

the DDW directive will initialize each word of program memory with the supplied value, specifically (in hexadecimal):

00000058 00000001 00000002 0000018E 8005FFFF
Strings consist of a sequence of characters enclosed within either single or double quotes. There is no termination character added by the assembler. If you need a nul-terminated string, then specify the termination character as a separate argument to the DDW directive, for example:
PSECT myConst,class=CODE,delta=1
words:
        DDW "a terminated string",0
will define:
00000061 00000020 00000074 00000065 00000072 0000006D 00000069 0000006E 00000061 00000074
00000065 00000064 00000020 00000073 00000074 00000072 00000069 0000006E 00000067 00000000

The DDW directive cannot be used to created objects in data memory. For that, use the DS directive (see 4.9.13 Ds Directive).