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;
 
        //
        zpreq = 0;
 
-       switch (tok.u32[0])
+       switch (tok[0])
        {
        case EOL:
                amode = A65_IMPL;
                break;
 
        case '#':
        {
        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;
 
                        if (expr(exprbuf, &eval, &eattr, NULL) < 0)
                                return;
@@ -277,9 +277,9 @@ void m6502cg(int op)
                        amode = A65_IMMEDH;
                        break;
                }
                        amode = A65_IMMEDH;
                        break;
                }
-               else if (*tok.u32 == '<')
+               else if (*tok == '<')
                {
                {
-                       tok.u32++;
+                       tok++;
 
                        if (expr(exprbuf, &eval, &eattr, NULL) < 0)
                                return;
 
                        if (expr(exprbuf, &eval, &eattr, NULL) < 0)
                                return;
@@ -295,43 +295,43 @@ void m6502cg(int op)
                break;
 
        case '(':
                break;
 
        case '(':
-               tok.u32++;
+               tok++;
 
                if (expr(exprbuf, &eval, &eattr, NULL) < 0)
                        return;
 
 
                if (expr(exprbuf, &eval, &eattr, NULL) < 0)
                        return;
 
-               if (*tok.u32 == ')')
+               if (*tok == ')')
                {
                        // (foo) or (foo),y
                {
                        // (foo) or (foo),y
-                       if (*++tok.u32 == ',')
+                       if (*++tok == ',')
                        {
                                // (foo),y
                        {
                                // (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;
 
                                        goto badmode;
 
-                               tok.u32 += 2;
+                               tok += 2;
                                amode = A65_INDY;
                        }
                        else
                                amode = A65_IND;
                }
                                amode = A65_INDY;
                        }
                        else
                                amode = A65_IND;
                }
-               else if (*tok.u32 == ',')
+               else if (*tok == ',')
                {
                        // (foo,x)
                {
                        // (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;
 
                                goto badmode;
 
-                       tok.u32 += 2;
+                       tok += 2;
 
 
-                       if (*tok.u32++ != ')')
+                       if (*tok++ != ')')
                                goto badmode;
 
                        amode = A65_INDX;
                                goto badmode;
 
                        amode = A65_INDX;
@@ -342,17 +342,17 @@ void m6502cg(int op)
                break;
 
        case '@':
                break;
 
        case '@':
-               tok.u32++;
+               tok++;
 
                if (expr(exprbuf, &eval, &eattr, NULL) < 0)
                        return;
 
 
                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()
                                goto badmode;
 
                        i = (*p | 0x20);        // Sleazo tolower()
@@ -364,10 +364,10 @@ void m6502cg(int op)
                        else
                                goto badmode;
 
                        else
                                goto badmode;
 
-                       tok.u32 += 3;   // Past SYMBOL <string> ')' EOL
+                       tok += 3;       // Past SYMBOL <string> ')' EOL
                        zpreq = 1;              // Request zeropage optimization
                }
                        zpreq = 1;              // Request zeropage optimization
                }
-               else if (*tok.u32 == EOL)
+               else if (*tok == EOL)
                        amode = A65_IND;
                else
                        goto badmode;
                        amode = A65_IND;
                else
                        goto badmode;
@@ -380,7 +380,7 @@ void m6502cg(int op)
                //   x,foo
                //   y,foo
                //
                //   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
                // 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;
 
 
                zpreq = 1;
 
-               if (*tok.u32 == EOL)
+               if (*tok == EOL)
                        amode = A65_ABS;
                        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;
 
                                goto badmode;
 
-                       tok.u32 += 2;
+                       tok += 2;
 
                        //
                        // Check for X or Y index register;
 
                        //
                        // Check for X or Y index register;
@@ -583,7 +583,7 @@ badmode:
        if (sloc > 0x10000L)
                fatal("6502 code pointer > 64K");
 
        if (sloc > 0x10000L)
                fatal("6502 code pointer > 64K");
 
-       if (*tok.u32 != EOL)
+       if (*tok != EOL)
                error(extra_stuff);
 }
 
                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
        bf0esym = NULL;
 
        // If at EOL, then no addr modes at all
-       if (*tok.u32 == EOL)
+       if (*tok == EOL)
                return 0;
 
        // Parse first addressing mode
                return 0;
 
        // Parse first addressing mode
@@ -106,17 +106,17 @@ int amode(int acount)
        #define AnREG     a0reg
        #define AnIXREG   a0ixreg
        #define AnIXSIZ   a0ixsiz
        #define AnREG     a0reg
        #define AnIXREG   a0ixreg
        #define AnIXSIZ   a0ixsiz
-       #define AnEXPR    (TOKENPTR)a0expr
+       #define AnEXPR    a0expr
        #define AnEXVAL   a0exval
        #define AnEXATTR  a0exattr
        #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 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
        #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
 
        // it's a bitfield instruction--check the parameters inside the {} block
        // for validity
-       if (*tok.u32 == '{')
+       if (*tok == '{')
                if (check030bf() == ERROR)
                        return ERROR;
 
                if (check030bf() == ERROR)
                        return ERROR;
 
-       if ((acount == 0) || (*tok.u32 != ','))
+       if ((acount == 0) || (*tok != ','))
                return 1;
 
        // Eat the comma
                return 1;
 
        // Eat the comma
-       tok.u32++;
+       tok++;
 
        // Parse second addressing mode
        #define AnOK      a1ok
 
        // 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 AnREG     a1reg
        #define AnIXREG   a1ixreg
        #define AnIXSIZ   a1ixsiz
-       #define AnEXPR    (TOKENPTR)a1expr
+       #define AnEXPR    a1expr
        #define AnEXVAL   a1exval
        #define AnEXATTR  a1exattr
        #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 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
        #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
 
        // 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 (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 :)
        {
                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;
                }
                        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 :");
 
                        mulmode = 1 << 10;
                }
                else
                        return error("a data or FPU register must follow a :");
 
-               *tok.u32++;
+               *tok++;
        }
        else
        {
        }
        else
        {
@@ -236,17 +236,17 @@ int reglist(WORD * a_rmask)
 
        for(;;)
        {
 
        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;
 
                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");
 
                        else
                                return error("register list syntax");
 
@@ -261,10 +261,10 @@ int reglist(WORD * a_rmask)
                while (cnt-- >= 0)
                        rmask |= msktab[r++];
 
                while (cnt-- >= 0)
                        rmask |= msktab[r++];
 
-               if (*tok.u32 != '/')
+               if (*tok != '/')
                        break;
 
                        break;
 
-               tok.u32++;
+               tok++;
        }
 
        *a_rmask = rmask;
        }
 
        *a_rmask = rmask;
@@ -288,17 +288,17 @@ int fpu_reglist_left(WORD * a_rmask)
 
        for(;;)
        {
 
        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;
 
                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");
 
                        else
                                return error("register list syntax");
 
@@ -315,10 +315,10 @@ int fpu_reglist_left(WORD * a_rmask)
                while (cnt-- >= 0)
                        rmask |= msktab_minus[r++];
 
                while (cnt-- >= 0)
                        rmask |= msktab_minus[r++];
 
-               if (*tok.u32 != '/')
+               if (*tok != '/')
                        break;
 
                        break;
 
-               tok.u32++;
+               tok++;
        }
 
        *a_rmask = rmask;
        }
 
        *a_rmask = rmask;
@@ -339,17 +339,17 @@ int fpu_reglist_right(WORD * a_rmask)
 
        for(;;)
        {
 
        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;
 
                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");
 
                        else
                                return error("register list syntax");
 
@@ -364,10 +364,10 @@ int fpu_reglist_right(WORD * a_rmask)
                while (cnt-- >= 0)
                        rmask |= msktab_plus[r++];
 
                while (cnt-- >= 0)
                        rmask |= msktab_plus[r++];
 
-               if (*tok.u32 != '/')
+               if (*tok != '/')
                        break;
 
                        break;
 
-               tok.u32++;
+               tok++;
        }
 
        *a_rmask = rmask;
        }
 
        *a_rmask = rmask;
@@ -384,24 +384,22 @@ int fpu_reglist_right(WORD * a_rmask)
 //
 int check030bf(void)
 {
 //
 int check030bf(void)
 {
+       PTR tp;
        CHECK00;
        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);
 
                // 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))
                        return ERROR;
 
                if (!(bf0exattr & DEFINED))
@@ -412,42 +410,39 @@ int check030bf(void)
                // Do=0, offset=immediate - shift it to place
                bfparam1 = (0 << 11);
        }
                // 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);
        {
                // 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
        }
        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}"
        {
                // It is ok to have }, EOL here - it might be "fmove fpn,<ea> {dx}"
-               tok.u32++;
+               tok++;
                return OK;
        }
 
                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);
 
                // 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;
                        return ERROR;
 
                bfval2 = (int)bf0exval;
@@ -458,17 +453,17 @@ int check030bf(void)
                // Do=0, offset=immediate - shift it to place
                bfparam2 = (0 << 5);
        }
                // 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
        {
                // Do=1, offset=data register - shift it to place
-               bfval2 = ((*(int *)tok.u32 - 128));
+               bfval2 = (*(int *)tok - 128);
                bfparam2 = (1 << 5);
                bfparam2 = (1 << 5);
-               tok.u32++;
+               tok++;
        }
        else
                return ERROR;
 
        }
        else
                return ERROR;
 
-       tok.u32++;      // Eat the '}'
+       tok++;  // Eat the '}'
 
        return OK;
 }
 
        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 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
 //
 //
 // 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:
                        {
                        case SYMBOL:
-                               printf("'%s' ", symbolPtr[*tp]->sname);
-                               tp++;
+                               printf("'%s' ", symbolPtr[*tokenptr]->sname);
+                               tokenptr++;
                                break;
                        case CONST:
                                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:
                                break;
                        case ACONST:
-                               printf("ACONST=($%X,$%X) ", *tp, tp[1]);
-                               tp += 2;
+                               printf("ACONST=($%X,$%X) ", *tokenptr, tokenptr[1]);
+                               tokenptr += 2;
                                break;
                        default:
                                break;
                        default:
-                               printf("%c ", (char)tp[-1]);
+                               printf("%c ", (char)tokenptr[-1]);
                                break;
                        }
                }
        }
 
                                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);
                        {
                                uint16_t esiz = *p.wp++;
                                printf("(%d long) ", (int)esiz);
-                               p.tk.u32 = printexpr(p.tk.u32);
+                               p.tk = printexpr(p.tk);
                        }
                        else
                        {
                        }
                        else
                        {
@@ -219,16 +221,16 @@ int mdump(char * start, LONG count, int flg, LONG base)
                switch (flg & 3)
                {
                case 0:
                switch (flg & 3)
                {
                case 0:
-                       printf("%02X ", start[i] & 0xff);
+                       printf("%02X ", start[i] & 0xFF);
                        i++;
                        break;
                case 1:
                        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:
                        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:
                        i += 4;
                        break;
                case 3:
@@ -281,8 +283,9 @@ int dumptok(TOKEN * tk)
                switch ((int)*tk++)
                {
                case CONST:                                        // CONST <value>
                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++]);
                        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("[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)
                        t += 2;
                }
                else if (*t == ACONST)
index d535c4842b40870f794dfeb424e28093b96c6dea..155fa3fb360821bc945bb0e8e3a79ffd6fe973a9 100644 (file)
--- a/direct.c
+++ b/direct.c
 #define DEF_KW
 #include "kwtab.h"
 
 #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
 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)
 {
 //
 int d_error(char *str)
 {
-       if (*tok.u32 == EOL)
+       if (*tok == EOL)
                return error("error directive encountered - aborting assembling");
        else
        {
                return error("error directive encountered - aborting assembling");
        else
        {
-               switch(*tok.u32)
+               switch(*tok)
                {
                case STRING:
                {
                case STRING:
-                       return error(string[tok.u32[1]]);
+                       return error(string[tok[1]]);
                        break;
                default:
                        return error("error directive encountered--aborting assembly");
                        break;
                default:
                        return error("error directive encountered--aborting assembly");
@@ -197,14 +195,14 @@ int d_error(char *str)
 //
 int d_warn(char *str)
 {
 //
 int d_warn(char *str)
 {
-       if (*tok.u32 == EOL)
+       if (*tok == EOL)
                return warn("WARNING WARNING WARNING");
        else
        {
                return warn("WARNING WARNING WARNING");
        else
        {
-               switch(*tok.u32)
+               switch(*tok)
                {
                case STRING:
                {
                case STRING:
-                       return warn(string[tok.u32[1]]);
+                       return warn(string[tok[1]]);
                        break;
                default:
                        return warn("WARNING WARNING WARNING");
                        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];
 
        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:
                {
                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));
 
                        printf("%s", prntstr);
 
                        if (list_fd)
                                unused = write(list_fd, prntstr, (LONG)strlen(prntstr));
 
-                       tok.u32 += 2;
+                       tok += 2;
                        break;
                case '/':
                        formatting = 1;
 
                        break;
                case '/':
                        formatting = 1;
 
-                       if (tok.u32[1] != SYMBOL)
+                       if (tok[1] != SYMBOL)
                                goto token_err;
 
                                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])
                        {
 
                        switch(prntstr[0])
                        {
@@ -310,13 +308,13 @@ int d_print(void)
                                return ERROR;
                        }
 
                                return ERROR;
                        }
 
-                       tok.u32 += 3;
+                       tok += 3;
                        break;
                case ',':
                        break;
                case ',':
-                       tok.u32++;
+                       tok++;
                        break;
                default:
                        break;
                default:
-                       if (expr((TOKENPTR)r_expr, &eval, &eattr, &esym) != OK)
+                       if (expr(r_expr, &eval, &eattr, &esym) != OK)
                                goto token_err;
                        else
                        {
                                goto token_err;
                        else
                        {
@@ -370,13 +368,13 @@ int d_ccundef(void)
                return ERROR;
        }
 
                return ERROR;
        }
 
-       if (*tok.u32 != SYMBOL)
+       if (*tok != SYMBOL)
        {
                error("syntax error; expected symbol");
                return ERROR;
        }
 
        {
                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))
 
        // 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");
 
        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)
        {
                // Skip preceeding or seperating commas (if any)
-               if (*tok.u32 == ',')
-                       tok.u32++;
+               if (*tok == ',')
+                       tok++;
 
                // Check we are dealing with a symbol
 
                // 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
                        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))
                {
 
                if (regname && (regname->sattre & EQUATEDREG))
                {
@@ -424,7 +422,7 @@ int d_equrundef(void)
                }
 
                // Skip over symbol token and address
                }
 
                // Skip over symbol token and address
-               tok.u32 += 2;
+               tok += 2;
        }
 
        return 0;
        }
 
        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)
        {
        // 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;
        }
 
                return ERROR;
        }
 
-       if (*tok.u32 != STRING)
+       if (*tok != STRING)
        {
                error("syntax error; string missing");
                return ERROR;
        {
                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.
        // 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++)
                {
        {
                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);
 
                        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;
                }
 
 
                        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:
        }
 
 allright:
@@ -493,14 +491,14 @@ allright:
        pos = lseek(fd, 0L, SEEK_SET);
        chcheck(size);
 
        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)
        {
 
        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;
        }
 
                return ERROR;
        }
 
@@ -718,21 +716,21 @@ int symlist(int(* func)())
 
        for(;;)
        {
 
        for(;;)
        {
-               if (*tok.u32 != SYMBOL)
+               if (*tok != SYMBOL)
                        return error(em);
 
                        return error(em);
 
-               if ((*func)(string[tok.u32[1]]) != OK)
+               if ((*func)(string[tok[1]]) != OK)
                        break;
 
                        break;
 
-               tok.u32 += 2;
+               tok += 2;
 
 
-               if (*tok.u32 == EOL)
+               if (*tok == EOL)
                        break;
 
                        break;
 
-               if (*tok.u32 != ',')
+               if (*tok != ',')
                        return error(em);
 
                        return error(em);
 
-               tok.u32++;
+               tok++;
        }
 
        return 0;
        }
 
        return 0;
@@ -750,11 +748,11 @@ int d_include(void)
        char buf[128];
        char buf1[128];
 
        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];
        }
                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
 
        // 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
                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;
 
        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");
        {
                if (!(eattr & DEFINED))
                        return error("forward or undefined .assert");
@@ -810,7 +808,7 @@ int d_assert(void)
                if (!eval)
                        return error("assert failure");
 
                if (!eval)
                        return error("assert failure");
 
-               if (*tok.u32 != ',')
+               if (*tok != ',')
                        break;
        }
 
                        break;
        }
 
@@ -860,7 +858,7 @@ int d_prgflags(void)
 {
        uint64_t eval;
 
 {
        uint64_t eval;
 
-       if (*tok.u32 == EOL)
+       if (*tok == EOL)
                return error("PRGFLAGS requires value");
        else if (abs_expr(&eval) == OK)
        {
                return error("PRGFLAGS requires value");
        else if (abs_expr(&eval) == OK)
        {
@@ -886,7 +884,7 @@ int d_abs(void)
 
        SaveSection();
 
 
        SaveSection();
 
-       if (*tok.u32 == EOL)
+       if (*tok == EOL)
                eval = 0;
        else if (abs_expr(&eval) != OK)
                return 0;
                eval = 0;
        else if (abs_expr(&eval) != OK)
                return 0;
@@ -992,7 +990,7 @@ int d_ds(WORD siz)
        }
        else
        {
        }
        else
        {
-               dep_block(eval, siz, 0, (WORD)(DEFINED | ABS), (TOKENPTR){NULL});
+               dep_block(eval, siz, 0, (WORD)(DEFINED | ABS), NULL);
        }
 
        at_eol();
        }
 
        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");
 
                || (rdsp && (orgaddr >= 0xF1B000) && (orgaddr <= 0xF1CFFFF))))
                warn("depositing LONGs on a non-long address in local RAM");
 
-       for(;; tok.u32++)
+       for(;; tok++)
        {
                // dc.b 'string' [,] ...
        {
                // 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 ((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);
                        }
                                        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
                                        D_byte(strtoa8[*p]);
                        }
                        else
@@ -1048,16 +1046,16 @@ int d_dc(WORD siz)
                                error("String format not supported... yet");
                        }
 
                                error("String format not supported... yet");
                        }
 
-                       tok.u32 += 2;
+                       tok += 2;
                        goto comma;
                }
 
                int movei = 0; // MOVEI flag for dc.i
 
                        goto comma;
                }
 
                int movei = 0; // MOVEI flag for dc.i
 
-               if (*tok.u32 == DOTI)
+               if (*tok == DOTI)
                {
                        movei = 1;
                {
                        movei = 1;
-                       tok.u32++;
+                       tok++;
                        siz = SIZL;
                }
 
                        siz = SIZL;
                }
 
@@ -1215,7 +1213,7 @@ int d_dc(WORD siz)
                }
 
 comma:
                }
 
 comma:
-               if (*tok.u32 != ',')
+               if (*tok != ',')
                        break;
        }
 
                        break;
        }
 
@@ -1240,7 +1238,7 @@ int d_dcb(WORD siz)
        if (abs_expr(&evalc) != OK)
                return 0;
 
        if (abs_expr(&evalc) != OK)
                return 0;
 
