Chapter 10 Writing Assembler Control Statements

Usage example

A source file that uses #ifeq and #ifneq is shown below. The macro named compare uses two dummy parameters(data1,data2). Within the macro it compares the strings of those dummy parameters. If they match, an instruction that sets the A register to 1 will be assembled. If they do not match, an instruction that sets the A register to 0 will be assembled. The macro is called by specifying strings to be passed to the dummy parameters.

compare

macro

data1, data2

#ifeq

data1, data2

 

#else

mov

0x01, D0

mov

0x02, D0

#endif

endm

 

;

 

 

 

_TEXT

section

CODE, PUBLIC, 1

 

compare

abc, abc

 

compare

abc, acb

196 Conditional Assembly

Page 208
Image 208
Panasonic MN1030 user manual Compare Abc, abc Abc, acb