diff options
author | B. Watson <urchlay@slackware.uk> | 2024-07-07 13:47:11 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-07-07 13:47:11 -0400 |
commit | e81d17367b19e6aad27f2dd5332cf845a0f185bf (patch) | |
tree | 9a2afff78d08d51cda7424cc09199f584977e861 | |
parent | b13f58cab38be2e0543161aa1eab7760ab1ee3d4 (diff) | |
download | bw-atari8-tools-e81d17367b19e6aad27f2dd5332cf845a0f185bf.tar.gz |
whichbas: detect >128 Turbo BASIC variables.
-rw-r--r-- | whichbas.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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) { |