]> Shamusworld >> Repos - rmac/commitdiff
Much better implementation for A8 strings - introduced a new token called STRINGA8...
authorggn <ggn.dbug@gmail.com>
Fri, 21 Apr 2017 19:58:11 +0000 (22:58 +0300)
committerShamus Hammons <jlhamm@acm.org>
Fri, 21 Apr 2017 21:26:28 +0000 (16:26 -0500)
direct.c
mntab
rmac.h
token.c
token.h

index aebe56648760f3ee3add972e7ef1b68eb56c44de..900c629a3b686d392b207cf4e36bad04adab8991 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
 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);
 
 // Function prototypes
 int d_unimpl(void);
@@ -983,19 +982,19 @@ int d_dc(WORD siz)
        for(;; tok++)
        {
                // dc.b 'string' [,] ...
        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);
 
                {
                        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);
                        }
                        {
                                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]);
                        {
                                for(p=string[tok[1]]; *p!=EOS; p++)
                                        D_byte(strtoa8[*p]);
diff --git a/mntab b/mntab
index 56a87cf599fe199de016fb9502af6ef3d39f6bb2..57cf325027e39b8cd73025dd6d186f303e2bae10 100644 (file)
--- a/mntab
+++ b/mntab
@@ -2,6 +2,7 @@
 org    0
 .even  1
 even   1
 org    0
 .even  1
 even   1
+.6502  2
 .68000 3
 .bss   4
 bss    4
 .68000 3
 .bss   4
 bss    4
diff --git a/rmac.h b/rmac.h
index 5c562043ad10412e0911a32444c92c3a0f9e4497..f5d3e7456855b1c16a5bbbbfa597288156a2fb82 100644 (file)
--- a/rmac.h
+++ b/rmac.h
 #define CONST        'a'                       // CONST <value>
 #define ACONST       'A'                       // ACONST <value> <attrib>
 #define STRING       'b'                       // STRING <address>
 #define CONST        'a'                       // CONST <value>
 #define ACONST       'A'                       // ACONST <value> <attrib>
 #define STRING       'b'                       // STRING <address>
+#define STRINGA8     'S'            // Atari 800 internal STRING <address>
 #define SYMBOL       'c'                       // SYMBOL <address>
 #define EOL          'e'                       // End of line
 #define TKEOF        'f'                       // End of file (or macro)
 #define SYMBOL       'c'                       // SYMBOL <address>
 #define EOL          'e'                       // End of line
 #define TKEOF        'f'                       // End of file (or macro)
diff --git a/token.c b/token.c
index 00ead96bdf7c0d9f866744433e4779ca620ed4ae..629f8a6f98a18bb8afeb90bb86461b8f37600caa 100644 (file)
--- a/token.c
+++ b/token.c
@@ -1162,7 +1162,6 @@ if (debug) printf("TokenizeLine: Calling fpop() from SRC_IREPT...\n");
                // Handle multiple-character tokens
                if (c & MULTX)
                {
                // Handle multiple-character tokens
                if (c & MULTX)
                {
-                       stringtype = 0;
 
                        switch (*ln++)
                        {
 
                        switch (*ln++)
                        {
@@ -1178,12 +1177,15 @@ if (debug) printf("TokenizeLine: Calling fpop() from SRC_IREPT...\n");
                                continue;
                        case '\'':              // 'string'
                                if (m6502)
                                continue;
                        case '\'':              // 'string'
                                if (m6502)
-                                       stringtype = A8INT; // hardcoded for now, maybe this will change in the future
-
+                {
+                                       *tk++ = STRINGA8; // hardcoded for now, maybe this will change in the future
+                    goto dostring;
+                }
                                // Fall through
                        case '\"':              // "string"
                                // Fall through
                        case '\"':              // "string"
-                               c1 = ln[-1];
                                *tk++ = STRING;
                                *tk++ = STRING;
+dostring:
+                               c1 = ln[-1];
 //#warning
 // More char * stuffing (8 bytes) into the space of 4 (TOKEN).
 // Need to figure out how to fix this crap.
 //#warning
 // More char * stuffing (8 bytes) into the space of 4 (TOKEN).
 // Need to figure out how to fix this crap.
diff --git a/token.h b/token.h
index f5910d3279726d13b42dd56a51adb9c1c21dfbfc..91230e5f0182ff86ec789ac81de9ba3dccc83e3d 100644 (file)
--- a/token.h
+++ b/token.h
 #define MULTX           64                                     // Multiple-character tokens
 #define DOT             128                                    // [bwlsBWSL] for what follows a `.'
 
 #define MULTX           64                                     // Multiple-character tokens
 #define DOT             128                                    // [bwlsBWSL] for what follows a `.'
 
-// "special" string types
-#define NORMAL          0                   // Standard for PC/ST/whatever
-#define A8INT           1                   // Atari 800 ATASCII translation
-#define PETSCII         2                   // lol
-#define ORICSCII        3                   // lolol
-
 // Conditional assembly structures
 IFENT {
        IFENT * if_prev;                // Ptr prev .if state block (or NULL)
 // Conditional assembly structures
 IFENT {
        IFENT * if_prev;                // Ptr prev .if state block (or NULL)