Chapter 10 Writing Assembler Control Statements
196 Conditional Assembly
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
mov 0x01, D0
#else mov 0x02, D0
#endif endm
;
_TEXT section CODE, PUBLIC, 1
compare abc, abc
compare abc, acb