Chapter 9 Writing Machine Language Instructions and Directive Statements

9.4.12 dw

Syntax

label

operation

operand

[name]

dw

expression (, expression )...

Functional description

This directive is used to define 16-bit constants in a memory area. The 16-bit constant specified by the operand will be stored at the location of the statement specifying this directive.

When a name is coded for the label, the assembler will assign the current location counter value to that name.

Operand coding rules

The operands are delimited with commas (,). Any number of operands can be coded.

If data that exceeds 16 bits is specified, the lower 16 bits will be valid, and the upper bits will be lost. The assembler will output a warning message in such cases.

When the specified data has fewer than 16 bits, those bits will fill the lower bits, and the upper bits will be padded with zeroes.

Usage example

Below is an example use of the dw directive.

 

 

 

dw.lst

Page 1

 

*** PanaX Series MN1030 Cross Assembler ***

Loc

Object

Line

Source

 

 

 

1

_DATA

section DATA, PUBLIC, 4

00000000

3930

2

dw0 dw

12345

00000002

34127856

3

dw1 dw

0x1234, 0x5678

00000006

0000

4

dw2 dw

0

Writing Directive Statements 169

Page 181
Image 181
Panasonic MN1030 user manual 12 dw, Section DATA, Public, 3930 Dw0 dw 12345, 34127856 Dw1 dw 0x1234, 0000 Dw2 dw