]> Shamusworld >> Repos - rmac/commitdiff
Fix for bug #77 (ds with negative numbers).
authorShamus Hammons <jlhamm@acm.org>
Tue, 2 May 2017 18:02:47 +0000 (13:02 -0500)
committerShamus Hammons <jlhamm@acm.org>
Tue, 2 May 2017 18:02:47 +0000 (13:02 -0500)
Last time it didn't work because our target number was an unsigned int
(as opposed to a signed int). So now that we know, we have a proper
check for it now.

direct.c
expr.c
version.h

index 8d3d804330ad71f8080f232c0d2ef640fdd5cb39..a7368550bd82857811166b1aa6956cfe59889d71 100644 (file)
--- a/direct.c
+++ b/direct.c
@@ -929,7 +929,9 @@ int d_ds(WORD siz)
 
        // Check to see if the value being passed in is negative (who the hell does
        // that?--nobody does; it's the code gremlins, or rum, that does it)
 
        // Check to see if the value being passed in is negative (who the hell does
        // that?--nobody does; it's the code gremlins, or rum, that does it)
-       if (eval < 0)
+       // N.B.: Since VALUE is of type uint32_t, if it goes negative, it will have
+       //       its high bit set.
+       if (eval & 0x80000000)
                return error("negative sizes not allowed");
 
        // In non-TDB section (BSS, ABS and M6502) just advance the location
                return error("negative sizes not allowed");
 
        // In non-TDB section (BSS, ABS and M6502) just advance the location
diff --git a/expr.c b/expr.c
index debcd8884d06915ad75b007ccc72866265407081..4c4168f4a0c543eb45179a5ac376ff2337f8dc7c 100644 (file)
--- a/expr.c
+++ b/expr.c
@@ -464,17 +464,12 @@ thrown away right here. What the hell is it for?
 //
 int evexpr(TOKEN * tk, VALUE * a_value, WORD * a_attr, SYM ** a_esym)
 {
 //
 int evexpr(TOKEN * tk, VALUE * a_value, WORD * a_attr, SYM ** a_esym)
 {
-       WORD * sattr;
-       VALUE * sval;
        WORD attr;
        SYM * sy;
        WORD attr;
        SYM * sy;
-       SYM * esym;
-       WORD sym_seg;
-
-       sval = evstk;                                                   // (Empty) initial stack
-       sattr = evattr;
-       esym = NULL;                                                    // No external symbol involved
-       sym_seg = 0;
+       VALUE * sval = evstk;                                   // (Empty) initial stack
+       WORD * sattr = evattr;
+       SYM * esym = NULL;                                              // No external symbol involved
+       WORD sym_seg = 0;
 
        while (*tk != ENDEXPR)
        {
 
        while (*tk != ENDEXPR)
        {
@@ -744,7 +739,7 @@ printf("EVEXPR (-): sym1 = %X, sym2 = %X\n", attr, sattr[1]);
        // sym_seg added in 1.0.16 to solve a problem with forward symbols in
        // expressions where absolute values also existed. The absolutes were
        // overiding the symbol segments and not being included :(
        // sym_seg added in 1.0.16 to solve a problem with forward symbols in
        // expressions where absolute values also existed. The absolutes were
        // overiding the symbol segments and not being included :(
-       //*a_attr = *sattr | sym_seg;                                        // Copy value + attrib
+       //*a_attr = *sattr | sym_seg;           // Copy value + attrib
 
        *a_attr = *sattr;                                               // Copy value + attrib
        *a_value = *sval;
 
        *a_attr = *sattr;                                               // Copy value + attrib
        *a_value = *sval;
index 61ada40779c494d8af37a0f65c4e62c6bd0e4ab3..db4e907fc5f546f5f09629619685d5cff61ee9d3 100644 (file)
--- a/version.h
+++ b/version.h
@@ -15,7 +15,7 @@
 
 #define MAJOR   1              // Major version number
 #define MINOR   6              // Minor version number
 
 #define MAJOR   1              // Major version number
 #define MINOR   6              // Minor version number
-#define PATCH   6              // Patch release number
+#define PATCH   7              // Patch release number
 
 #endif // __VERSION_H__
 
 
 #endif // __VERSION_H__