]> Shamusworld >> Repos - rmac/commitdiff
Roll back TOKENPTR changes and most of the .u32 changes weren't needed.
authorShamus Hammons <jlhamm@acm.org>
Wed, 29 Nov 2017 13:57:58 +0000 (07:57 -0600)
committerShamus Hammons <jlhamm@acm.org>
Wed, 29 Nov 2017 13:57:58 +0000 (07:57 -0600)
The last commit had gone a bit overboard with the 32 vs 64 bit token
changes; this has been rectified. There's still a ways to go with the
floating point code, but this should be stable for now. Version now at
1.10.1.

22 files changed:
6502.c
amode.c
debug.c
direct.c
direct.h
eagen.c
error.c
expr.c
expr.h
listing.c
mach.c
macro.c
parmode.h
procln.c
riscasm.c
riscasm.h
rmac.h
sect.c
sect.h
token.c
token.h
version.h

diff --git a/6502.c b/6502.c
index 711435e1bac68f7205fc5b50390f3e4b3e8c5397..2fc971d277bf681c95c1479eea8429dbb832a988 100644 (file)
--- a/6502.c
+++ b/6502.c
@@ -258,18 +258,18 @@ void m6502cg(int op)
        //
        zpreq = 0;
 
-       switch (tok.u32[0])
+       switch (tok[0])
        {
        case EOL:
                amode = A65_IMPL;
                break;
 
        case '#':
-               tok.u32++;
+               tok++;
 
-               if (*tok.u32 == '>')
+               if (*tok == '>')
                {
-                       tok.u32++;
+                       tok++;
 
                        if (expr(exprbuf, &eval, &eattr, NULL) < 0)
                                return;
@@ -277,9 +277,9 @@ void m6502cg(int op)
                        amode = A65_IMMEDH;
                        break;
                }
-               else if (*tok.u32 == '<')
+               else if (*tok == '<')
                {
-                       tok.u32++;
+                       tok++;
 
                        if (expr(exprbuf, &eval, &eattr, NULL) < 0)
                                return;
@@ -295,43 +295,43 @@ void m6502cg(int op)
                break;
 
        case '(':
-               tok.u32++;
+               tok++;
 
                if (expr(exprbuf, &eval, &eattr, NULL) < 0)
                        return;
 
-               if (*tok.u32 == ')')
+               if (*tok == ')')
                {
                        // (foo) or (foo),y
-                       if (*++tok.u32 == ',')
+                       if (*++tok == ',')
                        {
                                // (foo),y
-                               tok.u32++;
-                               p = string[tok.u32[1]];
+                               tok++;
+                               p = string[tok[1]];
 
-                               // Sleazo tolower() ---------------------vvvvvvvvvvv
-                               if (*tok.u32 != SYMBOL || p[1] != EOS || (*p | 0x20) != 'y')
+                               // Sleazo tolower() -----------------vvvvvvvvvvv
+                               if (*tok != SYMBOL || p[1] != EOS || (*p | 0x20) != 'y')
                                        goto badmode;
 
-                               tok.u32 += 2;
+                               tok += 2;
                                amode = A65_INDY;
                        }
                        else
                                amode = A65_IND;
                }
-               else if (*tok.u32 == ',')
+               else if (*tok == ',')
                {
                        // (foo,x)
-                       tok.u32++;
-                       p = string[tok.u32[1]];
+                       tok++;
+                       p = string[tok[1]];
 
-                       // Sleazo tolower() ---------------------vvvvvvvvvvv
-                       if (*tok.u32 != SYMBOL || p[1] != EOS || (*p | 0x20) != 'x')
+                       // Sleazo tolower() -----------------vvvvvvvvvvv
+                       if (*tok != SYMBOL || p[1] != EOS || (*p | 0x20) != 'x')
                                goto badmode;
 
-                       tok.u32 += 2;
+                       tok += 2;
 
-                       if (*tok.u32++ != ')')
+                       if (*tok++ != ')')
                                goto badmode;
 
                        amode = A65_INDX;
@@ -342,17 +342,17 @@ void m6502cg(int op)
                break;
 
        case '@':
-               tok.u32++;
+               tok++;
 
                if (expr(exprbuf, &eval, &eattr, NULL) < 0)
                        return;
 
-               if (*tok.u32 == '(')
+               if (*tok == '(')
                {
-                       tok.u32++;
-                       p = string[tok.u32[1]];
+                       tok++;
+                       p = string[tok[1]];
 
-                       if (*tok.u32 != SYMBOL || p[1] != EOS || tok.u32[2] != ')' || tok.u32[3] != EOL)
+                       if (*tok != SYMBOL || p[1] != EOS || tok[2] != ')' || tok[3] != EOL)
                                goto badmode;
 
                        i = (*p | 0x20);        // Sleazo tolower()
@@ -364,10 +364,10 @@ void m6502cg(int op)
                        else
                                goto badmode;
 
-                       tok.u32 += 3;   // Past SYMBOL <string> ')' EOL
+                       tok += 3;       // Past SYMBOL <string> ')' EOL
                        zpreq = 1;              // Request zeropage optimization
                }
-               else if (*tok.u32 == EOL)
+               else if (*tok == EOL)
                        amode = A65_IND;
                else
                        goto badmode;
@@ -380,7 +380,7 @@ void m6502cg(int op)
                //   x,foo
                //   y,foo
                //
-               p = string[tok.u32[1]];
+               p = string[tok[1]];
                // ggn: the following code is effectively disabled as it would make
                //      single letter labels not work correctly (would not identify the
                //      label properly). And from what I understand it's something to
@@ -416,17 +416,17 @@ not_coinop:
 
                zpreq = 1;
 
-               if (*tok.u32 == EOL)
+               if (*tok == EOL)
                        amode = A65_ABS;
-               else if (*tok.u32 == ',')
+               else if (*tok == ',')
                {
-                       tok.u32++;
-                       p = string[tok.u32[1]];
+                       tok++;
+                       p = string[tok[1]];
 
-                       if (*tok.u32 != SYMBOL || p[1] != EOS)
+                       if (*tok != SYMBOL || p[1] != EOS)
                                goto badmode;
 
-                       tok.u32 += 2;
+                       tok += 2;
 
                        //
                        // Check for X or Y index register;
@@ -583,7 +583,7 @@ badmode:
        if (sloc > 0x10000L)
                fatal("6502 code pointer > 64K");
 
-       if (*tok.u32 != EOL)
+       if (*tok != EOL)
                error(extra_stuff);
 }
 
diff --git a/amode.c b/amode.c
index 2608d79793f32493ab4d0cf11dd2f8f678fda7e6..7ba585349883a49b2fa1e897dd7060882f3a0e80 100644 (file)
--- a/amode.c
+++ b/amode.c
@@ -97,7 +97,7 @@ int amode(int acount)
        bf0esym = NULL;
 
        // If at EOL, then no addr modes at all
-       if (*tok.u32 == EOL)
+       if (*tok == EOL)
                return 0;
 
        // Parse first addressing mode
@@ -106,17 +106,17 @@ int amode(int acount)
        #define AnREG     a0reg
        #define AnIXREG   a0ixreg
        #define AnIXSIZ   a0ixsiz
-       #define AnEXPR    (TOKENPTR)a0expr
+       #define AnEXPR    a0expr
        #define AnEXVAL   a0exval
        #define AnEXATTR  a0exattr
-       #define AnOEXPR   (TOKENPTR)a0oexpr
+       #define AnOEXPR   a0oexpr
        #define AnOEXVAL  a0oexval
        #define AnOEXATTR a0oexattr
        #define AnESYM    a0esym
        #define AMn_IX0   am0_ix0
        #define AMn_IXN   am0_ixn
        #define CHK_FOR_DISPn CheckForDisp0
-       #define AnBEXPR   (TOKENPTR)a0bexpr
+       #define AnBEXPR   a0bexpr
        #define AnBEXVAL  a0bexval
        #define AnBEXATTR a0bexattr
        #define AnBZISE   a0bsize
@@ -132,15 +132,15 @@ int amode(int acount)
 
        // it's a bitfield instruction--check the parameters inside the {} block
        // for validity
-       if (*tok.u32 == '{')
+       if (*tok == '{')
                if (check030bf() == ERROR)
                        return ERROR;
 
-       if ((acount == 0) || (*tok.u32 != ','))
+       if ((acount == 0) || (*tok != ','))
                return 1;
 
        // Eat the comma
-       tok.u32++;
+       tok++;
 
        // Parse second addressing mode
        #define AnOK      a1ok
@@ -148,17 +148,17 @@ int amode(int acount)
        #define AnREG     a1reg
        #define AnIXREG   a1ixreg
        #define AnIXSIZ   a1ixsiz
-       #define AnEXPR    (TOKENPTR)a1expr
+       #define AnEXPR    a1expr
        #define AnEXVAL   a1exval
        #define AnEXATTR  a1exattr
-       #define AnOEXPR   (TOKENPTR)a1oexpr
+       #define AnOEXPR   a1oexpr
        #define AnOEXVAL  a1oexval
        #define AnOEXATTR a1oexattr
        #define AnESYM    a1esym
        #define AMn_IX0   am1_ix0
        #define AMn_IXN   am1_ixn
        #define CHK_FOR_DISPn CheckForDisp1
-       #define AnBEXPR   (TOKENPTR)a1bexpr
+       #define AnBEXPR   a1bexpr
        #define AnBEXVAL  a1bexval
        #define AnBEXATTR a1bexattr
        #define AnBZISE   a1bsize
@@ -170,34 +170,34 @@ int amode(int acount)
 
        // It's a bitfield instruction--check the parameters inside the {} block
        // for validity
-       if (*tok.u32 == '{')
+       if (*tok == '{')
         if (check030bf() == ERROR)
                return ERROR;
 
        // At this point, it is legal for 020+ to have a ':'. For example divu.l
        // d0,d2:d3
-       if (*tok.u32 == ':')
+       if (*tok == ':')
        {
                if ((activecpu & (CPU_68020 | CPU_68030 | CPU_68040)) == 0)
                        return error(unsupport);
 
                // TODO: protect this from combinations like Dx:FPx etc :)
-               tok.u32++;  //eat the colon
+               tok++;  //eat the colon
 
-               if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_D7))
+               if ((*tok >= KW_D0) && (*tok <= KW_D7))
                {
-                       a2reg = (*tok.u32 - KW_D0);
+                       a2reg = (*tok - KW_D0);
                        mulmode = 1 << 10;
                }
-               else if ((*tok.u32 >= KW_FP0) && (*tok.u32 <= KW_FP7))
+               else if ((*tok >= KW_FP0) && (*tok <= KW_FP7))
                {
-                       a2reg = (*tok.u32 - KW_FP0);
+                       a2reg = (*tok - KW_FP0);
                        mulmode = 1 << 10;
                }
                else
                        return error("a data or FPU register must follow a :");
 
-               *tok.u32++;
+               *tok++;
        }
        else
        {
@@ -236,17 +236,17 @@ int reglist(WORD * a_rmask)
 
        for(;;)
        {
-               if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_A7))
-                       r = *tok.u32++ & 0x0F;
+               if ((*tok >= KW_D0) && (*tok <= KW_A7))
+                       r = *tok++ & 0x0F;
                else
                        break;
 
-               if (*tok.u32 == '-')
+               if (*tok == '-')
                {
-                       tok.u32++;
+                       tok++;
 
-                       if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_A7))
-                               cnt = *tok.u32++ & 0x0F;
+                       if ((*tok >= KW_D0) && (*tok <= KW_A7))
+                               cnt = *tok++ & 0x0F;
                        else
                                return error("register list syntax");
 
@@ -261,10 +261,10 @@ int reglist(WORD * a_rmask)
                while (cnt-- >= 0)
                        rmask |= msktab[r++];
 
-               if (*tok.u32 != '/')
+               if (*tok != '/')
                        break;
 
-               tok.u32++;
+               tok++;
        }
 
        *a_rmask = rmask;
@@ -288,17 +288,17 @@ int fpu_reglist_left(WORD * a_rmask)
 
        for(;;)
        {
-               if ((*tok.u32 >= KW_FP0) && (*tok.u32 <= KW_FP7))
-                       r = *tok.u32++ & 0x07;
+               if ((*tok >= KW_FP0) && (*tok <= KW_FP7))
+                       r = *tok++ & 0x07;
                else
                        break;
 
-               if (*tok.u32 == '-')
+               if (*tok == '-')
                {
-                       tok.u32++;
+                       tok++;
 
-                       if ((*tok.u32 >= KW_FP0) && (*tok.u32 <= KW_FP7))
-                               cnt = *tok.u32++ & 0x07;
+                       if ((*tok >= KW_FP0) && (*tok <= KW_FP7))
+                               cnt = *tok++ & 0x07;
                        else
                                return error("register list syntax");
 
@@ -315,10 +315,10 @@ int fpu_reglist_left(WORD * a_rmask)
                while (cnt-- >= 0)
                        rmask |= msktab_minus[r++];
 
-               if (*tok.u32 != '/')
+               if (*tok != '/')
                        break;
 
-               tok.u32++;
+               tok++;
        }
 
        *a_rmask = rmask;
@@ -339,17 +339,17 @@ int fpu_reglist_right(WORD * a_rmask)
 
        for(;;)
        {
-               if ((*tok.u32 >= KW_FP0) && (*tok.u32 <= KW_FP7))
-                       r = *tok.u32++ & 0x07;
+               if ((*tok >= KW_FP0) && (*tok <= KW_FP7))
+                       r = *tok++ & 0x07;
                else
                        break;
 
-               if (*tok.u32 == '-')
+               if (*tok == '-')
                {
-                       tok.u32++;
+                       tok++;
 
-                       if ((*tok.u32 >= KW_FP0) && (*tok.u32 <= KW_FP7))
-                               cnt = *tok.u32++ & 0x07;
+                       if ((*tok >= KW_FP0) && (*tok <= KW_FP7))
+                               cnt = *tok++ & 0x07;
                        else
                                return error("register list syntax");
 
@@ -364,10 +364,10 @@ int fpu_reglist_right(WORD * a_rmask)
                while (cnt-- >= 0)
                        rmask |= msktab_plus[r++];
 
-               if (*tok.u32 != '/')
+               if (*tok != '/')
                        break;
 
-               tok.u32++;
+               tok++;
        }
 
        *a_rmask = rmask;
@@ -384,24 +384,22 @@ int fpu_reglist_right(WORD * a_rmask)
 //
 int check030bf(void)
 {
+       PTR tp;
        CHECK00;
-       tok.u32++;
+       tok++;
 
-       if (*tok.u32 == CONST)
+       if (*tok == CONST)
        {
-               tok.u32++;
-//             bfval1 = (int)*(uint64_t *)tok.u32;
-               bfval1 = (int)*tok.u64;
+               tp.u32 = tok + 1;
+               bfval1 = (int)*tp.u64++;
+               tok = tp.u32;
 
                // Do=0, offset=immediate - shift it to place
                bfparam1 = (0 << 11);
-//             tok.u32++;
-//             tok.u32++;
-               tok.u64++;
        }
-       else if (*tok.u32 == SYMBOL)
+       else if (*tok == SYMBOL)
        {
-               if (expr((TOKENPTR)bf0expr, &bf0exval, &bf0exattr, &bf0esym) != OK)
+               if (expr(bf0expr, &bf0exval, &bf0exattr, &bf0esym) != OK)
                        return ERROR;
 
                if (!(bf0exattr & DEFINED))
@@ -412,42 +410,39 @@ int check030bf(void)
                // Do=0, offset=immediate - shift it to place
                bfparam1 = (0 << 11);
        }
-       else if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_D7))
+       else if ((*tok >= KW_D0) && (*tok <= KW_D7))
        {
                // Do=1, offset=data register - shift it to place
                bfparam1 = (1 << 11);
-               bfval1 = (*(int *)tok.u32 - 128);
-               tok.u32++;
+               bfval1 = (*(int *)tok - 128);
+               tok++;
        }
        else
                return ERROR;
 
        // Eat the ':', if any
-       if (*tok.u32 == ':')
-               tok.u32++;
+       if (*tok == ':')
+               tok++;
 
-       if (*tok.u32 == '}' && tok.u32[1] == EOL)
+       if (*tok == '}' && tok[1] == EOL)
        {
                // It is ok to have }, EOL here - it might be "fmove fpn,<ea> {dx}"
-               tok.u32++;
+               tok++;
                return OK;
        }
 
-       if (*tok.u32 == CONST)
+       if (*tok == CONST)
        {
-               tok.u32++;
-//             bfval2 = (int)*(uint64_t *)tok.u32;
-               bfval2 = (int)*tok.u64;
+               tp.u32 = tok + 1;
+               bfval2 = (int)*tp.u64++;
+               tok = tp.u32;
 
                // Do=0, offset=immediate - shift it to place
                bfparam2 = (0 << 5);
-//             tok.u32++;
-//             tok.u32++;
-               tok.u64++;
        }
-       else if (*tok.u32 == SYMBOL)
+       else if (*tok == SYMBOL)
        {
-               if (expr((TOKENPTR)bf0expr, &bf0exval, &bf0exattr, &bf0esym) != OK)
+               if (expr(bf0expr, &bf0exval, &bf0exattr, &bf0esym) != OK)
                        return ERROR;
 
                bfval2 = (int)bf0exval;
@@ -458,17 +453,17 @@ int check030bf(void)
                // Do=0, offset=immediate - shift it to place
                bfparam2 = (0 << 5);
        }
-       else if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_D7))
+       else if ((*tok >= KW_D0) && (*tok <= KW_D7))
        {
                // Do=1, offset=data register - shift it to place
-               bfval2 = ((*(int *)tok.u32 - 128));
+               bfval2 = (*(int *)tok - 128);
                bfparam2 = (1 << 5);
-               tok.u32++;
+               tok++;
        }
        else
                return ERROR;
 
-       tok.u32++;      // Eat the '}'
+       tok++;  // Eat the '}'
 
        return OK;
 }
diff --git a/debug.c b/debug.c
index eac64fa6eba11efa7da4e5d8d53b64cef642d5bf..28784bfe5b4cbae1d5fe36da3e0eb71207bd7061 100644 (file)
--- a/debug.c
+++ b/debug.c
@@ -15,6 +15,7 @@
 
 
 static int siztab[4] = { 3, 5, 9, 9 };
+static PTR tp;
 
 
 //
@@ -34,34 +35,35 @@ int visprt(char c)
 //
 // Print expression, return ptr to just past the ENDEXPR
 //
-TOKEN * printexpr(TOKEN * tp)
+TOKEN * printexpr(TOKEN * tokenptr)
 {
-       if (tp != NULL)
+       if (tokenptr != NULL)
        {
-               while (*tp != ENDEXPR)
+               while (*tokenptr != ENDEXPR)
                {
-                       switch ((int)*tp++)
+                       switch ((int)*tokenptr++)
                        {
                        case SYMBOL:
-                               printf("'%s' ", symbolPtr[*tp]->sname);
-                               tp++;
+                               printf("'%s' ", symbolPtr[*tokenptr]->sname);
+                               tokenptr++;
                                break;
                        case CONST:
-                               printf("$%lX ", ((uint64_t)tp[0] << 32) | (uint64_t)tp[1]);
-                               tp += 2;
+                               tp.u32 = tokenptr;
+                               printf("$%lX ", *tp.u64++);
+                               tokenptr = tp.u32;
                                break;
                        case ACONST:
-                               printf("ACONST=($%X,$%X) ", *tp, tp[1]);
-                               tp += 2;
+                               printf("ACONST=($%X,$%X) ", *tokenptr, tokenptr[1]);
+                               tokenptr += 2;
                                break;
                        default:
-                               printf("%c ", (char)tp[-1]);
+                               printf("%c ", (char)tokenptr[-1]);
                                break;
                        }
                }
        }
 
-       return tp + 1;
+       return tokenptr + 1;
 }
 
 
