aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--whichbas.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/whichbas.c b/whichbas.c
index 8a0b335..2b39a44 100644
--- a/whichbas.c
+++ b/whichbas.c
@@ -64,13 +64,13 @@ void print_result(void) {
name = "Unknown variant: Not Atari BASIC, Turbo, BXL, or BXE";
} else if(bas_type & BT_ATARI) {
name = "Atari BASIC";
- } else if(bas_type == BT_TURBO) {
- name = "Turbo BASIC XL";
} else if(bas_type & BT_TURBO) {
if(bas_type & BT_BXL) {
name = "Either Turbo BASIC XL or OSS BASIC XL";
} else if(bas_type & BT_BXE) {
name = "Either Turbo BASIC XL or OSS BASIC XE";
+ } else { /* bas_type == BT_TURBO */
+ name = "Turbo BASIC XL";
}
} else if(bas_type == BT_BXL || bas_type == (BT_BXL | BT_BXE)) {
name = "OSS BASIC XL";
@@ -91,8 +91,8 @@ void remove_type(int type) {
if(keep_going) return;
- /* without -k, stop if it gets narrowed down to one of these two. */
- if(bas_type == BT_TURBO || bas_type == BT_BXE)
+ /* without -k, stop if it gets narrowed down to one of these 3. */
+ if(bas_type == BT_TURBO || bas_type == BT_BXE || bas_type == BT_BXL)
print_result();
}
@@ -309,6 +309,26 @@ CALLBACK(handle_op) {
print_result();
}
+ /* attempt to detect BXL/BXE DIM for 2D string arrays.
+ DIM A$(10,10) is illegal in Atari/Turbo.
+ partial: this only works if the first dimension is either a
+ constant or a scalar variable (not an array element or an
+ expression).
+ */
+ if(tok == OP_DIM_STR_LPAR) {
+ int str2d = 0;
+ if(nexttok >= 0x80 && nexttok2 == OP_ARR_COMMA) {
+ str2d = 1;
+ } else if(nexttok == OP_NUMCONST || nexttok == OP_HEXCONST) {
+ str2d = (program[pos + 8] == OP_ARR_COMMA);
+ }
+ if(str2d) {
+ if(verbose)
+ fprintf(stderr, "===> found 2d string array at line %d\n", lineno);
+ remove_type(BT_ATARI | BT_TURBO);
+ }
+ }
+
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);