diff options
author | B. Watson <urchlay@slackware.uk> | 2024-07-17 03:55:09 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-07-17 03:55:09 -0400 |
commit | 18bfe53f6d36a30ed2867aced9999e8d91f57a5f (patch) | |
tree | 35f38dda40fa82db264a267d10469a2a77ecace0 | |
parent | 7f0e34424af36acb4846497f6a847d4008dec48f (diff) | |
download | bw-atari8-tools-18bfe53f6d36a30ed2867aced9999e8d91f57a5f.tar.gz |
listbas: separate print_varname() logic from callback.
-rw-r--r-- | listbas.c | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -625,18 +625,16 @@ CALLBACK(print_op) { if(color) color_off(); } -CALLBACK(print_varname) { +void print_varname(unsigned char varnum) { int i, count; unsigned char c; if(color) color_on(color_varnames); - tok &= 0x7f; - - for(i = vnstart, count = 0; count < tok; i++) { + for(i = vnstart, count = 0; count < varnum; i++) { if(program[i] & 0x80) count++; if(i == codestart) { - fprintf(outfh, "(bad var tok $%02x)", tok | 0x80); + fprintf(outfh, "(bad var tok $%02x)", varnum | 0x80); return; } } @@ -651,6 +649,13 @@ CALLBACK(print_varname) { if(color) color_off(); } +/* for normal BASIC/A+/XL/XE variable tokens, $80-$FF. Turbo uses + these, too, but it supports 256 variables, so it only uses $80-$FF + for the first 128 vars. */ +CALLBACK(print_std_varname) { + print_varname(tok & 0x7f); +} + CALLBACK(print_text) { unsigned char c, is_data = program[pos - 1] == CMD_DATA, comma = 0; @@ -688,7 +693,7 @@ void list(void) { on_start_line = print_lineno; on_cmd_token = print_cmd; on_exp_token = print_op; - on_var_token = print_varname; + on_var_token = print_std_varname; /* see also: print_turbo_varname() */ on_end_line = print_newline; on_text = print_text; on_bad_line_length = code_prot; |