Fixed word reversed fixup problem.
authorShamus Hammons <jlhamm@acm.org>
Sat, 17 May 2014 20:56:15 +0000 (15:56 -0500)
committerShamus Hammons <jlhamm@acm.org>
Sat, 17 May 2014 20:56:15 +0000 (15:56 -0500)
For some reason, there was code in several places that marked fixups/symbols
as belonging to a RISC section when it was clearly not the case. As a result,
it caused serious problems by reversing words in 68K sections just because a
symbol had been seen in a MOVEI # statement in a RISC section. Probably not
the last nasty surprise in this pile of spaghetti. :-/

19 files changed:
.gitignore
debug.c
direct.c
eagen0.c
expr.c
expr.h
listing.c
mach.c
mark.c
parmode.h
procln.c
riscasm.c
rmac.c
rmac.h
sect.c
sect.h
symbol.c
symbol.h
version.h

index 033e720f8a8bd31c254ac5bf18b0a894b6d60c9c..5cb2947a8473a5ffc2368dacffaadc531e85696a 100644 (file)
@@ -13,3 +13,7 @@ bugs/
 bugs1/
 bugs2/
 bugs3/
 bugs1/
 bugs2/
 bugs3/
+bugs4/
+bugs5/
+*.zip
+features/
diff --git a/debug.c b/debug.c
index cb12e3da0f1c4b19af72b4f0d45c10ab09fa0add..5062b8fb5dff35829fb7108a99928ef3405c91be 100644 (file)
--- a/debug.c
+++ b/debug.c
@@ -115,7 +115,6 @@ int fudump(CHUNK * ch)
                        }
                        else
                        {
                        }
                        else
                        {
-//                             printf("`%s' ;\n", (*p.sy)->sname);
                                printf("`%s' ;", (*p.sy)->sname);
                                p.sy++;
                        }
                                printf("`%s' ;", (*p.sy)->sname);
                                p.sy++;
                        }
index 67a6ffdfcf014fa7111a1afd4e7330ce1046f15b..efec94a2f438fd63d3a3931f14567cfea8efa690 100644 (file)
--- a/direct.c
+++ b/direct.c
@@ -258,10 +258,7 @@ int d_equrundef(void)
 
        // Check that we are in a RISC section
        if (!rgpu && !rdsp)
 
        // Check that we are in a RISC section
        if (!rgpu && !rdsp)
