From f97bee398b26ce9f5aa2883ea95a3a31ad436fa5 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 7 Jul 2024 04:44:13 -0400 Subject: whichbas: add a few more operators, document the rest. --- whichbas.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/whichbas.c b/whichbas.c index fc39609..8bd6d9a 100644 --- a/whichbas.c +++ b/whichbas.c @@ -252,13 +252,40 @@ CALLBACK(handle_op) { print_result(); } + /* FIXME: I should have written this as a switch, not a bunch of if's */ + if(tok == 0x55) { /* DPEEK (function) TB, USING (infix, not a function) in BXL/BXE */ if(nexttok == OP_FUNC_LPAR) { remove_type(BT_BXL_BXE); + } else { + remove_type(BT_TURBO); + } + } + + /* 56! & (logical AND) or % (XOR), both infix numeric ops; can't tell apart */ + /* 57! ! (logical OR) in both Turbo and BXL/BXE, can't tell apart */ + + /* 58: INSTR (function) or & (infix numeric) */ + if(tok == 0x58) { + if(nexttok == OP_FUNC_LPAR) { + remove_type(BT_BXL_BXE); + } else { + remove_type(BT_TURBO); + } + } + + if(tok == 0x59) { + /* INKEY$ (pseudo-function) in TB, string array separator semicolon in BXL/BXE */ + if(nexttok == OP_NUMCONST || nexttok >= 0x80) { + /* INKEY$ may not be followed by a numeric constant or a variable of any kind */ + remove_type(BT_TURBO); } } + /* 5a: EXOR (infix num op) or BUMP( (pseudo-function, no OP_FUNC_LPAR) */ + /* 5b: HEX$ (func, takes 1 num arg) or FIND( (pseudo-func, 3 args */ + if(tok == 0x5c) { /* DEC (function, takes str) in TB, HEX$ (function, takes num) in BXL/BXE */ if(nexttok2 == OP_STRCONST) { @@ -269,6 +296,9 @@ CALLBACK(handle_op) { } } + /* 5d: DIV (infix num op) or RANDOM( (pseudo-func, 1 or 2 num args) */ + /* 5e! FRAC (num func, 1 arg) or DPEEK (num func, 1 arg), can't tell apart :( */ + if(tok == 0x5f) { /* TIME$ in TB, SYS (function) in BXL/BXE */ if(nexttok == OP_FUNC_LPAR) { @@ -295,6 +325,10 @@ CALLBACK(handle_op) { remove_type(BT_TURBO); } + /* 63! RND (func, 1 num arg) or ERR (func, 1 num arg), can't tell apart */ + /* 64! RAND (func, 1 num arg) or TAB (func, 1 num arg), can't tell apart */ + /* 65! TRUNC (func, 1 num arg) or PEN (func, 1 num arg), can't tell apart */ + if(tok == 0x66 || tok == 0x67 || tok == 0x68) { /* either %0 %1 %2 (TB), or LEFT$ RIGHT$ MID$ (BXL/XE) */ if(nexttok == OP_STRCONST || nexttok >= 0x80) { -- cgit v1.2.3