Roll back TOKENPTR changes and most of the .u32 changes weren't needed.
[rmac] / direct.c
index 7c480357c4e801b9420dd1ea1ad4b873a211a454..155fa3fb360821bc945bb0e8e3a79ffd6fe973a9 100644 (file)
--- a/direct.c
+++ b/direct.c
@@ -26,6 +26,7 @@
 #define DEF_KW
 #include "kwtab.h"
 
+
 TOKEN exprbuf[128];                    // Expression buffer
 SYM * symbolPtr[1000000];      // Symbol pointers table
 static long unused;                    // For supressing 'write' warnings
@@ -998,15 +999,12 @@ int d_ds(WORD siz)
 
 
 //
-// dc.b, dc.w / dc, dc.l, dc.i
+// dc.b, dc.w / dc, dc.l, dc.i, dc.q, dc.d
 //
 int d_dc(WORD siz)
 {
        WORD eattr;
        uint64_t eval;
-       WORD tdb;
-       WORD defined;
-       uint64_t val64;
        uint8_t * p;
 
        if ((scattr & SBSS) != 0)
@@ -1061,26 +1059,14 @@ int d_dc(WORD siz)
                        siz = SIZL;
                }
 
-               if (siz != SIZQ)
-               {
                // dc.x <expression>
                SYM * esym = 0;
 
                if (expr(exprbuf, &eval, &eattr, &esym) != OK)
                        return 0;
-               }
-               else
-               {
-                       val64 = *(uint64_t *)(tok);
-                       tok = tok + 2;
-                       D_long((uint32_t)(val64 >> 32));
-                       D_long((uint32_t)val64);
 
-            goto comma;
-        }
-
-               tdb = (WORD)(eattr & TDB);
-               defined = (WORD)(eattr & DEFINED);
+               uint16_t tdb = eattr & TDB;
+               uint16_t defined = eattr & DEFINED;
 
                if ((challoc - ch_size) < 4)
                        chcheck(4);
@@ -1153,6 +1139,15 @@ int d_dc(WORD siz)
                                D_long(eval);
                        }
                        break;
+               case SIZQ:
+                       // 64-bit size
+                       if (m6502)
+                               return error(in_6502mode);
+
+                       // Shamus: We only handle DC.Q type stuff, will have to add fixups
+                       //         and stuff later (maybe... might not be needed...)
+                       D_quad(eval);
+                       break;
                case SIZS:
                        if (m6502)
                                return error(in_6502mode);
@@ -1171,6 +1166,7 @@ int d_dc(WORD siz)
 
                                D_single(eval);
                        }
+
                        break;
                case SIZD:
                        if (m6502)
@@ -1185,13 +1181,13 @@ int d_dc(WORD siz)
                        }
                        else
                        {
-                               double vv;
                                if (tdb)
                                        MarkRelocatable(cursect, sloc, tdb, MDOUBLE, NULL);
 
-                               vv = *(double *)&eval;
+                               double vv = *(double *)&eval;
                                D_double(vv);
                        }
+
                        break;
                case SIZX:
                        if (m6502)
@@ -1206,17 +1202,16 @@ int d_dc(WORD siz)
                        }
                        else
                        {
-                               float vv;
                                if (tdb)
                                        MarkRelocatable(cursect, sloc, tdb, MEXTEND, NULL);
 
-                               vv = *(double *)&eval;
+                               float vv = *(double *)&eval;
                                D_extend(vv);
                        }
+
                        break;
                }
 
-
 comma:
                if (*tok != ',')
                        break;
@@ -1285,7 +1280,7 @@ int d_init(WORD def_siz)
                // Get repeat count (defaults to 1)
                if (*tok == '#')
                {
-                       ++tok;
+                       tok++;
 
                        if (abs_expr(&count) != OK)
                                return 0;
@@ -1300,7 +1295,7 @@ int d_init(WORD def_siz)
                if (expr(exprbuf, &eval, &eattr, NULL) < 0)
                        return 0;
 
-               switch ((int)*tok++)
+               switch (*tok++)
                {                                 // Determine size of object to deposit
                case DOTB: siz = SIZB; break;
                case DOTW: siz = SIZB; break;
@@ -1313,7 +1308,7 @@ int d_init(WORD def_siz)
 
                dep_block((uint32_t)count, siz, (uint32_t)eval, eattr, exprbuf);
 
-               switch ((int)*tok)
+               switch (*tok)
                {
                case EOL:
                        return 0;
@@ -1593,14 +1588,12 @@ int d_gpu(void)
                return ERROR;
        }
 
-       // If previous section was dsp or 68000 then we need to reset ORG'd Addresses
+       // If previous section was DSP or 68000 then we need to reset ORG'd Addresses
        if (!rgpu)
        {
-//printf("Resetting ORG...\n");
                orgactive = 0;
                orgwarning = 0;
        }
-//else printf("NOT resetting ORG!\n");
 
        rgpu = 1;                       // Set GPU assembly
        rdsp = 0;                       // Unset DSP assembly