]> Shamusworld >> Repos - rmac/blobdiff - direct.c
Fixed word reversed fixup problem.
[rmac] / direct.c
index 31852c8e2f9213c3a3a0e3735406aa9c57b95fab..efec94a2f438fd63d3a3931f14567cfea8efa690 100644 (file)
--- a/direct.c
+++ b/direct.c
@@ -85,6 +85,7 @@ int (*dirtab[])() = {
        d_cstruct,                      // 53 .cstruct
        d_jpad,                         // 54 .jpad (deprecated)
        d_nojpad,                       // 55 .nojpad (deprecated)
+       d_gpumain,                      // 56 .gpumain (deprecated)
 };
 
 
@@ -118,15 +119,15 @@ int d_org(void)
 //
 int d_print(void)
 {
-       char prntstr[LNSIZ];                                     // String for PRINT directive
-       char format[LNSIZ];                                      // Format for PRINT directive
-       int formatting = 0;                                      // Formatting on/off
-       int wordlong = 0;                                        // WORD = 0, LONG = 1
-       int outtype = 0;                                         // 0:hex, 1:decimal, 2:unsigned
-
-       VALUE eval;                                              // Expression value
-       WORD eattr;                                              // Expression attributes
-       SYM * esym;                                              // External symbol involved in expr.
+       char prntstr[LNSIZ];                                    // String for PRINT directive
+       char format[LNSIZ];                                             // Format for PRINT directive
+       int formatting = 0;                                             // Formatting on/off
+       int wordlong = 0;                                               // WORD = 0, LONG = 1
+       int outtype = 0;                                                // 0:hex, 1:decimal, 2:unsigned
+
+       VALUE eval;                                                             // Expression value
+       WORD eattr;                                                             // Expression attributes
+       SYM * esym;                                                             // External symbol involved in expr.
        TOKEN r_expr[EXPRSIZE];
 
        while (*tok != EOL)
@@ -201,7 +202,7 @@ int d_print(void)
        }
 
        printf("\n");
-       println("\n");
+//     println("\n");
 
        return 0;
 
@@ -227,7 +228,8 @@ int d_ccundef(void)
 
        if (*tok != SYMBOL)
        {
-               error(syntax_error);
+//             error(syntax_error);
+               error("syntax error; expected symbol");
                return ERROR;
        }
 
