From: Shamus Hammons Date: Tue, 2 May 2017 18:02:47 +0000 (-0500) Subject: Fix for bug #77 (ds with negative numbers). X-Git-Tag: v2.1.0~126 X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=commitdiff_plain;h=a29cbeceeadc92ff48ffa70a51135b503c96cc6d Fix for bug #77 (ds with negative numbers). 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. --- diff --git a/direct.c b/direct.c index 8d3d804..a736855 100644 --- 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) - 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 diff --git a/expr.c b/expr.c index debcd88..4c4168f 100644 --- 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) { - WORD * sattr; - VALUE * sval; 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) { @@ -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 :( - //*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; diff --git a/version.h b/version.h index 61ada40..db4e907 100644 --- a/version.h +++ b/version.h @@ -15,7 +15,7 @@ #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__