]> Shamusworld >> Repos - rmac/blobdiff - debug.c
Fixes for last commit; version is now 1.10.0.
[rmac] / debug.c
diff --git a/debug.c b/debug.c
index 6359cfbc2bddf5909807c3d65d20262d876fa9fe..eac64fa6eba11efa7da4e5d8d53b64cef642d5bf 100644 (file)
--- a/debug.c
+++ b/debug.c
@@ -1,5 +1,5 @@
 //
-// RMAC - Reboot's Macro Assembler for the Atari Jaguar Console System
+// RMAC - Reboot's Macro Assembler for all Atari computers
 // DEBUG.C - Debugging Messages
 // Copyright (C) 199x Landon Dyer, 2011-2017 Reboot and Friends
 // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
@@ -47,7 +47,8 @@ TOKEN * printexpr(TOKEN * tp)
                                tp++;
                                break;
                        case CONST:
-                               printf("$%X ", *tp++);
+                               printf("$%lX ", ((uint64_t)tp[0] << 32) | (uint64_t)tp[1]);
+                               tp += 2;
                                break;
                        case ACONST:
                                printf("ACONST=($%X,$%X) ", *tp, tp[1]);
@@ -105,7 +106,7 @@ int fudump(CHUNK * ch)
                        {
                                uint16_t esiz = *p.wp++;
                                printf("(%d long) ", (int)esiz);
-                               p.tk = printexpr(p.tk);
+                               p.tk.u32 = printexpr(p.tk.u32);
                        }
                        else
                        {
@@ -280,7 +281,8 @@ int dumptok(TOKEN * tk)
                switch ((int)*tk++)
                {
                case CONST:                                        // CONST <value>
-                       printf("CONST=%u", *tk++);
+                       printf("CONST=%lu", ((uint64_t)tk[0] << 32) | (uint64_t)tk[1]);
+                       tk += 2;
                        break;
                case STRING:                                       // STRING <address>
                        printf("STRING='%s'", string[*tk++]);
@@ -327,6 +329,98 @@ int dumptok(TOKEN * tk)
 }
 
 
+void DumpTokens(TOKEN * tokenBuffer)
+{
+//     printf("Tokens [%X]: ", sloc);
+
+       for(TOKEN * t=tokenBuffer; *t!=EOL; t++)
+       {
+               if (*t == COLON)
+                       printf("[COLON]");
+               else if (*t == CONST)
+               {
+                       printf("[CONST: $%lX]", ((uint64_t)t[1] << 32) | (uint64_t)t[2]);
+                       t += 2;
+               }
+               else if (*t == ACONST)
+               {
+                       printf("[ACONST: $%X, $%X]", (uint32_t)t[1], (uint32_t)t[2]);
+                       t += 2;
+               }
+               else if (*t == STRING)
+               {
+                       t++;
+                       printf("[STRING:\"%s\"]", string[*t]);
+               }
+               else if (*t == SYMBOL)
+               {
+                       t++;
+                       printf("[SYMBOL:\"%s\"]", string[*t]);
+               }
+               else if (*t == EOS)
+                       printf("[EOS]");
+               else if (*t == TKEOF)
+                       printf("[TKEOF]");
+               else if (*t == DEQUALS)
+                       printf("[DEQUALS]");
+               else if (*t == SET)
+                       printf("[SET]");
+               else if (*t == REG)
+                       printf("[REG]");
+               else if (*t == DCOLON)
+                       printf("[DCOLON]");
+               else if (*t == GE)
+                       printf("[GE]");
+               else if (*t == LE)
+                       printf("[LE]");
+               else if (*t == NE)
+                       printf("[NE]");
+               else if (*t == SHR)
+                       printf("[SHR]");
+               else if (*t == SHL)
+                       printf("[SHL]");
+               else if (*t == UNMINUS)
+                       printf("[UNMINUS]");
+               else if (*t == DOTB)
+                       printf("[DOTB]");
+               else if (*t == DOTW)
+                       printf("[DOTW]");
+               else if (*t == DOTL)
+                       printf("[DOTL]");
+               else if (*t == DOTI)
+                       printf("[DOTI]");
+               else if (*t == ENDEXPR)
+                       printf("[ENDEXPR]");
+               else if (*t == CR_ABSCOUNT)
+                       printf("[CR_ABSCOUNT]");
+               else if (*t == CR_DEFINED)
+                       printf("[CR_DEFINED]");
+               else if (*t == CR_REFERENCED)
+                       printf("[CR_REFERENCED]");
+               else if (*t == CR_STREQ)
+                       printf("[CR_STREQ]");
+               else if (*t == CR_MACDEF)
+                       printf("[CR_MACDEF]");
+               else if (*t == CR_TIME)
+                       printf("[CR_TIME]");
+               else if (*t == CR_DATE)
+                       printf("[CR_DATE]");
+               else if (*t >= 0x20 && *t <= 0x2F)
+                       printf("[%c]", (char)*t);
+               else if (*t >= 0x3A && *t <= 0x3F)
+                       printf("[%c]", (char)*t);
+               else if (*t >= 0x80 && *t <= 0x87)
+                       printf("[D%u]", ((uint32_t)*t) - 0x80);
+               else if (*t >= 0x88 && *t <= 0x8F)
+                       printf("[A%u]", ((uint32_t)*t) - 0x88);
+               else
+                       printf("[%X:%c]", (uint32_t)*t, (char)*t);
+       }
+
+       printf("[EOL]\n");
+}
+
+
 //
 // Dump everything
 //