-       if (*tok.u32++ != ',')
+       if (*tok++ != ',')
                return error("missing comma");
 
        if (expr(exprbuf, &eval, &eattr, NULL) < 0)
                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)
        for(;;)
        {
                // Get repeat count (defaults to 1)
-               if (*tok.u32 == '#')
+               if (*tok == '#')
                {
                {
-                       tok.u32++;
+                       tok++;
 
                        if (abs_expr(&count) != OK)
                                return 0;
 
 
                        if (abs_expr(&count) != OK)
                                return 0;
 
-                       if (*tok.u32++ != ',')
+                       if (*tok++ != ',')
                                return error(comma_error);
                }
                else
                                return error(comma_error);
                }
                else
@@ -1297,25 +1295,25 @@ int d_init(WORD def_siz)
                if (expr(exprbuf, &eval, &eattr, NULL) < 0)
                        return 0;
 
                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;
                {                                 // 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);
 
                        break;
                }
 
                dep_block((uint32_t)count, siz, (uint32_t)eval, eattr, exprbuf);
 
-               switch (*tok.u32)
+               switch (*tok)
                {
                case EOL:
                        return 0;
                case ',':
                {
                case EOL:
                        return 0;
                case ',':
-                       tok.u32++;
+                       tok++;
                        continue;
                default:
                        return error(comma_error);
                        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
 //
 //
 // 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;
 {
        WORD tdb;
        WORD defined;
@@ -1421,11 +1419,11 @@ int d_comm(void)
        if (m6502)
                return error(in_6502mode);
 
        if (m6502)
                return error(in_6502mode);
 
-       if (*tok.u32 != SYMBOL)
+       if (*tok != SYMBOL)
                return error("missing 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);
 
        if (*p == '.')                                                  // Cannot .comm a local symbol
                return error(locgl_error);
@@ -1440,7 +1438,7 @@ int d_comm(void)
 
        sym->sattr = GLOBAL | COMMON | BSS;
 
 
        sym->sattr = GLOBAL | COMMON | BSS;
 
-       if (*tok.u32++ != ',')
+       if (*tok++ != ',')
                return error(comma_error);
 
        if (abs_expr(&eval) != OK)                              // Parse size of common region
                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 (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 (abs_expr(&eval) != OK)
                        return 0;
 
                // Eat the comma, if it's there
-               if (*tok.u32 == ',')
-                       tok.u32++;
+               if (*tok == ',')
+                       tok++;
        }
 
        for(;;)
        {
        }
 
        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);
 
                        // 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;
 
                        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.
 
                        // 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:
                        {
                        case DOTL:
                                eval += 2;
                        case DOTB:
                        case DOTW:
-                               tok.u32++;
+                               tok++;
                        }
 
                        eval += 2;
                }
                        }
 
                        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;
                {
                        if (reglist(&rlist) < 0)
                                return 0;
@@ -1716,7 +1714,7 @@ int d_cargs(void)
                }
                else
                {
                }
                else
                {
-                       switch ((int)*tok.u32)
+                       switch ((int)*tok)
                        {
                        case KW_USP:
                        case KW_SSP:
                        {
                        case KW_USP:
                        case KW_SSP:
@@ -1726,7 +1724,7 @@ int d_cargs(void)
                        case KW_SR:
                        case KW_CCR:
                                eval += 2;
                        case KW_SR:
                        case KW_CCR:
                                eval += 2;
-                               tok.u32++;
+                               tok++;
                                break;
                        case EOL:
                                return 0;
                                break;
                        case EOL:
                                return 0;
@@ -1736,8 +1734,8 @@ int d_cargs(void)
                }
 
                // Eat commas in between each argument, if they exist
                }
 
                // 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 (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 (abs_expr(&eval) != OK)
                        return 0;
 
                // Eat the comma, if it's there
-               if (*tok.u32 == ',')
-                       tok.u32++;
+               if (*tok == ',')
+                       tok++;
        }
 
        for(;;)
        {
        }
 
        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);
 
                        // 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);
 
                        // 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.
 
                        // 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:
                        {
                        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.
                        // 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;
                        {
                        case DOTL:
                                eval += 4;
@@ -1833,9 +1831,9 @@ int d_cstruct(void)
                                return error("Symbol missing dot suffix in .cstruct construct");
                        }
 
                                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;
                {
                        if (reglist(&rlist) < 0)
                                return 0;
@@ -1848,7 +1846,7 @@ int d_cstruct(void)
                }
                else
                {
                }
                else
                {
-                       switch ((int)*tok.u32)
+                       switch ((int)*tok)
                        {
                        case KW_USP:
                        case KW_SSP:
                        {
                        case KW_USP:
                        case KW_SSP:
@@ -1858,7 +1856,7 @@ int d_cstruct(void)
                        case KW_SR:
                        case KW_CCR:
                                eval += 2;
                        case KW_SR:
                        case KW_CCR:
                                eval += 2;
-                               tok.u32++;
+                               tok++;
                                break;
                        case EOL:
                                return 0;
                                break;
                        case EOL:
                                return 0;
@@ -1868,8 +1866,8 @@ int d_cstruct(void)
                }
 
                // Eat commas in between each argument, if they exist
                }
 
                // 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)
 {
 //
 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);
 
                        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
 #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);
 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(*)());
 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 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 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 aNbdexval a0bexval
 #define aNbdexattr a0bexattr
 #include "eagen0.c"
 #define amN       am1
 #define aNexattr  a1exattr
 #define aNexval   a1exval
 #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 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"
 #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)
 {
 //
 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 = ");
                printf("Token = ");
-               DumpToken(*tok.u32);
+               DumpToken(*tok);
                printf("\n");
                DumpTokenBuffer();
        }
                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
 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)
 {
 //
 int expr0(void)
 {
-       TOKEN t;
-
        if (expr1() != OK)
                return ERROR;
 
        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;
 
                if (expr1() != OK)
                        return ERROR;
@@ -127,18 +125,17 @@ int expr0(void)
 //
 int expr1(void)
 {
 //
 int expr1(void)
 {
-       int class;
        TOKEN t;
        SYM * sy;
        char * p, * p2;
        WORD w;
        int j;
 
        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;
 
                if (expr2() != OK)
                        return ERROR;
@@ -153,7 +150,7 @@ int expr1(void)
        }
        else if (class == SUNARY)
        {
        }
        else if (class == SUNARY)
        {
-               switch (*tok.u32++)
+               switch (*tok++)
                {
                case CR_ABSCOUNT:
                        *evalTokenBuffer.u32++ = CONST;
                {
                case CR_ABSCOUNT:
                        *evalTokenBuffer.u32++ = CONST;
@@ -168,10 +165,10 @@ int expr1(void)
                        *evalTokenBuffer.u64++ = dos_date();
                        break;
                case CR_MACDEF: // ^^macdef <macro-name>
                        *evalTokenBuffer.u64++ = dos_date();
                        break;
                case CR_MACDEF: // ^^macdef <macro-name>
-                       if (*tok.u32++ != SYMBOL)
+                       if (*tok++ != SYMBOL)
                                return error(missym_error);
 
                                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;
                        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:
                case CR_REFERENCED:
                        w = REFERENCED;
 getsym:
-                       if (*tok.u32++ != SYMBOL)
+                       if (*tok++ != SYMBOL)
                                return error(missym_error);
 
                                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:
                        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);
 
                                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);
 
                                return error(comma_error);
 
-                       if (*tok.u32 != SYMBOL && *tok.u32 != STRING)
+                       if (*tok != SYMBOL && *tok != STRING)
                                return error(str_error);
 
                                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;
 
                        w = (WORD)(!strcmp(p, p2));
                        *evalTokenBuffer.u32++ = CONST;
@@ -228,19 +225,19 @@ int expr2(void)
        char * p;
        SYM * sy;
        int j;
        char * p;
        SYM * sy;
        int j;
+       PTR ptk;
 
 
-       switch (*tok.u32++)
+       switch (*tok++)
        {
        case CONST:
        {
        case CONST:
-               *evalTokenBuffer.u32++ = CONST;
-               *evalTokenBuffer.u64++ = *tok.u64++;
-               break;
        case FCONST:
        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:
                break;
        case SYMBOL:
-               p = string[*tok.u32++];
+               p = string[*tok++];
                j = (*p == '.' ? curenv : 0);
                sy = lookup(p, LABEL, j);
 
                j = (*p == '.' ? curenv : 0);
                sy = lookup(p, LABEL, j);
 
@@ -264,13 +261,13 @@ int expr2(void)
                break;
        case STRING:
                *evalTokenBuffer.u32++ = CONST;
                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;
 
                break;
        case '(':
                if (expr0() != OK)
                        return ERROR;
 
-               if (*tok.u32++ != ')')
+               if (*tok++ != ')')
                        return error("missing closing parenthesis ')'");
 
                break;
                        return error("missing closing parenthesis ')'");
 
                break;
@@ -278,9 +275,23 @@ int expr2(void)
                if (expr0() != OK)
                        return ERROR;
 
                if (expr0() != OK)
                        return ERROR;
 
-               if (*tok.u32++ != ']')
+               if (*tok++ != ']')
                        return error("missing closing bracket ']'");
 
                        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
                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;
                *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");
                break;
        default:
                return error("bad expression");
@@ -320,7 +317,7 @@ int expr2(void)
 //
 // Recursive-descent expression analyzer (with some simple speed hacks)
 //
 //
 // 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
 {
        // 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;
        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.)
 
                                                        // 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...!
        // 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
        //         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:
                )
 #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
        {
 #endif
        {
-               if (*tok.u32 >= KW_R0 && *tok.u32 <= KW_R31)
+               if (*tok >= KW_R0 && *tok <= KW_R31)
                {
                        *evalTokenBuffer.u32++ = CONST;
                {
                        *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;
 
                        *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;
                        *a_attr = ABS | DEFINED;
+                       tok = ptk.u32;
 
                        if (a_esym != NULL)
                                *a_esym = NULL;
 
 
                        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
                }
 // 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;
 
                        *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
                }
 #endif
-               else if (*tok.u32 == '*')
+               else if (*tok == '*')
                {
                        *evalTokenBuffer.u32++ = CONST;
 
                {
                        *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;
 
                        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
                        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;
 
                                && 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...
                }
                else
                {
                        // Unknown type here... Alert the user!,
                        error("undefined RISC register in expression");
                        // Prevent spurious error reporting...
-                       tok.u32++;
+                       tok++;
                        return ERROR;
                }
 
                        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.
 //
 // 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;
 {
        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;
        WORD * sattr = evattr;
        SYM * esym = NULL;                                              // No external symbol involved
        WORD sym_seg = 0;
+       PTR tk;
+       tk.u32 = _tk;
 
        while (*tk.u32 != ENDEXPR)
        {
 
        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);
 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__
 
 #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;
 
        int ejectok;
        ejectok = 1;
 
-       if (*tok.u32 == '-')
+       if (*tok == '-')
        {
                ejectok = 0;
        {
                ejectok = 0;
-               ++tok.u32;
+               ++tok;
        }
 
        }
 
-       if (*tok.u32 != STRING)
+       if (*tok != STRING)
                return error("missing 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))
 
        // Always eject on pages 2+
        if (ejectok && (subflag || pageno > 1))
@@ -462,12 +462,12 @@ int d_subttl(void)
 //
 int d_title(void)
 {
 //
 int d_title(void)
 {
-       if (*tok.u32 != STRING)
+       if (*tok != STRING)
                return error("missing 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)
        {
 
        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
        {
        }
        else
        {
-               AddFixup(FU_QUICK, sloc, (TOKENPTR)a0expr);
+               AddFixup(FU_QUICK, sloc, a0expr);
                D_word(inst);
        }
 
                D_word(inst);
        }
 
@@ -723,7 +723,7 @@ int m_dbra(WORD inst, WORD siz)
        }
        else
        {
        }
        else
        {
-               AddFixup(FU_WORD | FU_PCREL | FU_ISBRA, sloc, (TOKENPTR)a1expr);
+               AddFixup(FU_WORD | FU_PCREL | FU_ISBRA, sloc, a1expr);
                D_word(0);
        }
 
                D_word(0);
        }
 
@@ -914,7 +914,7 @@ int m_moveq(WORD inst, WORD siz)
        // Arrange for future fixup
        if (!(a0exattr & DEFINED))
        {
        // 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)
                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
        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;
        }
                D_word(inst);
                return OK;
        }
@@ -1038,7 +1038,7 @@ int m_br(WORD inst, WORD siz)
        {
                // .W
                D_word(inst);
        {
                // .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);
        }
 
                D_word(0);
        }
 
@@ -1063,7 +1063,7 @@ int m_addq(WORD inst, WORD siz)
        }
        else
        {
        }
        else
        {
-               AddFixup(FU_QUICK, sloc, (TOKENPTR)a0expr);
+               AddFixup(FU_QUICK, sloc, a0expr);
                D_word(inst);
        }
 
                D_word(inst);
        }
 
@@ -1114,10 +1114,10 @@ int m_movem(WORD inst, WORD siz)
        if (siz == SIZL)
                inst |= 0x0040;
 
        if (siz == SIZL)
                inst |= 0x0040;
 
-       if (*tok.u32 == '#')
+       if (*tok == '#')
        {
                // Handle #<expr>, ea
        {
                // Handle #<expr>, ea
-               tok.u32++;
+               tok++;
 
                if (abs_expr(&eval) != OK)
                        return OK;
 
                if (abs_expr(&eval) != OK)
                        return OK;
@@ -1129,14 +1129,14 @@ int m_movem(WORD inst, WORD siz)
                goto immed1;
        }
 
                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:
        {
                // <rlist>, ea
                if (reglist(&rmask) < 0)
                        return OK;
 
 immed1:
-               if (*tok.u32++ != ',')
+               if (*tok++ != ',')
                        return error("missing comma");
 
                if (amode(0) < 0)
                        return error("missing comma");
 
                if (amode(0) < 0)
@@ -1165,16 +1165,16 @@ immed1:
 
                inst |= 0x0400 | am0 | a0reg;
 
 
                inst |= 0x0400 | am0 | a0reg;
 
-               if (*tok.u32++ != ',')
+               if (*tok++ != ',')
                        return error("missing comma");
 
                        return error("missing comma");
 
-               if (*tok.u32 == EOL)
+               if (*tok == EOL)
                        return error("missing register list");
 
                        return error("missing register list");
 
-               if (*tok.u32 == '#')
+               if (*tok == '#')
                {
                        // ea, #<expr>
                {
                        // ea, #<expr>
-                       tok.u32++;
+                       tok++;
 
                        if (abs_expr(&eval) != OK)
                                return OK;
 
                        if (abs_expr(&eval) != OK)
                                return OK;
@@ -1236,7 +1236,7 @@ int m_br30(WORD inst, WORD siz)
        else
        {
                // .L
        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;
        }
                D_word(inst);
                return OK;
        }
@@ -1378,21 +1378,21 @@ int m_cas(WORD inst, WORD siz)
        }
 
        // Dc
        }
 
        // Dc
-       if ((*tok.u32 < KW_D0) && (*tok.u32 > KW_D7))
+       if ((*tok < KW_D0) && (*tok > KW_D7))
                return error("CAS accepts only data registers");
 
                return error("CAS accepts only data registers");
 
-       inst2 = (*tok.u32++) & 7;
+       inst2 = (*tok++) & 7;
 
 
-       if (*tok.u32++ != ',')
+       if (*tok++ != ',')
                return error("missing comma");
 
        // Du
                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");
 
                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
                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 (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
                return error("extra (unexpected) text found");
 
        // Reject invalud ea modes
@@ -1448,71 +1448,71 @@ int m_cas2(WORD inst, WORD siz)
        }
 
        // Dc1
        }
 
        // 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");
 
                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
                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");
 
                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
                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");
 
                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
                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");
 
                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
                return error("missing comma");
 
        // Rn1
-       if (*tok.u32++ != '(')
+       if (*tok++ != '(')
                return error("missing (");
                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");
 
        else
                return error("CAS accepts either data or address registers for Rn1:Rn2 pair");
 
-       if (*tok.u32++ != ')')
+       if (*tok++ != ')')
                return error("missing (");
 
                return error("missing (");
 
-       if (*tok.u32++ != ':')
+       if (*tok++ != ':')
                return error("missing colon");
 
        // Rn2
                return error("missing colon");
 
        // Rn2
-       if (*tok.u32++ != '(')
+       if (*tok++ != '(')
                return error("missing (");
                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");
 
        else
                return error("CAS accepts either data or address registers for Rn1:Rn2 pair");
 
-       if (*tok.u32++ != ')')
+       if (*tok++ != ')')
                return error("missing (");
 
                return error("missing (");
 
-       if (*tok.u32 != EOL)
+       if (*tok != EOL)
                return error("extra (unexpected) text found");
 
        D_word(inst);
                return error("extra (unexpected) text found");
 
        D_word(inst);
@@ -1652,7 +1652,7 @@ int m_cpbr(WORD inst, WORD siz)
        {
                // .L
                D_word(inst);
        {
                // .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;
        }
                D_long(0);
                return OK;
        }
@@ -1660,7 +1660,7 @@ int m_cpbr(WORD inst, WORD siz)
        {
                // .W
                D_word(inst);
        {
                // .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);
        }
 
                D_word(0);
        }
 
@@ -1700,7 +1700,7 @@ int m_cpdbr(WORD inst, WORD siz)
        }
        else
        {
        }
        else
        {
-               AddFixup(FU_WORD | FU_PCREL | FU_ISBRA, sloc, (TOKENPTR)a1expr);
+               AddFixup(FU_WORD | FU_PCREL | FU_ISBRA, sloc, a1expr);
                D_word(0);
        }
 
                D_word(0);
        }
 
@@ -2129,51 +2129,51 @@ int m_pack(WORD inst, WORD siz)
        if (siz != SIZN)
                return error("bad size suffix");
 
        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
        {
                // 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");
 
                        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);
 
                        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)
        }
                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
        {
                // -(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);
 
                        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);
 
                        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);
 
                        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");
 
                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);
 
                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)
                return ERROR;
 
        if ((a0exattr & DEFINED) == 0)
@@ -2182,7 +2182,7 @@ int m_pack(WORD inst, WORD siz)
        if (a0exval + 0x8000 > 0x10000)
                return error("");
 
        if (a0exval + 0x8000 > 0x10000)
                return error("");
 
-       if (*tok.u32 != EOL)
+       if (*tok != EOL)
                return error(extra_stuff);
 
        D_word((a0exval & 0xFFFF));
                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;
 
                // PFLUSH FC, MASK, < ea >
                WORD mask, fc;
 
-               switch ((int)*tok.u32)
+               switch ((int)*tok)
                {
                case '#':
                {
                case '#':
-                       tok.u32++;
+                       tok++;
 
 
-                       if (*tok.u32 != CONST && *tok.u32 != SYMBOL)
+                       if (*tok != CONST && *tok != SYMBOL)
                                return error("function code should be an expression");
 
                                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)
                                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:
                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;
                        break;
                case KW_SFC:
                        fc = 0;
-                       tok.u32++;
+                       tok++;
                        break;
                case KW_DFC:
                        fc = 1;
                        break;
                case KW_DFC:
                        fc = 1;
-                       tok.u32++;
+                       tok++;
                        break;
                default:
                        return error(syntax_error);
                }
 
                        break;
                default:
                        return error(syntax_error);
                }
 
-               if (*tok.u32++ != ',')
+               if (*tok++ != ',')
                        return error("comma exptected");
 
                        return error("comma exptected");
 
-               if (*tok.u32++ != '#')
+               if (*tok++ != '#')
                        return error("mask should be an immediate value");
 
                        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");
 
                        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)
                        return ERROR;
 
                if ((a0exattr & DEFINED) == 0)
