From e81d17367b19e6aad27f2dd5332cf845a0f185bf Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 7 Jul 2024 13:47:11 -0400 Subject: whichbas: detect >128 Turbo BASIC variables. --- whichbas.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/whichbas.c b/whichbas.c index fcad6a0..20b2fdf 100644 --- a/whichbas.c +++ b/whichbas.c @@ -235,6 +235,14 @@ CALLBACK(handle_op) { if(verbose) fprintf(stderr, "handle_op: lineno %d, tok $%02x, comma_count %d, bas_type was %02x\n", lineno, tok, comma_count, bas_type); + if(tok == 0x00) { + /* Turbo allows 256 variables, tokenizes the first 128 normally ($80-$FF). + The extra ones above $FF are tokenized as $00, varnum - $80. None of + our other BASICs uses $00 as an operator token, so.. */ + bas_type = BT_TURBO; + print_result(); + } + if(tok == OP_HEXCONST) remove_type(BT_ATARI); /* hex const (turbo *and* bxl/xe) */ if(tok <= OP_FUNC_STRIG) { if(verbose) fprintf(stderr, " bas_type now %02x\n", bas_type); @@ -351,6 +359,8 @@ CALLBACK(handle_op) { if(verbose) fprintf(stderr, " bas_type now %02x\n", bas_type); } +/* we can count commas, because both Turbo and BXE/BXL use the "array" comma + to separate function arguments, not the "regular" comma. */ CALLBACK(handle_end_stmt) { if(verbose) fprintf(stderr, "handle_end_stmt: lineno %d, tok $%02x, last_cmd $%02x, comma_count %d, bas_type was %02x\n", lineno, tok, last_cmd, comma_count, bas_type); switch(last_cmd) { -- cgit v1.2.3