Leaving a nested DO
It is possible to leave a nested DO macro by specifying a label on the DO macro and the same
label as a parameter on a contained ASMLEAVE macro. Here is the flowchart for this structure:
If a label is not specified, then the current macro is exited.
In the following example,
asmleave loop
breaks from the inner
DO loop to the end of the outer (labeled) DO loop, while the asmleave
without a label just breaks to the end of the current DO loop:
loop do while=2
do while=4
mvc a,d
if (clc,a,eq,b)
asmleave loop
else
asmleave
endif
enddo
enddo
produces:
loop do while=2
+loop DC 0H
+ BC 15,#@LB2
+#@LB3 DC 0H
do while=4
+ BC 15,#@LB7
+#@LB8 DC 0H
mvc a,d
if (clc,a,eq,b)
+ clc a,b
+ BC 15-8,#@LB11
asmleave loop
+ BC 15,#@LB1
else
+ BC 15,#@LB13
+#@LB11 DC 0H
asmleave
+ BC 15,#@LB6
endif
+#@LB13 DC 0H
enddo
+#@LB7 DC 0H
+ BC 4,#@LB8
+#@LB6 DC 0H
enddo
+#@LB2 DC 0H
+ BC 2,#@LB3
+#@LB1 DC 0H