06.02.2013 Views

C166/ST10 Cross-Assembler, Linker/Locator, Utilities ... - Tasking

C166/ST10 Cross-Assembler, Linker/Locator, Utilities ... - Tasking

C166/ST10 Cross-Assembler, Linker/Locator, Utilities ... - Tasking

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2−44<br />

MACRO PREPROCESSOR<br />

This expands to:<br />

MOV R1, #DBFLAG<br />

JMP DEBUG<br />

MOV R1, R2<br />

@SET can be changed to:<br />

@SET( DEBUG, 0 )<br />

to turn off the debug code.<br />

2.6.4.2 WHILE FUNCTION<br />

Chapter 2<br />

The IF macro is useful for implementing one kind of conditional assembly<br />

including or excluding lines of code in the source file. However, in many<br />

cases this is not enough. Often you may wish to perform macro operations<br />

until a certain condition is met. The built−in function WHILE provides this<br />

facility.<br />

Syntax:<br />

@WHILE( expression )<br />

statements<br />

@ENDW<br />

The WHILE function evaluates the expression. If it results to TRUE, the<br />

statements are expanded; otherwise not. Once the statements have been<br />

expanded, the logical arguments is retested and it’s still TRUE, the<br />

statements are expanded again. This continues until the logical argument<br />

proves FALSE.<br />

Since the macro continues processing until the expression is FALSE, the<br />

statements should modify the expression, or else WHILE may never<br />

terminate.<br />

A call to built−in function BREAK or EXIT always terminates a WHILE<br />

macro. BREAK and EXIT are described below.<br />

The following example shows the common use of the WHILE macro:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!