@@ -256,10 +258,7 @@ int d_equrundef(void)
 
        // 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)
        {
@@ -269,13 +268,9 @@ int d_equrundef(void)
 
                // Check we are dealing with a symbol
                if (*tok != SYMBOL)
-               {
-                       error(syntax_error);
-                       return ERROR;
-               }
+                       return error("syntax error; expected symbol");
 
                // 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))
@@ -317,7 +312,8 @@ int d_incbin(void)
 
        if (*tok != STRING)
        {
-               error(syntax_error);
+//             error(syntax_error);
+               error("syntax error; string missing");
                return ERROR;
        }
 
@@ -520,7 +516,7 @@ int d_qphrase(void)
        {
                if ((scattr & SBSS) == 0)
                {
-                       savsect();
+                       SaveSection();
                        chcheck(val);
 
                        for(i=0; i<val; i++) 
@@ -590,18 +586,14 @@ int abs_expr(VALUE * a_eval)
 //
 int symlist(int(* func)())
 {
-       char * em = "symbol list syntax";
+       const char * em = "symbol list syntax";
 
        for(;;)
        {
                if (*tok != SYMBOL)
                        return error(em);
 
-#if 0
-               if ((*func)(tok[1]) != OK)
-#else
                if ((*func)(string[tok[1]]) != OK)
-#endif
                        break;
 
                tok += 2;
@@ -612,7 +604,7 @@ int symlist(int(* func)())
                if (*tok != ',')
                        return error(em);
 
-               ++tok;
+               tok++;
        }
 
        return 0;
@@ -711,7 +703,7 @@ int d_assert(void)
 //
 int globl1(char * p)
 {
-       SYM *sy;
+       SYM * sy;
 
        if (*p == '.')
                return error("cannot .globl local symbol");
@@ -721,6 +713,7 @@ int globl1(char * p)
                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;
@@ -743,14 +736,14 @@ int d_abs(void)
 {
        VALUE eval;
 
-       savsect();
+       SaveSection();
 
        if (*tok == EOL)
                eval = 0;
        else if (abs_expr(&eval) != OK)
                return 0;
 
-       switchsect(ABS);
+       SwitchSection(ABS);
        sloc = eval;
        return 0;
 }
@@ -767,8 +760,8 @@ int d_text(void)
 
        if (cursect != TEXT)
        {
-               savsect();
-               switchsect(TEXT);
+               SaveSection();
+               SwitchSection(TEXT);
        }
 
        return 0;
@@ -782,8 +775,8 @@ int d_data(void)
 
        if (cursect != DATA)
        {
-               savsect();
-               switchsect(DATA);
+               SaveSection();
+               SwitchSection(DATA);
        }
 
        return 0;
@@ -797,8 +790,8 @@ int d_bss(void)
 
        if (cursect != BSS)
        {
-               savsect();
-               switchsect(BSS);
+               SaveSection();
+               SwitchSection(BSS);
        }
 
        return 0;
@@ -907,7 +900,7 @@ int d_dc(WORD siz)
                case SIZB:
                        if (!defined)
                        {
-                               fixup(FU_BYTE | FU_SEXT, sloc, exprbuf);
+                               AddFixup(FU_BYTE | FU_SEXT, sloc, exprbuf);
                                D_byte(0);
                        }
                        else
@@ -926,7 +919,7 @@ int d_dc(WORD siz)
                case SIZN:
                        if (!defined)
                        {
-                               fixup(FU_WORD | FU_SEXT, sloc, exprbuf);
+                               AddFixup(FU_WORD | FU_SEXT, sloc, exprbuf);
                                D_word(0);
                        }
                        else
@@ -946,9 +939,9 @@ int d_dc(WORD siz)
                        if (!defined)
                        {
                                if (movei)
-                                       fixup(FU_LONG | FU_MOVEI, sloc, exprbuf);
+                                       AddFixup(FU_LONG | FU_MOVEI, sloc, exprbuf);
                                else
-                                       fixup(FU_LONG, sloc, exprbuf);
+                                       AddFixup(FU_LONG, sloc, exprbuf);
 
                                D_long(0);
                        }
@@ -1094,7 +1087,7 @@ int dep_block(VALUE count, WORD siz, VALUE eval, WORD eattr, TOKEN * exprbuf)
                case SIZB:
                        if (!defined)
                        {
-                               fixup(FU_BYTE | FU_SEXT, sloc, exprbuf);
+                               AddFixup(FU_BYTE | FU_SEXT, sloc, exprbuf);
                                D_byte(0);
                        }
                        else
@@ -1113,7 +1106,7 @@ int dep_block(VALUE count, WORD siz, VALUE eval, WORD eattr, TOKEN * exprbuf)
                case SIZN:
                        if (!defined)
                        {
-                               fixup(FU_WORD | FU_SEXT, sloc, exprbuf);
+                               AddFixup(FU_WORD | FU_SEXT, sloc, exprbuf);
                                D_word(0);
                        }
                        else
@@ -1132,7 +1125,7 @@ int dep_block(VALUE count, WORD siz, VALUE eval, WORD eattr, TOKEN * exprbuf)
                case SIZL:
                        if (!defined)
                        {
-                               fixup(FU_LONG, sloc, exprbuf);
+                               AddFixup(FU_LONG, sloc, exprbuf);
                                D_long(0);
                        }
                        else
@@ -1225,8 +1218,8 @@ int d_68000(void)
        // Switching from gpu/dsp sections should reset any ORG'd Address
        orgactive = 0;                               
        orgwarning = 0;
-       savsect();
-       switchsect(TEXT);
+       SaveSection();
+       SwitchSection(TEXT);
        return 0;
 }
 
@@ -1344,7 +1337,7 @@ int d_cargs(void)
 
                        // Put symbol in "order of definition" list
                        if (!(symbol->sattr & SDECLLIST))
-                               sym_decl(symbol);
+                               AddToSymbolOrderList(symbol);
 
                        symbol->sattr |= (ABS | DEFINED | EQUATED);
                        symbol->svalue = eval;
@@ -1462,7 +1455,7 @@ int d_cstruct(void)
 
                        // Put symbol in "order of definition" list
                        if (!(symbol->sattr & SDECLLIST))
-                               sym_decl(symbol);
+                               AddToSymbolOrderList(symbol);
 
                        tok += 2;
 
@@ -1573,3 +1566,9 @@ int d_nojpad(void)
        return OK;
 }
 
+
+int d_gpumain(void)
+{
+       return error("What the hell? Do you think we adhere to the Goof standard?");
+}
+