]> Shamusworld >> Repos - rmac/commitdiff
Tentative fix for bug #55. Thanks to ggn for reporting!
authorShamus Hammons <jlhamm@acm.org>
Wed, 11 Nov 2015 03:44:44 +0000 (21:44 -0600)
committerShamus Hammons <jlhamm@acm.org>
Wed, 11 Nov 2015 03:44:44 +0000 (21:44 -0600)
amode.c
parmode.h
version.h

diff --git a/amode.c b/amode.c
index 875c324d6175ffe77304c157ab2cb29ff7dcb8f5..b09b2da57cb63fc4b6880e4e320c9f0d9811d1c6 100644 (file)
--- a/amode.c
+++ b/amode.c
@@ -75,6 +75,7 @@ int amode(int acount)
        #define AnESYM    a0esym
        #define AMn_IX0   am0_ix0
        #define AMn_IXN   am0_ixn
        #define AnESYM    a0esym
        #define AMn_IX0   am0_ix0
        #define AMn_IXN   am0_ixn
+       #define CHK_FOR_DISPn CheckForDisp0
        #include "parmode.h"
 
        // If caller wants only one mode, return just one (ignore comma); 
        #include "parmode.h"
 
        // If caller wants only one mode, return just one (ignore comma); 
@@ -102,6 +103,7 @@ int amode(int acount)
        #define AnESYM    a1esym
        #define AMn_IX0   am1_ix0
        #define AMn_IXN   am1_ixn
        #define AnESYM    a1esym
        #define AMn_IX0   am1_ix0
        #define AMn_IXN   am1_ixn
+       #define CHK_FOR_DISPn CheckForDisp1
        #include "parmode.h"
 
        nmodes = 2;
        #include "parmode.h"
 
        nmodes = 2;
index 543701ace549f4bb9e9ee4c879888a1f6cab2c70..38f6f94b6c787f5143c40bb98cdc0e7f806c8a0f 100644 (file)
--- a/parmode.h
+++ b/parmode.h
 
                AMn = IMMED;
        }
 
                AMn = IMMED;
        }
+
+       // Small problem with this is that the opening parentheses might be an
+       // expression that's part of a displacement; this code will falsely flag
+       // that as an error.
+
        // (An)
        // (An)+
        // (An,Xn[.siz][*scale])
        // (An)
        // (An)+
        // (An,Xn[.siz][*scale])
                        if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                                return ERROR;
 
                        if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                                return ERROR;
 
+                       // It could be that this is really just an expression prefixing a
+                       // register as a displacement...
+                       if (*tok == ')')
+                       {
+                               tok++;
+                               goto CHK_FOR_DISPn;
+                       }
+
+                       // Otherwise, check for PC & etc displacements...
                        if (*tok++ != ',')
                                goto badmode;
 
                        if (*tok++ != ',')
                                goto badmode;
 
                if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                        return ERROR;
 
                if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                        return ERROR;
 
+CHK_FOR_DISPn:
                if (*tok == DOTW)
                {
                        // expr.W 
                if (*tok == DOTW)
                {
                        // expr.W 
        ;
 }
 
        ;
 }
 
-// Cleanup dirty little macros
+// Clean up dirty little macros
 #undef AnOK
 #undef AMn
 #undef AnREG
 #undef AnOK
 #undef AMn
 #undef AnREG
 #undef AnESYM
 #undef AMn_IX0
 #undef AMn_IXN
 #undef AnESYM
 #undef AMn_IX0
 #undef AMn_IXN
+#undef CHK_FOR_DISPn
index ad818756de9da7a495e456f2c1120656fe7656e3..1d1ba1e56ed9560326cfae3dc71e4c288a64b56d 100644 (file)
--- a/version.h
+++ b/version.h
@@ -13,6 +13,6 @@
 
 #define MAJOR   1              // Major version number
 #define MINOR   4              // Minor version number
 
 #define MAJOR   1              // Major version number
 #define MINOR   4              // Minor version number
-#define PATCH   0              // Patch release number
+#define PATCH   1              // Patch release number
 
 #endif // __VERSION_H__
 
 #endif // __VERSION_H__