]> Shamusworld >> Repos - rmac/blobdiff - direct.c
Initial commit for 68020/30/40/60/68881/68882/68851 support.
[rmac] / direct.c
index aebe56648760f3ee3add972e7ef1b68eb56c44de..7076358cf0db46c2fa2384a0791b0761391b22ce 100644 (file)
--- a/direct.c
+++ b/direct.c
@@ -27,7 +27,6 @@ TOKEN exprbuf[128];                   // Expression buffer
 SYM * symbolPtr[1000000];      // Symbol pointers table
 static long unused;                    // For supressing 'write' warnings
 char buffer[256];                      // Scratch buffer for messages
-int stringtype;             // Non-zero if we need any special string conversions
 
 // Function prototypes
 int d_unimpl(void);
@@ -67,6 +66,7 @@ int d_fail(void);
 int d_cstruct(void);
 int d_prgflags(void);
 int d_opt(void);
+int d_dsp(void);
 
 // Directive handler table
 int (*dirtab[])() = {
@@ -128,6 +128,14 @@ int (*dirtab[])() = {
        d_nojpad,                       // 55 .nojpad (deprecated)
        d_gpumain,                      // 56 .gpumain (deprecated)
        d_prgflags,                     // 57 .prgflags
+       d_68020,                        // 58 .68020
+       d_68030,                        // 59 .68030
+       d_68040,                        // 60 .68040
+       d_68060,                        // 61 .68060
+       d_68881,                        // 62 .68881
+       d_68882,                        // 63 .68882
+       d_56001,                        // 64 .56001
+       d_nofpu,                        // 65 nofpu
        d_opt,                          // 58 .opt
 };
 
@@ -930,7 +938,9 @@ int d_ds(WORD siz)
 
        // Check to see if the value being passed in is negative (who the hell does
        // that?--nobody does; it's the code gremlins, or rum, that does it)
-       if (eval < 0)
+       // N.B.: Since VALUE is of type uint32_t, if it goes negative, it will have
+       //       its high bit set.
+       if (eval & 0x80000000)
                return error("negative sizes not allowed");
 
        // In non-TDB section (BSS, ABS and M6502) just advance the location
@@ -983,19 +993,19 @@ int d_dc(WORD siz)
        for(;; tok++)
        {
                // dc.b 'string' [,] ...
-               if (siz == SIZB && *tok == STRING && (tok[2] == ',' || tok[2] == EOL))
+               if (siz == SIZB && (*tok == STRING || *tok == STRINGA8) && (tok[2] == ',' || tok[2] == EOL))
                {
                        uint32_t i = strlen(string[tok[1]]);
 
                        if ((challoc - ch_size) < i)
                                chcheck(i);
 
-                       if (stringtype == NORMAL)
+                       if (*tok == STRING)
                        {
                                for(p=string[tok[1]]; *p!=EOS; p++)
                                        D_byte(*p);
                        }
-                       else if(stringtype == A8INT)
+                       else if(*tok == STRINGA8)
                        {
                                for(p=string[tok[1]]; *p!=EOS; p++)
                                        D_byte(strtoa8[*p]);
@@ -1005,7 +1015,6 @@ int d_dc(WORD siz)
                                error("String format not supported... yet");
                        }
 
-
                        tok += 2;
                        goto comma;
                }
@@ -1041,15 +1050,15 @@ int d_dc(WORD siz)
                        }
                        else
                        {
+                               if (tdb)
+                                       return error("non-absolute byte value");
+
                                if (eval + 0x100 >= 0x200)
                                {
                                        sprintf(buffer, "%s (value = $%X)", range_error, eval);
                                        return error(buffer);
                                }
 
-                               if (tdb)
-                                       return error("non-absolute byte value");
-
                                D_byte(eval);
                        }
 
@@ -1376,9 +1385,88 @@ int d_68000(void)
        orgwarning = 0;
        SaveSection();
        SwitchSection(TEXT);
+       activecpu=CPU_68000;
+       return 0;
+}
+
+//
+// .68020 - Back to 68000 TEXT segment and select 68020
+//
+int d_68020(void)
+{
+       d_68000();
+       activecpu=CPU_68020;
+       return 0;
+}
+
+//
+// .68030 - Back to 68000 TEXT segment and select 68030
+//
+int d_68030(void)
+{
+       d_68000();
+       activecpu=CPU_68030;
+       return 0;
+}
+
+//
+// .68040 - Back to 68000 TEXT segment and select 68040
+//
+int d_68040(void)
+{
+       d_68000();
+       activecpu=CPU_68040;
+       activefpu=FPU_68040;
+       return 0;
+}
+
+//
+// .68060 - Back to 68000 TEXT segment and select 68060
+//
+int d_68060(void)
+{
+       d_68000();
+       activecpu=CPU_68060;
+       activefpu=FPU_68040;
+       return 0;
+}
+
+//
+// .68881 - Back to 68000 TEXT segment and select 68881 FPU
+//
+int d_68881(void)
+{
+       d_68000();
+       activefpu=FPU_68881;
        return 0;
 }
 
+//
+// .68882 - Back to 68000 TEXT segment and select 68882 FPU
+//
+int d_68882(void)
+{
+       d_68000();
+       activefpu=FPU_68881;
+       return 0;
+}
+
+//
+// nofpu - Deselect FPUs.
+//
+int d_nofpu(void)
+{
+       activefpu=FPU_NONE;
+       return 0;
+}
+
+//
+// DSP56001
+//
+int d_56001(void)
+{
+       return error("Not yet, child. Be patient.");
+}
 
 //
 // .gpu - Switch to GPU assembler