12.07.2015 Views

MAXQ Core Assembly Guide - Maxim

MAXQ Core Assembly Guide - Maxim

MAXQ Core Assembly Guide - Maxim

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.

<strong>MAXQ</strong> <strong>Core</strong> <strong>Assembly</strong> <strong>Guide</strong>Macro output file; swap A[0], A[1], A[2] ; Too many parameters (error); BEGIN Macro swapmove GR, A[0]move A[0], A[1]move A[1], GR; End Macro swap; BEGIN Macro swapmove GR, Reg1move Reg1, Reg2move Reg2, GR; End Macro swapendMacros with Local IdentifiersLocal identifiers must be used in macros which contain labels, since if a macro is simply defined asloopN macro Countmove LC[0], CountL1:djnz LC[0], L1endmthere will be an assembly error if the macro is called more than once, since the L1 label will be redefined at a newlocation. The solution to this is to use a local identifier, as follows.loopN macro Countlocal L1move LC[0], CountL1:djnz LC[0], L1endmIn this way, each time a macro is expanded which contains the local identifier L1, that identifier will be replaced inthe body of the macro with a unique identifier formed by merging the name of the source file, the name of theidentifier, and the number of times that local identifier has been used. This allows multiple macros to use the samelocal identifier name without conflicts, as shown below.Version 1.2 40 of 43 March 7, 2007

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

Saved successfully!

Ooh no, something went wrong!