EasyManua.ls Logo

ST ST7 - Macros

ST ST7
317 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
156/317
6 - STMicroelectronics Programming Tools
#DEFINE FIRST_TYPE
must be removed, or changed, like this:
#DEFINE SECOND_TYPE
Then, the identifier FIRST_TYPE is no longer defined; that the identifier SECOND_TYPE is defined
instead does not prevent the
FIRST_TYPE throughout the program being false, and thus ena-
bles the assembly of the
ELSE part of the source.
The
IFDEF linemayalsobecomeacomment,likethis:
; #DEFINE FIRST_TYPE
with the same result.
It is even possible to change the version being assembled without altering a single line of the
source text. For this to happen, there must be no
#DEFINE pseudo-ops in the source text; in-
stead, the invocation line of the assemble must have the argument
-D FIRST_TYPE.Thisde-
fines the identifier
FIRST_TYPE before the program is assembled. Then,the program is assem-
bled for the first type of display. If this argument is omitted, or changed, the program is assem-
bled for the second type of display.
There are other types of
#IF pseudo-ops; although they can be used for the same function,
they are usually more often used within macros, sothey will be explained in the paragraph that
discusses macros.
6.1.7 Macros
A macro is basically a predefined block of text that is associated with an identifier. Using this
identifier in lieu of an operation code, causes the text to be inserted at the position of the iden-
tifier. Example:
The code below defines a macro that contains three statements.
MyCode MACRO
inc CounterLo
ld A, CounterHi
adc A, #0
MEND

Table of Contents

Related product manuals