-       {
-               error(".equrundef/.regundef must be defined in .gpu/.dsp section");
-               return ERROR;
-       }
+               return error(".equrundef/.regundef must be defined in .gpu/.dsp section");
 
        while (*tok != EOL)
        {
 
        while (*tok != EOL)
        {
@@ -271,14 +268,9 @@ int d_equrundef(void)
 
                // Check we are dealing with a symbol
                if (*tok != SYMBOL)
 
                // Check we are dealing with a symbol
                if (*tok != SYMBOL)
-               {
-//                     error(syntax_error);
-                       error("syntax error; expected symbol");
-                       return ERROR;
-               }
+                       return error("syntax error; expected symbol");
 
                // Lookup and undef if equated register
 
                // Lookup and undef if equated register
-//             regname = lookup((char *)tok[1], LABEL, 0);
                regname = lookup(string[tok[1]], LABEL, 0);
 
                if (regname && (regname->sattre & EQUATEDREG))
                regname = lookup(string[tok[1]], LABEL, 0);
 
                if (regname && (regname->sattre & EQUATEDREG))
@@ -524,7 +516,7 @@ int d_qphrase(void)
        {
                if ((scattr & SBSS) == 0)
                {
        {
                if ((scattr & SBSS) == 0)
                {
-                       savsect();
+                       SaveSection();
                        chcheck(val);
 
                        for(i=0; i<val; i++) 
                        chcheck(val);
 
                        for(i=0; i<val; i++) 
@@ -594,18 +586,14 @@ int abs_expr(VALUE * a_eval)
 //
 int symlist(int(* func)())
 {
 //
 int symlist(int(* func)())
 {
-       char * em = "symbol list syntax";
+       const char * em = "symbol list syntax";
 
        for(;;)
        {
                if (*tok != SYMBOL)
                        return error(em);
 
 
        for(;;)
        {
                if (*tok != SYMBOL)
                        return error(em);
 
-#if 0
-               if ((*func)(tok[1]) != OK)
-#else
                if ((*func)(string[tok[1]]) != OK)
                if ((*func)(string[tok[1]]) != OK)
-#endif
                        break;
 
                tok += 2;
                        break;
 
                tok += 2;
@@ -616,7 +604,7 @@ int symlist(int(* func)())
                if (*tok != ',')
                        return error(em);
 
                if (*tok != ',')
                        return error(em);
 
-               ++tok;
+               tok++;
        }
 
        return 0;
        }
 
        return 0;
@@ -715,7 +703,7 @@ int d_assert(void)
 //
 int globl1(char * p)
 {
 //
 int globl1(char * p)
 {
-       SYM *sy;
+       SYM * sy;
 
        if (*p == '.')
                return error("cannot .globl local symbol");
 
        if (*p == '.')
                return error("cannot .globl local symbol");
@@ -725,6 +713,7 @@ int globl1(char * p)
                sy = NewSymbol(p, LABEL, 0);
                sy->svalue = 0;
                sy->sattr = GLOBAL;
                sy = NewSymbol(p, LABEL, 0);
                sy->svalue = 0;
                sy->sattr = GLOBAL;
+//printf("glob1: Making global symbol: attr=%04X, eattr=%08X, %s\n", sy->sattr, sy->sattre, sy->sname);
        }
        else 
                sy->sattr |= GLOBAL;
        }
        else 
                sy->sattr |= GLOBAL;
@@ -747,14 +736,14 @@ int d_abs(void)
 {
        VALUE eval;
 
 {
        VALUE eval;
 
-       savsect();
+       SaveSection();
 
        if (*tok == EOL)
                eval = 0;
        else if (abs_expr(&eval) != OK)
                return 0;
 
 
        if (*tok == EOL)
                eval = 0;
        else if (abs_expr(&eval) != OK)
                return 0;
 
-       switchsect(ABS);
+       SwitchSection(ABS);
        sloc = eval;
        return 0;
 }
        sloc = eval;
        return 0;
 }
@@ -771,8 +760,8 @@ int d_text(void)
 
        if (cursect != TEXT)
        {
 
        if (cursect != TEXT)
        {
-               savsect();
-               switchsect(TEXT);
+               SaveSection();
+               SwitchSection(TEXT);
        }
 
        return 0;
        }
 
        return 0;
@@ -786,8 +775,8 @@ int d_data(void)
 
        if (cursect != DATA)
        {
 
        if (cursect != DATA)
        {
-               savsect();
-               switchsect(DATA);
+               SaveSection();
+               SwitchSection(DATA);
        }
 
        return 0;
        }
 
        return 0;
@@ -801,8 +790,8 @@ int d_bss(void)
 
        if (cursect != BSS)
        {
 
        if (cursect != BSS)
        {
-               savsect();
-               switchsect(BSS);
+               SaveSection();
+               SwitchSection(BSS);
        }
 
        return 0;
        }
 
        return 0;
@@ -911,7 +900,7 @@ int d_dc(WORD siz)
                case SIZB:
                        if (!defined)
                        {
                case SIZB:
                        if (!defined)
                        {
-                               fixup(FU_BYTE | FU_SEXT, sloc, exprbuf);
+                               AddFixup(FU_BYTE | FU_SEXT, sloc, exprbuf);
                                D_byte(0);
                        }
                        else
                                D_byte(0);
                        }
                        else
@@ -930,7 +919,7 @@ int d_dc(WORD siz)
                case SIZN:
                        if (!defined)
                        {
                case SIZN:
                        if (!defined)
                        {
-                               fixup(FU_WORD | FU_SEXT, sloc, exprbuf);
+                               AddFixup(FU_WORD | FU_SEXT, sloc, exprbuf);
                                D_word(0);
                        }
                        else
                                D_word(0);
                        }
                        else
@@ -950,9 +939,9 @@ int d_dc(WORD siz)
                        if (!defined)
                        {
                                if (movei)
                        if (!defined)
                        {
                                if (movei)
-                                       fixup(FU_LONG | FU_MOVEI, sloc, exprbuf);
+                                       AddFixup(FU_LONG | FU_MOVEI, sloc, exprbuf);
                                else
                                else
-                                       fixup(FU_LONG, sloc, exprbuf);
+                                       AddFixup(FU_LONG, sloc, exprbuf);
 
                                D_long(0);
                        }
 
                                D_long(0);
                        }
@@ -1098,7 +1087,7 @@ int dep_block(VALUE count, WORD siz, VALUE eval, WORD eattr, TOKEN * exprbuf)
                case SIZB:
                        if (!defined)
                        {
                case SIZB:
                        if (!defined)
                        {
-                               fixup(FU_BYTE | FU_SEXT, sloc, exprbuf);
+                               AddFixup(FU_BYTE | FU_SEXT, sloc, exprbuf);
                                D_byte(0);
                        }
                        else
                                D_byte(0);
                        }
                        else
@@ -1117,7 +1106,7 @@ int dep_block(VALUE count, WORD siz, VALUE eval, WORD eattr, TOKEN * exprbuf)
                case SIZN:
                        if (!defined)
                        {
                case SIZN:
                        if (!defined)
                        {
-                               fixup(FU_WORD | FU_SEXT, sloc, exprbuf);
+                               AddFixup(FU_WORD | FU_SEXT, sloc, exprbuf);
                                D_word(0);
                        }
                        else
                                D_word(0);
                        }
                        else
@@ -1136,7 +1125,7 @@ int dep_block(VALUE count, WORD siz, VALUE eval, WORD eattr, TOKEN * exprbuf)
                case SIZL:
                        if (!defined)
                        {
                case SIZL:
                        if (!defined)
                        {
-                               fixup(FU_LONG, sloc, exprbuf);
+                               AddFixup(FU_LONG, sloc, exprbuf);
                                D_long(0);
                        }
                        else
                                D_long(0);
                        }
                        else
@@ -1229,8 +1218,8 @@ int d_68000(void)
        // Switching from gpu/dsp sections should reset any ORG'd Address
        orgactive = 0;                               
        orgwarning = 0;
        // Switching from gpu/dsp sections should reset any ORG'd Address
        orgactive = 0;                               
        orgwarning = 0;
-       savsect();
-       switchsect(TEXT);
+       SaveSection();
+       SwitchSection(TEXT);
        return 0;
 }
 
        return 0;
 }
 
@@ -1348,7 +1337,7 @@ int d_cargs(void)
 
                        // Put symbol in "order of definition" list
                        if (!(symbol->sattr & SDECLLIST))
 
                        // Put symbol in "order of definition" list
                        if (!(symbol->sattr & SDECLLIST))
-                               sym_decl(symbol);
+                               AddToSymbolOrderList(symbol);
 
                        symbol->sattr |= (ABS | DEFINED | EQUATED);
                        symbol->svalue = eval;
 
                        symbol->sattr |= (ABS | DEFINED | EQUATED);
                        symbol->svalue = eval;
@@ -1466,7 +1455,7 @@ int d_cstruct(void)
 
                        // Put symbol in "order of definition" list
                        if (!(symbol->sattr & SDECLLIST))
 
                        // Put symbol in "order of definition" list
                        if (!(symbol->sattr & SDECLLIST))
-                               sym_decl(symbol);
+                               AddToSymbolOrderList(symbol);
 
                        tok += 2;
 
 
                        tok += 2;
 
index c69ac886efe96673908a6a77547f9cc31961f4d1..c3feb2c0baaba382f51a72cfc1be110b31b406cc 100644 (file)
--- a/eagen0.c
+++ b/eagen0.c
@@ -19,7 +19,8 @@ int eaNgen(WORD siz)
 
        switch (amN)
        {
 
        switch (amN)
        {
-       case DREG:                                            // "Do nothing" - they're in the opword
+       // "Do nothing" - they're in the opword
+       case DREG:
        case AREG:
        case AIND:
        case APOSTINC:
        case AREG:
        case AIND:
        case APOSTINC:
@@ -28,10 +29,13 @@ int eaNgen(WORD siz)
        case AM_CCR:
        case AM_SR:
        case AM_NONE:
        case AM_CCR:
        case AM_SR:
        case AM_NONE:
-               break;                                             // This is a performance hit, though
-       case ADISP:                                           // expr(An)
+               // This is a performance hit, though
+               break;
+       case ADISP:
+               // expr(An)
                if (w)
                if (w)
-               {                                            // Just deposit it 
+               {
+                       // Just deposit it 
                        if (tdb)
                                rmark(cursect, sloc, tdb, MWORD, NULL);
 
                        if (tdb)
                                rmark(cursect, sloc, tdb, MWORD, NULL);
 
@@ -41,15 +45,17 @@ int eaNgen(WORD siz)
                        D_word(v);
                }
                else
                        D_word(v);
                }
                else
-               {                                           // Arrange for fixup later on 
-                       fixup(FU_WORD|FU_SEXT, sloc, aNexpr);
+               {
+                       // Arrange for fixup later on 
+                       AddFixup(FU_WORD|FU_SEXT, sloc, aNexpr);
                        D_word(0);
                }
 
                break;
        case PCDISP:
                if (w)
                        D_word(0);
                }
 
                break;
        case PCDISP:
                if (w)
-               {                                            // Just deposit it 
+               {
+                       // Just deposit it 
                        if ((aNexattr & TDB) == cursect)
                                v -= (VALUE)sloc;
                        else if ((aNexattr & TDB) != ABS)
                        if ((aNexattr & TDB) == cursect)
                                v -= (VALUE)sloc;
                        else if ((aNexattr & TDB) != ABS)
@@ -61,19 +67,23 @@ int eaNgen(WORD siz)
                        D_word(v);
                }
                else
                        D_word(v);
                }
                else
-               {                                           // Arrange for fixup later on 
-                       fixup(FU_WORD|FU_SEXT|FU_PCREL, sloc, aNexpr);
+               {
+                       // Arrange for fixup later on 
+                       AddFixup(FU_WORD|FU_SEXT|FU_PCREL, sloc, aNexpr);
                        D_word(0);
                }
 
                break;
        case AINDEXED:
                        D_word(0);
                }
 
                break;
        case AINDEXED:
-               w = (WORD)((aNixreg << 12) | aNixsiz);             // Compute ixreg and size+scale
+               // Compute ixreg and size+scale
+               w = (WORD)((aNixreg << 12) | aNixsiz);
 
                if (aNexattr & DEFINED)
 
                if (aNexattr & DEFINED)
-               {                           // Deposit a byte... 
+               {
+                       // Deposit a byte... 
                        if (tdb)
                        if (tdb)
-                               return error(abs_error);                    // Can't mark bytes 
+                               // Can't mark bytes 
+                               return error(abs_error);
 
                        if (v + 0x80 >= 0x180)
                                return error(range_error);
 
                        if (v + 0x80 >= 0x180)
                                return error(range_error);
@@ -82,17 +92,20 @@ int eaNgen(WORD siz)
                        D_word(w);
                }
                else
                        D_word(w);
                }
                else
-               {                                           // Fixup the byte later
-                       fixup(FU_BYTE|FU_SEXT, sloc+1, aNexpr);
+               {
+                       // Fixup the byte later
+                       AddFixup(FU_BYTE|FU_SEXT, sloc+1, aNexpr);
                        D_word(w);
                }
 
                break;
        case PCINDEXED:
                        D_word(w);
                }
 
                break;
        case PCINDEXED:
-               w = (WORD)((aNixreg << 12) | aNixsiz);             // Compute ixreg and size+scale
+               // Compute ixreg and size+scale
+               w = (WORD)((aNixreg << 12) | aNixsiz);
 
                if (aNexattr & DEFINED)
 
                if (aNexattr & DEFINED)
-               {                           // Deposit a byte... 
+               {
+                       // Deposit a byte... 
                        if ((aNexattr & TDB) == cursect) 
                                v -= (VALUE)sloc;
                        else if ((aNexattr & TDB) != ABS)
                        if ((aNexattr & TDB) == cursect) 
                                v -= (VALUE)sloc;
                        else if ((aNexattr & TDB) != ABS)
@@ -105,8 +118,9 @@ int eaNgen(WORD siz)
                        D_word(w);
                }
                else
                        D_word(w);
                }
                else
-               {                                           // Fixup the byte later 
-                       fixup(FU_WBYTE|FU_SEXT|FU_PCREL, sloc, aNexpr);
+               {
+                       // Fixup the byte later 
+                       AddFixup(FU_WBYTE|FU_SEXT|FU_PCREL, sloc, aNexpr);
                        D_word(w);
                }
 
                        D_word(w);
                }
 
@@ -127,7 +141,7 @@ int eaNgen(WORD siz)
                        }
                        else
                        {
                        }
                        else
                        {
-                               fixup(FU_BYTE|FU_SEXT, sloc+1, aNexpr);
+                               AddFixup(FU_BYTE|FU_SEXT, sloc+1, aNexpr);
                                D_word(0);
                        }
 
                                D_word(0);
                        }
 
@@ -146,7 +160,7 @@ int eaNgen(WORD siz)
                        }
                        else
                        {
                        }
                        else
                        {
-                               fixup(FU_WORD|FU_SEXT, sloc, aNexpr);
+                               AddFixup(FU_WORD|FU_SEXT, sloc, aNexpr);
                                D_word(0);
                        }
 
                                D_word(0);
                        }
 
@@ -161,13 +175,14 @@ int eaNgen(WORD siz)
                        }
                        else
                        {
                        }
                        else
                        {
-                               fixup(FU_LONG, sloc, aNexpr);
+                               AddFixup(FU_LONG, sloc, aNexpr);
                                D_long(0);
                        }
 
                        break;
                default:
                                D_long(0);
                        }
 
                        break;
                default:
-                       interror(1);                                 // IMMED size problem
+                       // IMMED size problem
+                       interror(1);
                }
 
                break;
                }
 
                break;
@@ -184,7 +199,7 @@ int eaNgen(WORD siz)
                }
                else
                {
                }
                else
                {
-                       fixup(FU_WORD|FU_SEXT, sloc, aNexpr);
+                       AddFixup(FU_WORD|FU_SEXT, sloc, aNexpr);
                        D_word(0);
                }
 
                        D_word(0);
                }
 
@@ -199,7 +214,7 @@ int eaNgen(WORD siz)
                }
                else
                {
                }
                else
                {
-                       fixup(FU_LONG, sloc, aNexpr);
+                       AddFixup(FU_LONG, sloc, aNexpr);
                        D_long(0);
                }
 
                        D_long(0);
                }
 
@@ -212,7 +227,8 @@ int eaNgen(WORD siz)
        case PCMPRE:
                return error("unsupported 68020 addressing mode");
        default:
        case PCMPRE:
                return error("unsupported 68020 addressing mode");
        default:
-               interror(3);                                       // Bad addressing mode in ea gen 
+               // Bad addressing mode in ea gen 
+               interror(3);
        }
 
        return OK;
        }
 
        return OK;
@@ -226,3 +242,4 @@ int eaNgen(WORD siz)
 #undef aNexpr
 #undef aNixreg
 #undef aNixsiz
 #undef aNexpr
 #undef aNixreg
 #undef aNixsiz
