diff options
author | B. Watson <urchlay@slackware.uk> | 2025-02-27 02:50:27 -0500 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2025-02-27 02:50:27 -0500 |
commit | e159f1abc6963e5b32293641a90bf844dd80548b (patch) | |
tree | 0c7b538a62c4bb1ed0cd726f16c17e06f8383d91 | |
parent | f475ce0d91eaab2a077c232673a0252d74bcbe5d (diff) | |
download | bw-atari8-tools-e159f1abc6963e5b32293641a90bf844dd80548b.tar.gz |
listamsb: don't try to detokenize comments (treat like string).
-rw-r--r-- | listamsb.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -18,7 +18,8 @@ #define MIN_EXT_TOK 0xa3 /* SGN */ #define MAX_EXT_TOK 0xc5 /* STACK */ -/* AMSB's tokens for "!" and "'", used to introduce comments */ +/* AMSB's tokens for "!", "'", REM. used to introduce comments */ +#define TOK_REM 0x98 #define TOK_SQUOTE 0x9a #define TOK_BANG 0x9b @@ -186,7 +187,7 @@ void unknown_token(int lineno, unsigned char byte, int ext) { int next_line(void) { static int last_lineno = -1; static int last_ptr = -1; - int ptr, lineno, was_ff, in_string, offset, len; + int ptr, lineno, was_ff, in_string, in_comment, offset, len; int printing; unsigned char byte; @@ -245,6 +246,7 @@ int next_line(void) { was_ff = 0; in_string = 0; + in_comment = 0; /* walk and print the tokens. when we hit a null byte, we're done. */ while(1) { @@ -265,6 +267,9 @@ int next_line(void) { } } if(printing) putc(byte, outfile); + } else if(in_comment) { + if(byte == 0x00) break; + if(printing) putc(byte, outfile); } else if(byte == ':') { /* don't print the colon if the next token is a ! or ' for a comment */ unsigned char next = read_prog_byte(); @@ -287,6 +292,8 @@ int next_line(void) { was_ff = 1; } else if(byte >= MIN_STD_TOK && byte <= MAX_STD_TOK) { if(printing) fputs(std_tokens[byte - MIN_STD_TOK], outfile); + if(byte == TOK_SQUOTE || byte == TOK_BANG || byte == TOK_REM) + in_comment = 1; } else if(byte >= 0x80) { if(printing) unknown_token(lineno, byte, 0); warnings++; |