]> Shamusworld >> Repos - rmac/blobdiff - expr.c
Multiple fixes for 020+ mode, including:
[rmac] / expr.c
diff --git a/expr.c b/expr.c
index 50d1f5ada0c2e30ef71ab0bfd1bec37f349ab8a2..c89b1828b6f4f88acf1707b21f248a4b24ddcff5 100644 (file)
--- a/expr.c
+++ b/expr.c
@@ -1,7 +1,7 @@
 //
 //
-// RMAC - Reboot's Macro Assembler for the Atari Jaguar Console System
+// RMAC - Reboot's Macro Assembler for all Atari computers
 // EXPR.C - Expression Analyzer
 // EXPR.C - Expression Analyzer
-// Copyright (C) 199x Landon Dyer, 2011 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2017 Reboot and Friends
 // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
 // Source utilised with the kind permission of Landon Dyer
 //
 // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
 // Source utilised with the kind permission of Landon Dyer
 //
@@ -17,7 +17,7 @@
 #include "symbol.h"
 #include "token.h"
 
 #include "symbol.h"
 #include "token.h"
 
-#define DEF_KW                                         // Declare keyword values 
+#define DEF_KW                                         // Declare keyword values
 #include "kwtab.h"                                     // Incl generated keyword tables & defs
 
 // N.B.: The size of tokenClass should be identical to the largest value of
 #include "kwtab.h"                                     // Incl generated keyword tables & defs
 
 // N.B.: The size of tokenClass should be identical to the largest value of
@@ -29,21 +29,22 @@ static WORD evattr[EVSTACKSIZE];    // Evaluator attribute stack
 // Token-class initialization list
 char itokcl[] = {
        0,                                                              // END
 // Token-class initialization list
 char itokcl[] = {
        0,                                                              // END
-       CONST, SYMBOL, 0,                               // ID 
+       CONST, SYMBOL, 0,                               // ID
        '(', '[', '{', 0,                               // OPAR
        '(', '[', '{', 0,                               // OPAR
-       ')', ']', '}', 0,                               // CPAR 
+       ')', ']', '}', 0,                               // CPAR
        CR_DEFINED, CR_REFERENCED,              // SUNARY (special unary)
        CR_STREQ, CR_MACDEF,
        CR_DEFINED, CR_REFERENCED,              // SUNARY (special unary)
        CR_STREQ, CR_MACDEF,
-       CR_DATE, CR_TIME, 0,
+       CR_DATE, CR_TIME,
+       CR_ABSCOUNT, 0,
        '!', '~', UNMINUS, 0,                   // UNARY
        '!', '~', UNMINUS, 0,                   // UNARY
-       '*', '/', '%', 0,                               // MULT 
-       '+', '-', 0,                                    // ADD 
-       SHL, SHR, 0,                                    // SHIFT 
-       LE, GE, '<', '>', NE, '=', 0,   // REL 
-       '&', 0,                                                 // AND 
-       '^', 0,                                                 // XOR 
-       '|', 0,                                                 // OR 
-       1                                                               // (the end) 
+       '*', '/', '%', 0,                               // MULT
+       '+', '-', 0,                                    // ADD
+       SHL, SHR, 0,                                    // SHIFT
+       LE, GE, '<', '>', NE, '=', 0,   // REL
+       '&', 0,                                                 // AND
+       '^', 0,                                                 // XOR
+       '|', 0,                                                 // OR
+       1                                                               // (the end)
 };
 
 const char missym_error[] = "missing symbol";
 };
 
 const char missym_error[] = "missing symbol";
@@ -54,7 +55,7 @@ static TOKEN * evalTokenBuffer;               // Deposit tokens here (this is really a
                                                                        // pointer to exprbuf from direct.c)
                                                                        // (Can also be from others, like
                                                                        // riscasm.c)
                                                                        // pointer to exprbuf from direct.c)
                                                                        // (Can also be from others, like
                                                                        // riscasm.c)
-static symbolNum;                                      // Pointer to the entry in symbolPtr[]
+static int symbolNum;                          // Pointer to the entry in symbolPtr[]
 
 
 //
 
 
 //