+
diff --git a/expr.c b/expr.c
index f582408c5773be5f90d77c13220ebfefee679a58..6373114484d70b845c10c4e68ada293c9340999d 100644 (file)
--- a/expr.c
+++ b/expr.c
@@ -20,7 +20,7 @@
 #define DEF_KW                                                 // Declare keyword values 
 #include "kwtab.h"                                             // Incl generated keyword tables & defs
 
 #define DEF_KW                                                 // Declare keyword values 
 #include "kwtab.h"                                             // Incl generated keyword tables & defs
 
-static char tokenClass[128];                                   // Generated table of token classes
+static char tokenClass[128];                   // Generated table of token classes
 static VALUE evstk[EVSTACKSIZE];               // Evaluator value stack
 static WORD evattr[EVSTACKSIZE];               // Evaluator attribute stack
 
 static VALUE evstk[EVSTACKSIZE];               // Evaluator value stack
 static WORD evattr[EVSTACKSIZE];               // Evaluator attribute stack
 
@@ -364,6 +364,11 @@ int expr(TOKEN * otk, VALUE * a_value, WORD * a_attr, SYM ** a_esym)
                        p = string[tok[1]];
                        j = (*p == '.' ? curenv : 0);
                        symbol = lookup(p, LABEL, j);
                        p = string[tok[1]];
                        j = (*p == '.' ? curenv : 0);
                        symbol = lookup(p, LABEL, j);
+#if 0
+printf("eval: Looking up symbol [=%08X]\n", symbol);
+if (symbol)
+       printf("      attr=%04X, attre=%08X, val=%i, name=%s\n", symbol->sattr, symbol->sattre, symbol->svalue, symbol->sname);
+#endif
 
                        if (symbol == NULL)
                                symbol = NewSymbol(p, LABEL, j);
 
                        if (symbol == NULL)
                                symbol = NewSymbol(p, LABEL, j);
diff --git a/expr.h b/expr.h
index 148157f33af4bc1f708ec52071f879c65323169c..ad83d2807d67eca0827dca5bb504e7a2258b85ee 100644 (file)
--- a/expr.h
+++ b/expr.h
 #include "rmac.h"
 
 // Tunable definitions
 #include "rmac.h"
 
 // Tunable definitions
-#define STKSIZE      64                        // Size of expression stacks
-#define EVSTACKSIZE  64                        // Expression evaluator stack size
+#define STKSIZE      64                // Size of expression stacks
+#define EVSTACKSIZE  64                // Expression evaluator stack size
 
 // Token classes in order of precedence
 
 // Token classes in order of precedence
-#define END          0                 // End/beginning of input
-#define ID           1                 // Symbol or constant
-#define OPAR         2                 // (
-#define CPAR         3                 // )
-#define SUNARY       4                 // Special unary (^^defined, etc.)
-#define UNARY        5                 // Unary class: ! ~ -
-#define MULT         6                 // Multiplicative class: * / %
-#define ADD          7                 // Additive class: + -
-#define SHIFT        8                 // Shift class: << >>
-#define REL          9                 // Relational class: <= >= < > <> = !=
-#define AND          10                        // Bitwise and: &
-#define XOR          11                        // Bitwise xor: ^
-#define OR           12                        // Bitwise or: |
+#define END          0         // End/beginning of input
+#define ID           1         // Symbol or constant
+#define OPAR         2         // (
+#define CPAR         3         // )
+#define SUNARY       4         // Special unary (^^defined, etc.)
+#define UNARY        5         // Unary class: ! ~ -
+#define MULT         6         // Multiplicative class: * / %
+#define ADD          7         // Additive class: + -
+#define SHIFT        8         // Shift class: << >>
+#define REL          9         // Relational class: <= >= < > <> = !=
+#define AND          10                // Bitwise and: &
+#define XOR          11                // Bitwise xor: ^
+#define OR           12                // Bitwise or: |
 
 // Prototypes
 void InitExpression(void);
 
 // Prototypes
 void InitExpression(void);
index 9dfddc595e79a1d49375ca02c1cb7c97af647418..530691334c3ea0d8574ab7a097cedff0ae5d60bb 100644 (file)
--- a/listing.c
+++ b/listing.c
@@ -306,7 +306,7 @@ void listeol(void)
        // deposited with dcb. The fix (kludge) is an extra variable which records
        // the fact that a 'ds.x' directive generated all the data, and it
        // shouldn't be listed
        // deposited with dcb. The fix (kludge) is an extra variable which records
        // the fact that a 'ds.x' directive generated all the data, and it
        // shouldn't be listed
-       savsect();                                               // Update section variables
+       SaveSection();                                               // Update section variables
 
        if (lcursect == cursect && (sect[lcursect].scattr & SBSS) == 0
                && lsloc != sloc && just_bss == 0)
 
        if (lcursect == cursect && (sect[lcursect].scattr & SBSS) == 0
                && lsloc != sloc && just_bss == 0)
diff --git a/mach.c b/mach.c
index 550db6129b6008d25d2cc1e06fb045e5e5762f70..db4512325ea2e9826d81768fe697d131e47e87cc 100644 (file)
--- a/mach.c
+++ b/mach.c
@@ -307,7 +307,7 @@ int m_shi(WORD inst, WORD siz)
        }
        else
        {
        }
        else
        {
-               fixup(FU_QUICK, sloc, a0expr);
+               AddFixup(FU_QUICK, sloc, a0expr);
                D_word(inst);
        }
 
                D_word(inst);
        }
 
@@ -372,7 +372,7 @@ int m_dbra(WORD inst, WORD siz)
        }
        else
        {
        }
        else
        {
-               fixup(FU_WORD | FU_PCREL | FU_ISBRA, sloc, a1expr);
+               AddFixup(FU_WORD | FU_PCREL | FU_ISBRA, sloc, a1expr);
                D_word(0);
        }
 
                D_word(0);
        }
 
@@ -489,7 +489,7 @@ int m_moveq(WORD inst, WORD siz)
        // Arrange for future fixup 
        if (!(a0exattr & DEFINED))
        {
        // Arrange for future fixup 
        if (!(a0exattr & DEFINED))
        {
-               fixup(FU_BYTE | FU_SEXT, sloc + 1, a0expr);
+               AddFixup(FU_BYTE | FU_SEXT, sloc + 1, a0expr);
                a0exval = 0; 
        }
        else if (a0exval + 0x100 >= 0x200)
                a0exval = 0; 
        }
        else if (a0exval + 0x100 >= 0x200)
@@ -599,7 +599,7 @@ int m_br(WORD inst, WORD siz)
        if (siz == SIZB)
        {
                // .B 
        if (siz == SIZB)
        {
                // .B 
-               fixup(FU_BBRA | FU_PCREL | FU_SEXT, sloc, a0expr);
+               AddFixup(FU_BBRA | FU_PCREL | FU_SEXT, sloc, a0expr);
                D_word(inst);
                return 0;
        }
                D_word(inst);
                return 0;
        }
@@ -607,7 +607,7 @@ int m_br(WORD inst, WORD siz)
        {
                // .W 
                D_word(inst);
        {
                // .W 
                D_word(inst);
-               fixup(FU_WORD | FU_PCREL | FU_LBRA | FU_ISBRA, sloc, a0expr);
+               AddFixup(FU_WORD | FU_PCREL | FU_LBRA | FU_ISBRA, sloc, a0expr);
                D_word(0);
        }
 
                D_word(0);
        }
 
@@ -632,7 +632,7 @@ int m_addq(WORD inst, WORD siz)
        }
        else
        {
        }
        else
        {
-               fixup(FU_QUICK, sloc, a0expr);
+               AddFixup(FU_QUICK, sloc, a0expr);
                D_word(inst);
        }
 
                D_word(inst);
        }
 
diff --git a/mark.c b/mark.c
index c33f4508559cd0eff331e792546d7f23949ecb22..3b3bd3ada80dd969415089218b95f5b0b59e6e5d 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -54,8 +54,9 @@ int rmark(uint16_t from, uint32_t loc, uint16_t to, uint16_t size, SYM * symbol)
 {
 #ifdef DEBUG_IMAGE_MARKING
 printf("rmark: from=%i, loc=$%X, to=$%X, size=$%x, symbol=$%X\n", from, loc, to, size, symbol);
 {
 #ifdef DEBUG_IMAGE_MARKING
 printf("rmark: from=%i, loc=$%X, to=$%X, size=$%x, symbol=$%X\n", from, loc, to, size, symbol);
+if (symbol)
+       printf("      symbol->stype=$%02X, sattr=$%04X, sattre=$%08X, svalue=%i, sname=%s\n", symbol->stype, symbol->sattr, symbol->sattre, symbol->svalue, symbol->sname);
 #endif
 #endif
-//     uint16_t w;
 
        if ((mcalloc - mcused) < MIN_MARK_MEM)
                amark();
 
        if ((mcalloc - mcused) < MIN_MARK_MEM)
                amark();
@@ -212,8 +213,12 @@ printf(" validsegment: raddr = $%08X\n", raddr);
                                else
                                        rflag = 0x00000040;     // Absolute fixup
 
                                else
                                        rflag = 0x00000040;     // Absolute fixup
 
+// This flag tells the linker to WORD swap the LONG when doing the fixup.
                                if (w & MMOVEI)
                                if (w & MMOVEI)
+//{
+//printf("bsdmarkimg: ORing $01 to rflag (MMOVEI) [symbol=%s]...\n", symbol->sname);
                                        rflag |= 0x00000001;
                                        rflag |= 0x00000001;
+//}
                        }
 
                        // Compute mark position in relocation information;
                        }
 
                        // Compute mark position in relocation information;
