6.1.9.14 Dw Directive
The DW
directive is used to initialize 16-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 two bytes into consecutive program memory
locations within the current psect.
In the following code:
PSECT myWords,class=CODE,delta=2
alabel:
DW 'X',1,2,398,5472
the DW
directive will initialize each word of program
memory with the supplied value, specifically (in hexadecimal):
0058 0001 0002 018E 1560
DW
directive, for
example:PSECT myConst,class=CODE,delta=1
words:
DW "a terminated string",0
will
define:0061 0020 0074 0065 0072 006D 0069 006E 0061 0074 0065 0064 0020 0073 0074 0072 0069 006E 0067 0000
The DW
directive cannot be used to created objects in data memory. For
that, use the DS
directive (see 6.1.9.13 Ds Directive).