aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--whichbas.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/whichbas.c b/whichbas.c
index f086689..ce2f88a 100644
--- a/whichbas.c
+++ b/whichbas.c
@@ -343,10 +343,18 @@ CALLBACK(handle_cmd) {
break;
case 0x54: /* -- in TB, LVAR in BXL/BXE */
/* COMPLETE */
- /* we can tell these apart because TB gives us a next-statement offset of 5
- when we use this (normally, the minimum offset is 6, but there's no OP_EOS
- after this token for some reason). */
- if(program[pos - 1] == 0x05) {
+ /* We can tell these apart because:
+ 1. TB gives us a next-statement offset of 5 if -- is the first (or
+ actually only) statement on a line. Normally, the minimum offset
+ is 6, but there's no OP_EOL after this token for some reason.
+ 2. If -- is the 2nd or or later statement on a line (after a colon)
+ it *does* get a statement terminator, but it's 0x9b (ATASCII EOL,
+ like a REM or DATA gets).
+ Note that it's impossible to put more statements *after* the --,
+ they just get ignored if you type them. This doesn't help us
+ here, but it's interesting anyway.
+ The explanation is a lot longer than the code... */
+ if(program[pos - 1] == 0x05 || nexttok == 0x9b) {
bas_type = BT_TURBO;
print_result();
} else {