@@ -231,8 +236,14 @@ printf(" validsegment: raddr = $%08X\n", raddr);
                                        rflag |= 0x00000010;                    // Set external reloc flag bit
                                        rflag |= (symbol->senv << 8);   // Put symbol index in flags
 
                                        rflag |= 0x00000010;                    // Set external reloc flag bit
                                        rflag |= (symbol->senv << 8);   // Put symbol index in flags
 
+// Looks like this is completely unnecessary (considering it does the wrong thing!)
+#if 0
                                        if (symbol->sattre & RISCSYM)
                                        if (symbol->sattre & RISCSYM)
+{
+printf("bsdmarkimg: ORing $01 to rflag (RISCSYM) [symbol=%s]...\n", symbol->sname);
                                                rflag |= 0x00000001;
                                                rflag |= 0x00000001;
+}
+#endif
 
                                        if (validsegment)
                                        {
 
                                        if (validsegment)
                                        {
index 5ef768a44175dbde77b08ffbc58cc078798877b8..13805fd47cb2958ac575c796e935bfdd847c67a5 100644 (file)
--- a/parmode.h
+++ b/parmode.h
                        return ERROR;
 
                if (*tok == DOTW)
                        return ERROR;
 
                if (*tok == DOTW)
-               {                                    // expr.W 
+               {
+                       // expr.W 
                        tok++;
                        AMn = ABSW;
                        goto AnOK;
                }
                else if (*tok != '(')
                        tok++;
                        AMn = ABSW;
                        goto AnOK;
                }
                else if (*tok != '(')
-               {                              // expr[.L]
+               {
+                       // expr[.L]
                        AMn = ABSL;
                        AMn = ABSL;
-                       // Defined, absolute values from $FFFF8000..$00007FFF get optimized to absolute short
 
 
+                       // Defined, absolute values from $FFFF8000..$00007FFF get optimized
+                       // to absolute short
                        if ((AnEXATTR & (TDB|DEFINED)) == DEFINED && (AnEXVAL + 0x8000) < 0x10000)
                                AMn = ABSW;
 
                        if ((AnEXATTR & (TDB|DEFINED)) == DEFINED && (AnEXVAL + 0x8000) < 0x10000)
                                AMn = ABSW;
 
+                       // Is .L forced here?
                        if (*tok == DOTL)
                        if (*tok == DOTL)
-                       {                                 // force .L 
+                       {
                                tok++;
                                AMn = ABSL;
                        }
                                tok++;
                                AMn = ABSL;
                        }
index 727b9dbb5f5cb630544c4c95435b4a3387248572..b56b25461d9012c845e6720a107851b6f38d5a19 100644 (file)
--- a/procln.c
+++ b/procln.c
@@ -127,7 +127,6 @@ void Assemble(void)
        SYM * sy, * sy2;                        // Symbol (temp usage)
        char * opname = NULL;           // Name of dirctve/mnemonic/macro
        int listflag;                           // 0: Don't call listeol()
        SYM * sy, * sy2;                        // Symbol (temp usage)
        char * opname = NULL;           // Name of dirctve/mnemonic/macro
        int listflag;                           // 0: Don't call listeol()
-//     int as68mode = 0;                       // 1: Handle multiple labels
        WORD rmask;                                     // Register list, for REG
        int registerbank;                       // RISC register bank
        int riscreg;                            // RISC register
        WORD rmask;                                     // Register list, for REG
        int registerbank;                       // RISC register bank
        int riscreg;                            // RISC register
@@ -172,10 +171,9 @@ loop1:                                                                             // Internal line processing loop
        if (*tok == EOL)                                                // Restart loop if end-of-line
                goto loop;
 
        if (*tok == EOL)                                                // Restart loop if end-of-line
                goto loop;
 
-       // First token MUST be a symbol
+       // First token MUST be a symbol (Shamus: not sure why :-/)
        if (*tok != SYMBOL)
        {
        if (*tok != SYMBOL)
        {
-//             error(syntax_error);
                error("syntax error; expected symbol");
                goto loop;
        }
                error("syntax error; expected symbol");
                goto loop;
        }
@@ -194,28 +192,19 @@ loop1:                                                                            // Internal line processing loop
        if (j == ':' || j == DCOLON)
        {
 as68label:
        if (j == ':' || j == DCOLON)
        {
 as68label:
-//             label = (char *)tok[1];                         // Get label name
                label = string[tok[1]];                         // Get label name
                labtyp = tok[2];                                        // Get label type
                tok += 3;                                                       // Go to next line token
 
                label = string[tok[1]];                         // Get label name
                labtyp = tok[2];                                        // Get label type
                tok += 3;                                                       // Go to next line token
 
-               // Handle multiple labels; if there's another label, go process it, 
-               // and come back at `as68label' above.
-               if (as68_flag)
+               // AS68 MODE:
+               // Looks like another label follows the previous one, so handle
+               // the previous one until there aren't any more
+               if (as68_flag && (*tok == SYMBOL && tok[2] == ':'))
                {
                {
-//                     as68mode = 0;
-
-                       // Looks like another label follows the previous one, so handle
-                       // the previous one
-                       if (*tok == SYMBOL && tok[2] == ':')
-                       {
-//                             as68mode = 1;
-//                             goto do_label;
-                               if (HandleLabel(label, labtyp) != 0)
-                                       goto loop;
+                       if (HandleLabel(label, labtyp) != 0)
+                               goto loop;
 
 
-                               goto as68label;
-                       }
+                       goto as68label;
                }
        }
 
                }
        }
 
@@ -226,19 +215,11 @@ as68label:
        // Next token MUST be a symbol
        if (*tok++ != SYMBOL)
        {
        // Next token MUST be a symbol
        if (*tok++ != SYMBOL)
        {
-//             error(syntax_error);
                error("syntax error; expected symbol");
                goto loop;
        }
 
                error("syntax error; expected symbol");
                goto loop;
        }
 
-// This is the problem here: On 64-bit platforms, this cuts the native pointer
-// in half. We need to figure out how to fix this.
-//#warning "!!! Bad pointer !!!"
-#if 0
-       opname = p = (char *)*tok++;                    // Store opcode name here
-#else
        opname = p = string[*tok++];
        opname = p = string[*tok++];
-#endif
 
        // Check to see if the SYMBOL is a keyword (a mnemonic or directive).
        // On output, `state' will have one of the values:
 
        // Check to see if the SYMBOL is a keyword (a mnemonic or directive).
        // On output, `state' will have one of the values:
@@ -315,6 +296,7 @@ as68label:
                case MN_MACRO:                                          // .macro --- macro definition
                        if (!disabled)
                        {
                case MN_MACRO:                                          // .macro --- macro definition
                        if (!disabled)
                        {
+                               // Label on a macro definition is bad mojo... Warn the user
                                if (label != NULL)
                                        warn(lab_ignored);
 
                                if (label != NULL)
                                        warn(lab_ignored);
 
@@ -326,7 +308,6 @@ as68label:
                case MN_ENDM:                                           // .endm --- same as .exitm
                        if (!disabled)
                        {
                case MN_ENDM:                                           // .endm --- same as .exitm
                        if (!disabled)
                        {
-                               // Label on a macro definition is bad mojo... Warn the user
                                if (label != NULL)
                                        warn(lab_ignored);
 
                                if (label != NULL)
                                        warn(lab_ignored);
 
@@ -337,17 +318,12 @@ as68label:
                case MN_REPT:
                        if (!disabled)
                        {
                case MN_REPT:
                        if (!disabled)
                        {
-#if 0
-                               if (label != NULL)
-                                       warn(lab_ignored);
-#else
                                // Handle labels on REPT directive lines...
                                if (label)
                                {
                                        if (HandleLabel(label, labtyp) != 0)
                                                goto loop;
                                }
                                // Handle labels on REPT directive lines...
                                if (label)
                                {
                                        if (HandleLabel(label, labtyp) != 0)
                                                goto loop;
                                }
-#endif
 
                                defrept();
                        }
 
                                defrept();
                        }
@@ -369,14 +345,7 @@ normal:
        if (equate != NULL)
        {
                // Pick global or local symbol enviroment
        if (equate != NULL)
        {
                // Pick global or local symbol enviroment
-#if 0
-               j = 0;
-
-               if (*equate == '.')
-                       j = curenv;
-#else
                j = (*equate == '.' ? curenv : 0);
                j = (*equate == '.' ? curenv : 0);
-#endif
                sy = lookup(equate, LABEL, j);
 
                if (sy == NULL)
                sy = lookup(equate, LABEL, j);
 
                if (sy == NULL)
@@ -419,7 +388,7 @@ normal:
 
                // Put symbol in "order of definition" list
                if (!(sy->sattr & SDECLLIST))
 
                // Put symbol in "order of definition" list
                if (!(sy->sattr & SDECLLIST))
-                       sym_decl(sy);
+                       AddToSymbolOrderList(sy);
 
                // Parse value to equate symbol to;
                // o  .equr
 
                // Parse value to equate symbol to;
                // o  .equr
@@ -445,7 +414,8 @@ checking to see if it's already been equated, issue a warning.
                        // Check for register to equate to
                        if ((*tok >= KW_R0) && (*tok <= KW_R31))
                        {
                        // Check for register to equate to
                        if ((*tok >= KW_R0) && (*tok <= KW_R31))
                        {
-                               sy->sattre  = EQUATEDREG | RISCSYM;     // Mark as equated register
+//                             sy->sattre  = EQUATEDREG | RISCSYM;     // Mark as equated register
+                               sy->sattre  = EQUATEDREG;       // Mark as equated register
                                riscreg = (*tok - KW_R0);
 //is there any reason to do this, since we're putting this in svalue?
 //i'm thinking, no. Let's test that out! :-D
                                riscreg = (*tok - KW_R0);
 //is there any reason to do this, since we're putting this in svalue?
 //i'm thinking, no. Let's test that out! :-D
@@ -589,63 +559,9 @@ checking to see if it's already been equated, issue a warning.
        // Do labels
        if (label != NULL)
        {
        // Do labels
        if (label != NULL)
        {
-do_label:
-#if 0
-               // Check for dot in front of label; means this is a local label if present
-               j = (*label == '.' ? curenv : 0);
-               sy = lookup(label, LABEL, j);
-
-               if (sy == NULL)
-               {
-                       sy = NewSymbol(label, LABEL, j);
-                       sy->sattr = 0;
-                       sy->sattre = RISCSYM;
-               }
-               else if (sy->sattr & DEFINED)
-               {
-                       errors("multiply-defined label '%s'", label);
-                       goto loop;
-               }
-
-               // Put symbol in "order of definition" list
-               if (!(sy->sattr & SDECLLIST))
-                       sym_decl(sy);
-
-               if (orgactive)
-               {
-                       sy->svalue = orgaddr;
-                       sy->sattr |= ABS | DEFINED | EQUATED;
-               }
-               else
-               {
-                       sy->svalue = sloc;
-                       sy->sattr |= DEFINED | cursect;
-               }
-
-               lab_sym = sy;
-
-               if (!j)
-                       curenv++;
-
-               // Make label global
-               if (labtyp == DCOLON)
-               {
-                       if (j)
-                       {
-                               error(locgl_error);
-                               goto loop;
-                       }
-
-                       sy->sattr |= GLOBAL;
-               }
-#else
                // Non-zero == error occurred
                if (HandleLabel(label, labtyp) != 0)
                        goto loop;
                // Non-zero == error occurred
                if (HandleLabel(label, labtyp) != 0)
                        goto loop;
-#endif
-               // If we're in as68 mode, and there's another label, go back and handle it
-//             if (as68_flag && as68mode)
-//                     goto as68label;
        }
 
        // Punt on EOL
        }
 
        // Punt on EOL
@@ -765,45 +681,46 @@ do_label:
 int HandleLabel(char * label, int labelType)
 {
        // Check for dot in front of label; means this is a local label if present
 int HandleLabel(char * label, int labelType)
 {
        // Check for dot in front of label; means this is a local label if present
-       int j = (*label == '.' ? curenv : 0);
-       SYM * sy = lookup(label, LABEL, j);
+       int environment = (*label == '.' ? curenv : 0);
+       SYM * symbol = lookup(label, LABEL, environment);
 
 
-       if (sy == NULL)
+       if (symbol == NULL)
        {
        {
-               sy = NewSymbol(label, LABEL, j);
-               sy->sattr = 0;
-               sy->sattre = RISCSYM;
+               symbol = NewSymbol(label, LABEL, environment);
+               symbol->sattr = 0;
+//             symbol->sattre = RISCSYM;
+               symbol->sattre = 0;
        }
        }
-       else if (sy->sattr & DEFINED)
+       else if (symbol->sattr & DEFINED)
                return errors("multiply-defined label '%s'", label);
 
        // Put symbol in "order of definition" list
                return errors("multiply-defined label '%s'", label);
 
        // Put symbol in "order of definition" list
-       if (!(sy->sattr & SDECLLIST))
-               sym_decl(sy);
+       if (!(symbol->sattr & SDECLLIST))
+               AddToSymbolOrderList(symbol);
 
        if (orgactive)
        {
 
        if (orgactive)
        {
-               sy->svalue = orgaddr;
-               sy->sattr |= ABS | DEFINED | EQUATED;
+               symbol->svalue = orgaddr;
+               symbol->sattr |= ABS | DEFINED | EQUATED;
        }
        else
        {
        }
        else
        {
-               sy->svalue = sloc;
-               sy->sattr |= DEFINED | cursect;
+               symbol->svalue = sloc;
+               symbol->sattr |= DEFINED | cursect;
        }
 
        }
 
-       lab_sym = sy;
+       lab_sym = symbol;
 
 
-       if (!j)
+       if (0 == environment)
                curenv++;
 
        // Make label global if it has a double colon
        if (labelType == DCOLON)
        {
                curenv++;
 
        // Make label global if it has a double colon
        if (labelType == DCOLON)
        {
-               if (j)
+               if (environment != 0)
                        return error(locgl_error);
 
                        return error(locgl_error);
 
-               sy->sattr |= GLOBAL;
+               symbol->sattr |= GLOBAL;
        }
 
        return 0;
        }
 
        return 0;
@@ -883,3 +800,4 @@ int d_endif (void)
        f_ifent = rif;
        return 0;
 }
        f_ifent = rif;
        return 0;
 }
+
index 2754600b2dabdcee7561eae01cb717e64c6cc4aa..e55a9861cbb8e53b31dbf546328439fd6b5af148 100644 (file)
--- a/riscasm.c
+++ b/riscasm.c
@@ -3,7 +3,7 @@
 // RISCA.C - GPU/DSP Assembler
 // Copyright (C) 199x Landon Dyer, 2011 Reboot and Friends
 // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
 // RISCA.C - GPU/DSP Assembler
 // Copyright (C) 199x Landon Dyer, 2011 Reboot and Friends
 // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
-// Source Utilised with the Kind Permission of Landon Dyer
+// Source utilised with the kind permission of Landon Dyer
 //
 
 #include "riscasm.h"
 //
 
 #include "riscasm.h"
 #include "mark.h"
 #include "amode.h"
 
 #include "mark.h"
 #include "amode.h"
 
-#define DEF_MR                         // Declar keyword values
-#include "risckw.h"                    // Incl generated risc keywords
+#define DEF_MR                         // Declare keyword values
+#include "risckw.h"                    // Incl. generated risc keywords
 
 #define DEF_KW                         // Declare keyword values 
 
 #define DEF_KW                         // Declare keyword values 
-#include "kwtab.h"                     // Incl generated keyword tables & defs
+#include "kwtab.h"                     // Incl. generated keyword tables & defs
 
 
 unsigned altbankok = 0;                // Ok to use alternate register bank
 
 
 unsigned altbankok = 0;                // Ok to use alternate register bank
@@ -28,22 +28,22 @@ unsigned orgaddr = 0;               // Org'd address
 unsigned orgwarning = 0;       // Has an ORG warning been issued
 int lastOpcode = -1;           // Last RISC opcode assembled
 
 unsigned orgwarning = 0;       // Has an ORG warning been issued
 int lastOpcode = -1;           // Last RISC opcode assembled
 
-char reg_err[] = "missing register R0...R31";
+const char reg_err[] = "missing register R0...R31";
 
 // Jaguar Jump Condition Names
 
 // Jaguar Jump Condition Names
-char condname[MAXINTERNCC][5] = { 
+const char condname[MAXINTERNCC][5] = { 
        "NZ", "Z", "NC", "NCNZ", "NCZ", "C", "CNZ", "CZ", "NN", "NNNZ", "NNZ",
        "N", "N_NZ", "N_Z", "T", "A", "NE", "EQ", "CC", "HS", "HI", "CS", "LO",
        "PL", "MI", "F"
 };
 
 // Jaguar Jump Condition Numbers
        "NZ", "Z", "NC", "NCNZ", "NCZ", "C", "CNZ", "CZ", "NN", "NNNZ", "NNZ",
        "N", "N_NZ", "N_Z", "T", "A", "NE", "EQ", "CC", "HS", "HI", "CS", "LO",
        "PL", "MI", "F"
 };
 
 // Jaguar Jump Condition Numbers
-char condnumber[] = {
+const char condnumber[] = {
        1, 2, 4, 5, 6, 8, 9, 10, 20, 21, 22, 24, 25, 26,
        0, 0, 1, 2, 4, 4, 5,  8,  8, 20, 24, 31
 };
 
        1, 2, 4, 5, 6, 8, 9, 10, 20, 21, 22, 24, 25, 26,
        0, 0, 1, 2, 4, 4, 5,  8,  8, 20, 24, 31
 };
 
-struct opcoderecord roptbl[] = {
+const struct opcoderecord roptbl[] = {
        { MR_ADD,     RI_TWO,    0 },
        { MR_ADDC,    RI_TWO,    1 },
        { MR_ADDQ,    RI_NUM_32, 2 },
        { MR_ADD,     RI_TWO,    0 },
        { MR_ADDC,    RI_TWO,    1 },
        { MR_ADDQ,    RI_NUM_32, 2 },
@@ -110,7 +110,7 @@ struct opcoderecord roptbl[] = {
 
 
 //
 
 
 //
-// Convert a String to Uppercase
+// Convert a string to uppercase
 //
 void strtoupper(char * s)
 {
 //
 void strtoupper(char * s)
 {
@@ -127,20 +127,20 @@ static inline int MalformedOpcode(int signal)
 {
        char buf[16];
        sprintf(buf, "%02X", signal);
 {
        char buf[16];
        sprintf(buf, "%02X", signal);
-       errors("Malformed opcode [internal $%s]", buf);
-       return ERROR;
+       return errors("Malformed opcode [internal $%s]", buf);
 }
 
 
 //
 }
 
 
 //
-// Build RISC Instruction Word
+// Build RISC instruction word
 //
 void BuildRISCIntructionWord(unsigned short opcode, int reg1, int reg2)
 {
        // Check for absolute address setting
        if (!orgwarning && !orgactive)
        {
 //
 void BuildRISCIntructionWord(unsigned short opcode, int reg1, int reg2)
 {
        // Check for absolute address setting
        if (!orgwarning && !orgactive)
        {
-               warn("GPU/DSP code outside of absolute section");
+//             warn("GPU/DSP code outside of absolute section");
+               warn("RISC code generated with no origin defined");
                orgwarning = 1;
        }
 
                orgwarning = 1;
        }
 
@@ -150,7 +150,7 @@ void BuildRISCIntructionWord(unsigned short opcode, int reg1, int reg2)
 
 
 //
 
 
 //
-// Get a RISC Register
+// Get a RISC register
 //
 int GetRegister(WORD rattr)
 {
 //
 int GetRegister(WORD rattr)
 {
@@ -170,7 +170,7 @@ int GetRegister(WORD rattr)
 
        if (!(eattr & DEFINED))
        {
 
        if (!(eattr & DEFINED))
        {
-               fixup((WORD)(FU_WORD | rattr), sloc, r_expr);      
+               AddFixup((WORD)(FU_WORD | rattr), sloc, r_expr);      
                return 0;
        }
 
                return 0;
        }
 
@@ -179,13 +179,12 @@ int GetRegister(WORD rattr)
                return eval;
 
        // Otherwise, it's out of range & we flag an error
                return eval;
 
        // Otherwise, it's out of range & we flag an error
-       error(reg_err);
-       return ERROR;
+       return error(reg_err);
 }
 
 
 //
 }
 
 
 //
-// Do RISC Code Generation
+// Do RISC code generation
 //
 int GenerateRISCCode(int state)
 {
 //
 int GenerateRISCCode(int state)
 {
@@ -213,10 +212,7 @@ int GenerateRISCCode(int state)
        // specific to only one of the RISC processors and ensure it is legal in
        // the current code section. If not then show error and return.
        if (((parm & GPUONLY) && rdsp) || ((parm & DSPONLY) && rgpu))
        // specific to only one of the RISC processors and ensure it is legal in
        // the current code section. If not then show error and return.
        if (((parm & GPUONLY) && rdsp) || ((parm & DSPONLY) && rgpu))
-       {
-               error("Opcode is not valid in this code section");
-               return ERROR;
-       }
+               return error("Opcode is not valid in this code section");
 
        // Process RISC opcode
        switch (type)
 
        // Process RISC opcode
        switch (type)
@@ -294,16 +290,13 @@ int GenerateRISCCode(int state)
 
                if (!(eattr & DEFINED))
                {
 
                if (!(eattr & DEFINED))
                {
-                       fixup((WORD)(FU_WORD | attrflg), sloc, r_expr);
+                       AddFixup((WORD)(FU_WORD | attrflg), sloc, r_expr);
                        reg1 = 0;
                }
                else
                {
                        if ((int)eval < reg1 || (int)eval > reg2)
                        reg1 = 0;
                }
                else
                {
                        if ((int)eval < reg1 || (int)eval > reg2)
-                       {
-                               error("constant out of range");
-                               return ERROR;
-                       }
+                               return error("constant out of range");
 
                        if (parm & SUB32) 
                                reg1 = 32 - eval; 
 
                        if (parm & SUB32) 
                                reg1 = 32 - eval; 
@@ -346,7 +339,7 @@ int GenerateRISCCode(int state)
 
                if (!(eattr & DEFINED))
                {
 
                if (!(eattr & DEFINED))
                {
-                       fixup(FU_LONG | FU_MOVEI, sloc + 2, r_expr);
+                       AddFixup(FU_LONG | FU_MOVEI, sloc + 2, r_expr);
                        eval = 0;
                }
                else
                        eval = 0;
                }
                else
@@ -467,10 +460,7 @@ int GenerateRISCCode(int state)
                                                chcheck(4L);
 
                                        if (!(eattr & DEFINED))
                                                chcheck(4L);
 
                                        if (!(eattr & DEFINED))
-                                       {
-                                               error("constant expected after '+'");
-                                               return ERROR;
-                                       }
+                                               return error("constant expected after '+'");
 
                                        reg1 = eval;
 
 
                                        reg1 = eval;
 
@@ -483,10 +473,7 @@ int GenerateRISCCode(int state)
                                        else
                                        {
                                                if (reg1 < 1 || reg1 > 32)
                                        else
                                        {
                                                if (reg1 < 1 || reg1 > 32)
-                                               {
-                                                       error("constant in LOAD out of range");
-                                                       return ERROR;
-                                               }
+                                                       return error("constant in LOAD out of range");
 
                                                if (reg1 == 32)
                                                        reg1 = 0;
 
                                                if (reg1 == 32)
                                                        reg1 = 0;
@@ -528,7 +515,6 @@ int GenerateRISCCode(int state)
 
                if (*tok == SYMBOL)
                {
 
                if (*tok == SYMBOL)
                {
-//                     sy = lookup((char *)tok[1], LABEL, 0);
                        sy = lookup(string[tok[1]], LABEL, 0);
 
                        if (!sy)
                        sy = lookup(string[tok[1]], LABEL, 0);
 
                        if (!sy)
@@ -568,7 +554,6 @@ int GenerateRISCCode(int state)
 
                                if (*tok == SYMBOL)
                                {
 
                                if (*tok == SYMBOL)
                                {
-//                                     sy = lookup((char *)tok[1], LABEL, 0);
                                        sy = lookup(string[tok[1]], LABEL, 0);
 
                                        if (!sy)
                                        sy = lookup(string[tok[1]], LABEL, 0);
 
                                        if (!sy)
@@ -595,7 +580,7 @@ int GenerateRISCCode(int state)
 
                                        if (!(eattr & DEFINED))
                                        {
 
                                        if (!(eattr & DEFINED))
                                        {
-                                               fixup(FU_WORD | FU_REGTWO, sloc, r_expr);
+                                               AddFixup(FU_WORD | FU_REGTWO, sloc, r_expr);
                                                reg2 = 0;
                                        }
                                        else
                                                reg2 = 0;
                                        }
                                        else
@@ -611,10 +596,7 @@ int GenerateRISCCode(int state)
                                                else
                                                {
                                                        if (reg2 < 1 || reg2 > 32)
                                                else
                                                {
                                                        if (reg2 < 1 || reg2 > 32)
-                                                       {
-                                                               error("constant in STORE out of range");
-                                                               return ERROR;
-                                                       }
+                                                               return error("constant in STORE out of range");
 
                                                        if (reg2 == 32)
                                                                reg2 = 0;
 
                                                        if (reg2 == 32)
                                                                reg2 = 0;
@@ -731,10 +713,7 @@ int GenerateRISCCode(int state)
                                                val = ccsym->svalue;
                                        }
                                        else
                                                val = ccsym->svalue;
                                        }
                                        else
-                                       {
-                                               error("unknown condition code");
-                                               return ERROR;
-                                       }
+                                               return error("unknown condition code");
                                }
 
                                tok += 2;
                                }
 
                                tok += 2;
@@ -753,10 +732,7 @@ int GenerateRISCCode(int state)
                }
 
                if (val < 0 || val > 31)
                }
 
                if (val < 0 || val > 31)
-               {
-                       error("condition constant out of range");
-                       return ERROR;
-               }
+                       return error("condition constant out of range");
 
                // Store condition code
                reg1 = val;
 
                // Store condition code
                reg1 = val;
@@ -772,7 +748,7 @@ int GenerateRISCCode(int state)
 
                        if (!(eattr & DEFINED))
                        {
 
                        if (!(eattr & DEFINED))
                        {
-                               fixup(FU_WORD | FU_JR, sloc, r_expr);
+                               AddFixup(FU_WORD | FU_JR, sloc, r_expr);
                                reg2 = 0;
                        }
                        else
                                reg2 = 0;
                        }
                        else
@@ -806,8 +782,7 @@ int GenerateRISCCode(int state)
 
        // Should never get here :-D
        default:
 
        // Should never get here :-D
        default:
-               error("Unknown risc opcode type");
-               return ERROR;
+               return error("Unknown RISC opcode type");
        }
 
        lastOpcode = type;
        }
 
        lastOpcode = type;
diff --git a/rmac.c b/rmac.c
index c47adf2b2997cd60fe8e519cab9f3f1b516cdc3c..4506a95b517616d02d86b878fccab0877bff6605 100644 (file)
--- a/rmac.c
+++ b/rmac.c
@@ -105,9 +105,9 @@ int kmatch(char * p, int * base, int * check, int * tab, int * accept)
 //
 void autoeven(int sect)
 {
 //
 void autoeven(int sect)
 {
-       switchsect(sect);
+       SwitchSection(sect);
        d_even();
        d_even();
-       savsect();
+       SaveSection();
 }
 
 
 }
 
 
@@ -470,11 +470,11 @@ int process(int argc, char ** argv)
        // o  determine name of object file:
        //    -  "foo.o" for linkable output;
        //    -  "foo.prg" for GEMDOS executable (-p flag).
        // o  determine name of object file:
        //    -  "foo.o" for linkable output;
        //    -  "foo.prg" for GEMDOS executable (-p flag).
-       savsect();
+       SaveSection();
 
        for(i=TEXT; i<=BSS; i<<=1)
        {
 
        for(i=TEXT; i<=BSS; i<<=1)
        {
-               switchsect(i);
+               SwitchSection(i);
 
                switch(segpadsize)
                {
 
                switch(segpadsize)
                {
@@ -485,7 +485,7 @@ int process(int argc, char ** argv)
                case 32: d_qphrase(); break;
                }
 
                case 32: d_qphrase(); break;
                }
 
-               savsect();
+               SaveSection();
        }
 
        if (objfname == NULL)
        }
 
        if (objfname == NULL)
diff --git a/rmac.h b/rmac.h
index 25f69f58757f4e42951387d42b1f3ccaabade7b2..24da33d17a5ac62c18ab853d4e432f92b1173170 100644 (file)
--- a/rmac.h
+++ b/rmac.h
@@ -165,7 +165,7 @@ PTR
 #define EQUATEDCC    0x0020
 #define UNDEF_CC     0x0040
 
 #define EQUATEDCC    0x0020
 #define UNDEF_CC     0x0040
 
-#define RISCSYM      0x00010000
+//#define RISCSYM      0x00010000
 
 // Globals, externals etc
 extern int verb_flag;
 
 // Globals, externals etc
 extern int verb_flag;
@@ -183,7 +183,7 @@ extern int lsym_flag;
 extern int sbra_flag;
 extern int obj_format;
 extern int legacy_flag;
 extern int sbra_flag;
 extern int obj_format;
 extern int legacy_flag;
-extern LONG amemtot;
+//extern LONG amemtot;
 
 // Prototypes
 void init_sym(void);
 
 // Prototypes
 void init_sym(void);
diff --git a/sect.c b/sect.c
index fe630b15d3a2f8aaf1b4f8a36ac0d33f34b65f78..d4277fcc0aad7f501d4b2b89d179945ab3b60033 100644 (file)
--- a/sect.c
+++ b/sect.c
@@ -19,8 +19,8 @@
 
 
 // Function prototypes
 
 
 // Function prototypes
-void mksect(int, WORD);
-void switchsect(int);
+void MakeSection(int, WORD);
+void SwitchSection(int);
 
 // Section descriptors
 SECT sect[NSECTS];                             // All sections... 
 
 // Section descriptors
 SECT sect[NSECTS];                             // All sections... 
@@ -77,23 +77,23 @@ void InitSection(void)
 
        // Cleanup all sections
        for(i=0; i<NSECTS; i++)
 
        // Cleanup all sections
        for(i=0; i<NSECTS; i++)
-               mksect(i, 0);
+               MakeSection(i, 0);
 
        // Construct default sections, make TEXT the current section
 
        // Construct default sections, make TEXT the current section
-       mksect(ABS,   SUSED | SABS | SBSS);             // ABS
-       mksect(TEXT,  SUSED | TEXT       );             // TEXT
-       mksect(DATA,  SUSED | DATA       );             // DATA
-       mksect(BSS,   SUSED | BSS | SBSS );             // BSS
-//     mksect(M6502, SUSED | TEXT       );             // 6502 code section
+       MakeSection(ABS,   SUSED | SABS | SBSS);                // ABS
+       MakeSection(TEXT,  SUSED | TEXT       );                // TEXT
+       MakeSection(DATA,  SUSED | DATA       );                // DATA
+       MakeSection(BSS,   SUSED | BSS  | SBSS);                // BSS
+//     MakeSection(M6502, SUSED | TEXT       );                // 6502 code section
 
 
-       switchsect(TEXT);                                               // Switch to TEXT for starters
+       SwitchSection(TEXT);                                            // Switch to TEXT for starters
 }
 
 
 //
 // Make a New (Clean) Section
 //
 }
 
 
 //
 // Make a New (Clean) Section
 //
-void mksect(int sno, WORD attr)
+void MakeSection(int sno, WORD attr)
 {
        SECT * p = &sect[sno];
        p->scattr = attr;
 {
        SECT * p = &sect[sno];
        p->scattr = attr;
@@ -104,10 +104,10 @@ void mksect(int sno, WORD attr)
 
 
 //
 
 
 //
-// Switch to Another Section (Copy Section & Chunk Descriptors to Global Vars
-// for Fast Access)
+// Switch to another section (copy section & chunk descriptors to global vars
+// for fast access)
 //
 //
-void switchsect(int sno)
+void SwitchSection(int sno)
 {
        CHUNK * cp;                                                             // Chunk pointer
        cursect = sno;
 {
        CHUNK * cp;                                                             // Chunk pointer
        cursect = sno;
@@ -141,9 +141,9 @@ void switchsect(int sno)
 
 
 //
 
 
 //
-// Save Current Section
+// Save current section
 //
 //
-void savsect(void)
+void SaveSection(void)
 {
        SECT * p = &sect[cursect];
 
 {
        SECT * p = &sect[cursect];
 
@@ -263,14 +263,14 @@ int chcheck(LONG amt)
 //
 // Arrange for a fixup on a location
 //
 //
 // Arrange for a fixup on a location
 //
-int fixup(WORD attr, LONG loc, TOKEN * fexpr)
+int AddFixup(WORD attr, LONG loc, TOKEN * fexpr)
 {
        LONG i;
        LONG len = 0;
        CHUNK * cp;
        SECT * p;
        // Shamus: Expression lengths are voodoo ATM (variable "i"). Need to fix this.
 {
        LONG i;
        LONG len = 0;
        CHUNK * cp;
        SECT * p;
        // Shamus: Expression lengths are voodoo ATM (variable "i"). Need to fix this.
-#warning "!!! fixup() is filled with VOODOO !!!"
+#warning "!!! AddFixup() is filled with VOODOO !!!"
        DEBUG printf("FIXUP@$%X: $%X\n", loc, attr);
 
        // Compute length of expression (could be faster); determine if it's the
        DEBUG printf("FIXUP@$%X: $%X\n", loc, attr);
 
        // Compute length of expression (could be faster); determine if it's the
@@ -280,7 +280,7 @@ int fixup(WORD attr, LONG loc, TOKEN * fexpr)
        {
                // Just a single symbol
                // SCPCD : correct bit mask for attr (else other FU_xxx will match) NYAN !
        {
                // Just a single symbol
                // SCPCD : correct bit mask for attr (else other FU_xxx will match) NYAN !
-               if ((attr & 0x0F00) == FU_JR)
+               if ((attr & FUMASKRISC) == FU_JR)
                {
 //                     i = 18;
 //                     i = FIXUP_BASE_SIZE + (sizeof(LONG) * 2);
                {
 //                     i = 18;
 //                     i = FIXUP_BASE_SIZE + (sizeof(LONG) * 2);
@@ -358,7 +358,7 @@ int fixup(WORD attr, LONG loc, TOKEN * fexpr)
        }
 
        // SCPCD : correct bit mask for attr (else other FU_xxx will match) NYAN !
        }
 
        // SCPCD : correct bit mask for attr (else other FU_xxx will match) NYAN !
-       if ((attr & 0x0F00) == FU_JR)
+       if ((attr & FUMASKRISC) == FU_JR)
        {
                if (orgactive)
                        *fchptr.lp++ = orgaddr;
        {
                if (orgactive)
                        *fchptr.lp++ = orgaddr;
@@ -388,28 +388,6 @@ int ResolveAllFixups(void)
        DEBUG printf("Resolving DATA sections...\n");
        ResolveFixups(DATA);
 
        DEBUG printf("Resolving DATA sections...\n");
        ResolveFixups(DATA);
 
-//No, no we don't.
-#if 0  
-       // We need to do a final check of forward 'jump' destination addresses that
-       // are external
-       for(i=0; i<MAXFWDJUMPS; i++)
-       {
-               if (fwdjump[i])
-               {
-                       err_setup();
-                       sprintf(buf, "* \'jump\' at $%08X - destination address is external to this source file and cannot have its aligment validated", fwdjump[i]);
-
-                       if (listing > 0)
-                               ship_ln(buf);
-
-                       if (err_flag)
-                               write(err_fd, buf, (LONG)strlen(buf));
-                       else
-                               printf("%s\n", buf);
-               }
-       }
-#endif
-
        return 0;
 }
 
        return 0;
 }
 
@@ -444,9 +422,11 @@ int ResolveFixups(int sno)
        if (ch == NULL)
                return 0;
 
        if (ch == NULL)
                return 0;
 
-       CHUNK * cch = sc->sfcode;                               // "cache" first chunk
+       // "Cache" first chunk
+       CHUNK * cch = sc->sfcode;
 
 
-       if (cch == NULL)                                                // Can't fixup a sect with nothing in it
+       // Can't fixup a sect with nothing in it
+       if (cch == NULL)
                return 0;
 
        do
                return 0;
 
        do
@@ -481,7 +461,8 @@ DEBUG { printf("ResolveFixups: cfileno=%u\n", cfileno); }
 
                                if (cch == NULL)
                                {
 
                                if (cch == NULL)
                                {
-                                       interror(7);                    // Fixup (loc) out of range 
+                                       // Fixup (loc) out of range 
+                                       interror(7);
                                        // NOTREACHED
                                }
                        }
                                        // NOTREACHED
                                }
                        }
@@ -522,14 +503,20 @@ DEBUG { printf("ResolveFixups: cfileno=%u\n", cfileno); }
 
                        // If the expression is undefined and no external symbol is
                        // involved, then it's an error.
 
                        // If the expression is undefined and no external symbol is
                        // involved, then it's an error.
-                       if (!(eattr & DEFINED) && esym == NULL)
+                       if (!(eattr & DEFINED) && (esym == NULL))
                        {
                                error(undef_error);
                                continue;
                        }
 
                        {
                                error(undef_error);
                                continue;
                        }
 
-                       if (((w & 0x0F00) == FU_MOVEI) && esym)
+// It seems that this is completely unnecessary!
+#if 0
+                       if (((w & FUMASKRISC) == FU_MOVEI) && esym)
+//{
+//printf("DoFixups: Setting symbol attre to RISCSYM...\n");
                                esym->sattre |= RISCSYM;
                                esym->sattre |= RISCSYM;
+//}
+#endif
 
                        // Do the fixup
                        // 
 
                        // Do the fixup
                        // 
@@ -625,7 +612,7 @@ DEBUG { printf("ResolveFixups: cfileno=%u\n", cfileno); }
                        // the word could be unaligned in the section buffer, so we have to
                        // be careful.
                        case FU_WORD:
                        // the word could be unaligned in the section buffer, so we have to
                        // be careful.
                        case FU_WORD:
-                               if ((w & 0x0F00) == FU_JR)// || ((w & 0x0F00) == FU_MJR))
+                               if ((w & FUMASKRISC) == FU_JR)// || ((w & 0x0F00) == FU_MJR))
                                {
                                        oaddr = *fup.lp++;
 
                                {
                                        oaddr = *fup.lp++;
 
@@ -685,7 +672,7 @@ DEBUG { printf("ResolveFixups: cfileno=%u\n", cfileno); }
                                        break;
                                }
 
                                        break;
                                }
 
-                               if ((w & 0x0F00) == FU_NUM15)
+                               if ((w & FUMASKRISC) == FU_NUM15)
                                {
                                        if (eval < -16 || eval > 15)
                                        {
                                {
                                        if (eval < -16 || eval > 15)
                                        {
@@ -699,7 +686,7 @@ DEBUG { printf("ResolveFixups: cfileno=%u\n", cfileno); }
                                        break;
                                }
 
                                        break;
                                }
 
-                               if ((w & 0x0F00) == FU_NUM31)
+                               if ((w & FUMASKRISC) == FU_NUM31)
                                {
                                        if (eval < 0 || eval > 31)
                                        {
                                {
                                        if (eval < 0 || eval > 31)
                                        {
@@ -713,7 +700,7 @@ DEBUG { printf("ResolveFixups: cfileno=%u\n", cfileno); }
                                        break;
                                }
 
                                        break;
                                }
 
-                               if ((w & 0x0F00) == FU_NUM32)
+                               if ((w & FUMASKRISC) == FU_NUM32)
                                {
                                        if (eval < 1 || eval > 32)
                                        {
                                {
                                        if (eval < 1 || eval > 32)
                                        {
@@ -731,7 +718,7 @@ DEBUG { printf("ResolveFixups: cfileno=%u\n", cfileno); }
                                        break;
                                }
 
                                        break;
                                }
 
-                               if ((w & 0x0F00) == FU_REGONE)
+                               if ((w & FUMASKRISC) == FU_REGONE)
                                {
                                        if (eval < 0 || eval > 31)
                                        {
                                {
                                        if (eval < 0 || eval > 31)
                                        {
@@ -745,7 +732,7 @@ DEBUG { printf("ResolveFixups: cfileno=%u\n", cfileno); }
                                        break;
                                }
 
                                        break;
                                }
 
-                               if ((w & 0x0F00) == FU_REGTWO)
+                               if ((w & FUMASKRISC) == FU_REGTWO)
                                {
                                        if (eval < 0 || eval > 31)
                                        {
                                {
                                        if (eval < 0 || eval > 31)
                                        {
@@ -797,7 +784,7 @@ DEBUG { printf("ResolveFixups: cfileno=%u\n", cfileno); }
                        // the long could be unaligned in the section buffer, so be careful
                        // (again).
                        case FU_LONG:
                        // the long could be unaligned in the section buffer, so be careful
                        // (again).
                        case FU_LONG:
-                               if ((w & 0x0F00) == FU_MOVEI)
+                               if ((w & FUMASKRISC) == FU_MOVEI)
                                {
 #if 0
                                        address = loc + 4;
                                {
 #if 0
                                        address = loc + 4;
@@ -851,6 +838,7 @@ DEBUG { printf("ResolveFixups: cfileno=%u\n", cfileno); }
                                        }
 #endif
 
                                        }
 #endif
 
+                                       // Long constant in MOVEI # is word-swapped, so fix it here
                                        eval = ((eval >> 16) & 0x0000FFFF) | ((eval << 16) & 0xFFFF0000);
                                        flags = (MLONG | MMOVEI);
                                }
                                        eval = ((eval >> 16) & 0x0000FFFF) | ((eval << 16) & 0xFFFF0000);
                                        flags = (MLONG | MMOVEI);
                                }
diff --git a/sect.h b/sect.h
index d86056d33372df357fa664a770f9b8e22d0cc174..8759eda1dcbd9c41a996f1a5be7fae3847d1c08b 100644 (file)
--- a/sect.h
+++ b/sect.h
 #define FU_PCREL     020                       // Subtract PC first
 #define FU_EXPR      040                       // Expression (not symbol) follows
 
 #define FU_PCREL     020                       // Subtract PC first
 #define FU_EXPR      040                       // Expression (not symbol) follows
 
+#define FUMASKRISC     0x0F00                  // Mask for RISC fixup cases
 #define FU_MOVEI     0x0100
 #define FU_JR        0x0200
 #define FU_MOVEI     0x0100
 #define FU_JR        0x0200
-//#define FU_MJR       0x0300
 #define FU_REGONE    0x0400
 #define FU_NUM15     0x0500
 #define FU_NUM31     0x0600
 #define FU_NUM32     0x0700
 #define FU_REGTWO    0x0800
 #define FU_REGONE    0x0400
 #define FU_NUM15     0x0500
 #define FU_NUM31     0x0600
 #define FU_NUM32     0x0700
 #define FU_REGTWO    0x0800
+
 #define FU_SUB32     0x1000
 #define FU_ISBRA     0x2000                    // Word forward fixup is a BRA or DBRA
 #define FU_LBRA      0x4000                    // Long branch, for short branch detect
 #define FU_SUB32     0x1000
 #define FU_ISBRA     0x2000                    // Word forward fixup is a BRA or DBRA
 #define FU_LBRA      0x4000                    // Long branch, for short branch detect
@@ -120,10 +121,6 @@ MCHUNK {
 #define MCHEND       0x2000                    // Indicates end of mark chunk
 #define MPCREL       0x1000                    // Mark is PC-relative
 
 #define MCHEND       0x2000                    // Indicates end of mark chunk
 #define MPCREL       0x1000                    // Mark is PC-relative
 
-//#define MAXFWDJUMPS  1024                    // Maximum forward jumps to check
-//extern unsigned fwdjump[MAXFWDJUMPS];
-//extern unsigned fwindex;
-
 // Globals, external etc
 extern LONG sloc;
 extern WORD scattr;
 // Globals, external etc
 extern LONG sloc;
 extern WORD scattr;
@@ -136,11 +133,11 @@ extern CHUNK * scode;
 
 // Prototypes
 void InitSection(void);
 
 // Prototypes
 void InitSection(void);
-void switchsect(int);
-void savsect(void);
+void SwitchSection(int);
+void SaveSection(void);
 int fixtest(int, LONG);
 int chcheck(LONG);
 int fixtest(int, LONG);
 int chcheck(LONG);
-int fixup(WORD, LONG, TOKEN *);
+int AddFixup(WORD, LONG, TOKEN *);
 int ResolveAllFixups(void);
 
 #endif // __SECT_H__
 int ResolveAllFixups(void);
 
 #endif // __SECT_H__
index f8d8424ff99de0886df08bd03cd459b85cf94d68..d4761214006bf4a98e631cc89fb8321344e4d447 100644 (file)
--- a/symbol.c
+++ b/symbol.c
@@ -91,7 +91,12 @@ SYM * NewSymbol(char * name, int type, int envno)
        symbol->stype  = (BYTE)type;
        symbol->senv   = (WORD)envno;
        symbol->sattr  = 0;
        symbol->stype  = (BYTE)type;
        symbol->senv   = (WORD)envno;
        symbol->sattr  = 0;
-       symbol->sattre = (rgpu || rdsp ? RISCSYM : 0);
+//we don't do this, it could be a forward reference!
+//     symbol->sattr  = DEFINED;               // We just defined it...
+       // This is a bad assumption. Not every symbol 1st seen in a RISC section is
+       // a RISC symbol!
+//     symbol->sattre = (rgpu || rdsp ? RISCSYM : 0);
+       symbol->sattre = 0;
        symbol->svalue = 0;
        symbol->sorder = NULL;
        symbol->uid    = currentUID++;
        symbol->svalue = 0;
        symbol->sorder = NULL;
        symbol->uid    = currentUID++;
@@ -165,7 +170,8 @@ SYM * lookup(char * name, int type, int envno)
 //
 // Put symbol on "order-of-declaration" list of symbols
 //
 //
 // Put symbol on "order-of-declaration" list of symbols
 //
-void sym_decl(SYM * symbol)
+//void sym_decl(SYM * symbol)
+void AddToSymbolOrderList(SYM * symbol)
 {
        if (symbol->sattr & SDECLLIST)
                return;                                                         // Already on list
 {
        if (symbol->sattr & SDECLLIST)
                return;                                                         // Already on list
index eaf9107d1a52c055842f18686190bdf8ae04a1d8..e183b432d5a50ad861726d1c94af38d2574893a1 100644 (file)
--- a/symbol.h
+++ b/symbol.h
@@ -44,7 +44,7 @@ extern char subttl[];
 SYM * lookup(char *, int, int);
 void InitSymbolTable(void);
 SYM * NewSymbol(char *, int, int);
 SYM * lookup(char *, int, int);
 void InitSymbolTable(void);
 SYM * NewSymbol(char *, int, int);
-void sym_decl(SYM *);
+void AddToSymbolOrderList(SYM *);
 int syg_fix(void);
 int symtable(void);
 int sy_assign(char *, char *(*)());
 int syg_fix(void);
 int symtable(void);
 int sy_assign(char *, char *(*)());
index 03024234f3c3926a77283d8797f2cf95c87b6cbb..75e1c569e74a497e94e24941c05b2ca1a637cfb9 100644 (file)
--- a/version.h
+++ b/version.h
@@ -13,6 +13,6 @@
 
 #define MAJOR   1                      // Major version number
 #define MINOR   2                      // Minor version number
 
 #define MAJOR   1                      // Major version number
 #define MINOR   2                      // Minor version number
-#define PATCH   13                     // Patch release number
+#define PATCH   15                     // Patch release number
 
 #endif // __VERSION_H__
 
 #endif // __VERSION_H__