aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--whichbas.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/whichbas.c b/whichbas.c
index a64ea00..d9b85dc 100644
--- a/whichbas.c
+++ b/whichbas.c
@@ -118,8 +118,8 @@ void remove_type(int type) {
if(keep_going) return;
- /* 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)
+ /* without -k, stop if it gets narrowed down to one of these 4. */
+ if(bas_type == BT_ATARI || bas_type == BT_TURBO || bas_type == BT_BXE || bas_type == BT_BXL)
print_result();
}
@@ -157,19 +157,24 @@ CALLBACK(handle_cmd) {
case CMD_INPUT:
/* TB, BXL, BXE all support INPUT "Prompt",VAR with the same tokenized
form. Atari BASIC doesn't allow string constants in INPUT args. */
- if(nexttok == OP_STRCONST) {
- int pos_after_string;
- remove_type(BT_ATARI);
- /* TB only: INPUT "Prompt";VAR is also supported (not in BXL/BXE) */
- pos_after_string = pos + 3 + program[pos + 2];
- if(verbose)
- fprintf(stderr,
- "===> INPUT with string prompt at line %d, "
- "pos %04x, pos_after_string %04x (token %02x)\n",
- lineno, pos, pos_after_string, program[pos_after_string]);
- if(program[pos_after_string] == OP_SEMICOLON) {
- remove_type(BT_BXL_BXE);
+ if(has_args) {
+ if(nexttok == OP_STRCONST) {
+ int pos_after_string;
+ remove_type(BT_ATARI);
+ /* TB only: INPUT "Prompt";VAR is also supported (not in BXL/BXE) */
+ pos_after_string = pos + 3 + program[pos + 2];
+ if(verbose)
+ fprintf(stderr,
+ "===> INPUT with string prompt at line %d, "
+ "pos %04x, pos_after_string %04x (token %02x)\n",
+ lineno, pos, pos_after_string, program[pos_after_string]);
+ if(program[pos_after_string] == OP_SEMICOLON) {
+ remove_type(BT_BXL_BXE);
+ }
}
+ } else { /* has_args is false, oh shit! */
+ fprintf(stderr, "*** INPUT without variable at line %d.\n*** Rev A BASIC bug, program will crash, better fix it!\n", lineno);
+ remove_type(BT_TURBO | BT_BXL_BXE);
}
break;
case CMD_GET: