From a3feec3b2d24d0f4685549a5059a210e074c2b99 Mon Sep 17 00:00:00 2001 From: ggn Date: Fri, 21 Apr 2017 22:58:11 +0300 Subject: [PATCH] Much better implementation for A8 strings - introduced a new token called STRINGA8. Also, all this time we forgot to update mntab :). --- direct.c | 7 +++---- mntab | 1 + rmac.h | 1 + token.c | 10 ++++++---- token.h | 6 ------ 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/direct.c b/direct.c index aebe566..900c629 100644 --- 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); @@ -983,19 +982,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]); diff --git a/mntab b/mntab index 56a87cf..57cf325 100644 --- a/mntab +++ b/mntab @@ -2,6 +2,7 @@ org 0 .even 1 even 1 +.6502 2 .68000 3 .bss 4 bss 4 diff --git a/rmac.h b/rmac.h index 5c56204..f5d3e74 100644 --- a/rmac.h +++ b/rmac.h @@ -168,6 +168,7 @@ #define CONST 'a' // CONST #define ACONST 'A' // ACONST #define STRING 'b' // STRING
+#define STRINGA8 'S' // Atari 800 internal STRING
#define SYMBOL 'c' // SYMBOL
#define EOL 'e' // End of line #define TKEOF 'f' // End of file (or macro) diff --git a/token.c b/token.c index 00ead96..629f8a6 100644 --- 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) { - stringtype = 0; switch (*ln++) { @@ -1178,12 +1177,15 @@ if (debug) printf("TokenizeLine: Calling fpop() from SRC_IREPT...\n"); 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" - c1 = ln[-1]; *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. diff --git a/token.h b/token.h index f5910d3..91230e5 100644 --- a/token.h +++ b/token.h @@ -75,12 +75,6 @@ #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) -- 2.37.2