@@ -106,7 +108,7 @@ int fudump(CHUNK * ch)
                        {
                                uint16_t esiz = *p.wp++;
                                printf("(%d long) ", (int)esiz);
-                               p.tk.u32 = printexpr(p.tk.u32);
+                               p.tk = printexpr(p.tk);
                        }
                        else
                        {
@@ -219,16 +221,16 @@ int mdump(char * start, LONG count, int flg, LONG base)
                switch (flg & 3)
                {
                case 0:
-                       printf("%02X ", start[i] & 0xff);
+                       printf("%02X ", start[i] & 0xFF);
                        i++;
                        break;
                case 1:
-                       printf("%02X%02X ", start[i] & 0xff, start[i+1] & 0xff);
+                       printf("%02X%02X ", start[i] & 0xFF, start[i+1] & 0xFF);
                        i += 2;
                        break;
                case 2:
-                       printf("%02X%02X%02X%02X ", start[i] & 0xff, start[i+1] & 0xff,
-                               start[i+2] & 0xff, start[i+3] & 0xff);
+                       printf("%02X%02X%02X%02X ", start[i] & 0xFF, start[i+1] & 0xFF,
+                               start[i+2] & 0xFF, start[i+3] & 0xFF);
                        i += 4;
                        break;
                case 3:
@@ -281,8 +283,9 @@ int dumptok(TOKEN * tk)
                switch ((int)*tk++)
                {
                case CONST:                                        // CONST <value>
-                       printf("CONST=%lu", ((uint64_t)tk[0] << 32) | (uint64_t)tk[1]);
-                       tk += 2;
+                       tp.u32 = tk;
+                       printf("CONST=%lu", *tp.u64++);
+                       tk = tp.u32;
                        break;
                case STRING:                                       // STRING <address>
                        printf("STRING='%s'", string[*tk++]);
@@ -339,7 +342,8 @@ void DumpTokens(TOKEN * tokenBuffer)
                        printf("[COLON]");
                else if (*t == CONST)
                {
-                       printf("[CONST: $%lX]", ((uint64_t)t[1] << 32) | (uint64_t)t[2]);
+                       tp.u32 = t + 1;
+                       printf("[CONST: $%lX]", *tp.u64);
                        t += 2;
                }
                else if (*t == ACONST)
index d535c4842b40870f794dfeb424e28093b96c6dea..155fa3fb360821bc945bb0e8e3a79ffd6fe973a9 100644 (file)
--- a/direct.c
+++ b/direct.c
 #define DEF_KW
 #include "kwtab.h"
 
-// N.B.: It's perfectly fine to keep exprbuf as an array of TOKENS and to cast
-//       to a TOKENPTR where needed. But this works too. :-P
-TOKEN _exprbuf[128];           // Expression buffer
-TOKENPTR exprbuf = (TOKENPTR)_exprbuf; // Expression buffer point
+
+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
@@ -176,14 +174,14 @@ void SetLargestAlignment(int size)
 //
 int d_error(char *str)
 {
-       if (*tok.u32 == EOL)
+       if (*tok == EOL)
                return error("error directive encountered - aborting assembling");
        else
        {
-               switch(*tok.u32)
+               switch(*tok)
                {
                case STRING:
-                       return error(string[tok.u32[1]]);
+                       return error(string[tok[1]]);
                        break;
                default:
                        return error("error directive encountered--aborting assembly");
@@ -197,14 +195,14 @@ int d_error(char *str)
 //
 int d_warn(char *str)
 {
-       if (*tok.u32 == EOL)
+       if (*tok == EOL)
                return warn("WARNING WARNING WARNING");
        else
        {
-               switch(*tok.u32)
+               switch(*tok)
                {
                case STRING:
-                       return warn(string[tok.u32[1]]);
+                       return warn(string[tok[1]]);
                        break;
                default:
                        return warn("WARNING WARNING WARNING");
@@ -276,27 +274,27 @@ int d_print(void)
        SYM * esym;                                     // External symbol involved in expr.
        TOKEN r_expr[EXPRSIZE];
 
-       while (*tok.u32 != EOL)
+       while (*tok != EOL)
        {
-               switch(*tok.u32)
+               switch(*tok)
                {
                case STRING:
-                       sprintf(prntstr, "%s", string[tok.u32[1]]);
+                       sprintf(prntstr, "%s", string[tok[1]]);
                        printf("%s", prntstr);
 
                        if (list_fd)
                                unused = write(list_fd, prntstr, (LONG)strlen(prntstr));
 
-                       tok.u32 += 2;
+                       tok += 2;
                        break;
                case '/':
                        formatting = 1;
 
-                       if (tok.u32[1] != SYMBOL)
+                       if (tok[1] != SYMBOL)
                                goto token_err;
 
-//                     strcpy(prntstr, (char *)tok.u32[2]);
-                       strcpy(prntstr, string[tok.u32[2]]);
+//                     strcpy(prntstr, (char *)tok[2]);
+                       strcpy(prntstr, string[tok[2]]);
 
                        switch(prntstr[0])
                        {
@@ -310,13 +308,13 @@ int d_print(void)
                                return ERROR;
                        }
 
-                       tok.u32 += 3;
+                       tok += 3;
                        break;
                case ',':
-                       tok.u32++;
+                       tok++;
                        break;
                default:
-                       if (expr((TOKENPTR)r_expr, &eval, &eattr, &esym) != OK)
+                       if (expr(r_expr, &eval, &eattr, &esym) != OK)
                                goto token_err;
                        else
                        {
@@ -370,13 +368,13 @@ int d_ccundef(void)
                return ERROR;
        }
 
-       if (*tok.u32 != SYMBOL)
+       if (*tok != SYMBOL)
        {
                error("syntax error; expected symbol");
                return ERROR;
        }
 
-       ccname = lookup(string[tok.u32[1]], LABEL, 0);
+       ccname = lookup(string[tok[1]], LABEL, 0);
 
        // Make sure symbol is a valid ccdef
        if (!ccname || !(ccname->sattre & EQUATEDCC))
@@ -402,18 +400,18 @@ int d_equrundef(void)
        if (!rgpu && !rdsp)
                return error(".equrundef/.regundef must be defined in .gpu/.dsp section");
 
-       while (*tok.u32 != EOL)
+       while (*tok != EOL)
        {
                // Skip preceeding or seperating commas (if any)
-               if (*tok.u32 == ',')
-                       tok.u32++;
+               if (*tok == ',')
+                       tok++;
 
                // Check we are dealing with a symbol
-               if (*tok.u32 != SYMBOL)
+               if (*tok != SYMBOL)
                        return error("syntax error; expected symbol");
 
                // Lookup and undef if equated register
-               regname = lookup(string[tok.u32[1]], LABEL, 0);
+               regname = lookup(string[tok[1]], LABEL, 0);
 
                if (regname && (regname->sattre & EQUATEDREG))
                {
@@ -424,7 +422,7 @@ int d_equrundef(void)
                }
 
                // Skip over symbol token and address
-               tok.u32 += 2;
+               tok += 2;
        }
 
        return 0;
@@ -455,11 +453,11 @@ int d_incbin(void)
        // Check to see if we're in BSS, and, if so, throw an error
        if (scattr & SBSS)
        {
-               error("cannot include binary file \"%s\" in BSS section", string[tok.u32[1]]);
+               error("cannot include binary file \"%s\" in BSS section", string[tok[1]]);
                return ERROR;
        }
 
-       if (*tok.u32 != STRING)
+       if (*tok != STRING)
        {
                error("syntax error; string missing");
                return ERROR;
@@ -468,7 +466,7 @@ int d_incbin(void)
        // Attempt to open the include file in the current directory, then (if that
        // failed) try list of include files passed in the enviroment string or by
        // the "-d" option.
-       if ((fd = open(string[tok.u32[1]], _OPEN_INC)) < 0)
+       if ((fd = open(string[tok[1]], _OPEN_INC)) < 0)
        {
                for(i=0; nthpath("RMACPATH", i, buf1)!=0; i++)
                {
@@ -478,13 +476,13 @@ int d_incbin(void)
                        if (fd > 0 && buf1[fd - 1] != SLASHCHAR)
                                strcat(buf1, SLASHSTRING);
 
-                       strcat(buf1, string[tok.u32[1]]);
+                       strcat(buf1, string[tok[1]]);
 
                        if ((fd = open(buf1, _OPEN_INC)) >= 0)
                                goto allright;
                }
 
-               return error("cannot open: \"%s\"", string[tok.u32[1]]);
+               return error("cannot open: \"%s\"", string[tok[1]]);
        }
 
 allright:
@@ -493,14 +491,14 @@ allright:
        pos = lseek(fd, 0L, SEEK_SET);
        chcheck(size);
 
-       DEBUG { printf("INCBIN: File '%s' is %li bytes.\n", string[tok.u32[1]], size); }
+       DEBUG { printf("INCBIN: File '%s' is %li bytes.\n", string[tok[1]], size); }
 
        char * fileBuffer = (char *)malloc(size);
        bytesRead = read(fd, fileBuffer, size);
 
        if (bytesRead != size)
        {
-               error("was only able to read %li bytes from binary file (%s, %li bytes)", bytesRead, string[tok.u32[1]], size);
+               error("was only able to read %li bytes from binary file (%s, %li bytes)", bytesRead, string[tok[1]], size);
                return ERROR;
        }
 
@@ -718,21 +716,21 @@ int symlist(int(* func)())
 
        for(;;)
        {
-               if (*tok.u32 != SYMBOL)
+               if (*tok != SYMBOL)
                        return error(em);
 
-               if ((*func)(string[tok.u32[1]]) != OK)
+               if ((*func)(string[tok[1]]) != OK)
                        break;
 
-               tok.u32 += 2;
+               tok += 2;
 
-               if (*tok.u32 == EOL)
+               if (*tok == EOL)
                        break;
 
-               if (*tok.u32 != ',')
+               if (*tok != ',')
                        return error(em);
 
-               tok.u32++;
+               tok++;
        }
 
        return 0;
@@ -750,11 +748,11 @@ int d_include(void)
        char buf[128];
        char buf1[128];
 
-       if (*tok.u32 == STRING)                 // Leave strings ALONE
-               fn = string[*++tok.u32];
-       else if (*tok.u32 == SYMBOL)    // Try to append ".s" to symbols
+       if (*tok == STRING)                     // Leave strings ALONE
+               fn = string[*++tok];
+       else if (*tok == SYMBOL)        // Try to append ".s" to symbols
        {
-               strcpy(buf, string[*++tok.u32]);
+               strcpy(buf, string[*++tok]);
                fext(buf, ".s", 0);
                fn = &buf[0];
        }
@@ -763,7 +761,7 @@ int d_include(void)
 
        // Make sure the user didn't try anything like:
        // .include equates.s
-       if (*++tok.u32 != EOL)
+       if (*++tok != EOL)
                return error("extra stuff after filename--enclose it in quotes");
 
        // Attempt to open the include file in the current directory, then (if that
@@ -802,7 +800,7 @@ int d_assert(void)
        WORD eattr;
        uint64_t eval;
 
-       for(; expr(exprbuf, &eval, &eattr, NULL)==OK; ++tok.u32)
+       for(; expr(exprbuf, &eval, &eattr, NULL)==OK; ++tok)
        {
                if (!(eattr & DEFINED))
                        return error("forward or undefined .assert");
@@ -810,7 +808,7 @@ int d_assert(void)
                if (!eval)
                        return error("assert failure");
 
-               if (*tok.u32 != ',')
+               if (*tok != ',')
                        break;
        }
 
@@ -860,7 +858,7 @@ int d_prgflags(void)
 {
        uint64_t eval;
 
-       if (*tok.u32 == EOL)
+       if (*tok == EOL)
                return error("PRGFLAGS requires value");
        else if (abs_expr(&eval) == OK)
        {
@@ -886,7 +884,7 @@ int d_abs(void)
 
        SaveSection();
 
-       if (*tok.u32 == EOL)
+       if (*tok == EOL)
                eval = 0;
        else if (abs_expr(&eval) != OK)
                return 0;
@@ -992,7 +990,7 @@ int d_ds(WORD siz)
        }
        else
        {
-               dep_block(eval, siz, 0, (WORD)(DEFINED | ABS), (TOKENPTR){NULL});
+               dep_block(eval, siz, 0, (WORD)(DEFINED | ABS), NULL);
        }
 
        at_eol();
@@ -1023,24 +1021,24 @@ int d_dc(WORD siz)
                || (rdsp && (orgaddr >= 0xF1B000) && (orgaddr <= 0xF1CFFFF))))
                warn("depositing LONGs on a non-long address in local RAM");
 
-       for(;; tok.u32++)
+       for(;; tok++)
        {
                // dc.b 'string' [,] ...
-               if (siz == SIZB && (*tok.u32 == STRING || *tok.u32 == STRINGA8) && (tok.u32[2] == ',' || tok.u32[2] == EOL))
+               if (siz == SIZB && (*tok == STRING || *tok == STRINGA8) && (tok[2] == ',' || tok[2] == EOL))
                {
-                       uint32_t i = strlen(string[tok.u32[1]]);
+                       uint32_t i = strlen(string[tok[1]]);
 
                        if ((challoc - ch_size) < i)
                                chcheck(i);
 
-                       if (*tok.u32 == STRING)
+                       if (*tok == STRING)
                        {
-                               for(p=string[tok.u32[1]]; *p!=EOS; p++)
+                               for(p=string[tok[1]]; *p!=EOS; p++)
                                        D_byte(*p);
                        }
-                       else if(*tok.u32 == STRINGA8)
+                       else if(*tok == STRINGA8)
                        {
-                               for(p=string[tok.u32[1]]; *p!=EOS; p++)
+                               for(p=string[tok[1]]; *p!=EOS; p++)
                                        D_byte(strtoa8[*p]);
                        }
                        else
@@ -1048,16 +1046,16 @@ int d_dc(WORD siz)
                                error("String format not supported... yet");
                        }
 
-                       tok.u32 += 2;
+                       tok += 2;
                        goto comma;
                }
 
                int movei = 0; // MOVEI flag for dc.i
 
-               if (*tok.u32 == DOTI)
+               if (*tok == DOTI)
                {
                        movei = 1;
-                       tok.u32++;
+                       tok++;
                        siz = SIZL;
                }
 
@@ -1215,7 +1213,7 @@ int d_dc(WORD siz)
                }
 
 comma:
-               if (*tok.u32 != ',')
+               if (*tok != ',')
                        break;
        }
 
@@ -1240,7 +1238,7 @@ int d_dcb(WORD siz)
        if (abs_expr(&evalc) != OK)
                return 0;
 
-       if (*tok.u32++ != ',')
+       if (*tok++ != ',')
                return error("missing comma");
 
        if (expr(exprbuf, &eval, &eattr, NULL) < 0)
@@ -1280,14 +1278,14 @@ int d_init(WORD def_siz)
        for(;;)
        {
                // Get repeat count (defaults to 1)
-               if (*tok.u32 == '#')
+               if (*tok == '#')
                {
-                       tok.u32++;
+                       tok++;
 
                        if (abs_expr(&count) != OK)
                                return 0;
 
-                       if (*tok.u32++ != ',')
+                       if (*tok++ != ',')
                                return error(comma_error);
                }
                else
@@ -1297,25 +1295,25 @@ int d_init(WORD def_siz)
                if (expr(exprbuf, &eval, &eattr, NULL) < 0)
                        return 0;
 
-               switch (*tok.u32++)
+               switch (*tok++)
                {                                 // Determine size of object to deposit
                case DOTB: siz = SIZB; break;
                case DOTW: siz = SIZB; break;
                case DOTL: siz = SIZL; break;
                default:
                        siz = def_siz;
-                       tok.u32--;
+                       tok--;
                        break;
                }
 
                dep_block((uint32_t)count, siz, (uint32_t)eval, eattr, exprbuf);
 
-               switch (*tok.u32)
+               switch (*tok)
                {
                case EOL:
                        return 0;
                case ',':
-                       tok.u32++;
+                       tok++;
                        continue;
                default:
                        return error(comma_error);
@@ -1327,7 +1325,7 @@ int d_init(WORD def_siz)
 //
 // Deposit 'count' values of size 'siz' in the current (non-BSS) segment
 //
-int dep_block(uint32_t count, WORD siz, uint32_t eval, WORD eattr, TOKENPTR exprbuf)
+int dep_block(uint32_t count, WORD siz, uint32_t eval, WORD eattr, TOKEN * exprbuf)
 {
        WORD tdb;
        WORD defined;
@@ -1421,11 +1419,11 @@ int d_comm(void)
        if (m6502)
                return error(in_6502mode);
 
-       if (*tok.u32 != SYMBOL)
+       if (*tok != SYMBOL)
                return error("missing symbol");
 
-       p = string[tok.u32[1]];
-       tok.u32 += 2;
+       p = string[tok[1]];
+       tok += 2;
 
        if (*p == '.')                                                  // Cannot .comm a local symbol
                return error(locgl_error);
@@ -1440,7 +1438,7 @@ int d_comm(void)
 
        sym->sattr = GLOBAL | COMMON | BSS;
 
-       if (*tok.u32++ != ',')
+       if (*tok++ != ',')
                return error(comma_error);
 
        if (abs_expr(&eval) != OK)                              // Parse size of common region
@@ -1652,23 +1650,23 @@ int d_cargs(void)
        if (rgpu || rdsp)
                return error("directive forbidden in gpu/dsp mode");
 
-       if (*tok.u32 == '#')
+       if (*tok == '#')
        {
-               tok.u32++;
+               tok++;
 
                if (abs_expr(&eval) != OK)
                        return 0;
 
                // Eat the comma, if it's there
-               if (*tok.u32 == ',')
-                       tok.u32++;
+               if (*tok == ',')
+                       tok++;
        }
 
        for(;;)
        {
-               if (*tok.u32 == SYMBOL)
+               if (*tok == SYMBOL)
                {
-                       p = string[tok.u32[1]];
+                       p = string[tok[1]];
 
                        // Set env to either local (dot prefixed) or global scope
                        env = (*p == '.' ? curenv : 0);
@@ -1687,23 +1685,23 @@ int d_cargs(void)
 
                        symbol->sattr |= (ABS | DEFINED | EQUATED);
                        symbol->svalue = (uint32_t)eval;
-                       tok.u32 += 2;
+                       tok += 2;
 
                        // What this does is eat any dot suffixes attached to a symbol. If
                        // it's a .L, it adds 4 to eval; if it's .W or .B, it adds 2. If
                        // there is no dot suffix, it assumes a size of 2.
-                       switch ((int)*tok.u32)
+                       switch ((int)*tok)
                        {
                        case DOTL:
                                eval += 2;
                        case DOTB:
                        case DOTW:
-                               tok.u32++;
+                               tok++;
                        }
 
                        eval += 2;
                }
-               else if (*tok.u32 >= KW_D0 && *tok.u32 <= KW_A7)
+               else if (*tok >= KW_D0 && *tok <= KW_A7)
                {
                        if (reglist(&rlist) < 0)
                                return 0;
@@ -1716,7 +1714,7 @@ int d_cargs(void)
                }
                else
                {
-                       switch ((int)*tok.u32)
+                       switch ((int)*tok)
                        {
                        case KW_USP:
                        case KW_SSP:
@@ -1726,7 +1724,7 @@ int d_cargs(void)
                        case KW_SR:
                        case KW_CCR:
                                eval += 2;
-                               tok.u32++;
+                               tok++;
                                break;
                        case EOL:
                                return 0;
@@ -1736,8 +1734,8 @@ int d_cargs(void)
                }
 
                // Eat commas in between each argument, if they exist
-               if (*tok.u32 == ',')
-                       tok.u32++;
+               if (*tok == ',')
+                       tok++;
        }
 }
 
@@ -1766,23 +1764,23 @@ int d_cstruct(void)
        if (rgpu || rdsp)
                return error("directive forbidden in gpu/dsp mode");
 
-       if (*tok.u32 == '#')
+       if (*tok == '#')
        {
-               tok.u32++;
+               tok++;
 
                if (abs_expr(&eval) != OK)
                        return 0;
 
                // Eat the comma, if it's there
-               if (*tok.u32 == ',')
-                       tok.u32++;
+               if (*tok == ',')
+                       tok++;
        }
 
        for(;;)
        {
-               if (*tok.u32 == SYMBOL)
+               if (*tok == SYMBOL)
                {
-                       symbolName = string[tok.u32[1]];
+                       symbolName = string[tok[1]];
 
                        // Set env to either local (dot prefixed) or global scope
                        env = (symbolName[0] == '.' ? curenv : 0);
@@ -1801,11 +1799,11 @@ int d_cstruct(void)
                        // Put symbol in "order of definition" list
                        AddToSymbolDeclarationList(symbol);
 
-                       tok.u32 += 2;
+                       tok += 2;
 
                        // Adjust label start address if it's a word or a long, as a byte
                        // label might have left us on an odd address.
-                       switch ((int)*tok.u32)
+                       switch ((int)*tok)
                        {
                        case DOTW:
                        case DOTL:
@@ -1818,7 +1816,7 @@ int d_cstruct(void)
                        // Check for dot suffixes and adjust space accordingly (longs and
                        // words on an odd boundary get bumped to the next word aligned
                        // address). If no suffix, then throw an error.
-                       switch ((int)*tok.u32)
+                       switch ((int)*tok)
                        {
                        case DOTL:
                                eval += 4;
@@ -1833,9 +1831,9 @@ int d_cstruct(void)
                                return error("Symbol missing dot suffix in .cstruct construct");
                        }
 
-                       tok.u32++;
+                       tok++;
                }
-               else if (*tok.u32 >= KW_D0 && *tok.u32 <= KW_A7)
+               else if (*tok >= KW_D0 && *tok <= KW_A7)
                {
                        if (reglist(&rlist) < 0)
                                return 0;
@@ -1848,7 +1846,7 @@ int d_cstruct(void)
                }
                else
                {
-                       switch ((int)*tok.u32)
+                       switch ((int)*tok)
                        {
                        case KW_USP:
                        case KW_SSP:
@@ -1858,7 +1856,7 @@ int d_cstruct(void)
                        case KW_SR:
                        case KW_CCR:
                                eval += 2;
-                               tok.u32++;
+                               tok++;
                                break;
                        case EOL:
                                return 0;
@@ -1868,8 +1866,8 @@ int d_cstruct(void)
                }
 
                // Eat commas in between each argument, if they exist
-               if (*tok.u32 == ',')
-                       tok.u32++;
+               if (*tok == ',')
+                       tok++;
        }
 }
 
@@ -1921,12 +1919,12 @@ int d_gpumain(void)
 //
 int d_opt(void)
 {
-       while (*tok.u32 != EOL)
+       while (*tok != EOL)
        {
-               if (*tok.u32 == STRING)
+               if (*tok == STRING)
                {
-                       tok.u32++;
-                       char * tmpstr = string[*tok.u32++];
+                       tok++;
+                       char * tmpstr = string[*tok++];
 
                        if (ParseOptimization(tmpstr) != OK)
                                return error("unknown optimization flag '%s'", tmpstr);
index 3c884dc5a4b34b03cbbd531b8c15d9a4306910ab..d1924de5ab0a6d5243bea5e7f53f34b9cd290f08 100644 (file)
--- a/direct.h
+++ b/direct.h
 #include "token.h"
 
 // Exported variables
-extern TOKENPTR exprbuf;
+extern TOKEN exprbuf[];
 extern SYM * symbolPtr[];
 extern int (* dirtab[])();
 extern int largestAlign[];
 
 // Exported functions
 void auto_even(void);
-int dep_block(uint32_t, WORD, uint32_t, WORD, TOKENPTR);
+int dep_block(uint32_t, WORD, uint32_t, WORD, TOKEN *);
 int eject(void);
 int abs_expr(uint64_t *);
 int symlist(int(*)());
diff --git a/eagen.c b/eagen.c
index 197bd4e60427d97a4288a956ed14383bfa1b099c..1f18b8598df87c4629b680730428df3740b5d0b1 100644 (file)
--- a/eagen.c
+++ b/eagen.c
 #define amN       am0
 #define aNexattr  a0exattr
 #define aNexval   a0exval
-#define aNexpr    (TOKENPTR)a0expr
+#define aNexpr    a0expr
 #define aNixreg   a0ixreg
 #define aNixsiz   a0ixsiz
 #define AnESYM    a0esym
 #define aNexten   a0extension
-#define aNbexpr   (TOKENPTR)a0bexpr
+#define aNbexpr   a0bexpr
 #define aNbdexval a0bexval
 #define aNbdexattr a0bexattr
 #include "eagen0.c"
 #define amN       am1
 #define aNexattr  a1exattr
 #define aNexval   a1exval
-#define aNexpr    (TOKENPTR)a1expr
+#define aNexpr    a1expr
 #define aNixreg   a1ixreg
 #define aNixsiz   a1ixsiz
 #define AnESYM    a1esym
 #define aNexten   a1extension
-#define aNbexpr   (TOKENPTR)a1bexpr
+#define aNbexpr   a1bexpr
 #define aNbdexval a1bexval
 #define aNbdexattr a1bexattr
 #include "eagen0.c"
diff --git a/error.c b/error.c
index c27911796f9dc9778102ccccb1c19b47db8ef0a3..75e91490d3d44df485fed4cd180befc545055443 100644 (file)
--- a/error.c
+++ b/error.c
@@ -24,11 +24,11 @@ static long unused;                         // For supressing 'write' warnings
 //
 int at_eol(void)
 {
-       if (*tok.u32 != EOL)
+       if (*tok != EOL)
        {
-               error("syntax error. expected EOL, found $%X ('%c')", *tok.u32, *tok.u32);
+               error("syntax error. expected EOL, found $%X ('%c')", *tok, *tok);
                printf("Token = ");
-               DumpToken(*tok.u32);
+               DumpToken(*tok);
                printf("\n");
                DumpTokenBuffer();
        }
diff --git a/expr.c b/expr.c
index 3529f29613f2e8f9cec978514838a306ed238731..20f43cfcb3aace6feb23228e635f8a1cfd5d4dc1 100644 (file)
--- a/expr.c
+++ b/expr.c
@@ -51,11 +51,11 @@ const char missym_error[] = "missing symbol";
 const char str_error[] = "missing symbol or string";
 
 // Convert expression to postfix
-static TOKENPTR evalTokenBuffer;       // Deposit tokens here (this is really a
-                                                                       // pointer to exprbuf from direct.c)
-                                                                       // (Can also be from others, like
-                                                                       // riscasm.c)
-static int symbolNum;                          // Pointer to the entry in symbolPtr[]
+static PTR evalTokenBuffer;            // Deposit tokens here (this is really a
+                                                               // pointer to exprbuf from direct.c)
+                                                               // (Can also be from others, like
+                                                               // riscasm.c)
+static int symbolNum;                  // Pointer to the entry in symbolPtr[]
 
 
 //
@@ -100,14 +100,12 @@ void InitExpression(void)
 //
 int expr0(void)
 {
-       TOKEN t;
-
        if (expr1() != OK)
                return ERROR;
 
-       while (tokenClass[*tok.u32] >= MULT)
+       while (tokenClass[*tok] >= MULT)
        {
-               t = *tok.u32++;
+               TOKEN t = *tok++;
 
                if (expr1() != OK)
                        return ERROR;
@@ -127,18 +125,17 @@ int expr0(void)
 //
 int expr1(void)
 {
-       int class;
        TOKEN t;
        SYM * sy;
        char * p, * p2;
        WORD w;
        int j;
 
-       class = tokenClass[*tok.u32];
+       int class = tokenClass[*tok];
 
-       if (*tok.u32 == '-' || *tok.u32 == '+' || class == UNARY)
+       if (*tok == '-' || *tok == '+' || class == UNARY)
        {
-               t = *tok.u32++;
+               t = *tok++;
 
                if (expr2() != OK)
                        return ERROR;
@@ -153,7 +150,7 @@ int expr1(void)
        }
        else if (class == SUNARY)
        {
-               switch (*tok.u32++)
+               switch (*tok++)
                {
                case CR_ABSCOUNT:
                        *evalTokenBuffer.u32++ = CONST;
@@ -168,10 +165,10 @@ int expr1(void)
                        *evalTokenBuffer.u64++ = dos_date();
                        break;
                case CR_MACDEF: // ^^macdef <macro-name>
-                       if (*tok.u32++ != SYMBOL)
+                       if (*tok++ != SYMBOL)
                                return error(missym_error);
 
-                       p = string[*tok.u32++];
+                       p = string[*tok++];
                        w = (lookup(p, MACRO, 0) == NULL ? 0 : 1);
                        *evalTokenBuffer.u32++ = CONST;
                        *evalTokenBuffer.u64++ = (uint64_t)w;
@@ -182,30 +179,30 @@ int expr1(void)
                case CR_REFERENCED:
                        w = REFERENCED;
 getsym:
-                       if (*tok.u32++ != SYMBOL)
+                       if (*tok++ != SYMBOL)
                                return error(missym_error);
 
-                       p = string[*tok.u32++];
+                       p = string[*tok++];
                        j = (*p == '.' ? curenv : 0);
                        w = ((sy = lookup(p, LABEL, j)) != NULL && (sy->sattr & w) ? 1 : 0);
                        *evalTokenBuffer.u32++ = CONST;
                        *evalTokenBuffer.u64++ = (uint64_t)w;
                        break;
                case CR_STREQ:
-                       if (*tok.u32 != SYMBOL && *tok.u32 != STRING)
+                       if (*tok != SYMBOL && *tok != STRING)
                                return error(str_error);
 
-                       p = string[tok.u32[1]];
-                       tok.u32 +=2;
+                       p = string[tok[1]];
+                       tok +=2;
 
-                       if (*tok.u32++ != ',')
+                       if (*tok++ != ',')
                                return error(comma_error);
 
-                       if (*tok.u32 != SYMBOL && *tok.u32 != STRING)
+                       if (*tok != SYMBOL && *tok != STRING)
                                return error(str_error);
 
-                       p2 = string[tok.u32[1]];
-                       tok.u32 += 2;
+                       p2 = string[tok[1]];
+                       tok += 2;
 
                        w = (WORD)(!strcmp(p, p2));
                        *evalTokenBuffer.u32++ = CONST;
@@ -228,19 +225,19 @@ int expr2(void)
        char * p;
        SYM * sy;
        int j;
+       PTR ptk;
 
-       switch (*tok.u32++)
+       switch (*tok++)
        {
        case CONST:
-               *evalTokenBuffer.u32++ = CONST;
-               *evalTokenBuffer.u64++ = *tok.u64++;
-               break;
        case FCONST:
-               *evalTokenBuffer.u32++ = FCONST;
-               *evalTokenBuffer.u64++ =  *tok.u64++;
+               ptk.u32 = tok;
+               *evalTokenBuffer.u32++ = CONST;
+               *evalTokenBuffer.u64++ = *ptk.u64++;
+               tok = ptk.u32;
                break;
        case SYMBOL:
-               p = string[*tok.u32++];
+               p = string[*tok++];
                j = (*p == '.' ? curenv : 0);
                sy = lookup(p, LABEL, j);
 
@@ -264,13 +261,13 @@ int expr2(void)
                break;
        case STRING:
                *evalTokenBuffer.u32++ = CONST;
-               *evalTokenBuffer.u64++ = str_value(string[*tok.u32++]);
+               *evalTokenBuffer.u64++ = str_value(string[*tok++]);
                break;
        case '(':
                if (expr0() != OK)
                        return ERROR;
 
-               if (*tok.u32++ != ')')
+               if (*tok++ != ')')
                        return error("missing closing parenthesis ')'");
 
                break;
@@ -278,9 +275,23 @@ int expr2(void)
                if (expr0() != OK)
                        return ERROR;
 
-               if (*tok.u32++ != ']')
+               if (*tok++ != ']')
                        return error("missing closing bracket ']'");
 
+               break;
+       case '{':
+               if (expr0() != OK)      // Eat up first parameter (register or immediate)
+                       return ERROR;
+
+               if (*tok++ != ':')      // Demand a ':' there
+                       return error("missing colon ':'");
+
+               if (expr0() != OK)      // Eat up second parameter (register or immediate)
+                       return ERROR;
+
+               if (*tok++ != '}')
+                       return error("missing closing brace '}'");
+
                break;
        case '$':
                *evalTokenBuffer.u32++ = ACONST;                        // Attributed const
@@ -294,20 +305,6 @@ int expr2(void)
                *evalTokenBuffer.u32++ = (orgactive ? orgaddr : pcloc);
                // '*' takes attributes of current section, not ABS!
                *evalTokenBuffer.u32++ = cursect | DEFINED;
-               break;
-       case '{':
-               if (expr0() != OK)                                                      // Eat up first parameter (register or immediate)
-                       return ERROR;
-
-               if (*tok.u32++ != ':')                                          // Demand a ':' there
-                       return error("missing colon ':'");
-
-               if (expr0() != OK)                                                      // Eat up second parameter (register or immediate)
-                       return ERROR;
-
-               if (*tok.u32++ != '}')
-                       return error("missing closing brace '}'");
-
                break;
        default:
                return error("bad expression");
@@ -320,7 +317,7 @@ int expr2(void)
 //
 // Recursive-descent expression analyzer (with some simple speed hacks)
 //
-int expr(TOKENPTR otk, uint64_t * a_value, WORD * a_attr, SYM ** a_esym)
+int expr(TOKEN * otk, uint64_t * a_value, WORD * a_attr, SYM ** a_esym)
 {
        // Passed in values (once derefenced, that is) can all be zero. They are
        // there so that the expression analyzer can fill them in as needed. The
@@ -329,79 +326,82 @@ int expr(TOKENPTR otk, uint64_t * a_value, WORD * a_attr, SYM ** a_esym)
        SYM * symbol;
        char * p;
        int j;
+       PTR ptk;
 
-       evalTokenBuffer = otk;  // Set token pointer to 'exprbuf' (direct.c)
+       evalTokenBuffer.u32 = otk;      // Set token pointer to 'exprbuf' (direct.c)
                                                        // Also set in various other places too (riscasm.c,
                                                        // e.g.)
 
-//printf("expr(): tokens 0-2: %i %i %i (%c %c %c); tc[2] = %i\n", tok.u32[0], tok.u32[1], tok.u32[2], tok.u32[0], tok.u32[1], tok.u32[2], tokenClass[tok.u32[2]]);
+//printf("expr(): tokens 0-2: %i %i %i (%c %c %c); tc[2] = %i\n", tok[0], tok[1], tok[2], tok[0], tok[1], tok[2], tokenClass[tok[2]]);
        // Optimize for single constant or single symbol.
        // Shamus: Subtle bug here. EOL token is 101; if you have a constant token
        //         followed by the value 101, it will trigger a bad evaluation here.
        //         This is probably a really bad assumption to be making here...!
-       //         (assuming tok.u32[1] == EOL is a single token that is)
+       //         (assuming tok[1] == EOL is a single token that is)
        //         Seems that even other tokens (SUNARY type) can fuck this up too.
 #if 0
-//     if ((tok.u32[1] == EOL)
-       if ((tok.u32[1] == EOL && ((tok.u32[0] != CONST || tok.u32[0] != FCONST) && tokenClass[tok.u32[0]] != SUNARY))
-//             || (((*tok.u32 == CONST || *tok.u32 == FCONST || *tok.u32 == SYMBOL) || (*tok.u32 >= KW_R0 && *tok.u32 <= KW_R31))
-//             && (tokenClass[tok.u32[2]] < UNARY)))
-               || (((tok.u32[0] == SYMBOL) || (tok.u32[0] >= KW_R0 && tok.u32[0] <= KW_R31))
-                       && (tokenClass[tok.u32[2]] < UNARY))
-               || ((tok.u32[0] == CONST || tok.u32[0] == FCONST) && (tokenClass[tok.u32[3]] < UNARY))
+//     if ((tok[1] == EOL)
+       if ((tok[1] == EOL && ((tok[0] != CONST || tok[0] != FCONST) && tokenClass[tok[0]] != SUNARY))
+//             || (((*tok == CONST || *tok == FCONST || *tok == SYMBOL) || (*tok >= KW_R0 && *tok <= KW_R31))
+//             && (tokenClass[tok[2]] < UNARY)))
+               || (((tok[0] == SYMBOL) || (tok[0] >= KW_R0 && tok[0] <= KW_R31))
+                       && (tokenClass[tok[2]] < UNARY))
+               || ((tok[0] == CONST || tok[0] == FCONST) && (tokenClass[tok[3]] < UNARY))
                )
 #else
 // Shamus: Seems to me that this could be greatly simplified by 1st checking if the first token is a multibyte token, *then* checking if there's an EOL after it depending on the actual length of the token (multiple vs. single). Otherwise, we have the horror show that is the following:
-       if ((tok.u32[1] == EOL
-                       && (tok.u32[0] != CONST && tokenClass[tok.u32[0]] != SUNARY))
-               || (((tok.u32[0] == SYMBOL)
-                               || (tok.u32[0] >= KW_R0 && tok.u32[0] <= KW_R31))
-                       && (tokenClass[tok.u32[2]] < UNARY))
-               || ((tok.u32[0] == CONST) && (tokenClass[tok.u32[3]] < UNARY))
+       if ((tok[1] == EOL
+                       && (tok[0] != CONST && tokenClass[tok[0]] != SUNARY))
+               || (((tok[0] == SYMBOL)
+                               || (tok[0] >= KW_R0 && tok[0] <= KW_R31))
+                       && (tokenClass[tok[2]] < UNARY))
+               || ((tok[0] == CONST) && (tokenClass[tok[3]] < UNARY))
                )
-// Shamus: Yes, you can parse that out and make some kind of sense of it, but damn, it takes a while to get it and understand the subtle bugs that result from not being careful about what you're checking; especially vis-a-vis niavely checking tok.u32[1] for an EOL. O_o
+// Shamus: Yes, you can parse that out and make some kind of sense of it, but damn, it takes a while to get it and understand the subtle bugs that result from not being careful about what you're checking; especially vis-a-vis niavely checking tok[1] for an EOL. O_o
 #endif
        {
-               if (*tok.u32 >= KW_R0 && *tok.u32 <= KW_R31)
+               if (*tok >= KW_R0 && *tok <= KW_R31)
                {
                        *evalTokenBuffer.u32++ = CONST;
-                       *evalTokenBuffer.u64++ = *a_value = (*tok.u32 - KW_R0);
+                       *evalTokenBuffer.u64++ = *a_value = (*tok - KW_R0);
                        *a_attr = ABS | DEFINED;
 
                        if (a_esym != NULL)
                                *a_esym = NULL;
 
-                       tok.u32++;
+                       tok++;
                }
-               else if (*tok.u32 == CONST)
+               else if (*tok == CONST)
                {
-                       *evalTokenBuffer.u32++ = *tok.u32++;
-                       *evalTokenBuffer.u64++ = *a_value = *tok.u64++;
+                       ptk.u32 = tok;
+                       *evalTokenBuffer.u32++ = *ptk.u32++;
+                       *evalTokenBuffer.u64++ = *a_value = *ptk.u64++;
                        *a_attr = ABS | DEFINED;
+                       tok = ptk.u32;
 
                        if (a_esym != NULL)
                                *a_esym = NULL;
 
-//printf("Quick eval in expr(): CONST = %i, tokenClass[tok.u32[2]] = %i\n", *a_value, tokenClass[*tok.u32]);
+//printf("Quick eval in expr(): CONST = %i, tokenClass[tok[2]] = %i\n", *a_value, tokenClass[*tok]);
                }
 // Not sure that removing float constant here is going to break anything and/or
 // make things significantly slower, but having this here seems to cause the
 // complexity of the check to get to this part of the parse to go through the
 // roof, and dammit, I just don't feel like fighting that fight ATM. :-P
 #if 0
-               else if (*tok.u32 == FCONST)
+               else if (*tok == FCONST)
                {
-                       *evalTokenBuffer.u32++ = *tok.u32++;
+                       *evalTokenBuffer.u32++ = *tok++;
                        *evalTokenBuffer.u64++ = *a_value = *tok.u64++;
                        *a_attr = ABS | DEFINED | FLOAT;
 
                        if (a_esym != NULL)
                                *a_esym = NULL;
 
-//printf("Quick eval in expr(): CONST = %i, tokenClass[tok.u32[2]] = %i\n", *a_value, tokenClass[*tok.u32]);
+//printf("Quick eval in expr(): CONST = %i, tokenClass[tok[2]] = %i\n", *a_value, tokenClass[*tok]);
                }
 #endif
-               else if (*tok.u32 == '*')
+               else if (*tok == '*')
                {
                        *evalTokenBuffer.u32++ = CONST;
 
@@ -416,11 +416,11 @@ int expr(TOKENPTR otk, uint64_t * a_value, WORD * a_attr, SYM ** a_esym)
                        if (a_esym != NULL)
                                *a_esym = NULL;
 
-                       tok.u32++;
+                       tok++;
                }
-               else if (*tok.u32 == STRING || *tok.u32 == SYMBOL)
+               else if (*tok == STRING || *tok == SYMBOL)
                {
-                       p = string[tok.u32[1]];
+                       p = string[tok[1]];
                        j = (*p == '.' ? curenv : 0);
                        symbol = lookup(p, LABEL, j);
 #if 0
@@ -487,14 +487,14 @@ thrown away right here. What the hell is it for?
                                && a_esym != NULL)
                                *a_esym = symbol;
 
-                       tok.u32 += 2;
+                       tok += 2;
                }
                else
                {
                        // Unknown type here... Alert the user!,
                        error("undefined RISC register in expression");
                        // Prevent spurious error reporting...
-                       tok.u32++;
+                       tok++;
                        return ERROR;
                }
 
@@ -516,7 +516,7 @@ thrown away right here. What the hell is it for?
 // UNDEFINED, but it's value includes everything but the symbol value, and
 // 'a_esym' is set to the external symbol.
 //
-int evexpr(TOKENPTR tk, uint64_t * a_value, WORD * a_attr, SYM ** a_esym)
+int evexpr(TOKEN * _tk, uint64_t * a_value, WORD * a_attr, SYM ** a_esym)
 {
        WORD attr, attr2;
        SYM * sy;
@@ -524,6 +524,8 @@ int evexpr(TOKENPTR tk, uint64_t * a_value, WORD * a_attr, SYM ** a_esym)
        WORD * sattr = evattr;
        SYM * esym = NULL;                                              // No external symbol involved
        WORD sym_seg = 0;
+       PTR tk;
+       tk.u32 = _tk;
 
        while (*tk.u32 != ENDEXPR)
        {
diff --git a/expr.h b/expr.h
index 6ebbe673305ffb17e573fc5a476686a63cd8f017..f03ca1e6f06130d78438ef5ec04506342545947b 100644 (file)
--- a/expr.h
+++ b/expr.h
@@ -34,7 +34,7 @@
 void InitExpression(void);
 int expr1(void);
 int expr2(void);
-int expr(TOKENPTR, uint64_t *, WORD *, SYM **);
-int evexpr(TOKENPTR, uint64_t *, WORD *, SYM **);
+int expr(TOKEN *, uint64_t *, WORD *, SYM **);
+int evexpr(TOKEN *, uint64_t *, WORD *, SYM **);
 
 #endif // __EXPR_H__
index e1fd73a7f42420de4ca0747750edf3d890a80c87..77226c7efe5be4c09c5143a05e527af17d3cd819 100644 (file)
--- a/listing.c
+++ b/listing.c
@@ -432,19 +432,19 @@ int d_subttl(void)
        int ejectok;
        ejectok = 1;
 
-       if (*tok.u32 == '-')
+       if (*tok == '-')
        {
                ejectok = 0;
-               ++tok.u32;
+               ++tok;
        }
 
-       if (*tok.u32 != STRING)
+       if (*tok != STRING)
                return error("missing string");
 
-//     strcpy(subttl, (char *)tok.u32[1]);
-       strcpy(subttl, string[tok.u32[1]]);
+//     strcpy(subttl, (char *)tok[1]);
+       strcpy(subttl, string[tok[1]]);
 
-       tok.u32 += 2;
+       tok += 2;
 
        // Always eject on pages 2+
        if (ejectok && (subflag || pageno > 1))
@@ -462,12 +462,12 @@ int d_subttl(void)
 //
 int d_title(void)
 {
-       if (*tok.u32 != STRING)
+       if (*tok != STRING)
                return error("missing string");
 
-//     strcpy(title, (char*)tok.u32[1]);
-       strcpy(title, string[tok.u32[1]]);
-       tok.u32 += 2;
+//     strcpy(title, (char*)tok[1]);
+       strcpy(title, string[tok[1]]);
+       tok += 2;
 
        if (pageno > 1)
        {
diff --git a/mach.c b/mach.c
index 78a79634f213fa31c78d0b17d1d480fe1a4391c9..4b8b8f0c76289a4db1365dcb02dba7f21a76fdc4 100644 (file)
--- a/mach.c
+++ b/mach.c
@@ -660,7 +660,7 @@ int m_shi(WORD inst, WORD siz)
        }
        else
        {
-               AddFixup(FU_QUICK, sloc, (TOKENPTR)a0expr);
+               AddFixup(FU_QUICK, sloc, a0expr);
                D_word(inst);
        }
 
@@ -723,7 +723,7 @@ int m_dbra(WORD inst, WORD siz)
        }
        else
        {
-               AddFixup(FU_WORD | FU_PCREL | FU_ISBRA, sloc, (TOKENPTR)a1expr);
+               AddFixup(FU_WORD | FU_PCREL | FU_ISBRA, sloc, a1expr);
                D_word(0);
        }
 
@@ -914,7 +914,7 @@ int m_moveq(WORD inst, WORD siz)
        // Arrange for future fixup
        if (!(a0exattr & DEFINED))
        {
-               AddFixup(FU_BYTE | FU_SEXT, sloc + 1, (TOKENPTR)a0expr);
+               AddFixup(FU_BYTE | FU_SEXT, sloc + 1, a0expr);
                a0exval = 0;
        }
        else if ((uint32_t)a0exval + 0x100 >= 0x200)
@@ -1030,7 +1030,7 @@ int m_br(WORD inst, WORD siz)
        if (siz == SIZB || siz == SIZS)
        {
                // .B
-               AddFixup(FU_BBRA | FU_PCREL | FU_SEXT, sloc, (TOKENPTR)a0expr);
+               AddFixup(FU_BBRA | FU_PCREL | FU_SEXT, sloc, a0expr);
                D_word(inst);
                return OK;
        }
@@ -1038,7 +1038,7 @@ int m_br(WORD inst, WORD siz)
        {
                // .W
                D_word(inst);
-               AddFixup(FU_WORD | FU_PCREL | FU_LBRA | FU_ISBRA, sloc, (TOKENPTR)a0expr);
+               AddFixup(FU_WORD | FU_PCREL | FU_LBRA | FU_ISBRA, sloc, a0expr);
                D_word(0);
        }
 
@@ -1063,7 +1063,7 @@ int m_addq(WORD inst, WORD siz)
        }
        else
        {
-               AddFixup(FU_QUICK, sloc, (TOKENPTR)a0expr);
+               AddFixup(FU_QUICK, sloc, a0expr);
                D_word(inst);
        }
 
@@ -1114,10 +1114,10 @@ int m_movem(WORD inst, WORD siz)
        if (siz == SIZL)
                inst |= 0x0040;
 
-       if (*tok.u32 == '#')
+       if (*tok == '#')
        {
                // Handle #<expr>, ea
-               tok.u32++;
+               tok++;
 
                if (abs_expr(&eval) != OK)
                        return OK;
@@ -1129,14 +1129,14 @@ int m_movem(WORD inst, WORD siz)
                goto immed1;
        }
 
-       if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_A7))
+       if ((*tok >= KW_D0) && (*tok <= KW_A7))
        {
                // <rlist>, ea
                if (reglist(&rmask) < 0)
                        return OK;
 
 immed1:
-               if (*tok.u32++ != ',')
+               if (*tok++ != ',')
                        return error("missing comma");
 
                if (amode(0) < 0)
@@ -1165,16 +1165,16 @@ immed1:
 
                inst |= 0x0400 | am0 | a0reg;
 
-               if (*tok.u32++ != ',')
+               if (*tok++ != ',')
                        return error("missing comma");
 
-               if (*tok.u32 == EOL)
+               if (*tok == EOL)
                        return error("missing register list");
 
-               if (*tok.u32 == '#')
+               if (*tok == '#')
                {
                        // ea, #<expr>
-                       tok.u32++;
+                       tok++;
 
                        if (abs_expr(&eval) != OK)
                                return OK;
@@ -1236,7 +1236,7 @@ int m_br30(WORD inst, WORD siz)
        else
        {
                // .L
-               AddFixup(FU_LONG | FU_PCREL | FU_SEXT, sloc, (TOKENPTR)a0expr);
+               AddFixup(FU_LONG | FU_PCREL | FU_SEXT, sloc, a0expr);
                D_word(inst);
                return OK;
        }
@@ -1378,21 +1378,21 @@ int m_cas(WORD inst, WORD siz)
        }
 
        // Dc
-       if ((*tok.u32 < KW_D0) && (*tok.u32 > KW_D7))
+       if ((*tok < KW_D0) && (*tok > KW_D7))
                return error("CAS accepts only data registers");
 
-       inst2 = (*tok.u32++) & 7;
+       inst2 = (*tok++) & 7;
 
-       if (*tok.u32++ != ',')
+       if (*tok++ != ',')
                return error("missing comma");
 
        // Du
-       if ((*tok.u32 < KW_D0) && (*tok.u32 > KW_D7))
+       if ((*tok < KW_D0) && (*tok > KW_D7))
                return error("CAS accepts only data registers");
 
-       inst2 |= ((*tok.u32++) & 7) << 6;
+       inst2 |= ((*tok++) & 7) << 6;
 
-       if (*tok.u32++ != ',')
+       if (*tok++ != ',')
                return error("missing comma");
 
        // ea
@@ -1402,7 +1402,7 @@ int m_cas(WORD inst, WORD siz)
        if (modes > 1)
                return error("too many ea fields");
 
-       if (*tok.u32 != EOL)
+       if (*tok != EOL)
                return error("extra (unexpected) text found");
 
        // Reject invalud ea modes
@@ -1448,71 +1448,71 @@ int m_cas2(WORD inst, WORD siz)
        }
 
        // Dc1
-       if ((*tok.u32 < KW_D0) && (*tok.u32 > KW_D7))
+       if ((*tok < KW_D0) && (*tok > KW_D7))
                return error("CAS2 accepts only data registers for Dx1:Dx2 pairs");
 
-       inst2 = (*tok.u32++) & 7;
+       inst2 = (*tok++) & 7;
 
-       if (*tok.u32++ != ':')
+       if (*tok++ != ':')
                return error("missing colon");
 
        // Dc2
-       if ((*tok.u32 < KW_D0) && (*tok.u32 > KW_D7))
+       if ((*tok < KW_D0) && (*tok > KW_D7))
                return error("CAS2 accepts only data registers for Dx1:Dx2 pairs");
 
-       inst3 = (*tok.u32++) & 7;
+       inst3 = (*tok++) & 7;
 
-       if (*tok.u32++ != ',')
+       if (*tok++ != ',')
                return error("missing comma");
 
        // Du1
-       if ((*tok.u32 < KW_D0) && (*tok.u32 > KW_D7))
+       if ((*tok < KW_D0) && (*tok > KW_D7))
                return error("CAS2 accepts only data registers for Dx1:Dx2 pairs");
 
-       inst2 |= ((*tok.u32++) & 7) << 6;
+       inst2 |= ((*tok++) & 7) << 6;
 
-       if (*tok.u32++ != ':')
+       if (*tok++ != ':')
                return error("missing colon");
 
        // Du2
-       if ((*tok.u32 < KW_D0) && (*tok.u32 > KW_D7))
+       if ((*tok < KW_D0) && (*tok > KW_D7))
                return error("CAS2 accepts only data registers for Dx1:Dx2 pairs");
 
-       inst3 |= ((*tok.u32++) & 7) << 6;
+       inst3 |= ((*tok++) & 7) << 6;
 
-       if (*tok.u32++ != ',')
+       if (*tok++ != ',')
                return error("missing comma");
 
        // Rn1
-       if (*tok.u32++ != '(')
+       if (*tok++ != '(')
                return error("missing (");
-       if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_D7))
-               inst2 |= (((*tok.u32++) & 7) << 12) | (0 << 15);
-       else if ((*tok.u32 >= KW_A0) && (*tok.u32 <= KW_A7))
-               inst2 |= (((*tok.u32++) & 7) << 12) | (1 << 15);
+       if ((*tok >= KW_D0) && (*tok <= KW_D7))
+               inst2 |= (((*tok++) & 7) << 12) | (0 << 15);
+       else if ((*tok >= KW_A0) && (*tok <= KW_A7))
+               inst2 |= (((*tok++) & 7) << 12) | (1 << 15);
        else
                return error("CAS accepts either data or address registers for Rn1:Rn2 pair");
 
-       if (*tok.u32++ != ')')
+       if (*tok++ != ')')
                return error("missing (");
 
-       if (*tok.u32++ != ':')
+       if (*tok++ != ':')
                return error("missing colon");
 
        // Rn2
-       if (*tok.u32++ != '(')
+       if (*tok++ != '(')
                return error("missing (");
-       if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_D7))
-               inst3 |= (((*tok.u32++) & 7) << 12) | (0 << 15);
-       else if ((*tok.u32 >= KW_A0) && (*tok.u32 <= KW_A7))
-               inst3 |= (((*tok.u32++) & 7) << 12) | (1 << 15);
+       if ((*tok >= KW_D0) && (*tok <= KW_D7))
+               inst3 |= (((*tok++) & 7) << 12) | (0 << 15);
+       else if ((*tok >= KW_A0) && (*tok <= KW_A7))
+               inst3 |= (((*tok++) & 7) << 12) | (1 << 15);
        else
                return error("CAS accepts either data or address registers for Rn1:Rn2 pair");
 
-       if (*tok.u32++ != ')')
+       if (*tok++ != ')')
                return error("missing (");
 
-       if (*tok.u32 != EOL)
+       if (*tok != EOL)
                return error("extra (unexpected) text found");
 
        D_word(inst);
@@ -1652,7 +1652,7 @@ int m_cpbr(WORD inst, WORD siz)
        {
                // .L
                D_word(inst);
-               AddFixup(FU_LONG | FU_PCREL | FU_SEXT, sloc, (TOKENPTR)a0expr);
+               AddFixup(FU_LONG | FU_PCREL | FU_SEXT, sloc, a0expr);
                D_long(0);
                return OK;
        }
@@ -1660,7 +1660,7 @@ int m_cpbr(WORD inst, WORD siz)
        {
                // .W
                D_word(inst);
-               AddFixup(FU_WORD | FU_PCREL | FU_SEXT, sloc, (TOKENPTR)a0expr);
+               AddFixup(FU_WORD | FU_PCREL | FU_SEXT, sloc, a0expr);
                D_word(0);
        }
 
@@ -1700,7 +1700,7 @@ int m_cpdbr(WORD inst, WORD siz)
        }
        else
        {
-               AddFixup(FU_WORD | FU_PCREL | FU_ISBRA, sloc, (TOKENPTR)a1expr);
+               AddFixup(FU_WORD | FU_PCREL | FU_ISBRA, sloc, a1expr);
                D_word(0);
        }
 
@@ -2129,51 +2129,51 @@ int m_pack(WORD inst, WORD siz)
        if (siz != SIZN)
                return error("bad size suffix");
 
-       if (*tok.u32 >= KW_D0 && *tok.u32 <= KW_D7)
+       if (*tok >= KW_D0 && *tok <= KW_D7)
        {
                // Dx,Dy,#<adjustment>
                inst |= (0 << 3);   // R/M
-               inst |= (*tok.u32++ & 7);
+               inst |= (*tok++ & 7);
 
-               if (*tok.u32 != ',' && tok.u32[2] != ',')
+               if (*tok != ',' && tok[2] != ',')
                        return error("missing comma");
 
-               if (tok.u32[1] < KW_D0 && tok.u32[1] > KW_D7)
+               if (tok[1] < KW_D0 && tok[1] > KW_D7)
                        return error(syntax_error);
 
-               inst |= ((tok.u32[1] & 7)<<9);
-               tok.u32 = tok.u32 + 3;
+               inst |= ((tok[1] & 7)<<9);
+               tok = tok + 3;
                D_word(inst);
                // Fall through for adjustment (common in both valid cases)
        }
-       else if (*tok.u32 == '-')
+       else if (*tok == '-')
        {
                // -(Ax),-(Ay),#<adjustment>
                inst |= (1 << 3);   // R/M
-               tok.u32++;  // eat the minus
+               tok++;  // eat the minus
 
-               if ((*tok.u32 != '(') && (tok.u32[2]!=')') && (tok.u32[3]!=',') && (tok.u32[4] != '-') && (tok.u32[5] != '(') && (tok.u32[7] != ')') && (tok.u32[8] != ','))
+               if ((*tok != '(') && (tok[2]!=')') && (tok[3]!=',') && (tok[4] != '-') && (tok[5] != '(') && (tok[7] != ')') && (tok[8] != ','))
                        return error(syntax_error);
 
-               if (tok.u32[1] < KW_A0 && tok.u32[1] > KW_A7)
+               if (tok[1] < KW_A0 && tok[1] > KW_A7)
                        return error(syntax_error);
 
-               if (tok.u32[5] < KW_A0 && tok.u32[6] > KW_A7)
+               if (tok[5] < KW_A0 && tok[6] > KW_A7)
                        return error(syntax_error);
 
-               inst |= ((tok.u32[1] & 7) << 0);
-               inst |= ((tok.u32[6] & 7) << 9);
-               tok.u32 = tok.u32 + 9;
+               inst |= ((tok[1] & 7) << 0);
+               inst |= ((tok[6] & 7) << 9);
+               tok = tok + 9;
                D_word(inst);
                // Fall through for adjustment (common in both valid cases)
        }
        else
                return error("invalid syntax");
 
-       if ((*tok.u32 != CONST) && (*tok.u32 != SYMBOL) && (*tok.u32 != '-'))
+       if ((*tok != CONST) && (*tok != SYMBOL) && (*tok != '-'))
                return error(syntax_error);
 
-       if (expr((TOKENPTR)a0expr, &a0exval, &a0exattr, &a0esym) == ERROR)
+       if (expr(a0expr, &a0exval, &a0exattr, &a0esym) == ERROR)
                return ERROR;
 
        if ((a0exattr & DEFINED) == 0)
@@ -2182,7 +2182,7 @@ int m_pack(WORD inst, WORD siz)
        if (a0exval + 0x8000 > 0x10000)
                return error("");
 
-       if (*tok.u32 != EOL)
+       if (*tok != EOL)
                return error(extra_stuff);
 
        D_word((a0exval & 0xFFFF));
@@ -2463,15 +2463,15 @@ int m_pflush(WORD inst, WORD siz)
                // PFLUSH FC, MASK, < ea >
                WORD mask, fc;
 
-               switch ((int)*tok.u32)
+               switch ((int)*tok)
                {
                case '#':
-                       tok.u32++;
+                       tok++;
 
-                       if (*tok.u32 != CONST && *tok.u32 != SYMBOL)
+                       if (*tok != CONST && *tok != SYMBOL)
                                return error("function code should be an expression");
 
-                       if (expr((TOKENPTR)a0expr, &a0exval, &a0exattr, &a0esym) == ERROR)
+                       if (expr(a0expr, &a0exval, &a0exattr, &a0esym) == ERROR)
                                return ERROR;
 
                        if ((a0exattr & DEFINED) == 0)
@@ -2490,30 +2490,30 @@ int m_pflush(WORD inst, WORD siz)
                case KW_D5:
                case KW_D6:
                case KW_D7:
-                       fc = (1 << 4) | (*tok.u32++ & 7);
+                       fc = (1 << 4) | (*tok++ & 7);
                        break;
                case KW_SFC:
                        fc = 0;
-                       tok.u32++;
+                       tok++;
                        break;
                case KW_DFC:
                        fc = 1;
-                       tok.u32++;
+                       tok++;
                        break;
                default:
                        return error(syntax_error);
                }
 
-               if (*tok.u32++ != ',')
+               if (*tok++ != ',')
                        return error("comma exptected");
 
-               if (*tok.u32++ != '#')
+               if (*tok++ != '#')
                        return error("mask should be an immediate value");
 
-               if (*tok.u32 != CONST && *tok.u32 != SYMBOL)
+               if (*tok != CONST && *tok != SYMBOL)
                        return error("mask is supposed to be immediate");
 
-               if (expr((TOKENPTR)a0expr, &a0exval, &a0exattr, &a0esym) == ERROR)
+               if (expr(a0expr, &a0exval, &a0exattr, &a0esym) == ERROR)
                        return ERROR;
 
                if ((a0exattr & DEFINED) == 0)
@@ -2524,7 +2524,7 @@ int m_pflush(WORD inst, WORD siz)
 
                mask = (uint16_t)a0exval << 5;
 
-               if (*tok.u32 == EOL)
+               if (*tok == EOL)
                {
                        // PFLUSH FC, MASK
                        D_word(inst);
@@ -2532,15 +2532,15 @@ int m_pflush(WORD inst, WORD siz)
                        D_word(inst);
                        return OK;
                }
-               else if (*tok.u32 == ',')
+               else if (*tok == ',')
                {
                        // PFLUSH FC, MASK, < ea >
-                       tok.u32++;
+                       tok++;
 
                        if (amode(0) == ERROR)
                                return ERROR;
 
-                       if (*tok.u32 != EOL)
+                       if (*tok != EOL)
                                return error(extra_stuff);
 
                        if (am0 == AIND || am0 == ABSW || am0 == ABSL || am0 == ADISP || am0 == ADISP || am0 == AINDEXED || am0 == ABASE || am0 == MEMPOST || am0 == MEMPRE)
@@ -2565,10 +2565,10 @@ int m_pflush(WORD inst, WORD siz)
        {
                // PFLUSH(An)
                // PFLUSHN(An)
-               if (*tok.u32 != '(' && tok.u32[2] != ')')
+               if (*tok != '(' && tok[2] != ')')
                        return error(syntax_error);
 
-               if (tok.u32[1] < KW_A0 && tok.u32[1] > KW_A7)
+               if (tok[1] < KW_A0 && tok[1] > KW_A7)
                        return error("expected (An)");
 
                if ((inst & 7) == 7)
@@ -2579,9 +2579,9 @@ int m_pflush(WORD inst, WORD siz)
                        // pflushn inside 68ktab and detect it here.
                        inst = (inst & 0xff8) | 8;
 
-               inst |= (tok.u32[1] & 7) | (5 << 8);
+               inst |= (tok[1] & 7) | (5 << 8);
 
-               if (tok.u32[3] != EOL)
+               if (tok[3] != EOL)
                        return error(extra_stuff);
 
                D_word(inst);
@@ -3111,7 +3111,7 @@ int m_fdbcc(WORD inst, WORD siz)
        }
        else
        {
-               AddFixup(FU_WORD | FU_PCREL | FU_ISBRA, sloc, (TOKENPTR)a1expr);
+               AddFixup(FU_WORD | FU_PCREL | FU_ISBRA, sloc, a1expr);
                D_word(0);
        }
 
@@ -3469,13 +3469,13 @@ int m_fmovem(WORD inst, WORD siz)
 
        if (siz == SIZX || siz==SIZN)
        {
-               if ((*tok.u32 >= KW_FP0) && (*tok.u32 <= KW_FP7))
+               if ((*tok >= KW_FP0) && (*tok <= KW_FP7))
                {
                        //fmovem.x <rlist>,ea
                        if (fpu_reglist_left(&regmask) < 0)
                                return OK;
 
-                       if (*tok.u32++ != ',')
+                       if (*tok++ != ',')
                                return error("missing comma");
 
                        if (amode(0) < 0)
@@ -3492,12 +3492,12 @@ int m_fmovem(WORD inst, WORD siz)
                        ea0gen(siz);
                        return OK;
                }
-               else if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_D7))
+               else if ((*tok >= KW_D0) && (*tok <= KW_D7))
                {
                        // fmovem.x Dn,ea
-                       datareg = (*tok.u32++ & 7) << 10;
+                       datareg = (*tok++ & 7) << 10;
 
-                       if (*tok.u32++ != ',')
+                       if (*tok++ != ',')
                                return error("missing comma");
 
                        if (amode(0) < 0)
@@ -3522,10 +3522,10 @@ int m_fmovem(WORD inst, WORD siz)
 
                        inst |= am0 | a0reg;
 
-                       if (*tok.u32++ != ',')
+                       if (*tok++ != ',')
                                return error("missing comma");
 
-                       if ((*tok.u32 >= KW_FP0) && (*tok.u32 <= KW_FP7))
+                       if ((*tok >= KW_FP0) && (*tok <= KW_FP7))
                        {
                                //fmovem.x ea,<rlist>
                                if (fpu_reglist_right(&regmask) < 0)
@@ -3540,7 +3540,7 @@ int m_fmovem(WORD inst, WORD siz)
                        else
                        {
                                // fmovem.x ea,Dn
-                               datareg = (*tok.u32++ & 7) << 10;
+                               datareg = (*tok++ & 7) << 10;
                                D_word(inst);
                                inst = (1 << 15) | (1 << 14) | (0 << 13) | (3 << 11) | (datareg << 4);
                                D_word(inst);
@@ -3551,39 +3551,39 @@ int m_fmovem(WORD inst, WORD siz)
        }
        else if (siz == SIZL)
        {
-               if ((*tok.u32 == KW_FPCR) || (*tok.u32 == KW_FPSR) || (*tok.u32 == KW_FPIAR))
+               if ((*tok == KW_FPCR) || (*tok == KW_FPSR) || (*tok == KW_FPIAR))
                {
                        //fmovem.l <rlist>,ea
                        regmask = (1 << 15) | (1 << 13);
 fmovem_loop_1:
-                       if (*tok.u32 == KW_FPCR)
+                       if (*tok == KW_FPCR)
                        {
                                regmask |= (1 << 12);
-                               tok.u32++;
+                               tok++;
                                goto fmovem_loop_1;
                        }
 
-                       if (*tok.u32 == KW_FPSR)
+                       if (*tok == KW_FPSR)
                        {
                                regmask |= (1 << 11);
-                               tok.u32++;
+                               tok++;
                                goto fmovem_loop_1;
                        }
 
-                       if (*tok.u32 == KW_FPIAR)
+                       if (*tok == KW_FPIAR)
                        {
                                regmask |= (1 << 10);
-                               tok.u32++;
+                               tok++;
                                goto fmovem_loop_1;
                        }
 
-                       if ((*tok.u32 == '/') || (*tok.u32 == '-'))
+                       if ((*tok == '/') || (*tok == '-'))
                        {
-                               tok.u32++;
+                               tok++;
                                goto fmovem_loop_1;
                        }
 
-                       if (*tok.u32++ != ',')
+                       if (*tok++ != ',')
                                return error("missing comma");
 
                        if (amode(0) < 0)
@@ -3602,40 +3602,40 @@ fmovem_loop_1:
 
                        inst |= am0 | a0reg;
 
-                       if (*tok.u32++ != ',')
+                       if (*tok++ != ',')
                                return error("missing comma");
 
                        regmask = (1 << 15) | (0 << 13);
 
 fmovem_loop_2:
-                       if (*tok.u32 == KW_FPCR)
+                       if (*tok == KW_FPCR)
                        {
                                regmask |= (1 << 12);
-                               tok.u32++;
+                               tok++;
                                goto fmovem_loop_2;
                        }
 
-                       if (*tok.u32 == KW_FPSR)
+                       if (*tok == KW_FPSR)
                        {
                                regmask |= (1 << 11);
-                               tok.u32++;
+                               tok++;
                                goto fmovem_loop_2;
                        }
 
-                       if (*tok.u32 == KW_FPIAR)
+                       if (*tok == KW_FPIAR)
                        {
                                regmask |= (1 << 10);
-                               tok.u32++;
+                               tok++;
                                goto fmovem_loop_2;
                        }
 
-                       if ((*tok.u32 == '/') || (*tok.u32 == '-'))
+                       if ((*tok == '/') || (*tok == '-'))
                        {
-                               tok.u32++;
+                               tok++;
                                goto fmovem_loop_2;
                        }
 
-                       if (*tok.u32 != EOL)
+                       if (*tok != EOL)
                                return error("extra (unexpected) text found");
 
                        inst |= am0 | a0reg;
diff --git a/macro.c b/macro.c
index 46443463317e265a30d1950241c7056c3e3aa645..54d34c43687b3cae932b9c7b5387e55b36a9ce99 100644 (file)
--- a/macro.c
+++ b/macro.c
@@ -153,10 +153,10 @@ int DefineMacro(void)
        // Setup entry in symbol table, make sure the macro isn't a duplicate
        // entry, and that it doesn't override any processor mnemonic or assembler
        // directive.
-       if (*tok.u32++ != SYMBOL)
+       if (*tok++ != SYMBOL)
                return error("missing symbol");
 
-       char * name = string[*tok.u32++];
+       char * name = string[*tok++];
 
        if (lookup(name, MACRO, 0) != NULL)
                return error("duplicate macro definition");
@@ -166,7 +166,7 @@ int DefineMacro(void)
        curmac->sattr = (WORD)(macnum++);
 
        // Parse and define formal arguments in symbol table
-       if (*tok.u32 != EOL)
+       if (*tok != EOL)
        {
                argno = 0;
                symlist(defmac2);
@@ -307,19 +307,19 @@ static int LNCatch(int (* lnfunc)(), char * dirlist)
                char * p = NULL;
                int k = -1;
 
-               if (*tok.u32 == SYMBOL)
+               if (*tok == SYMBOL)
                {
                        // A string followed by a colon or double colon is a symbol and
                        // *not* a directive, see if we can find the directive after it
-                       if ((tok.u32[2] == ':' || tok.u32[2] == DCOLON))
+                       if ((tok[2] == ':' || tok[2] == DCOLON))
                        {
-                               if (tok.u32[3] == SYMBOL)
-                                       p = string[tok.u32[4]];
+                               if (tok[3] == SYMBOL)
+                                       p = string[tok[4]];
                        }
                        else
                        {
                                // Otherwise, just grab the directive
-                               p = string[tok.u32[1]];
+                               p = string[tok[1]];
                        }
                }
 
@@ -389,7 +389,7 @@ static int KWMatch(char * kw, char * kwlist)
 //
 int InvokeMacro(SYM * mac, WORD siz)
 {
-       DEBUG { printf("InvokeMacro: arguments="); DumpTokens(tok.u32); }
+       DEBUG { printf("InvokeMacro: arguments="); DumpTokens(tok); }
 
        INOBJ * inobj = a_inobj(SRC_IMACRO);    // Alloc and init IMACRO
        IMACRO * imacro = inobj->inobj.imacro;
@@ -397,46 +397,46 @@ int InvokeMacro(SYM * mac, WORD siz)
 
        // Chop up the arguments, if any (tok comes from token.c, which at this
        // point points at the macro argument token stream)
-       if (*tok.u32 != EOL)
+       if (*tok != EOL)
        {
                // Parse out the arguments and set them up correctly
                TOKEN * p = imacro->argument[nargs].token;
                int stringNum = 0;
 
-               while (*tok.u32 != EOL)
+               while (*tok != EOL)
                {
-                       if (*tok.u32 == ACONST)
+                       if (*tok == ACONST)
                        {
                                for(int i=0; i<3; i++)
-                                       *p++ = *tok.u32++;
+                                       *p++ = *tok++;
                        }
-                       else if (*tok.u32 == CONST)             // Constants are 64-bits
+                       else if (*tok == CONST)         // Constants are 64-bits
                        {
-                               *p++ = *tok.u32++;                      // Token
+                               *p++ = *tok++;                  // Token
                                uint64_t *p64 = (uint64_t *)p;
-                               uint64_t *tok64 = (uint64_t *)tok.u32;
+                               uint64_t *tok64 = (uint64_t *)tok;
                                *p64++ = *tok64++;
-                               tok.u32 = (TOKEN *)tok64;
+                               tok = (TOKEN *)tok64;
                                p = (uint32_t *)p64;
                        }
-                       else if ((*tok.u32 == STRING) || (*tok.u32 == SYMBOL))
+                       else if ((*tok == STRING) || (*tok == SYMBOL))
                        {
-                               *p++ = *tok.u32++;
-                               imacro->argument[nargs].string[stringNum] = strdup(string[*tok.u32++]);
+                               *p++ = *tok++;
+                               imacro->argument[nargs].string[stringNum] = strdup(string[*tok++]);
                                *p++ = stringNum++;
                        }
-                       else if (*tok.u32 == ',')
+                       else if (*tok == ',')
                        {
                                // Comma delimiter was found, so set up for next argument
                                *p++ = EOL;
-                               tok.u32++;
+                               tok++;
                                stringNum = 0;
                                nargs++;
                                p = imacro->argument[nargs].token;
                        }
                        else
                        {
-                               *p++ = *tok.u32++;
+                               *p++ = *tok++;
                        }
                }
 
index 0c5ca2c0818e01b9ab248016127482dc41c456ce..64c3b5c86981c3576a099d2a921d04328de219da 100644 (file)
--- a/parmode.h
+++ b/parmode.h
        // Dn
        // An
        // # expression
-       if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_D7))
+       if ((*tok >= KW_D0) && (*tok <= KW_D7))
        {
                AMn = DREG;
-               AnREG = *tok.u32++ & 7;
+               AnREG = *tok++ & 7;
        }
-       else if ((*tok.u32 >= KW_A0) && (*tok.u32 <= KW_A7))
+       else if ((*tok >= KW_A0) && (*tok <= KW_A7))
        {
                AMn = AREG;
-               AnREG = *tok.u32++ & 7;
+               AnREG = *tok++ & 7;
        }
-       else if (*tok.u32 == '#')
+       else if (*tok == '#')
        {
-               tok.u32++;
+               tok++;
 
                if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                        return ERROR;
        // ([bd,An,Xn],od)
        // ([bd,PC],Xn,od)
        // ([bd,PC,Xn],od)
-       else if (*tok.u32 == '(')
+       else if (*tok == '(')
        {
-               tok.u32++;
+               tok++;
 
-               if ((*tok.u32 >= KW_A0) && (*tok.u32 <= KW_A7))
+               if ((*tok >= KW_A0) && (*tok <= KW_A7))
                {
-                       AnREG = *tok.u32++ & 7;
+                       AnREG = *tok++ & 7;
 
-                       if (*tok.u32 == ')')
+                       if (*tok == ')')
                        {
-                               tok.u32++;
+                               tok++;
 
-                               if (*tok.u32 == '+')
+                               if (*tok == '+')
                                {
-                                       tok.u32++;
+                                       tok++;
                                        AMn = APOSTINC;
                                }
                                else
                        AMn = AINDEXED;
                        goto AMn_IX0;            // Handle ",Xn[.siz][*scale])"
                }
-               else if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_D7))
+               else if ((*tok >= KW_D0) && (*tok <= KW_D7))
                {
                        //Since index register isn't used here, store register number in this field
-                       AnIXREG = *tok.u32++ & 7;                                // (Dn)
+                       AnIXREG = *tok++ & 7;                                // (Dn)
 
-                       if (*tok.u32 == ')')
+                       if (*tok == ')')
                        {
-                               tok.u32++;
+                               tok++;
                                AnEXTEN |= EXT_FULLWORD;    // Definitely using full extension format, so set bit 8
                                AnEXTEN |= EXT_BS;          // Base register suppressed
                                AnEXTEN |= EXT_BDSIZE0;     // Base displacement null
                                AnREG = 6 << 3;         // stuff 110 to mode field
                                goto AnOK;
                        }
-                       else if (*tok.u32 == 'L')
+                       else if (*tok == 'L')
                        {
                                // TODO: does DINDL gets used at all?
                                AMn = DINDL;                                     // (Dn.l)
                                AnEXTEN = 1 << 1;   // Long index size
-                               tok.u32++;
+                               tok++;
                        }
-                       else if (*tok.u32 == 'W')                                // (Dn.w)
+                       else if (*tok == 'W')                                // (Dn.w)
                        {
                                // TODO: does DINDW gets used at all?
                                AMn = DINDW;
                                AnEXTEN = 1 << 1;   // Word index size
-                               tok.u32++;
+                               tok++;
                        }
-                       else if (*tok.u32 == ',')
+                       else if (*tok == ',')
                        {
                                // ([bd,An],Xn..) without bd, An
                                // Base displacement is suppressed
                                AnEXTEN |= EXT_BS;          // Base register suppressed
                                AnEXTEN |= EXT_BDSIZE0;
                                AnREG = 6 << 3;         // stuff 110 to mode field
-                               tok.u32++;
+                               tok++;
                                goto CHECKODn;
                        }
                        else
                                return error("(Dn) error");
                        }
 
-                       if (*tok.u32 == '*')
+                       if (*tok == '*')
                        {                        // scale: *1, *2, *4, *8
-                               tok.u32++;
+                               tok++;
 
-                               if (*tok.u32 == SYMBOL)
+                               if (*tok == SYMBOL)
                                {
                                        if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                                                return error("scale factor expression must evaluate");
                                                goto badmode;
                                        }
                                }
-                               else if (*tok.u32++ != CONST || *tok.u32 > 8)
+                               else if (*tok++ != CONST || *tok > 8)
                                        goto badmode;
                                else
                                {
-                                       switch ((int)*tok.u32++)
+                                       switch ((int)*tok++)
                                        {
                                        case 1:
                                                break;
                                }
                        }
 
-                       if (*tok.u32 == ')')
+                       if (*tok == ')')
                        {
-                               tok.u32++;
+                               tok++;
                                AnEXTEN |= EXT_FULLWORD;    // Definitely using full extension format, so set bit 8
                                AnEXTEN |= EXT_BS;          // Base register suppressed
                                AnEXTEN |= EXT_BDSIZE0;     // Base displacement null
                                AMn = MEMPOST;
                                goto AnOK;
                        }
-                       else if (*tok.u32 == ',')
+                       else if (*tok == ',')
                        {
-                               tok.u32++;  // eat the comma
+                               tok++;  // eat the comma
                                // It might be (Dn[.wl][*scale],od)
                                // Maybe this is wrong and we have to write some code here
                                // instead of reusing that path...
                        else
                                return error("unhandled so far");
                }
-               else if (*tok.u32 == KW_PC)
+               else if (*tok == KW_PC)
                {                            // (PC,Xn[.siz][*scale])
-                       tok.u32++;
+                       tok++;
                        AMn = PCINDEXED;
 
                        // Common index handler; enter here with 'tok' pointing at the
 
                        AMn_IXN:                 // Handle any indexed (tok -> a comma)
 
-                       if (*tok.u32++ != ',')
+                       if (*tok++ != ',')
                                goto badmode;
 
-                       if (*tok.u32 < KW_D0 || *tok.u32 > KW_A7)
+                       if (*tok < KW_D0 || *tok > KW_A7)
                                goto badmode;
 
-                       AnIXREG = *tok.u32++ & 15;
+                       AnIXREG = *tok++ & 15;
 
-                       switch ((int)*tok.u32)
+                       switch ((int)*tok)
                        {                        // Index reg size: <empty> | .W | .L
                        case DOTW:
-                               tok.u32++;
+                               tok++;
                        default:
                                AnIXSIZ = 0;
                                break;
                        case DOTL:
                                AnIXSIZ = 0x0800;
-                               tok.u32++;
+                               tok++;
                                break;
                        case DOTB:               // .B not allowed here...
                                goto badmode;
                        }
 
-                       if (*tok.u32 == '*')
+                       if (*tok == '*')
                        {                        // scale: *1, *2, *4, *8
-                               tok.u32++;
+                               tok++;
 
-                               if (*tok.u32 == SYMBOL)
+                               if (*tok == SYMBOL)
                                {
                                        if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                                                return error("scale factor expression must evaluate");
                                                goto badmode;
                                        }
                                }
-                               else if (*tok.u32++ != CONST || *tok.u32 > 8)
+                               else if (*tok++ != CONST || *tok > 8)
                                        goto badmode;
                                else
                                {
-                                       switch ((int)*tok.u32++)
+                                       switch ((int)*tok++)
                                        {
                                        case 1:
                                                break;
                                }
                        }
 
-                       if (*tok.u32 == ',')
+                       if (*tok == ',')
                        {
                                // If we got here we didn't get any [] stuff
                                // so let's suppress base displacement before
                                // branching off
-                               tok.u32++;
+                               tok++;
                                AnEXTEN |= EXT_BDSIZE0;     // Base displacement null - suppressed
                                goto CHECKODn;
                        }
-                       if (*tok.u32++ != ')')         // final ")"
+                       if (*tok++ != ')')         // final ")"
                                goto badmode;
 
                        goto AnOK;
                }
-               else if (*tok.u32 == '[')
+               else if (*tok == '[')
                {                              // ([...
-                       tok.u32++;
+                       tok++;
                        AnEXTEN |= EXT_FULLWORD;     // Definitely using full extension format, so set bit 8
 
                        // Check to see if base displacement is present
-                       if (*tok.u32 != CONST && *tok.u32 != SYMBOL)
+                       if (*tok != CONST && *tok != SYMBOL)
                        {
                                AnEXTEN |= EXT_BDSIZE0;
                        }
                                        // bd=0 so let's optimise it out
                                        AnEXTEN|=EXT_BDSIZE0;
                                }
-                               else if (*tok.u32 == DOTL)
+                               else if (*tok == DOTL)
                                {                                               // ([bd.l,...
                                                AnEXTEN |= EXT_BDSIZEL;
-                                               tok.u32++;
+                                               tok++;
                                }
                                else
                                {                                               // ([bd[.w],... or ([bd,...
                                        // Is .W forced here?
-                                       if (*tok.u32 == DOTW)
+                                       if (*tok == DOTW)
                                        {
                                                AnEXTEN |= EXT_BDSIZEW;
-                                               tok.u32++;
+                                               tok++;
                                        }
                                        else
                                        {
                                        }
                                }
 
-                               if (*tok.u32 == ',')
-                                       tok.u32++;
+                               if (*tok == ',')
+                                       tok++;
                                //else
                                //      return error("Comma expected after base displacement");
                        }
                        // Check for address register or PC, suppress base register
                        // otherwise
 
-                       if (*tok.u32 == KW_PC)
+                       if (*tok == KW_PC)
                        {                                       // ([bd,PC,...
                                AnREG = (7 << 3) | 3;   // PC is special case - stuff 011 to register field and 111 to the mode field
-                               tok.u32++;
+                               tok++;
                        }
-                       else if ((*tok.u32 >= KW_A0) && (*tok.u32 <= KW_A7))
+                       else if ((*tok >= KW_A0) && (*tok <= KW_A7))
                        {                                       // ([bd,An,...
-                               AnREG = (6 << 3) | *tok.u32 & 7;
-                               tok.u32++;
+                               AnREG = (6 << 3) | *tok & 7;
+                               tok++;
                        }
-                       else if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_D7))
+                       else if ((*tok >= KW_D0) && (*tok <= KW_D7))
                        {
                                // ([bd,Dn,...
                                AnREG = (6 << 3);
-                               AnEXTEN |= ((*tok.u32 & 7) << 12);
+                               AnEXTEN |= ((*tok & 7) << 12);
                                AnEXTEN |= EXT_D;
                                AnEXTEN |= EXT_BS; // Oh look, a data register! Which means that base register is suppressed
-                               tok.u32++;
+                               tok++;
 
                                // Check for size
                                {
                                // ([bd,An/PC],Xn.W/L...)
-                               switch ((int)*tok.u32)
+                               switch ((int)*tok)
                                {
                                // Index reg size: <empty> | .W | .L
                                case DOTW:
-                                       tok.u32++;
+                                       tok++;
                                        break;
                                default:
                                        break;
                                case DOTL:
                                        AnEXTEN |= EXT_L;
-                                       tok.u32++;
+                                       tok++;
                                        break;
                                case DOTB:
                                        // .B not allowed here...
                                }
 
                                // Check for scale
-                               if (*tok.u32 == '*')                    // ([bd,An/PC],Xn*...)
+                               if (*tok == '*')                        // ([bd,An/PC],Xn*...)
                                {                           // scale: *1, *2, *4, *8
-                                       tok.u32++;
+                                       tok++;
 
-                                       if (*tok.u32 == SYMBOL)
+                                       if (*tok == SYMBOL)
                                        {
                                                if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                                                        return error("scale factor expression must evaluate");
                                                        goto badmode;
                                }
                                        }
-                                       else if (*tok.u32++ != CONST || *tok.u32 > 8)
+                                       else if (*tok++ != CONST || *tok > 8)
                                                goto badmode;
                                        else
                                        {
-                                               switch ((int)*tok.u32++)
+                                               switch ((int)*tok++)
                                                {
                                                case 1:
                                                        break;
                                                }
                                        }
                                }
-                               if (*tok.u32 == ']')  // ([bd,Dn]...
+                               if (*tok == ']')  // ([bd,Dn]...
                                {
-                                       tok.u32++;
+                                       tok++;
                                        goto IS_SUPPRESSEDn;
                                }
                        }
-                       else if (*tok.u32 == ']')
+                       else if (*tok == ']')
                        {
                                // PC and Xn is suppressed
                                AnREG = 6 << 3;         // stuff 110 to mode field
                        }
 
                        // At a crossroads here. We can accept either ([bd,An/PC],... or ([bd,An/PC,Xn*scale],...
-                       if (*tok.u32 == ']')
+                       if (*tok == ']')
                        {
                                //([bd,An/PC],Xn,od)
                                // Check for Xn
-                               tok.u32++;
+                               tok++;
 
-                               if (*tok.u32 == ')')
+                               if (*tok == ')')
                                {
                                        //Xn and od are non existent, get out of jail free card
-                                       tok.u32++;
+                                       tok++;
                                        AMn = MEMPRE;                   // ([bc,An,Xn],od) with no Xn and od
                                        AnEXTEN |= EXT_IS | EXT_IISPREN;        //Suppress Xn and od
                                        goto AnOK;
                                }
-                               else if (*tok.u32 != ',')
+                               else if (*tok != ',')
                                        return error("comma expected after ]");
                                else
-                                       tok.u32++;                              // eat the comma
+                                       tok++;                          // eat the comma
 
-                               if ((*tok.u32 >= KW_A0) && (*tok.u32 <= KW_A7))
+                               if ((*tok >= KW_A0) && (*tok <= KW_A7))
                                {
-                                       AnIXREG = ((*tok.u32 & 7) << 12);
+                                       AnIXREG = ((*tok & 7) << 12);
                                        AnEXTEN |= EXT_A;
-                                       tok.u32++;
+                                       tok++;
                                }
-                               else if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_D7))
+                               else if ((*tok >= KW_D0) && (*tok <= KW_D7))
                                {
-                                       AnEXTEN |= ((*tok.u32 & 7) << 12);
+                                       AnEXTEN |= ((*tok & 7) << 12);
                                        AnEXTEN |= EXT_D;
-                                       tok.u32++;
+                                       tok++;
                                }
                                else
                                {
                                        //No index found, suppress it
                                        AnEXTEN |= EXT_IS;
-                                       tok.u32--;                                      // Rewind tok to point to the comma
+                                       tok--;                                  // Rewind tok to point to the comma
                                        goto IS_SUPPRESSEDn;    // https://xkcd.com/292/ - what does he know anyway?
                                }
 
                                // Check for size
                                {
                                        // ([bd,An/PC],Xn.W/L...)
-                                       switch ((int)*tok.u32)
+                                       switch ((int)*tok)
                                        {
                                        // Index reg size: <empty> | .W | .L
                                        case DOTW:
-                                               tok.u32++;
+                                               tok++;
                                                break;
                                        default:
                                                break;
                                        case DOTL:
                                                AnEXTEN |= EXT_L;
-                                               tok.u32++;
+                                               tok++;
                                                break;
                                        case DOTB:
                                                // .B not allowed here...
                                }
 
                                // Check for scale
-                               if (*tok.u32 == '*')                   // ([bd,An/PC],Xn*...)
+                               if (*tok == '*')                   // ([bd,An/PC],Xn*...)
                                {                                  // scale: *1, *2, *4, *8
-                                       tok.u32++;
+                                       tok++;
 
-                                       if (*tok.u32 == SYMBOL)
+                                       if (*tok == SYMBOL)
                                        {
                                                if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                                                        return error("scale factor expression must evaluate");
                                                        goto badmode;
                                                }
                                        }
-                                       else if (*tok.u32++ != CONST || *tok.u32 > 8)
+                                       else if (*tok++ != CONST || *tok > 8)
                                                goto badmode;
                                        else
                                        {
-                                               switch ((int)*tok.u32++)
+                                               switch ((int)*tok++)
                                                {
                                                case 1:
                                                        break;
                                }
 
                                // Check for od
-                               if (*tok.u32 == ')')    // ([bd,An/PC],Xn)
+                               if (*tok == ')')        // ([bd,An/PC],Xn)
                                {
                                        //od is non existant, get out of jail free card
                                        AMn = MEMPOST;          // let's say it's ([bd,An],Xn,od) with od=0 then
                                        AnEXTEN |= EXT_IISPOSN; // No outer displacement
-                                       tok.u32++;
+                                       tok++;
                                        goto AnOK;
                                }
-                               else if (*tok.u32 != ',')
+                               else if (*tok != ',')
                                        return error("comma expected");
                                else
-                                       tok.u32++;      // eat the comma
+                                       tok++;  // eat the comma
 
                                CHECKODn:
                                if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                                        // od=0 so optimise it out
                                        AMn = MEMPOST;           // let's say it's ([bd,An],Xn,od) with od=0 then
                                        AnEXTEN |= EXT_IISPOSN; // No outer displacement
-                                       tok.u32++;
+                                       tok++;
                                        goto AnOK;
                                }
 
                                // ([bd,An/PC],Xn,od)
-                               if (*tok.u32 == DOTL)
+                               if (*tok == DOTL)
                                {
                                        // expr.L
                                        AnEXTEN |= EXT_IISPOSL; // Long outer displacement
                                        AMn = MEMPOST;
-                                       tok.u32++;
+                                       tok++;
 
                                        // Defined, absolute values from $FFFF8000..$00007FFF get
                                        // optimized to absolute short
                                        AMn = MEMPOST;
 
                                        // Is .W forced here?
-                                       if (*tok.u32 == DOTW)
+                                       if (*tok == DOTW)
                                        {
-                                               tok.u32++;
+                                               tok++;
                                        }
                                }
 
                                // Check for final closing parenthesis
-                               if (*tok.u32 == ')')
+                               if (*tok == ')')
                                {
-                                       tok.u32++;
+                                       tok++;
                                        goto AnOK;
                                }
                                else
 IS_SUPPRESSEDn:
 
                                // Check for od
-                               if (*tok.u32 == ')')    // ([bd,An/PC],Xn)
+                               if (*tok == ')')        // ([bd,An/PC],Xn)
                                {
                                        //od is non existant, get out of jail free card
                                        AMn = MEMPOST;          // let's say it's ([bd,An],Xn,od) with od=0 then
                                        AnEXTEN |= EXT_IISNOIN; // No outer displacement
-                                       tok.u32++;
+                                       tok++;
                                        goto AnOK;
                                }
-                               else if (*tok.u32!=',')
+                               else if (*tok!=',')
                                        return error("comma expected");
                                else
-                                       tok.u32++;      // eat the comma
+                                       tok++;  // eat the comma
 
-                if ((*tok.u32 != CONST) && (*tok.u32 != SYMBOL))
+                if ((*tok != CONST) && (*tok != SYMBOL))
                                        goto badmode;
 
                                expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM);
@@ -663,15 +663,15 @@ IS_SUPPRESSEDn:
                                        // od=0 so optimise it out
                                        AMn = MEMPOST;           // let's say it's ([bd,An],Xn,od) with od=0 then
                                        AnEXTEN |= EXT_IISNOIN; // No outer displacement
-                                       tok.u32++;
+                                       tok++;
                                        goto AnOK;
                                }
 
                                // ([bd,An/PC],Xn,od)
-                               if (*tok.u32 == DOTL)
+                               if (*tok == DOTL)
                                {
                                        // expr.L
-                                       tok.u32++;
+                                       tok++;
                                        AMn = MEMPOST;
                                        AnEXTEN |= EXT_IISNOIL; // Long outer displacement with IS suppressed
                                }
@@ -681,11 +681,11 @@ IS_SUPPRESSEDn:
                                        AnEXTEN |= EXT_IISNOIW; // Word outer displacement with IS suppressed
                                        AMn = MEMPRE;
 
-                                       if (*tok.u32 == DOTW)
+                                       if (*tok == DOTW)
                                        {
                                                //AnEXTEN|=EXT_IISNOIW; // Word outer displacement
                                                AMn = MEMPOST;
-                                               tok.u32++;
+                                               tok++;
                                        }
                                        // Defined, absolute values from $FFFF8000..$00007FFF get
                                        // optimized to absolute short
@@ -699,45 +699,45 @@ IS_SUPPRESSEDn:
                                }
 
                                // Check for final closing parenthesis
-                               if (*tok.u32 == ')')
+                               if (*tok == ')')
                                {
-                                       tok.u32++;
+                                       tok++;
                                        goto AnOK;
                                }
                                else
                                        return error("Closing parenthesis missing on addressing mode");
                        }
-                       else if (*tok.u32 == ',')
+                       else if (*tok == ',')
                        {
-                               *tok.u32++;                     // ([bd,An,Xn.size*scale],od)
+                               *tok++;                 // ([bd,An,Xn.size*scale],od)
 
                                //Check for Xn
-                               if ((*tok.u32 >= KW_A0) && (*tok.u32 <= KW_A7))
+                               if ((*tok >= KW_A0) && (*tok <= KW_A7))
                                {
-                                       AnEXTEN |= ((*tok.u32 & 7) << 12);
+                                       AnEXTEN |= ((*tok & 7) << 12);
                                        AnEXTEN |= EXT_A;
-                                       tok.u32++;
+                                       tok++;
                                }
-                               else if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_D7))
+                               else if ((*tok >= KW_D0) && (*tok <= KW_D7))
                                {
-                                       AnEXTEN |= ((*tok.u32 & 7) << 12);
+                                       AnEXTEN |= ((*tok & 7) << 12);
                                        AnEXTEN |= EXT_D;
-                                       tok.u32++;
+                                       tok++;
                                }
 
                                // Check for size
                                {
                                // ([bd,An/PC],Xn.W/L...)
-                               switch ((int)*tok.u32)
+                               switch ((int)*tok)
                                {
                                // Index reg size: <empty> | .W | .L
                                case DOTW:
-                                       tok.u32++;
+                                       tok++;
                                        break;
                                default:
                                        break;
                                case DOTL:
-                                       tok.u32++;
+                                       tok++;
                                        AnEXTEN |= EXT_L;
                                        break;
                                case DOTB:
@@ -747,11 +747,11 @@ IS_SUPPRESSEDn:
                                }
 
                                // Check for scale
-                               if (*tok.u32 == '*')                    // ([bd,An/PC],Xn*...)
+                               if (*tok == '*')                        // ([bd,An/PC],Xn*...)
                                {                           // scale: *1, *2, *4, *8
-                                       tok.u32++;
+                                       tok++;
 
-                                       if (*tok.u32 == SYMBOL)
+                                       if (*tok == SYMBOL)
                                        {
                                                if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                                                        return error("scale factor expression must evaluate");
@@ -772,11 +772,11 @@ IS_SUPPRESSEDn:
                                                        goto badmode;
                                                }
                                        }
-                                       else if (*tok.u32++ != CONST || *tok.u32 > 8)
+                                       else if (*tok++ != CONST || *tok > 8)
                                                goto badmode;
                                        else
                                        {
-                                               switch ((int)*tok.u32++)
+                                               switch ((int)*tok++)
                                                {
                                                case 1:
                                                        break;
@@ -796,24 +796,24 @@ IS_SUPPRESSEDn:
                                }
 
                                //Check for ]
-                               if (*tok.u32 != ']')
+                               if (*tok != ']')
                                        return error("Expected closing bracket ]");
-                               tok.u32++;                      // Eat the bracket
+                               tok++;                  // Eat the bracket
 
                                //Check for od
-                               if (*tok.u32 == ')')    // ([bd,An/PC,Xn]...
+                               if (*tok == ')')        // ([bd,An/PC,Xn]...
                                {
                                        //od is non existant, get out of jail free card
                                        //AnEXVAL=0;            // zero outer displacement
                                        AMn = MEMPRE;                   // let's say it's ([bd,An,Xn],od) with od suppressed then
                                        AnEXTEN |= EXT_IISPREN; // No outer displacement
-                                       tok.u32++;
+                                       tok++;
                                        goto AnOK;
                                }
-                else if (*tok.u32++ != ',')
+                else if (*tok++ != ',')
                                        return error("comma expected after ]");
 
-                               if (*tok.u32 == SYMBOL || *tok.u32 == CONST)
+                               if (*tok == SYMBOL || *tok == CONST)
                                {
                                        if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                                                goto badmode;
@@ -823,17 +823,17 @@ IS_SUPPRESSEDn:
                                                // od=0 so optimise it out
                                                AMn = MEMPRE;            // let's say it's ([bd,An],Xn,od) with od=0 then
                                                AnEXTEN |= EXT_IISPRE0; // No outer displacement
-                                               tok.u32++;
+                                               tok++;
                                                goto AnOK;
                                        }
                                }
 
                                // ([bd,An/PC,Xn],od)
-                               if (*tok.u32 == DOTL)
+                               if (*tok == DOTL)
                                {
                                        // expr.L
                                        AMn = MEMPRE;
-                                       tok.u32++;
+                                       tok++;
                                        AnEXTEN |= EXT_IISPREL;
                                }
                                else
@@ -861,9 +861,9 @@ IS_SUPPRESSEDn:
                                        AnEXTEN |= expr_size; // Assume we have a .w value
 
                                        // Is .W forced here?
-                                       if (*tok.u32 == DOTW)
+                                       if (*tok == DOTW)
                                        {
-                                               tok.u32++;
+                                               tok++;
 
                                                if (expr_size == EXT_IISPREL)
                                                        return error("outer displacement value does not fit in .w size");
@@ -871,9 +871,9 @@ IS_SUPPRESSEDn:
                                }
 
                                // Check for final closing parenthesis
-                               if (*tok.u32 == ')')
+                               if (*tok == ')')
                                {
-                                       tok.u32++;
+                                       tok++;
                                        goto AnOK;
                                }
                                else
@@ -890,46 +890,46 @@ IS_SUPPRESSEDn:
 
                        // It could be that this is really just an expression prefixing a
                        // register as a displacement...
-                       if (*tok.u32 == ')')
+                       if (*tok == ')')
                        {
-                               tok.u32++;
+                               tok++;
                                goto CHK_FOR_DISPn;
                        }
 
                        // Otherwise, check for PC & etc displacements...
-                       if (*tok.u32++ != ',')
+                       if (*tok++ != ',')
                                goto badmode;
 
-                       if ((*tok.u32 >= KW_A0) && (*tok.u32 <= KW_A7))
+                       if ((*tok >= KW_A0) && (*tok <= KW_A7))
                        {
-                               AnREG = *tok.u32 & 7;
-                               tok.u32++;
+                               AnREG = *tok & 7;
+                               tok++;
 
-                               if (*tok.u32 == ',')
+                               if (*tok == ',')
                                {
                                        AMn = AINDEXED;
                                        goto AMn_IXN;
                                }
-                               else if (*tok.u32 == ')')
+                               else if (*tok == ')')
                                {
                                        AMn = ADISP;
-                                       tok.u32++;
+                                       tok++;
                                        goto AnOK;
                                }
                                else
                                        goto badmode;
                        }
-                       else if (*tok.u32 == KW_PC)
+                       else if (*tok == KW_PC)
                        {
-                               if (*++tok.u32 == ',')
+                               if (*++tok == ',')
                                {                             // expr(PC,Xn...)
                                        AMn = PCINDEXED;
                                        goto AMn_IXN;
                                }
-                               else if (*tok.u32 == ')')
+                               else if (*tok == ')')
                                {
                                        AMn = PCDISP;             // expr(PC)
-                                       tok.u32++;
+                                       tok++;
                                        goto AnOK;
                                }
                                else
@@ -939,56 +939,56 @@ IS_SUPPRESSEDn:
                                goto badmode;
                }
        }
-       else if (*tok.u32 == '-' && tok.u32[1] == '(' && ((tok.u32[2] >= KW_A0) && (tok.u32[2] <= KW_A7)) && tok.u32[3] == ')')
+       else if (*tok == '-' && tok[1] == '(' && ((tok[2] >= KW_A0) && (tok[2] <= KW_A7)) && tok[3] == ')')
        {
                AMn = APREDEC;
-               AnREG = tok.u32[2] & 7;
-               tok.u32 += 4;
+               AnREG = tok[2] & 7;
+               tok += 4;
        }
-       else if (*tok.u32 == KW_CCR)
+       else if (*tok == KW_CCR)
        {
                AMn = AM_CCR;
-               tok.u32++;
+               tok++;
                goto AnOK;
        }
-       else if (*tok.u32 == KW_SR)
+       else if (*tok == KW_SR)
        {
                AMn = AM_SR;
-               tok.u32++;
+               tok++;
                goto AnOK;
        }
-       else if (*tok.u32 == KW_USP)
+       else if (*tok == KW_USP)
        {
                AMn = AM_USP;
-               tok.u32++;
+               tok++;
                AnREG = 2;      //Added this for the case of USP used in movec (see CREGlut in mach.c). Hopefully nothing gets broken!
                goto AnOK;
        }
-       else if ((*tok.u32 >= KW_IC40) && (*tok.u32 <= KW_BC40))
+       else if ((*tok >= KW_IC40) && (*tok <= KW_BC40))
        {
                AMn = CACHES;
-               AnREG = *tok.u32++ - KW_IC40;
+               AnREG = *tok++ - KW_IC40;
 
                // After a cache keyword only a comma or EOL is allowed
-               if ((*tok.u32 != ',') && (*tok.u32 != EOL))
+               if ((*tok != ',') && (*tok != EOL))
                        return ERROR;
                goto AnOK;
        }
-       else if ((*tok.u32 >= KW_SFC) && (*tok.u32 <= KW_CRP))
+       else if ((*tok >= KW_SFC) && (*tok <= KW_CRP))
        {
                AMn = CREG;
-               AnREG = (*tok.u32++) - KW_SFC;
+               AnREG = (*tok++) - KW_SFC;
                goto AnOK;
        }
-       else if ((*tok.u32 >= KW_FP0) && (*tok.u32 <= KW_FP7))
+       else if ((*tok >= KW_FP0) && (*tok <= KW_FP7))
        {
                AMn = FREG;
-               AnREG = (*tok.u32++ & 7);
+               AnREG = (*tok++ & 7);
        }
-       else if ((*tok.u32 >= KW_FPIAR) && (*tok.u32 <= KW_FPCR))
+       else if ((*tok >= KW_FPIAR) && (*tok <= KW_FPCR))
        {
                AMn = FPSCR;
-               AnREG = (1 << ((*tok.u32++) - KW_FPIAR + 10));
+               AnREG = (1 << ((*tok++) - KW_FPIAR + 10));
        }
        // expr
        // expr.w
@@ -1003,10 +1003,10 @@ IS_SUPPRESSEDn:
                        return ERROR;
 
 CHK_FOR_DISPn:
-               if (*tok.u32 == DOTW)
+               if (*tok == DOTW)
                {
                        // expr.W
-                       tok.u32++;
+                       tok++;
                        AMn = ABSW;
 
                        if (((AnEXATTR & (TDB | DEFINED)) == DEFINED) && (AnEXVAL < 0x10000))
@@ -1014,7 +1014,7 @@ CHK_FOR_DISPn:
 
                        goto AnOK;
                }
-               else if (*tok.u32 != '(')
+               else if (*tok != '(')
                {
                        // expr[.L]
                        AMn = ABSL;
@@ -1032,37 +1032,37 @@ CHK_FOR_DISPn:
                        }
 
                        // Is .L forced here?
-                       if (*tok.u32 == DOTL)
+                       if (*tok == DOTL)
                        {
-                               tok.u32++;
+                               tok++;
                                AMn = ABSL;
                        }
 
                        goto AnOK;
                }
 
-               tok.u32++;
+               tok++;
 
-               if ((*tok.u32 >= KW_A0) && (*tok.u32 <= KW_A7))
+               if ((*tok >= KW_A0) && (*tok <= KW_A7))
                {
-                       AnREG = *tok.u32++ & 7;
+                       AnREG = *tok++ & 7;
 
-                       if (*tok.u32 == ')')
+                       if (*tok == ')')
                        {
                                AMn = ADISP;
-                               tok.u32++;
+                               tok++;
                                goto AnOK;
                        }
 
                        AMn = AINDEXED;
                        goto AMn_IXN;
                }
-               else if (*tok.u32 == KW_PC)
+               else if (*tok == KW_PC)
                {
-                       if (*++tok.u32 == ')')
+                       if (*++tok == ')')
                        {
                                AMn = PCDISP;
-                               tok.u32++;
+                               tok++;
                                goto AnOK;
                        }
 
index 9b5392668ce2fe6ae4cee86d5a2c6935c5cc005b..2a8c0fdc093eddbdc6bc359f9855413f9bc573bb 100644 (file)
--- a/procln.c
+++ b/procln.c
@@ -176,18 +176,18 @@ DEBUG { printf("Assemble: Found TKEOF flag...\n"); }
        label = NULL;                                                   // No label
        lab_sym = NULL;                                                 // No (exported) label
        equate = NULL;                                                  // No equate
-       tk = tok.u32;                                                           // Save first token in line
+       tk = tok;                                                               // Save first token in line
        pcloc = (uint32_t)sloc;                                 // Set beginning-of-line PC
 
 loop1:                                                                         // Internal line processing loop
 
-       if (*tok.u32 == EOL)                                            // Restart loop if end-of-line
+       if (*tok == EOL)                                                // Restart loop if end-of-line
                goto loop;
 
        // First token MUST be a symbol (Shamus: not sure why :-/)
-       if (*tok.u32 != SYMBOL)
+       if (*tok != SYMBOL)
        {
-               if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_R31))
+               if ((*tok >= KW_D0) && (*tok <= KW_R31))
                        error("cannot use reserved keyword as label name or .equ");
                else
                        error("syntax error; expected symbol");
@@ -195,13 +195,13 @@ loop1:                                                                            // Internal line processing loop
                goto loop;
        }
 
-       j = (int)tok.u32[2];                                            // Skip equates (normal statements)
+       j = (int)tok[2];                                                // Skip equates (normal statements)
 
        if (j == '=' || j == DEQUALS || j == SET || j == REG || j == EQUREG || j == CCDEF)
        {
-               equate = string[tok.u32[1]];
+               equate = string[tok[1]];
                equtyp = j;
-               tok.u32 += 3;
+               tok += 3;
                goto normal;
        }
 
@@ -209,14 +209,14 @@ loop1:                                                                            // Internal line processing loop
        if (j == ':' || j == DCOLON)
        {
 as68label:
-               label = string[tok.u32[1]];                             // Get label name
-               labtyp = tok.u32[2];                                    // Get label type
-               tok.u32 += 3;                                                   // Go to next line token
+               label = string[tok[1]];                         // Get label name
+               labtyp = tok[2];                                        // Get label type
+               tok += 3;                                                       // Go to next line token
 
                // AS68 MODE:
                // Looks like another label follows the previous one, so handle
                // the previous one until there aren't any more
-               if (as68_flag && (*tok.u32 == SYMBOL && tok.u32[2] == ':'))
+               if (as68_flag && (*tok == SYMBOL && tok[2] == ':'))
                {
                        if (HandleLabel(label, labtyp) != 0)
                                goto loop;
@@ -226,17 +226,17 @@ as68label:
        }
 
        // EOL is legal here...
-       if (*tok.u32 == EOL)
+       if (*tok == EOL)
                goto normal;
 
        // First token MUST be a symbol (if we get here, tok didn't advance)
-       if (*tok.u32++ != SYMBOL)
+       if (*tok++ != SYMBOL)
        {
                error("syntax error; expected symbol");
                goto loop;
        }
 
-       opname = p = string[*tok.u32++];
+       opname = p = string[*tok++];
 
        // Check to see if the SYMBOL is a keyword (a mnemonic or directive).
        // On output, `state' will have one of the values:
@@ -269,16 +269,16 @@ as68label:
        // Check for ".b" ".w" ".l" after directive, macro or mnemonic.
        siz = SIZN;
 
-       switch (*tok.u32)
+       switch (*tok)
        {
-       case DOTW: siz = SIZW, tok.u32++; break;
-       case DOTL: siz = SIZL, tok.u32++; break;
-       case DOTB: siz = SIZB, tok.u32++; break;
-       case DOTD: siz = SIZD, tok.u32++; break;
-       case DOTP: siz = SIZP, tok.u32++; break;
-       case DOTQ: siz = SIZQ, tok.u32++; break;
-       case DOTS: siz = SIZS, tok.u32++; break;
-       case DOTX: siz = SIZX, tok.u32++; break;
+       case DOTW: siz = SIZW, tok++; break;
+       case DOTL: siz = SIZL, tok++; break;
+       case DOTB: siz = SIZB, tok++; break;
+       case DOTD: siz = SIZD, tok++; break;
+       case DOTP: siz = SIZP, tok++; break;
+       case DOTQ: siz = SIZQ, tok++; break;
+       case DOTS: siz = SIZS, tok++; break;
+       case DOTX: siz = SIZX, tok++; break;
        }
 
        // Do special directives (500..999) (These must be handled in "real time")
@@ -308,7 +308,7 @@ as68label:
                                goto loop;
                        }
 
-                       if (*tok.u32++ != ',')
+                       if (*tok++ != ',')
                        {
                                error(comma_error);
                                goto loop;
@@ -440,11 +440,11 @@ When checking to see if it's already been equated, issue a warning.
                        }
 
                        // Check for register to equate to
-                       if ((*tok.u32 >= KW_R0) && (*tok.u32 <= KW_R31))
+                       if ((*tok >= KW_R0) && (*tok <= KW_R31))
                        {
 //                             sy->sattre  = EQUATEDREG | RISCSYM;     // Mark as equated register
                                sy->sattre  = EQUATEDREG;       // Mark as equated register
-                               riscreg = (*tok.u32 - KW_R0);
+                               riscreg = (*tok - KW_R0);
 //is there any reason to do this, since we're putting this in svalue?
 //i'm thinking, no. Let's test that out! :-D
 //                             sy->sattre |= (riscreg << 8);           // Store register number
@@ -460,15 +460,15 @@ When checking to see if it's already been equated, issue a warning.
 #endif
 
                                // Check for ",<bank #>" override notation
-                               if ((tok.u32[1] == ',') && (tok.u32[2] == CONST))
+                               if ((tok[1] == ',') && (tok[2] == CONST))
                                {
                                        // Advance token pointer to the constant
-                                       tok.u32 += 3;
+                                       tok += 3;
 
                                        // Anything other than a 0 or a 1 will result in "No Bank"
-                                       if (*(uint64_t *)tok.u32 == 0)
+                                       if (*(uint64_t *)tok == 0)
                                                registerbank = BANK_0;
-                                       else if (*(uint64_t *)tok.u32 == 1)
+                                       else if (*(uint64_t *)tok == 1)
                                                registerbank = BANK_1;
                                }
 
@@ -488,12 +488,12 @@ When checking to see if it's already been equated, issue a warning.
 // & what does this $80000080 constant mean???
 //                             eval = 0x80000080 + (riscreg) + (registerbank << 8);
                                eval = riscreg;
-                               tok.u32++;
+                               tok++;
                        }
                        // Checking for a register symbol
-                       else if (tok.u32[0] == SYMBOL)
+                       else if (tok[0] == SYMBOL)
                        {
-                               sy2 = lookup(string[tok.u32[1]], LABEL, j);
+                               sy2 = lookup(string[tok[1]], LABEL, j);
 
                                // Make sure symbol is a valid equreg
                                if (!sy2 || !(sy2->sattre & EQUATEDREG))
@@ -506,7 +506,7 @@ When checking to see if it's already been equated, issue a warning.
                                        eattr = ABS | DEFINED | GLOBAL; // Copy symbols attributes
                                        sy->sattre = sy2->sattre;
                                        eval = (sy2->svalue & 0xFFFFF0FF);
-                                       tok.u32 += 2;
+                                       tok += 2;
                                }
                        }
                        else
@@ -528,9 +528,9 @@ When checking to see if it's already been equated, issue a warning.
                        sy->sattre |= EQUATEDCC;
                        eattr = ABS | DEFINED | GLOBAL;
 
-                       if (tok.u32[0] == SYMBOL)
+                       if (tok[0] == SYMBOL)
                        {
-                               sy2 = lookup(string[tok.u32[1]], LABEL, j);
+                               sy2 = lookup(string[tok[1]], LABEL, j);
 
                                if (!sy2 || !(sy2->sattre & EQUATEDCC))
                                {
@@ -542,16 +542,16 @@ When checking to see if it's already been equated, issue a warning.
                                        eattr = ABS | DEFINED | GLOBAL;
                                        sy->sattre = sy2->sattre;
                                        eval = sy2->svalue;
-                                       tok.u32 += 2;
+                                       tok += 2;
                                }
                        }
                        else if (expr(exprbuf, &eval, &eattr, &esym) != OK)
                                goto loop;
                }
                //equ a equr
-               else if (*tok.u32 == SYMBOL)
+               else if (*tok == SYMBOL)
                {
-                       sy2 = lookup(string[tok.u32[1]], LABEL, j);
+                       sy2 = lookup(string[tok[1]], LABEL, j);
 
                        if (sy2 && (sy2->sattre & EQUATEDREG))
                        {
@@ -711,7 +711,7 @@ When checking to see if it's already been equated, issue a warning.
        if (amode(1) < 0)                               // Parse 0, 1 or 2 addr modes
                goto loop;
 
-       if (*tok.u32 != EOL)
+       if (*tok != EOL)
                error(extra_stuff);
 
        amsk0 = amsktab[am0];
index a76cb2e19a1438310e38939571546a29cc1569cb..533eca7e41f52f75b70b39c834968bb0a97069ad 100644 (file)
--- a/riscasm.c
+++ b/riscasm.c
@@ -180,7 +180,7 @@ int GetRegister(WORD rattr)
        TOKEN r_expr[EXPRSIZE];         // Expression token list
 
        // Evaluate what's in the global "tok" buffer
-       if (expr((TOKENPTR)r_expr, &eval, &eattr, &esym) != OK)
+       if (expr(r_expr, &eval, &eattr, &esym) != OK)
                return ERROR;
 
        if ((challoc - ch_size) < 4)
@@ -188,7 +188,7 @@ int GetRegister(WORD rattr)
 
        if (!(eattr & DEFINED))
        {
-               AddFixup((WORD)(FU_WORD | rattr), sloc, (TOKENPTR)r_expr);
+               AddFixup((WORD)(FU_WORD | rattr), sloc, r_expr);
                return 0;
        }
 
@@ -298,13 +298,13 @@ int GenerateRISCCode(int state)
                if (parm & SUB32)
                        attrflg |= FU_SUB32;
 
-               if (*tok.u32 != '#')
+               if (*tok != '#')
                        return MalformedOpcode(0x01);
 
-               tok.u32++;
+               tok++;
                riscImmTokenSeen = 1;
 
-               if (expr((TOKENPTR)r_expr, &eval, &eattr, &esym) != OK)
+               if (expr(r_expr, &eval, &eattr, &esym) != OK)
                        return MalformedOpcode(0x02);
 
                if ((challoc - ch_size) < 4)
@@ -312,7 +312,7 @@ int GenerateRISCCode(int state)
 
                if (!(eattr & DEFINED))
                {
-                       AddFixup((WORD)(FU_WORD | attrflg), sloc, (TOKENPTR)r_expr);
+                       AddFixup((WORD)(FU_WORD | attrflg), sloc, r_expr);
                        reg1 = 0;
                }
                else
@@ -336,22 +336,22 @@ int GenerateRISCCode(int state)
 
        // Move Immediate--n,Rn--n in Second Word
        case RI_MOVEI:
-               if (*tok.u32 != '#')
+               if (*tok != '#')
                        return MalformedOpcode(0x03);
 
-               tok.u32++;
+               tok++;
                riscImmTokenSeen = 1;
 
                // Check for equated register after # and return error if so
-               if (*tok.u32 == SYMBOL)
+               if (*tok == SYMBOL)
                {
-                       sy = lookup(string[tok.u32[1]], LABEL, 0);
+                       sy = lookup(string[tok[1]], LABEL, 0);
 
                        if (sy && (sy->sattre & EQUATEDREG))
                                return error("equated register in 1st operand of MOVEI instruction");
                }
 
-               if (expr((TOKENPTR)r_expr, &eval, &eattr, &esym) != OK)
+               if (expr(r_expr, &eval, &eattr, &esym) != OK)
                        return MalformedOpcode(0x04);
 
                if (lastOpcode == RI_JUMP || lastOpcode == RI_JR)
@@ -371,7 +371,7 @@ int GenerateRISCCode(int state)
 
                if (!(eattr & DEFINED))
                {
-                       AddFixup(FU_LONG | FU_MOVEI, sloc + 2, (TOKENPTR)r_expr);
+                       AddFixup(FU_LONG | FU_MOVEI, sloc + 2, r_expr);
                        eval = 0;
                }
                else
@@ -394,11 +394,11 @@ int GenerateRISCCode(int state)
 
        // PC,Rd or Rs,Rd
        case RI_MOVE:
-               if (*tok.u32 == KW_PC)
+               if (*tok == KW_PC)
                {
                        parm = 51;
                        reg1 = 0;
-                       tok.u32++;
+                       tok++;
                }
                else
                {
@@ -417,24 +417,24 @@ int GenerateRISCCode(int state)
                indexed = 0;
                parm = 41;
 
-               if (*tok.u32 != '(')
+               if (*tok != '(')
                        return MalformedOpcode(0x05);
 
-               tok.u32++;
+               tok++;
 
-        if ((*(tok.u32 + 1) == '+') || (*(tok.u32 + 1) == '-')) {
+        if ((*(tok + 1) == '+') || (*(tok + 1) == '-')) {
             // Trying to make indexed call
-            if ((*tok.u32 == KW_R14 || *tok.u32 == KW_R15)) {
-                indexed = (*tok.u32 - KW_R0);
+            if ((*tok == KW_R14 || *tok == KW_R15)) {
+                indexed = (*tok - KW_R0);
             } else {
-                return IllegalIndexedRegister(*tok.u32);
+                return IllegalIndexedRegister(*tok);
             }
         }
 
-               if (*tok.u32 == SYMBOL)
+               if (*tok == SYMBOL)
                {
-//                     sy = lookup((char *)tok.u32[1], LABEL, 0);
-                       sy = lookup(string[tok.u32[1]], LABEL, 0);
+//                     sy = lookup((char *)tok[1], LABEL, 0);
+                       sy = lookup(string[tok[1]], LABEL, 0);
 
                        if (!sy)
                        {
@@ -444,10 +444,10 @@ int GenerateRISCCode(int state)
 
                        if (sy->sattre & EQUATEDREG)
                        {
-                               if ((*(tok.u32 + 2) == '+') || (*(tok.u32 + 2) == '-')) {
+                               if ((*(tok + 2) == '+') || (*(tok + 2) == '-')) {
                                    if ((sy->svalue & 0x1F) == 14 || (sy->svalue & 0x1F) == 15) {
                                        indexed = (sy->svalue & 0x1F);
-                        tok.u32++;
+                        tok++;
                                    } else {
                                        return IllegalIndexedRegisterEqur(sy);
                                    }
@@ -463,20 +463,20 @@ int GenerateRISCCode(int state)
                {
                        reg1 = indexed;
                        indexed = 0;
-                       tok.u32++;
+                       tok++;
 
-                       if (*tok.u32 == '+')
+                       if (*tok == '+')
                        {
                                parm = (WORD)(reg1 - 14 + 58);
-                               tok.u32++;
+                               tok++;
 
-                               if (*tok.u32 >= KW_R0 && *tok.u32 <= KW_R31)
+                               if (*tok >= KW_R0 && *tok <= KW_R31)
                                        indexed = 1;
 
-                               if (*tok.u32 == SYMBOL)
+                               if (*tok == SYMBOL)
                                {
-//                                     sy = lookup((char *)tok.u32[1], LABEL, 0);
-                                       sy = lookup(string[tok.u32[1]], LABEL, 0);
+//                                     sy = lookup((char *)tok[1], LABEL, 0);
+                                       sy = lookup(string[tok[1]], LABEL, 0);
 
                                        if (!sy)
                                        {
@@ -494,7 +494,7 @@ int GenerateRISCCode(int state)
                                }
                                else
                                {
-                                       if (expr((TOKENPTR)r_expr, &eval, &eattr, &esym) != OK)
+                                       if (expr(r_expr, &eval, &eattr, &esym) != OK)
                                                return MalformedOpcode(0x06);
 
                                        if ((challoc - ch_size) < 4)
@@ -529,10 +529,10 @@ int GenerateRISCCode(int state)
                        }
                }
 
-               if (*tok.u32 != ')')
+               if (*tok != ')')
                        return MalformedOpcode(0x07);
 
-               tok.u32++;
+               tok++;
                CHECK_COMMA;
                reg2 = GetRegister(FU_REGTWO);
                at_eol();
@@ -545,18 +545,18 @@ int GenerateRISCCode(int state)
                reg1 = GetRegister(FU_REGONE);
                CHECK_COMMA;
 
-               if (*tok.u32 != '(')
+               if (*tok != '(')
                        return MalformedOpcode(0x08);
 
-               tok.u32++;
+               tok++;
                indexed = 0;
 
-               if ((*tok.u32 == KW_R14 || *tok.u32 == KW_R15) && (*(tok.u32 + 1) != ')'))
-                       indexed = (*tok.u32 - KW_R0);
+               if ((*tok == KW_R14 || *tok == KW_R15) && (*(tok + 1) != ')'))
+                       indexed = (*tok - KW_R0);
 
-               if (*tok.u32 == SYMBOL)
+               if (*tok == SYMBOL)
                {
-                       sy = lookup(string[tok.u32[1]], LABEL, 0);
+                       sy = lookup(string[tok[1]], LABEL, 0);
 
                        if (!sy)
                        {
@@ -567,10 +567,10 @@ int GenerateRISCCode(int state)
                        if (sy->sattre & EQUATEDREG)
                        {
                                if (((sy->svalue & 0x1F) == 14 || (sy->svalue & 0x1F) == 15)
-                                       && (*(tok.u32 + 2) != ')'))
+                                       && (*(tok + 2) != ')'))
                                {
                                        indexed = (sy->svalue & 0x1F);
-                                       tok.u32++;
+                                       tok++;
                                }
                        }
                }
@@ -583,19 +583,19 @@ int GenerateRISCCode(int state)
                {
                        reg2 = indexed;
                        indexed = 0;
-                       tok.u32++;
+                       tok++;
 
-                       if (*tok.u32 == '+')
+                       if (*tok == '+')
                        {
                                parm = (WORD)(reg2 - 14 + 60);
-                               tok.u32++;
+                               tok++;
 
-                               if (*tok.u32 >= KW_R0 && *tok.u32 <= KW_R31)
+                               if (*tok >= KW_R0 && *tok <= KW_R31)
                                        indexed = 1;
 
-                               if (*tok.u32 == SYMBOL)
+                               if (*tok == SYMBOL)
                                {
-                                       sy = lookup(string[tok.u32[1]], LABEL, 0);
+                                       sy = lookup(string[tok[1]], LABEL, 0);
 
                                        if (!sy)
                                        {
@@ -613,7 +613,7 @@ int GenerateRISCCode(int state)
                                }
                                else
                                {
-                                       if (expr((TOKENPTR)r_expr, &eval, &eattr, &esym) != OK)
+                                       if (expr(r_expr, &eval, &eattr, &esym) != OK)
                                                return MalformedOpcode(0x09);
 
                                        if ((challoc - ch_size) < 4)
@@ -621,7 +621,7 @@ int GenerateRISCCode(int state)
 
                                        if (!(eattr & DEFINED))
                                        {
-                                               AddFixup(FU_WORD | FU_REGTWO, sloc, (TOKENPTR)r_expr);
+                                               AddFixup(FU_WORD | FU_REGTWO, sloc, r_expr);
                                                reg2 = 0;
                                        }
                                        else
@@ -653,26 +653,26 @@ int GenerateRISCCode(int state)
                        }
                }
 
-               if (*tok.u32 != ')')
+               if (*tok != ')')
                        return MalformedOpcode(0x0A);
 
-               tok.u32++;
+               tok++;
                at_eol();
                BuildRISCIntructionWord(parm, reg2, reg1);
                break;
 
        // LOADB/LOADP/LOADW (Rn),Rn
        case RI_LOADN:
-               if (*tok.u32 != '(')
+               if (*tok != '(')
                        return MalformedOpcode(0x0B);
 
-               tok.u32++;
+               tok++;
                reg1 = GetRegister(FU_REGONE);
 
-               if (*tok.u32 != ')')
+               if (*tok != ')')
                        return MalformedOpcode(0x0C);
 
-               tok.u32++;
+               tok++;
                CHECK_COMMA;
                reg2 = GetRegister(FU_REGTWO);
                at_eol();
@@ -684,16 +684,16 @@ int GenerateRISCCode(int state)
                reg1 = GetRegister(FU_REGONE);
                CHECK_COMMA;
 
-               if (*tok.u32 != '(')
+               if (*tok != '(')
                        return MalformedOpcode(0x0D);
 
-               tok.u32++;
+               tok++;
                reg2 = GetRegister(FU_REGTWO);
 
-               if (*tok.u32 != ')')
+               if (*tok != ')')
                        return MalformedOpcode(0x0E);
 
-               tok.u32++;
+               tok++;
                at_eol();
                BuildRISCIntructionWord(parm, reg2, reg1);
                break;
@@ -707,7 +707,7 @@ int GenerateRISCCode(int state)
                // the JR or JUMP should default to 0, Jump Always
                commaFound = 0;
 
-               for(t=tok.u32; *t!=EOL; t++)
+               for(t=tok; *t!=EOL; t++)
                {
                        if (*t == ',')
                        {
@@ -718,20 +718,20 @@ int GenerateRISCCode(int state)
 
                if (commaFound)
                {
-                       if (*tok.u32 == CONST)
+                       if (*tok == CONST)
                        {
                                // CC using a constant number
-                               tok.u32++;
-                               uint64_t *tok64 = (uint64_t *)tok.u32;
+                               tok++;
+                               uint64_t *tok64 = (uint64_t *)tok;
                                val = (int)*tok64++;
-                               tok.u32 = (uint32_t *)tok64;
+                               tok = (uint32_t *)tok64;
                                CHECK_COMMA;
                        }
-                       else if (*tok.u32 == SYMBOL)
+                       else if (*tok == SYMBOL)
                        {
                                val = 99;
-//                             strcpy(scratch, (char *)tok.u32[1]);
-                               strcpy(scratch, string[tok.u32[1]]);
+//                             strcpy(scratch, (char *)tok[1]);
+                               strcpy(scratch, string[tok[1]]);
                                strtoupper(scratch);
 
                                for(i=0; i<MAXINTERNCC; i++)
@@ -747,8 +747,8 @@ int GenerateRISCCode(int state)
                                // Standard CC was not found, look for an equated one
                                if (val == 99)
                                {
-//                                     ccsym = lookup((char *)tok.u32[1], LABEL, 0);
-                                       ccsym = lookup(string[tok.u32[1]], LABEL, 0);
+//                                     ccsym = lookup((char *)tok[1], LABEL, 0);
+                                       ccsym = lookup(string[tok[1]], LABEL, 0);
 
                                        if (ccsym && (ccsym->sattre & EQUATEDCC) && !(ccsym->sattre & UNDEF_CC))
                                                val = ccsym->svalue;
@@ -756,10 +756,10 @@ int GenerateRISCCode(int state)
                                                return error("unknown condition code");
                                }
 
-                               tok.u32 += 2;
+                               tok += 2;
                                CHECK_COMMA;
                        }
-                       else if (*tok.u32 == '(')
+                       else if (*tok == '(')
                        {
                                // Set CC to "Jump Always"
                                val = 0;
@@ -780,7 +780,7 @@ int GenerateRISCCode(int state)
                if (type == RI_JR)
                {
                        // JR cc,n
-                       if (expr((TOKENPTR)r_expr, &eval, &eattr, &esym) != OK)
+                       if (expr(r_expr, &eval, &eattr, &esym) != OK)
                                return MalformedOpcode(0x0F);
 
                        if ((challoc - ch_size) < 4)
@@ -788,7 +788,7 @@ int GenerateRISCCode(int state)
 
                        if (!(eattr & DEFINED))
                        {
-                               AddFixup(FU_WORD | FU_JR, sloc, (TOKENPTR)r_expr);
+                               AddFixup(FU_WORD | FU_JR, sloc, r_expr);
                                reg2 = 0;
                        }
                        else
@@ -804,16 +804,16 @@ int GenerateRISCCode(int state)
                else
                {
                        // JUMP cc, (Rn)
-                       if (*tok.u32 != '(')
+                       if (*tok != '(')
                                return MalformedOpcode(0x10);
 
-                       tok.u32++;
+                       tok++;
                        reg2 = GetRegister(FU_REGTWO);
 
-                       if (*tok.u32 != ')')
+                       if (*tok != ')')
                                return MalformedOpcode(0x11);
 
-                       tok.u32++;
+                       tok++;
                        at_eol();
                        BuildRISCIntructionWord(parm, reg2, reg1);
                }
index 5b5c63bb7507597e199b1703e577a10aec614bce..834cf85cc99c089d48768088bddd579ff4e275b3 100644 (file)
--- a/riscasm.h
+++ b/riscasm.h
@@ -34,7 +34,7 @@
 #define GPUONLY     0x4000             // Opcode is for the GPU Only
 #define DSPONLY     0x8000             // Opcode is for the DSP Only
 
-#define CHECK_COMMA  if(*tok.u32++ != ',') { error(comma_error); return(ERROR); }
+#define CHECK_COMMA  if(*tok++ != ',') { error(comma_error); return(ERROR); }
 
 // Opcode Specific Data
 struct opcoderecord {
diff --git a/rmac.h b/rmac.h
index bba14d71b29bda02c06117f8e2831d10fe010877..0519dc2f71bdedfc3d7b56d9ffcf281917728487 100644 (file)
--- a/rmac.h
+++ b/rmac.h
@@ -177,24 +177,18 @@ XEX,                              // COM/EXE/XEX/whatever a8 object format
 // Assembler token
 #define TOKEN  uint32_t
 
-// Token pointer type is a union because we have 64-bit sized tokens now :-P
-#define TOKENPTR union _tokenptr
-TOKENPTR
-{
-       uint32_t * u32;
-       uint64_t * u64;
-};
-
 // Pointer type that can point to (almost) anything
 #define PTR union _ptr
 PTR
 {
-       uint8_t *  cp;                          // Char
-       uint16_t * wp;                          // WORD
-       uint32_t * lp;                          // LONG
-       uint32_t   lw;                          // LONG
-       SYM **     sy;                          // SYM
-       TOKENPTR   tk;                          // TOKEN
+       uint8_t *  cp;                          // Char pointer
+       uint16_t * wp;                          // WORD pointer
+       uint32_t * lp;                          // LONG pointer
+       uint32_t * u32;                         // 32-bit pointer
+       uint64_t * u64;                         // 64-bit pointer
+       uint32_t   lw;                          // LONG (for some reason)
+       SYM **     sy;                          // SYM pointer
+       TOKEN *    tk;                          // TOKEN pointer
 };
 
 // Symbol spaces
diff --git a/sect.c b/sect.c
index 3b2ed99dfb24590ed620dc4b183f4d7382db6a52..3e127656916367fa1f7573336582f7a951f9501e 100644 (file)
--- a/sect.c
+++ b/sect.c
@@ -282,7 +282,7 @@ int chcheck(uint32_t amt)
 //
 // Arrange for a fixup on a location
 //
-int AddFixup(uint16_t attr, uint32_t loc, TOKENPTR fexpr)
+int AddFixup(uint16_t attr, uint32_t loc, TOKEN * fexpr)
 {
        uint32_t i = MIN_FIXUP_MEM;
        uint16_t len = 0;
@@ -291,7 +291,7 @@ int AddFixup(uint16_t attr, uint32_t loc, TOKENPTR fexpr)
 
        // Compute length of expression (could be faster); determine if it's the
        // single-symbol case; no expression if it's just a mark. (? is this true?)
-       if ((*fexpr.u32 == SYMBOL) && (fexpr.u32[2] == ENDEXPR))
+       if ((*fexpr == SYMBOL) && (fexpr[2] == ENDEXPR))
        {
                // Just a single symbol, possibly followed by a DWORD
                i += sizeof(SYM *);
@@ -306,12 +306,12 @@ int AddFixup(uint16_t attr, uint32_t loc, TOKENPTR fexpr)
                attr |= FU_EXPR;
 
                // Count the # of tokens in the expression
-               for(len=0; fexpr.u32[len]!=ENDEXPR; len++)
+               for(len=0; fexpr[len]!=ENDEXPR; len++)
                {
                        // Add one to len for 2X tokens, two for 3X tokens
-                       if (fexpr.u32[len] == SYMBOL)
+                       if (fexpr[len] == SYMBOL)
                                len++;
-                       else if (fexpr.u32[len] == CONST)
+                       else if (fexpr[len] == CONST)
                                len += 2;
                }
 
@@ -362,11 +362,11 @@ int AddFixup(uint16_t attr, uint32_t loc, TOKENPTR fexpr)
                *fchptr.wp++ = len;
 
                while (len--)
-                       *fchptr.lp++ = *fexpr.u32++;
+                       *fchptr.lp++ = *fexpr++;
        }
        else
        {
-               *fchptr.sy++ = symbolPtr[fexpr.u32[1]];
+               *fchptr.sy++ = symbolPtr[fexpr[1]];
 
                // SCPCD: Correct bit mask for attr (else other FU_xxx will match)
                // NYAN !
@@ -464,7 +464,7 @@ int ResolveFixups(int sno)
                        {
                                i = *fup.wp++;
 
-                               if (evexpr((TOKENPTR)fup.tk, &eval, &eattr, &esym) != OK)
+                               if (evexpr(fup.tk, &eval, &eattr, &esym) != OK)
                                {
                                        fup.lp += i;
                                        continue;
diff --git a/sect.h b/sect.h
index 4cd5db4bb1d51b60a55f7fd9ee2fd299754754a5..073d625d62779f2b6db06e1af063cbdff909026b 100644 (file)
--- a/sect.h
+++ b/sect.h
@@ -79,7 +79,9 @@
 
 #else
 
-#error Please implement a non-byte swapped D_extend!
+WARNING(Please implement a non-byte swapped D_extend!)
+//stopgap for now, until this can be implemented proppa-ly :-P
+#define D_extend(w) {chcheck(12); chptr+=12; sloc+=12; ch_size+=12; if(orgactive) orgaddr +=12;}
 
 #endif
 // Fill n bytes with zeroes
@@ -213,7 +215,7 @@ void SwitchSection(int);
 void SaveSection(void);
 int fixtest(int, uint32_t);
 int chcheck(uint32_t);
-int AddFixup(uint16_t, uint32_t, TOKENPTR);
+int AddFixup(uint16_t, uint32_t, TOKEN *);
 int ResolveAllFixups(void);
 
 #endif // __SECT_H__
diff --git a/token.c b/token.c
index 2e6c4563df05517a7e8cbb3e4bfcdb565d9fda4e..e1be9b5b8871ea3cde208b29b8e9a072f43ec64d 100644 (file)
--- a/token.c
+++ b/token.c
@@ -7,6 +7,8 @@
 //
 
 #include "token.h"
+
+#include <errno.h>
 #include "direct.h"
 #include "error.h"
 #include "macro.h"
@@ -32,7 +34,7 @@ char irbuf[LNSIZ];                    // Text for .rept block line
 char lnbuf[LNSIZ];                     // Text of current line
 WORD filecount;                                // Unique file number counter
 WORD cfileno;                          // Current file number
-TOKENPTR tok;                          // Ptr to current token
+TOKEN * tok;                           // Ptr to current token
 TOKEN * etok;                          // Ptr past last token in tokbuf[]
 TOKEN tokeol[1] = {EOL};       // Bailout end-of-line token
 char * string[TOKBUFSIZE*2];// Token buffer string pointer storage
@@ -305,7 +307,7 @@ INOBJ * a_inobj(int typ)
        // Install INOBJ on top of input stack
        inobj->in_ifent = ifent;                                // Record .if context on entry
        inobj->in_type = (WORD)typ;
-       inobj->in_otok = tok.u32;
+       inobj->in_otok = tok;
        inobj->in_etok = etok;
        inobj->in_link = cur_inobj;
        cur_inobj = inobj;
@@ -791,7 +793,7 @@ int fpop(void)
        if (numUnmatched > 0)
                warn("missing %d .endif(s)", numUnmatched);
 
-       tok.u32 = inobj->in_otok;       // Restore tok and otok
+       tok = inobj->in_otok;   // Restore tok and otok
        etok = inobj->in_etok;
 
        switch (inobj->in_type)
@@ -946,7 +948,7 @@ int TokenizeLine(void)
 {
        uint8_t * ln = NULL;            // Ptr to current position in line
        uint8_t * p;                            // Random character ptr
-       TOKENPTR tk;                            // Token-deposit ptr
+       PTR tk;                                         // Token-deposit ptr
        int state = 0;                          // State for keyword detector
        int j = 0;                                      // Var for keyword detector
        uint8_t c;                                      // Random char
@@ -1047,7 +1049,7 @@ DEBUG { printf("TokenizeLine: Calling fpop() from SRC_IFILE...\n"); }
                strcpy(lnbuf, ln);
 
        // General housekeeping
-       tok.u32 = tokeol;               // Set "tok" to EOL in case of error
+       tok = tokeol;           // Set "tok" to EOL in case of error
        tk.u32 = etok;                  // Reset token ptr
        stuffnull = 0;                  // Don't stuff nulls
        totlines++;                             // Bump total #lines assembled
@@ -1606,7 +1608,6 @@ dostring:
                                        }
 #else
                                        // Here we parse the whole floating point number
-#include <errno.h>
                                        char * numEnd;
                                        errno = 0;
                                        double f = strtod(numStart, &numEnd);
@@ -1639,7 +1640,7 @@ dostring:
        // Terminate line of tokens and return "success."
 
 goteol:
-       tok.u32 = etok;                                                 // Set tok to beginning of line
+       tok = etok;                                                     // Set tok to beginning of line
 
        if (stuffnull)                                                  // Terminate last SYMBOL
                *nullspot = EOS;
@@ -1668,11 +1669,11 @@ goteol:
 int d_goto(WORD unused)
 {
        // Setup for the search
-       if (*tok.u32 != SYMBOL)
+       if (*tok != SYMBOL)
                return error("missing label");
 
-       char * sym = string[tok.u32[1]];
-       tok.u32 += 2;
+       char * sym = string[tok[1]];
+       tok += 2;
 
        if (cur_inobj->in_type != SRC_IMACRO)
                return error("goto not in macro");
@@ -1804,8 +1805,9 @@ void DumpTokenBuffer(void)
                        printf("[COLON]");
                else if (*t == CONST)
                {
-                       TOKENPTR tp = (TOKENPTR)(t + 1);
-                       printf("[CONST: $%lX]", (uint64_t)(*tp.u64));
+                       PTR tp;
+                       tp.u32 = t + 1;
+                       printf("[CONST: $%lX]", *tp.u64);
                        t += 2;
                }
                else if (*t == ACONST)
diff --git a/token.h b/token.h
index 3867f7e8a59560863980345d90b92e64e2908205..28c1f8be562682dd65218efa9ebff4d655541dd3 100644 (file)
--- a/token.h
+++ b/token.h
@@ -153,7 +153,7 @@ extern int lnsave;
 extern uint16_t curlineno;
 extern char * curfname;
 extern WORD cfileno;
-extern TOKENPTR tok;
+extern TOKEN * tok;
 extern char lnbuf[];
 extern char lntag;
 extern char tolowertab[];
index 5859366ba8cd33aabfb9c22dad2391476ca718d3..067302f4a6f76aac6f33c60d7d7cafc15867d040 100644 (file)
--- a/version.h
+++ b/version.h
@@ -15,7 +15,7 @@
 
 #define MAJOR   1              // Major version number
 #define MINOR   10             // Minor version number
-#define PATCH   0              // Patch release number
+#define PATCH   1              // Patch release number
 
 #endif // __VERSION_H__