@@ -2524,7 +2524,7 @@ int m_pflush(WORD inst, WORD siz)
 
                mask = (uint16_t)a0exval << 5;
 
 
                mask = (uint16_t)a0exval << 5;
 
-               if (*tok.u32 == EOL)
+               if (*tok == EOL)
                {
                        // PFLUSH FC, MASK
                        D_word(inst);
                {
                        // PFLUSH FC, MASK
                        D_word(inst);
@@ -2532,15 +2532,15 @@ int m_pflush(WORD inst, WORD siz)
                        D_word(inst);
                        return OK;
                }
                        D_word(inst);
                        return OK;
                }
-               else if (*tok.u32 == ',')
+               else if (*tok == ',')
                {
                        // PFLUSH FC, MASK, < ea >
                {
                        // PFLUSH FC, MASK, < ea >
-                       tok.u32++;
+                       tok++;
 
                        if (amode(0) == ERROR)
                                return ERROR;
 
 
                        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)
                                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)
        {
                // PFLUSH(An)
                // PFLUSHN(An)
-               if (*tok.u32 != '(' && tok.u32[2] != ')')
+               if (*tok != '(' && tok[2] != ')')
                        return error(syntax_error);
 
                        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)
                        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;
 
                        // 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);
                        return error(extra_stuff);
 
                D_word(inst);
