aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-07-09 00:40:31 -0400
committerB. Watson <urchlay@slackware.uk>2024-07-09 00:40:31 -0400
commitb60ba6ca9977be25652b93385dcf1bfc4171e370 (patch)
tree36671b5646a6c5b69cd597eb13724737655beeb3
parent5934c31d6ef4e99512018cf671f4f501e53a3b35 (diff)
downloadbw-atari8-tools-b60ba6ca9977be25652b93385dcf1bfc4171e370.tar.gz
whichbas: detect INPUT without args, caused by buggy Rev A BASIC.
-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: