GNU Info

Info Node: (nasm.info)Section 4.7.2

(nasm.info)Section 4.7.2


Next: Section 4.7.3 Prev: Section 4.7.1 Up: Section 4.7
Enter node , (file) or (file)node

4.7.2. Context-Local Labels
---------------------------

   Just as the usage `%%foo' defines a label which is local to the
particular macro call in which it is used, the usage `%$foo' is used to
define a label which is local to the context on the top of the context
stack. So the `REPEAT' and `UNTIL' example given above could be
implemented by means of:

     %macro repeat 0
     
         %push   repeat
         %$begin:
     
     %endmacro
     
     %macro until 1
     
             j%-1    %$begin
         %pop
     
     %endmacro

   and invoked by means of, for example,

             mov     cx,string
             repeat
             add     cx,3
             scasb
             until   e

   which would scan every fourth byte of a string in search of the byte
in `AL'.

   If you need to define, or access, labels local to the context _below_
the top one on the stack, you can use `%$$foo', or `%$$$foo' for the
context below that, and so on.


automatically generated by info2www version 1.2.2.9