@@ -3111,7 +3111,7 @@ int m_fdbcc(WORD inst, WORD siz)
        }
        else
        {
        }
        else
        {
-               AddFixup(FU_WORD | FU_PCREL | FU_ISBRA, sloc, (TOKENPTR)a1expr);
+               AddFixup(FU_WORD | FU_PCREL | FU_ISBRA, sloc, a1expr);
                D_word(0);
        }
 
                D_word(0);
        }
 
@@ -3469,13 +3469,13 @@ int m_fmovem(WORD inst, WORD siz)
 
        if (siz == SIZX || siz==SIZN)
        {
 
        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;
 
                {
                        //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)
                                return error("missing comma");
 
                        if (amode(0) < 0)
@@ -3492,12 +3492,12 @@ int m_fmovem(WORD inst, WORD siz)
                        ea0gen(siz);
                        return OK;
                }
                        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
                {
                        // 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)
                                return error("missing comma");
 
                        if (amode(0) < 0)
@@ -3522,10 +3522,10 @@ int m_fmovem(WORD inst, WORD siz)
 
                        inst |= am0 | a0reg;
 
 
                        inst |= am0 | a0reg;
 
-                       if (*tok.u32++ != ',')
+                       if (*tok++ != ',')
                                return error("missing comma");
 
                                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)
                        {
                                //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
                        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);
                                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)
        {
        }
        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:
                {
                        //fmovem.l <rlist>,ea
                        regmask = (1 << 15) | (1 << 13);
 fmovem_loop_1:
-                       if (*tok.u32 == KW_FPCR)
+                       if (*tok == KW_FPCR)
                        {
                                regmask |= (1 << 12);
                        {
                                regmask |= (1 << 12);
-                               tok.u32++;
+                               tok++;
                                goto fmovem_loop_1;
                        }
 
                                goto fmovem_loop_1;
                        }
 
-                       if (*tok.u32 == KW_FPSR)
+                       if (*tok == KW_FPSR)
                        {
                                regmask |= (1 << 11);
                        {
                                regmask |= (1 << 11);
-                               tok.u32++;
+                               tok++;
                                goto fmovem_loop_1;
                        }
 
                                goto fmovem_loop_1;
                        }
 
-                       if (*tok.u32 == KW_FPIAR)
+                       if (*tok == KW_FPIAR)
                        {
                                regmask |= (1 << 10);
                        {
                                regmask |= (1 << 10);
-                               tok.u32++;
+                               tok++;
                                goto fmovem_loop_1;
                        }
 
                                goto fmovem_loop_1;
                        }
 
-                       if ((*tok.u32 == '/') || (*tok.u32 == '-'))
+                       if ((*tok == '/') || (*tok == '-'))
                        {
                        {
-                               tok.u32++;
+                               tok++;
                                goto fmovem_loop_1;
                        }
 
                                goto fmovem_loop_1;
                        }
 
-                       if (*tok.u32++ != ',')
+                       if (*tok++ != ',')
                                return error("missing comma");
 
                        if (amode(0) < 0)
                                return error("missing comma");
 
                        if (amode(0) < 0)
@@ -3602,40 +3602,40 @@ fmovem_loop_1:
 
                        inst |= am0 | a0reg;
 
 
                        inst |= am0 | a0reg;
 
-                       if (*tok.u32++ != ',')
+                       if (*tok++ != ',')
                                return error("missing comma");
 
                        regmask = (1 << 15) | (0 << 13);
 
 fmovem_loop_2:
                                return error("missing comma");
 
                        regmask = (1 << 15) | (0 << 13);
 
 fmovem_loop_2:
-                       if (*tok.u32 == KW_FPCR)
+                       if (*tok == KW_FPCR)
                        {
                                regmask |= (1 << 12);
                        {
                                regmask |= (1 << 12);
-                               tok.u32++;
+                               tok++;
                                goto fmovem_loop_2;
                        }
 
                                goto fmovem_loop_2;
                        }
 
-                       if (*tok.u32 == KW_FPSR)
+                       if (*tok == KW_FPSR)
                        {
                                regmask |= (1 << 11);
                        {
                                regmask |= (1 << 11);
-                               tok.u32++;
+                               tok++;
                                goto fmovem_loop_2;
                        }
 
                                goto fmovem_loop_2;
                        }
 
-                       if (*tok.u32 == KW_FPIAR)
+                       if (*tok == KW_FPIAR)
                        {
                                regmask |= (1 << 10);
                        {
                                regmask |= (1 << 10);
-                               tok.u32++;
+                               tok++;
                                goto fmovem_loop_2;
                        }
 
                                goto fmovem_loop_2;
                        }
 
-                       if ((*tok.u32 == '/') || (*tok.u32 == '-'))
+                       if ((*tok == '/') || (*tok == '-'))
                        {
                        {
-                               tok.u32++;
+                               tok++;
                                goto fmovem_loop_2;
                        }
 
                                goto fmovem_loop_2;
                        }
 
-                       if (*tok.u32 != EOL)
+                       if (*tok != EOL)
                                return error("extra (unexpected) text found");
 
                        inst |= am0 | a0reg;
                                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.
        // 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");
 
                return error("missing symbol");
 
-       char * name = string[*tok.u32++];
+       char * name = string[*tok++];
 
        if (lookup(name, MACRO, 0) != NULL)
                return error("duplicate macro definition");
 
        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
        curmac->sattr = (WORD)(macnum++);
 
        // Parse and define formal arguments in symbol table
-       if (*tok.u32 != EOL)
+       if (*tok != EOL)
        {
                argno = 0;
                symlist(defmac2);
        {
                argno = 0;
                symlist(defmac2);
@@ -307,19 +307,19 @@ static int LNCatch(int (* lnfunc)(), char * dirlist)
                char * p = NULL;
                int k = -1;
 
                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
                {
                        // 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
                        }
                        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)
 {
 //
 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;
 
        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)
 
        // 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;
 
        {
                // 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++)
                        {
                                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 *p64 = (uint64_t *)p;
-                               uint64_t *tok64 = (uint64_t *)tok.u32;
+                               uint64_t *tok64 = (uint64_t *)tok;
                                *p64++ = *tok64++;
                                *p64++ = *tok64++;
-                               tok.u32 = (TOKEN *)tok64;
+                               tok = (TOKEN *)tok64;
                                p = (uint32_t *)p64;
                        }
                                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++;
                        }
                                *p++ = stringNum++;
                        }
-                       else if (*tok.u32 == ',')
+                       else if (*tok == ',')
                        {
                                // Comma delimiter was found, so set up for next argument
                                *p++ = EOL;
                        {
                                // Comma delimiter was found, so set up for next argument
                                *p++ = EOL;
-                               tok.u32++;
+                               tok++;
                                stringNum = 0;
                                nargs++;
                                p = imacro->argument[nargs].token;
                        }
                        else
                        {
                                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
        // Dn
        // An
        // # expression
-       if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_D7))
+       if ((*tok >= KW_D0) && (*tok <= KW_D7))
        {
                AMn = DREG;
        {
                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;
        {
                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;
 
                if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                        return ERROR;
        // ([bd,An,Xn],od)
        // ([bd,PC],Xn,od)
        // ([bd,PC,Xn],od)
        // ([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 = APOSTINC;
                                }
                                else
                        AMn = AINDEXED;
                        goto AMn_IX0;            // Handle ",Xn[.siz][*scale])"
                }
                        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
                {
                        //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
                                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;
                        }
                                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
                        {
                                // 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
                        {
                                // 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
                        {
                                // ([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
                                AnEXTEN |= EXT_BS;          // Base register suppressed
                                AnEXTEN |= EXT_BDSIZE0;
                                AnREG = 6 << 3;         // stuff 110 to mode field
-                               tok.u32++;
+                               tok++;
                                goto CHECKODn;
                        }
                        else
                                goto CHECKODn;
                        }
                        else
                                return error("(Dn) error");
                        }
 
                                return error("(Dn) error");
                        }
 
-                       if (*tok.u32 == '*')
+                       if (*tok == '*')
                        {                        // scale: *1, *2, *4, *8
                        {                        // 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");
                                {
                                        if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                                                return error("scale factor expression must evaluate");
                                                goto badmode;
                                        }
                                }
                                                goto badmode;
                                        }
                                }
