]> Shamusworld >> Repos - rmac/blobdiff - direct.c
Fix for bug that happened when a called macro inside an if/endif block would have...
[rmac] / direct.c
index 5cdac4ca73b605c297caf6c0b870480677898fd4..04b576c22cc4df94d457c6fff750561937a1a264 100644 (file)
--- a/direct.c
+++ b/direct.c
@@ -3,7 +3,7 @@
 // DIRECT.C - Directive Handling
 // Copyright (C) 199x Landon Dyer, 2011 Reboot and Friends
 // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
-// Source Utilised with the Kind Permission of Landon Dyer
+// Source utilised with the kind permission of Landon Dyer
 //
 
 #include "direct.h"
@@ -25,6 +25,7 @@
 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
 
 
 // Directive handler table
@@ -291,6 +292,7 @@ int d_equrundef(void)
 //
 int d_noclear(void)
 {
+       warn("CLR.L opcode ignored...");
        return 0;
 }
 
@@ -802,15 +804,22 @@ int d_dc(WORD siz)
        if ((scattr & SBSS) != 0)
                return error("illegal initialization of section");
 
+       // Do an auto_even if it's not BYTE sized (hmm, should we be doing this???)
        if ((siz != SIZB) && (sloc & 1))
                auto_even();
 
+       // Check to see if we're trying to set LONGS on a non 32-bit aligned
+       // address in a GPU or DSP section, in their local RAM
+       if ((siz == SIZL) && (orgaddr & 0x03)
+               && ((rgpu && (orgaddr >= 0xF03000) && (orgaddr <= 0xF03FFFF))
+               || (rdsp && (orgaddr >= 0xF1B000) && (orgaddr <= 0xF1CFFFF))))
+               warn("depositing LONGs on a non-long address in local RAM");
+
        for(;; ++tok)
        {
                // dc.b 'string' [,] ...
                if (siz == SIZB && *tok == STRING && (tok[2] == ',' || tok[2] == EOL))
                {
-//                     i = strlen((const char*)tok[1]);
                        i = strlen(string[tok[1]]);
 
                        if ((challoc - ch_size) < i) 
@@ -854,7 +863,10 @@ int d_dc(WORD siz)
                                        return error("non-absolute byte value");
 
                                if (eval + 0x100 >= 0x200)
-                                       return error(range_error);
+                               {
+                                       sprintf(buffer, "%s (value = $%X)", range_error, eval);
+                                       return error(buffer);
+                               }
 
                                D_byte(eval);
                        }