@@ -76,18 +77,17 @@ static VALUE str_value(char * p)
 //
 void InitExpression(void)
 {
 //
 void InitExpression(void)
 {
-       int i;
-       char * p;
-
        // Initialize token-class table (all set to END)
        // Initialize token-class table (all set to END)
-       for(i=0; i<256; i++)
+       for(int i=0; i<256; i++)
                tokenClass[i] = END;
 
                tokenClass[i] = END;
 
-       for(i=0, p=itokcl; *p!=1; p++)
+       int i = 0;
+
+       for(char * p=itokcl; *p!=1; p++)
        {
                if (*p == 0)
                        i++;
        {
                if (*p == 0)
                        i++;
-               else 
+               else
                        tokenClass[(int)(*p)] = (char)i;
        }
 
                        tokenClass[(int)(*p)] = (char)i;
        }
 
@@ -104,7 +104,7 @@ int expr0(void)
 
        if (expr1() != OK)
                return ERROR;
 
        if (expr1() != OK)
                return ERROR;
-       
+
        while (tokenClass[*tok] >= MULT)
        {
                t = *tok++;
        while (tokenClass[*tok] >= MULT)
        {
                t = *tok++;
@@ -121,6 +121,9 @@ int expr0(void)
 
 //
 // Unary operators (detect unary '-')
 
 //
 // Unary operators (detect unary '-')
+// ggn: If expression starts with a plus then also eat it up.
+//      For some reason the parser gets confused when this happens and
+//      emits a "bad expression".
 //
 int expr1(void)
 {
 //
 int expr1(void)
 {
@@ -133,7 +136,7 @@ int expr1(void)
 
        class = tokenClass[*tok];
 
 
        class = tokenClass[*tok];
 
-       if (*tok == '-' || class == UNARY)
+       if (*tok == '-' || *tok == '+' || class == UNARY)
        {
                t = *tok++;
 
        {
                t = *tok++;
 
@@ -149,6 +152,10 @@ int expr1(void)
        {
                switch ((int)*tok++)
                {
        {
                switch ((int)*tok++)
                {
+               case CR_ABSCOUNT:
+                       *evalTokenBuffer++ = CONST;
+                       *evalTokenBuffer++ = (LONG)sect[ABS].sloc;
+                       break;
                case CR_TIME:
                        *evalTokenBuffer++ = CONST;
                        *evalTokenBuffer++ = dos_time();
                case CR_TIME:
                        *evalTokenBuffer++ = CONST;
                        *evalTokenBuffer++ = dos_time();
@@ -203,7 +210,7 @@ getsym:
                        break;
                }
        }
                        break;
                }
        }
-       else 
+       else
                return expr2();
 
        return OK;
                return expr2();
 
        return OK;
@@ -236,11 +243,11 @@ int expr2(void)
                // Check register bank usage
                if (sy->sattre & EQUATEDREG)
                {
                // Check register bank usage
                if (sy->sattre & EQUATEDREG)
                {
-                       if ((regbank == BANK_0) && (sy->sattre & BANK_1) && !altbankok)   
-                               warns("equated symbol \'%s\' cannot be used in register bank 0", sy->sname);
+                       if ((regbank == BANK_0) && (sy->sattre & BANK_1) && !altbankok)
+                               warn("equated symbol \'%s\' cannot be used in register bank 0", sy->sname);
 
                        if ((regbank == BANK_1) && (sy->sattre & BANK_0) && !altbankok)
 
                        if ((regbank == BANK_1) && (sy->sattre & BANK_0) && !altbankok)
-                               warns("equated symbol \'%s\' cannot be used in register bank 1", sy->sname);
+                               warn("equated symbol \'%s\' cannot be used in register bank 1", sy->sname);
                }
 
                *evalTokenBuffer++ = SYMBOL;
                }
 
                *evalTokenBuffer++ = SYMBOL;
@@ -257,7 +264,7 @@ int expr2(void)
                        return ERROR;
 
                if (*tok++ != ')')
                        return ERROR;
 
                if (*tok++ != ')')
-                       return error("missing close parenthesis ')'");
+                       return error("missing closing parenthesis ')'");
 
                break;
        case '[':
 
                break;
        case '[':
@@ -265,7 +272,7 @@ int expr2(void)
                        return ERROR;
 
                if (*tok++ != ']')
                        return ERROR;
 
                if (*tok++ != ']')
-                       return error("missing close parenthesis ']'");
+                       return error("missing closing bracket ']'");
 
                break;
        case '$':
 
                break;
        case '$':
@@ -280,6 +287,20 @@ int expr2(void)
                *evalTokenBuffer++ = (orgactive ? orgaddr : pcloc);
                // '*' takes attributes of current section, not ABS!
                *evalTokenBuffer++ = cursect | DEFINED;
                *evalTokenBuffer++ = (orgactive ? orgaddr : pcloc);
                // '*' takes attributes of current section, not ABS!
                *evalTokenBuffer++ = cursect | DEFINED;
+               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;
        default:
                return error("bad expression");
                break;
        default:
                return error("bad expression");
@@ -311,8 +332,9 @@ int expr(TOKEN * otk, VALUE * a_value, WORD * a_attr, SYM ** a_esym)
        //         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[1] == EOL is a single token that is)
        //         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[1] == EOL is a single token that is)
+       //         Seems that even other tokens (SUNARY type) can fuck this up too.
 //     if ((tok[1] == EOL)
 //     if ((tok[1] == EOL)
-       if ((tok[1] == EOL && tok[0] != CONST)
+       if ((tok[1] == EOL && (tok[0] != CONST && tokenClass[tok[0]] != SUNARY))
                || (((*tok == CONST || *tok == SYMBOL) || (*tok >= KW_R0 && *tok <= KW_R31))
                && (tokenClass[tok[2]] < UNARY)))
        {
                || (((*tok == CONST || *tok == SYMBOL) || (*tok >= KW_R0 && *tok <= KW_R31))
                && (tokenClass[tok[2]] < UNARY)))
        {
@@ -378,7 +400,7 @@ if (symbol)
                        // means it will be fixed up later, and thus, not an error.
                        if ((symbol->sattre & UNDEF_EQUR) && !riscImmTokenSeen)
                        {
                        // means it will be fixed up later, and thus, not an error.
                        if ((symbol->sattre & UNDEF_EQUR) && !riscImmTokenSeen)
                        {
-                               errors("undefined register equate '%s'", symbol->sname);
+                               error("undefined register equate '%s'", symbol->sname);
 //if we return right away, it returns some spurious errors...
 //                             return ERROR;
                        }
 //if we return right away, it returns some spurious errors...
 //                             return ERROR;
                        }
@@ -386,11 +408,11 @@ if (symbol)
                        // Check register bank usage
                        if (symbol->sattre & EQUATEDREG)
                        {
                        // Check register bank usage
                        if (symbol->sattre & EQUATEDREG)
                        {
-                               if ((regbank == BANK_0) && (symbol->sattre & BANK_1) && !altbankok)   
-                                       warns("equated symbol '%s' cannot be used in register bank 0", symbol->sname);
+                               if ((regbank == BANK_0) && (symbol->sattre & BANK_1) && !altbankok)
+                                       warn("equated symbol '%s' cannot be used in register bank 0", symbol->sname);
 
                                if ((regbank == BANK_1) && (symbol->sattre & BANK_0) && !altbankok)
 
                                if ((regbank == BANK_1) && (symbol->sattre & BANK_0) && !altbankok)
-                                       warns("equated symbol '%s' cannot be used in register bank 1", symbol->sname);
+                                       warn("equated symbol '%s' cannot be used in register bank 1", symbol->sname);
                        }
 
                        *evalTokenBuffer++ = SYMBOL;
                        }
 
                        *evalTokenBuffer++ = SYMBOL;
@@ -416,7 +438,7 @@ be converted from a linked list into an array).
 All that extra crap that was put into the svalue when doing the equr stuff is
 thrown away right here. What the hell is it for?
 */
 All that extra crap that was put into the svalue when doing the equr stuff is
 thrown away right here. What the hell is it for?
 */
-                       if (symbol->sattre & EQUATEDREG) 
+                       if (symbol->sattre & EQUATEDREG)
                                *a_value &= 0x1F;
 
                        *a_attr = (WORD)(symbol->sattr & ~GLOBAL);
                                *a_value &= 0x1F;
 
                        *a_attr = (WORD)(symbol->sattr & ~GLOBAL);
@@ -456,17 +478,12 @@ thrown away right here. What the hell is it for?
 //
 int evexpr(TOKEN * tk, VALUE * a_value, WORD * a_attr, SYM ** a_esym)
 {
 //
 int evexpr(TOKEN * tk, VALUE * a_value, WORD * a_attr, SYM ** a_esym)
 {
-       WORD * sattr;
-       VALUE * sval;
        WORD attr;
        SYM * sy;
        WORD attr;
        SYM * sy;
-       SYM * esym;
-       WORD sym_seg;
-
-       sval = evstk;                                                   // (Empty) initial stack
-       sattr = evattr;
-       esym = NULL;                                                    // No external symbol involved
-       sym_seg = 0;
+       VALUE * sval = evstk;                                   // (Empty) initial stack
+       WORD * sattr = evattr;
+       SYM * esym = NULL;                                              // No external symbol involved
+       WORD sym_seg = 0;
 
        while (*tk != ENDEXPR)
        {
 
        while (*tk != ENDEXPR)
        {
@@ -475,7 +492,7 @@ int evexpr(TOKEN * tk, VALUE * a_value, WORD * a_attr, SYM ** a_esym)
                case SYMBOL:
 //printf("evexpr(): SYMBOL\n");
                        sy = symbolPtr[*tk++];
                case SYMBOL:
 //printf("evexpr(): SYMBOL\n");
                        sy = symbolPtr[*tk++];
-                       sy->sattr |= REFERENCED;                // Set "referenced" bit 
+                       sy->sattr |= REFERENCED;                // Set "referenced" bit
 
                        if (!(sy->sattr & DEFINED))
                        {
 
                        if (!(sy->sattr & DEFINED))
                        {
@@ -499,7 +516,7 @@ int evexpr(TOKEN * tk, VALUE * a_value, WORD * a_attr, SYM ** a_esym)
                        }
                        else
                        {
                        }
                        else
                        {
-                               *++sval = 0;                            // 0 for undefined symbols 
+                               *++sval = 0;                            // 0 for undefined symbols
                        }
 
                        *++sattr = (WORD)(sy->sattr & ~GLOBAL); // Push attribs
                        }
 
                        *++sattr = (WORD)(sy->sattr & ~GLOBAL); // Push attribs
@@ -517,20 +534,20 @@ int evexpr(TOKEN * tk, VALUE * a_value, WORD * a_attr, SYM ** a_esym)
                        break;
 
                        // Binary "+" and "-" matrix:
                        break;
 
                        // Binary "+" and "-" matrix:
-                       // 
+                       //
                        //                ABS    Sect     Other
                        //     ----------------------------
                        //   ABS     |  ABS   |  Sect  |  Other |
                        //   Sect    |  Sect  |  [1]   |  Error |
                        //   Other   |  Other |  Error |  [1]   |
                        //      ----------------------------
                        //                ABS    Sect     Other
                        //     ----------------------------
                        //   ABS     |  ABS   |  Sect  |  Other |
                        //   Sect    |  Sect  |  [1]   |  Error |
                        //   Other   |  Other |  Error |  [1]   |
                        //      ----------------------------
-                       // 
+                       //
                        //   [1] + : Error
                        //       - : ABS
                case '+':
 //printf("evexpr(): +\n");
                        --sval;                                                 // Pop value
                        //   [1] + : Error
                        //       - : ABS
                case '+':
 //printf("evexpr(): +\n");
                        --sval;                                                 // Pop value
-                       --sattr;                                                // Pop attrib 
+                       --sattr;                                                // Pop attrib
 //printf("--> N+N: %i + %i = ", *sval, sval[1]);
                        *sval += sval[1];                               // Compute value
 //printf("%i\n", *sval);
 //printf("--> N+N: %i + %i = ", *sval, sval[1]);
                        *sval += sval[1];                               // Compute value
 //printf("%i\n", *sval);
@@ -544,7 +561,7 @@ int evexpr(TOKEN * tk, VALUE * a_value, WORD * a_attr, SYM ** a_esym)
                case '-':
 //printf("evexpr(): -\n");
                        --sval;                                                 // Pop value
                case '-':
 //printf("evexpr(): -\n");
                        --sval;                                                 // Pop value
-                       --sattr;                                                // Pop attrib 
+                       --sattr;                                                // Pop attrib
 //printf("--> N-N: %i - %i = ", *sval, sval[1]);
                        *sval -= sval[1];                               // Compute value
 //printf("%i\n", *sval);
 //printf("--> N-N: %i - %i = ", *sval, sval[1]);
                        *sval -= sval[1];                               // Compute value
 //printf("%i\n", *sval);
@@ -590,8 +607,8 @@ printf("EVEXPR (-): sym1 = %X, sym2 = %X\n", attr, sattr[1]);
                // are in the same segment, but that's the only requirement.
                case LE:
 //printf("evexpr(): LE\n");
                // are in the same segment, but that's the only requirement.
                case LE:
 //printf("evexpr(): LE\n");
-                       --sattr;
-                       --sval;
+                       sattr--;
+                       sval--;
 
                        if ((*sattr & TDB) != (sattr[1] & TDB))
                                error(seg_error);
 
                        if ((*sattr & TDB) != (sattr[1] & TDB))
                                error(seg_error);
@@ -601,8 +618,8 @@ printf("EVEXPR (-): sym1 = %X, sym2 = %X\n", attr, sattr[1]);
                        break;
                case GE:
 //printf("evexpr(): GE\n");
                        break;
                case GE:
 //printf("evexpr(): GE\n");
-                       --sattr;
-                       --sval;
+                       sattr--;
+                       sval--;
 
                        if ((*sattr & TDB) != (sattr[1] & TDB))
                                error(seg_error);
 
                        if ((*sattr & TDB) != (sattr[1] & TDB))
                                error(seg_error);
@@ -612,8 +629,8 @@ printf("EVEXPR (-): sym1 = %X, sym2 = %X\n", attr, sattr[1]);
                        break;
                case '>':
 //printf("evexpr(): >\n");
                        break;
                case '>':
 //printf("evexpr(): >\n");
-                       --sattr;
-                       --sval;
+                       sattr--;
+                       sval--;
 
                        if ((*sattr & TDB) != (sattr[1] & TDB))
                                error(seg_error);
 
                        if ((*sattr & TDB) != (sattr[1] & TDB))
                                error(seg_error);
@@ -623,8 +640,8 @@ printf("EVEXPR (-): sym1 = %X, sym2 = %X\n", attr, sattr[1]);
                        break;
                case '<':
 //printf("evexpr(): <\n");
                        break;
                case '<':
 //printf("evexpr(): <\n");
-                       --sattr;
-                       --sval;
+                       sattr--;
+                       sval--;
 
                        if ((*sattr & TDB) != (sattr[1] & TDB))
                                error(seg_error);
 
                        if ((*sattr & TDB) != (sattr[1] & TDB))
                                error(seg_error);
@@ -634,8 +651,8 @@ printf("EVEXPR (-): sym1 = %X, sym2 = %X\n", attr, sattr[1]);
                        break;
                case NE:
 //printf("evexpr(): NE\n");
                        break;
                case NE:
 //printf("evexpr(): NE\n");
-                       --sattr;
-                       --sval;
+                       sattr--;
+                       sval--;
 
                        if ((*sattr & TDB) != (sattr[1] & TDB))
                                error(seg_error);
 
                        if ((*sattr & TDB) != (sattr[1] & TDB))
                                error(seg_error);
@@ -645,8 +662,8 @@ printf("EVEXPR (-): sym1 = %X, sym2 = %X\n", attr, sattr[1]);
                        break;
                case '=':
 //printf("evexpr(): =\n");
                        break;
                case '=':
 //printf("evexpr(): =\n");
-                       --sattr;
-                       --sval;
+                       sattr--;
+                       sval--;
 
                        if ((*sattr & TDB) != (sattr[1] & TDB))
                                error(seg_error);
 
                        if ((*sattr & TDB) != (sattr[1] & TDB))
                                error(seg_error);
@@ -666,18 +683,18 @@ printf("EVEXPR (-): sym1 = %X, sym2 = %X\n", attr, sattr[1]);
                        switch ((int)tk[-1])
                        {
                        case '*':
                        switch ((int)tk[-1])
                        {
                        case '*':
-                               --sval;
-                               --sattr;                                        // Pop attrib 
+                               sval--;
+                               sattr--;                                        // Pop attrib
 //printf("--> NxN: %i x %i = ", *sval, sval[1]);
                                *sval *= sval[1];
 //printf("%i\n", *sval);
                                break;
                        case '/':
 //printf("--> NxN: %i x %i = ", *sval, sval[1]);
                                *sval *= sval[1];
 //printf("%i\n", *sval);
                                break;
                        case '/':
-                               --sval;
-                               --sattr;                                        // Pop attrib 
+                               sval--;
+                               sattr--;                                        // Pop attrib
 
                                if (sval[1] == 0)
 
                                if (sval[1] == 0)
-                                       return error("divide by zero");
+                                       return error("division by zero");
 
 //printf("--> N/N: %i / %i = ", sval[0], sval[1]);
                                // Compiler is picky here: Without casting these, it discards
 
 //printf("--> N/N: %i / %i = ", sval[0], sval[1]);
                                // Compiler is picky here: Without casting these, it discards
@@ -688,8 +705,8 @@ printf("EVEXPR (-): sym1 = %X, sym2 = %X\n", attr, sattr[1]);
 //printf("%i\n", *sval);
                                break;
                        case '%':
 //printf("%i\n", *sval);
                                break;
                        case '%':
-                               --sval;
-                               --sattr;                                        // Pop attrib 
+                               sval--;
+                               sattr--;                                        // Pop attrib
 
                                if (sval[1] == 0)
                                        return error("mod (%) by zero");
 
                                if (sval[1] == 0)
                                        return error("mod (%) by zero");
@@ -697,28 +714,28 @@ printf("EVEXPR (-): sym1 = %X, sym2 = %X\n", attr, sattr[1]);
                                *sval %= sval[1];
                                break;
                        case SHL:
                                *sval %= sval[1];
                                break;
                        case SHL:
-                               --sval;
-                               --sattr;                                        // Pop attrib 
+                               sval--;
+                               sattr--;                                        // Pop attrib
                                *sval <<= sval[1];
                                break;
                        case SHR:
                                *sval <<= sval[1];
                                break;
                        case SHR:
-                               --sval;
-                               --sattr;                                        // Pop attrib 
+                               sval--;
+                               sattr--;                                        // Pop attrib
                                *sval >>= sval[1];
                                break;
                        case '&':
                                *sval >>= sval[1];
                                break;
                        case '&':
-                               --sval;
-                               --sattr;                                        // Pop attrib 
+                               sval--;
+                               sattr--;                                        // Pop attrib
                                *sval &= sval[1];
                                break;
                        case '^':
                                *sval &= sval[1];
                                break;
                        case '^':
-                               --sval;
-                               --sattr;                                        // Pop attrib 
+                               sval--;
+                               sattr--;                                        // Pop attrib
                                *sval ^= sval[1];
                                break;
                        case '|':
                                *sval ^= sval[1];
                                break;
                        case '|':
-                               --sval;
-                               --sattr;                                        // Pop attrib 
+                               sval--;
+                               sattr--;                                        // Pop attrib
                                *sval |= sval[1];
                                break;
                        default:
                                *sval |= sval[1];
                                break;
                        default:
@@ -736,7 +753,7 @@ printf("EVEXPR (-): sym1 = %X, sym2 = %X\n", attr, sattr[1]);
        // sym_seg added in 1.0.16 to solve a problem with forward symbols in
        // expressions where absolute values also existed. The absolutes were
        // overiding the symbol segments and not being included :(
        // sym_seg added in 1.0.16 to solve a problem with forward symbols in
        // expressions where absolute values also existed. The absolutes were
        // overiding the symbol segments and not being included :(
-       //*a_attr = *sattr | sym_seg;                                        // Copy value + attrib
+       //*a_attr = *sattr | sym_seg;           // Copy value + attrib
 
        *a_attr = *sattr;                                               // Copy value + attrib
        *a_value = *sval;
 
        *a_attr = *sattr;                                               // Copy value + attrib
        *a_value = *sval;