-                               else if (*tok.u32++ != CONST || *tok.u32 > 8)
+                               else if (*tok++ != CONST || *tok > 8)
                                        goto badmode;
                                else
                                {
                                        goto badmode;
                                else
                                {
-                                       switch ((int)*tok.u32++)
+                                       switch ((int)*tok++)
                                        {
                                        case 1:
                                                break;
                                        {
                                        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
                                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;
                        }
                                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...
                                // 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
                                return error("unhandled so far");
                }
-               else if (*tok.u32 == KW_PC)
+               else if (*tok == KW_PC)
                {                            // (PC,Xn[.siz][*scale])
                {                            // (PC,Xn[.siz][*scale])
-                       tok.u32++;
+                       tok++;
                        AMn = PCINDEXED;
 
                        // Common index handler; enter here with 'tok' pointing at the
                        AMn = PCINDEXED;
 
                        // Common index handler; enter here with 'tok' pointing at the
 
                        AMn_IXN:                 // Handle any indexed (tok -> a comma)
 
 
                        AMn_IXN:                 // Handle any indexed (tok -> a comma)
 
-                       if (*tok.u32++ != ',')
+                       if (*tok++ != ',')
                                goto badmode;
 
                                goto badmode;
 
-                       if (*tok.u32 < KW_D0 || *tok.u32 > KW_A7)
+                       if (*tok < KW_D0 || *tok > KW_A7)
                                goto badmode;
 
                                goto badmode;
 
-                       AnIXREG = *tok.u32++ & 15;
+                       AnIXREG = *tok++ & 15;
 
 
-                       switch ((int)*tok.u32)
+                       switch ((int)*tok)
                        {                        // Index reg size: <empty> | .W | .L
                        case DOTW:
                        {                        // Index reg size: <empty> | .W | .L
                        case DOTW:
-                               tok.u32++;
+                               tok++;
                        default:
                                AnIXSIZ = 0;
                                break;
                        case DOTL:
                                AnIXSIZ = 0x0800;
                        default:
                                AnIXSIZ = 0;
                                break;
                        case DOTL:
                                AnIXSIZ = 0x0800;
-                               tok.u32++;
+                               tok++;
                                break;
                        case DOTB:               // .B not allowed here...
                                goto badmode;
                        }
 
                                break;
                        case DOTB:               // .B not allowed here...
                                goto badmode;
                        }
 
-                       if (*tok.u32 == '*')
+                       if (*tok == '*')
                        {                        // scale: *1, *2, *4, *8
                        {                        // 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");
                                {
                                        if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                                                return error("scale factor expression must evaluate");
                                                goto badmode;
                                        }
                                }
                                                goto badmode;
                                        }
                                }
-                               else if (*tok.u32++ != CONST || *tok.u32 > 8)
+                               else if (*tok++ != CONST || *tok > 8)
                                        goto badmode;
                                else
                                {
                                        goto badmode;
                                else
                                {
-                                       switch ((int)*tok.u32++)
+                                       switch ((int)*tok++)
                                        {
                                        case 1:
                                                break;
                                        {
                                        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
                        {
                                // 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;
                        }
                                AnEXTEN |= EXT_BDSIZE0;     // Base displacement null - suppressed
                                goto CHECKODn;
                        }
-                       if (*tok.u32++ != ')')         // final ")"
+                       if (*tok++ != ')')         // final ")"
                                goto badmode;
 
                        goto AnOK;
                }
                                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
                        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;
                        }
                        {
                                AnEXTEN |= EXT_BDSIZE0;
                        }
                                        // bd=0 so let's optimise it out
                                        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;
                                {                                               // ([bd.l,...
                                                AnEXTEN |= EXT_BDSIZEL;
-                                               tok.u32++;
+                                               tok++;
                                }
                                else
                                {                                               // ([bd[.w],... or ([bd,...
                                        // Is .W forced here?
                                }
                                else
                                {                                               // ([bd[.w],... or ([bd,...
                                        // Is .W forced here?
-                                       if (*tok.u32 == DOTW)
+                                       if (*tok == DOTW)
                                        {
                                                AnEXTEN |= EXT_BDSIZEW;
                                        {
                                                AnEXTEN |= EXT_BDSIZEW;
-                                               tok.u32++;
+                                               tok++;
                                        }
                                        else
                                        {
                                        }
                                        else
                                        {
                                        }
                                }
 
                                        }
                                }
 
-                               if (*tok.u32 == ',')
-                                       tok.u32++;
+                               if (*tok == ',')
+                                       tok++;
                                //else
                                //      return error("Comma expected after base displacement");
                        }
                                //else
                                //      return error("Comma expected after base displacement");
                        }
                        // Check for address register or PC, suppress base register
                        // otherwise
 
                        // 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
                        {                                       // ([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,...
                        {                                       // ([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);
                        {
                                // ([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
                                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...)
 
                                // Check for size
                                {
                                // ([bd,An/PC],Xn.W/L...)
-                               switch ((int)*tok.u32)
+                               switch ((int)*tok)
                                {
                                // Index reg size: <empty> | .W | .L
                                case DOTW:
                                {
                                // Index reg size: <empty> | .W | .L
                                case DOTW:
-                                       tok.u32++;
+                                       tok++;
                                        break;
                                default:
                                        break;
                                case DOTL:
                                        AnEXTEN |= EXT_L;
                                        break;
                                default:
                                        break;
                                case DOTL:
                                        AnEXTEN |= EXT_L;
-                                       tok.u32++;
+                                       tok++;
                                        break;
                                case DOTB:
                                        // .B not allowed here...
                                        break;
                                case DOTB:
                                        // .B not allowed here...
                                }
 
                                // Check for scale
                                }
 
                                // Check for scale
-                               if (*tok.u32 == '*')                    // ([bd,An/PC],Xn*...)
+                               if (*tok == '*')                        // ([bd,An/PC],Xn*...)
                                {                           // scale: *1, *2, *4, *8
                                {                           // 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");
                                        {
                                                if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                                                        return error("scale factor expression must evaluate");
                                                        goto badmode;
                                }
                                        }
                                                        goto badmode;
                                }
                                        }
-                                       else if (*tok.u32++ != CONST || *tok.u32 > 8)
+                                       else if (*tok++ != CONST || *tok > 8)
                                                goto badmode;
                                        else
                                        {
                                                goto badmode;
                                        else
                                        {
-                                               switch ((int)*tok.u32++)
+                                               switch ((int)*tok++)
                                                {
                                                case 1:
                                                        break;
                                                {
                                                case 1:
                                                        break;
                                                }
                                        }
                                }
                                                }
                                        }
                                }
-                               if (*tok.u32 == ']')  // ([bd,Dn]...
+                               if (*tok == ']')  // ([bd,Dn]...
                                {
                                {
-                                       tok.u32++;
+                                       tok++;
                                        goto IS_SUPPRESSEDn;
                                }
                        }
                                        goto IS_SUPPRESSEDn;
                                }
                        }
