aboutsummaryrefslogtreecommitdiff
path: root/listbas.c
diff options
context:
space:
mode:
Diffstat (limited to 'listbas.c')
-rw-r--r--listbas.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/listbas.c b/listbas.c
index ee4c68c..dac8253 100644
--- a/listbas.c
+++ b/listbas.c
@@ -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;