]> Shamusworld >> Repos - rmac/blobdiff - direct.c
Fix for bug where in alcyon mode the tokenizer would read past the end of the line.
[rmac] / direct.c
index aebe56648760f3ee3add972e7ef1b68eb56c44de..a7368550bd82857811166b1aa6956cfe59889d71 100644 (file)
--- a/direct.c
+++ b/direct.c
@@ -27,7 +27,6 @@ TOKEN exprbuf[128];                   // Expression buffer
 SYM * symbolPtr[1000000];      // Symbol pointers table
 static long unused;                    // For supressing 'write' warnings
 char buffer[256];                      // Scratch buffer for messages
-int stringtype;             // Non-zero if we need any special string conversions
 
 // Function prototypes
 int d_unimpl(void);
@@ -930,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
@@ -983,19 +984,19 @@ int d_dc(WORD siz)
        for(;; tok++)
        {
                // dc.b 'string' [,] ...
-               if (siz == SIZB && *tok == STRING && (tok[2] == ',' || tok[2] == EOL))
+               if (siz == SIZB && (*tok == STRING || *tok == STRINGA8) && (tok[2] == ',' || tok[2] == EOL))
                {
                        uint32_t i = strlen(string[tok[1]]);
 
                        if ((challoc - ch_size) < i)
                                chcheck(i);
 
-                       if (stringtype == NORMAL)
+                       if (*tok == STRING)
                        {
                                for(p=string[tok[1]]; *p!=EOS; p++)
                                        D_byte(*p);
                        }
-                       else if(stringtype == A8INT)
+                       else if(*tok == STRINGA8)
                        {
                                for(p=string[tok[1]]; *p!=EOS; p++)
                                        D_byte(strtoa8[*p]);
@@ -1005,7 +1006,6 @@ int d_dc(WORD siz)
                                error("String format not supported... yet");
                        }
 
-
                        tok += 2;
                        goto comma;
                }