-                       else if (*tok.u32 == ']')
+                       else if (*tok == ']')
                        {
                                // PC and Xn is suppressed
                                AnREG = 6 << 3;         // stuff 110 to mode field
                        {
                                // 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],...
                        }
 
                        // 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
                        {
                                //([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
                                {
                                        //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;
                                }
                                        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
                                        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;
                                        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;
                                        AnEXTEN |= EXT_D;
-                                       tok.u32++;
+                                       tok++;
                                }
                                else
                                {
                                        //No index found, suppress it
                                        AnEXTEN |= EXT_IS;
                                }
                                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...)
                                        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:
                                        {
                                        // Index reg size: <empty> | .W | .L
                                        case DOTW:
-                                               tok.u32++;
+                                               tok++;
                                                break;
                                        default:
                                                break;
                                        case DOTL:
                                                AnEXTEN |= EXT_L;
                                                break;
                                        default:
                                                break;
                                        case DOTL:
                                                AnEXTEN |= EXT_L;
-                                               tok.u32++;
+                                               tok++;
                                                break;
                                        case DOTB:
                                                // .B not allowed here...
                                                break;
                                        case DOTB:
                                                // .B not allowed here...
                                }
 
                                // Check for scale
                                }
 
                                // Check for scale
-                               if (*tok.u32 == '*')                   // ([bd,An/PC],Xn*...)
+                               if (*tok == '*')                   // ([bd,An/PC],Xn*...)
                                {                                  // scale: *1, *2, *4, *8
                                {                                  // 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");
                                        {
                                                if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                                                        return error("scale factor expression must evaluate");
                                                        goto badmode;
                                                }
                                        }
                                                        goto badmode;
                                                }
                                        }
-                                       else if (*tok.u32++ != CONST || *tok.u32 > 8)
+                                       else if (*tok++ != CONST || *tok > 8)
                                                goto badmode;
                                        else
                                        {
                                                goto badmode;
                                        else
                                        {
-                                               switch ((int)*tok.u32++)
+                                               switch ((int)*tok++)
                                                {
                                                case 1:
                                                        break;
                                                {
                                                case 1:
                                                        break;
                                }
 
                                // Check for od
                                }
 
                                // 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
                                {
                                        //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;
                                }
                                        goto AnOK;
                                }
-                               else if (*tok.u32 != ',')
+                               else if (*tok != ',')
                                        return error("comma expected");
                                else
                                        return error("comma expected");
                                else
-                                       tok.u32++;      // eat the comma
+                                       tok++;  // eat the comma
 
                                CHECKODn:
                                if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
 
                                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
                                        // 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)
                                        goto AnOK;
                                }
 
                                // ([bd,An/PC],Xn,od)
-                               if (*tok.u32 == DOTL)
+                               if (*tok == DOTL)
                                {
                                        // expr.L
                                        AnEXTEN |= EXT_IISPOSL; // Long outer displacement
                                        AMn = MEMPOST;
                                {
                                        // expr.L
                                        AnEXTEN |= EXT_IISPOSL; // Long outer displacement
                                        AMn = MEMPOST;
-                                       tok.u32++;
+                                       tok++;
 
                                        // Defined, absolute values from $FFFF8000..$00007FFF get
                                        // optimized to absolute short
 
                                        // Defined, absolute values from $FFFF8000..$00007FFF get
                                        // optimized to absolute short
                                        AMn = MEMPOST;
 
                                        // Is .W forced here?
                                        AMn = MEMPOST;
 
                                        // Is .W forced here?
-                                       if (*tok.u32 == DOTW)
+                                       if (*tok == DOTW)
                                        {
                                        {
-                                               tok.u32++;
+                                               tok++;
                                        }
                                }
 
                                // Check for final closing parenthesis
                                        }
                                }
 
                                // Check for final closing parenthesis
-                               if (*tok.u32 == ')')
+                               if (*tok == ')')
                                {
                                {
-                                       tok.u32++;
+                                       tok++;
                                        goto AnOK;
                                }
                                else
                                        goto AnOK;
                                }
                                else
 IS_SUPPRESSEDn:
 
                                // Check for od
 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
                                {
                                        //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;
                                }
                                        goto AnOK;
                                }
-                               else if (*tok.u32!=',')
+                               else if (*tok!=',')
                                        return error("comma expected");
                                else
                                        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);
                                        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
                                        // 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)
                                        goto AnOK;
                                }
 
                                // ([bd,An/PC],Xn,od)
-                               if (*tok.u32 == DOTL)
+                               if (*tok == DOTL)
                                {
                                        // expr.L
                                {
                                        // expr.L
-                                       tok.u32++;
+                                       tok++;
                                        AMn = MEMPOST;
                                        AnEXTEN |= EXT_IISNOIL; // Long outer displacement with IS suppressed
                                }
                                        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;
 
                                        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;
                                        {
                                                //AnEXTEN|=EXT_IISNOIW; // Word outer displacement
                                                AMn = MEMPOST;
-                                               tok.u32++;
+                                               tok++;
                                        }
                                        // Defined, absolute values from $FFFF8000..$00007FFF get
                                        // optimized to absolute short
                                        }
                                        // Defined, absolute values from $FFFF8000..$00007FFF get
                                        // optimized to absolute short
@@ -699,45 +699,45 @@ IS_SUPPRESSEDn:
                                }
 
                                // Check for final closing parenthesis
                                }
 
                                // Check for final closing parenthesis
-                               if (*tok.u32 == ')')
+                               if (*tok == ')')
                                {
                                {
-                                       tok.u32++;
+                                       tok++;
                                        goto AnOK;
                                }
                                else
                                        return error("Closing parenthesis missing on addressing mode");
                        }
                                        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
 
                                //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;
                                        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;
                                        AnEXTEN |= EXT_D;
-                                       tok.u32++;
+                                       tok++;
                                }
 
                                // Check for size
                                {
                                // ([bd,An/PC],Xn.W/L...)
                                }
 
                                // Check for size
                                {
                                // ([bd,An/PC],Xn.W/L...)
-                               switch ((int)*tok.u32)
+                               switch ((int)*tok)
                                {
                                // Index reg size: <empty> | .W | .L
                                case DOTW:
                                {
                                // Index reg size: <empty> | .W | .L
                                case DOTW:
-                                       tok.u32++;
+                                       tok++;
                                        break;
                                default:
                                        break;
                                case DOTL:
                                        break;
                                default:
                                        break;
                                case DOTL:
-                                       tok.u32++;
+                                       tok++;
                                        AnEXTEN |= EXT_L;
                                        break;
                                case DOTB:
                                        AnEXTEN |= EXT_L;
                                        break;
                                case DOTB:
@@ -747,11 +747,11 @@ IS_SUPPRESSEDn:
                                }
 
                                // Check for scale
                                }
 
                                // Check for scale
-                               if (*tok.u32 == '*')                    // ([bd,An/PC],Xn*...)
+                               if (*tok == '*')                        // ([bd,An/PC],Xn*...)
                                {                           // scale: *1, *2, *4, *8
                                {                           // 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");
                                        {
                                                if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
                                                        return error("scale factor expression must evaluate");
@@ -772,11 +772,11 @@ IS_SUPPRESSEDn:
                                                        goto badmode;
                                                }
                                        }
                                                        goto badmode;
                                                }
                                        }
-                                       else if (*tok.u32++ != CONST || *tok.u32 > 8)
+                                       else if (*tok++ != CONST || *tok > 8)
                                                goto badmode;
                                        else
                                        {
                                                goto badmode;
                                        else
                                        {
-                                               switch ((int)*tok.u32++)
+                                               switch ((int)*tok++)
                                                {
                                                case 1:
                                                        break;
                                                {
                                                case 1:
                                                        break;
@@ -796,24 +796,24 @@ IS_SUPPRESSEDn:
                                }
 
                                //Check for ]
                                }
 
                                //Check for ]
-                               if (*tok.u32 != ']')
+                    &