aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--listamsb.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/listamsb.c b/listamsb.c
index 6737243..c34d435 100644
--- a/listamsb.c
+++ b/listamsb.c
@@ -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++;