Chapter 9 Writing Machine Language Instructions and Directive Statements

9.4.19 assign

Syntax

label operation operand

name assign expression

Functional description

This directive defines the name to be the value of the expression coded in the operand. When that name is coded in the operand of machine language instructions or directive instructions, the assembler will refer the name’s value.

Operand coding rules

The expression coded in the operand must result in the attribute abs (absolute).

Refer to Chapter 8, “Writing Source Statements”, section 8.7, “Expressions”, section 8.7.4, “Expression Attributes”, regarding attributes of expression.

Names defined with the assign directive can be defined again with the assign directive.

Names defined with the assign directive cannot be declared external references or external declarations. No memory ares is reserved when an assign directive statement is executed.

Usage examples

The example below is a use of the assign directive.

 

 

 

 

 

assign.lst

Page 1

 

 

 

***

PanaX Series MN1030 Cross Assembler ***

 

 

Loc

Object

Line

Source

 

 

 

 

 

 

 

1

_TEXT

section

CODE, PUBLIC, 1

 

 

 

 

2

NUM

assign

0x01

 

 

00000000

8001

3

 

mov

NUM, D0

 

 

 

 

 

4

 

 

 

 

 

 

 

 

5

NUM

assign

0x02

 

 

00000002

8002

6

 

mov

NUM, D0

 

 

 

 

 

 

 

 

 

 

 

NOTE:

If a name defined with this directive is used, you must define the value before the

 

 

statement.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Writing Directive Statements 179

Page 191
Image 191
Panasonic MN1030 user manual Usage examples, Assign 0x01 00000000 8001 Mov, Assign 0x02 00000002 8002 Mov, Statement