diff options
-rw-r--r-- | bas.c | 13 | ||||
-rw-r--r-- | bas.h | 1 | ||||
-rw-r--r-- | listbas.c | 15 |
3 files changed, 29 insertions, 0 deletions
@@ -22,6 +22,11 @@ int verbose = 0; in sync with the token stream. */ int allow_hex_const = 0; +/* BASIC/A+ uses the same cmd tokens for REM and DATA that BASIC does, + but not for the ERROR- token. Unfortunately bas.c needs to know it's + an A+ program so it can handle this token correctly. */ +int aplus_errtok_hack = 0; + unsigned short lomem; unsigned short vntp; unsigned short vntd; @@ -376,6 +381,14 @@ void walk_code(unsigned int startlineno, unsigned int endlineno) { CALL(on_text); pos = end; break; + case 0x53: /* BASIC/A+'s ERROR- token */ + if(aplus_errtok_hack) { + pos++; + CALL(on_text); + pos = end; + break; + } + /* fall thru */ default: pos++; break; @@ -203,6 +203,7 @@ extern char *output_filename; extern int verbose; extern int allow_hex_const; +extern int aplus_errtok_hack; extern void set_self(const char *argv0); extern void die(const char *msg); @@ -441,6 +441,12 @@ CALLBACK(print_cmd) { } void aplus_op_color_on(unsigned char tok) { + switch(tok) { + default: + break; + } + + color_on(color_op); } void op_color_on(unsigned char tok) { @@ -535,9 +541,15 @@ CALLBACK(print_varname) { if(color) color_on(color_varnames); tok &= 0x7f; + for(i = vnstart, count = 0; count < tok; i++) { if(program[i] & 0x80) count++; + if(i == codestart) { + fprintf(outfh, "(bad var tok $%02x)", tok | 0x80); + return; + } } + do { c = program[i++]; if(color && c == ('(' | 0x80)) { @@ -640,6 +652,9 @@ int main(int argc, char **argv) { if(bas_type != B_ATARI && bas_type != B_APLUS) allow_hex_const = 1; + if(bas_type == B_APLUS) + aplus_errtok_hack = 1; + init_token_tables(); readfile(); |