ref: 4228e3e8900af0d42e5e2384af90deeef8882008
parent: 023b574fc5a21a259317a065b6f89db9a4855a40
author: Antonio Niño Díaz <[email protected]>
date: Wed Apr 26 18:02:47 EDT 2017
Document dependency problem for EQUS and MACRO This is hard to detect in MACROs, as there are legitimate uses for MACROs that call themselves recursively. For an EQUS, the problem is that its value may be modified at different points in the source code, so the only way to detect a possible problem is by doing an analysis at each usage of the EQUS. Also, since an EQUS may expand to the name of a MACRO and a MACRO can use an EQUS, it becomes even harder to check all possible problems that come out of it. It's better to let this task to the programmer. Signed-off-by: Antonio Niño Díaz <[email protected]>
--- a/src/asm/rgbasm.5
+++ b/src/asm/rgbasm.5
@@ -340,6 +340,14 @@
Note that a colon (:) following the label-name is not allowed.
String equates can't be exported or imported.
.Pp
+.Sy Important note :
+An EQUS can be expanded to a string that contains another EQUS
+and it will be expanded as well.
+This means that, if you aren't careful, you may trap the assembler into an
+infinite loop if there's a circular dependency in the expansions.
+Also, a MACRO can have inside an EQUS which references the same MACRO, which has
+the same problem.
+.Pp
.It Sy MACRO
.Pp
One of the best features of an assembler is the ability to write macros for it.
@@ -400,6 +408,14 @@
jr nz,.loop\[rs]\@
ENDM
.Ed
+.Pp
+.Sy Important note :
+Since a MACRO can call itself (or a different MACRO that calls the first one)
+there can be problems of circular dependency.
+They trap the assembler in an infinite loop, so you have to be careful when
+using recursion with MACROs.
+Also, a MACRO can have inside an EQUS which references the same MACRO, which has
+the same problem.
.Pp
.Sy Macro Arguments
.Pp