From 252a9d9f20b2f600f3dee747a22ef4a648b017dc Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 8 Jul 2024 23:22:49 -0400 Subject: whichbas: fix Turbo DSOUND with 0 args, detect Turbo CLS #IOCB. --- whichbas.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/whichbas.c b/whichbas.c index ff955ff..9031442 100644 --- a/whichbas.c +++ b/whichbas.c @@ -196,7 +196,6 @@ CALLBACK(handle_cmd) { 0x46: LOOP or CP (no args either way) 0x49: LOCK or UNPROTECT (take the same args) 0x4B: RENAME in both Turbo and BXL/XE (take the same args) - 0x60: CLS or HITCLR (no args either way) This leaves 42 we can check. Covered so far: 39 (93%) TODO: Unknown tokens: @@ -216,7 +215,6 @@ CALLBACK(handle_cmd) { case 0x3a: /* -MOVE or TRACEOFF */ case 0x3d: /* UNTIL or ENDIF */ case 0x56: /* DEL or FAST */ - case 0x61: /* DSOUND (4 num args) or INVERSE (no args) */ case 0x62: /* CIRCLE (3 num args) or NORMAL (no args) */ if(has_args) { remove_type(BT_BXL_BXE); @@ -344,6 +342,16 @@ CALLBACK(handle_cmd) { remove_type(BT_TURBO); } break; + case 0x60: /* CLS (optional IOCB with #) or HITCLR (no args) */ + /* partial: without args, can't tell them apart. */ + /* I doubt CLS #IOCB is actually used in many Turbo BASIC + programs, because it's broken (at least in Turbo 1.5). + It's supposed to only clear the screen of output that + happened after the OPEN #IOCB, but it really clears the + whole screen. */ + if(nexttok == OP_HASH) { + remove_type(BT_BXL_BXE); + } default: break; } if(verbose) fprintf(stderr, " bas_type now %02x\n", bas_type); @@ -571,6 +579,11 @@ CALLBACK(handle_end_stmt) { remove_type(BT_TURBO); } break; + case 0x61: /* DSOUND (0 or 4 num args) or INVERSE (no args) */ + /* partial: can't tell no-argument DSOUND from INVERSE. */ + if(comma_count) { + remove_type(BT_BXL_BXE); + } case 0x63: /* %PUT (usually seen with optional #; 1 or 2 args) or BLOAD (1 string arg) */ if(comma_count) { /* multiple args */ -- cgit v1.2.3