aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bas2aplus.c15
-rw-r--r--bas2aplus.rst12
2 files changed, 20 insertions, 7 deletions
diff --git a/bas2aplus.c b/bas2aplus.c
index ee71130..de259aa 100644
--- a/bas2aplus.c
+++ b/bas2aplus.c
@@ -14,6 +14,8 @@
#include "bxl_tokens.c"
#include "bxe_tokens.c"
+int errs = 0;
+
/* there are a few more BXL commands past 0x55, but they have no
A+ equivalents. */
#define LAST_BXL_CMD 0x55
@@ -197,8 +199,9 @@ const char *get_tok_name(unsigned char tok, int is_cmd) {
}
void unsupported_msg(unsigned char tok, int lineno, int is_cmd) {
- fprintf(stderr, "%s: Invalid %s \"%s\" (%02x) at line %d, not converted.\n",
+ fprintf(stderr, "%s: Invalid %s \"%s\" ($%02x) at line %d, not converted.\n",
self, is_cmd ? "command" : "operator", get_tok_name(tok, is_cmd), tok, lineno);
+ errs++;
}
int is_supported_cmd(unsigned char tok, int lineno) {
@@ -224,7 +227,7 @@ CALLBACK(conv_cmd) {
program[pos] = cmd_table[tok];
if(verbose && tok != program[pos])
- fprintf(stderr, "cmd tok \"%s\" ($%02x) converted to $%02x at line %d, pos $%04x\n",
+ fprintf(stderr, "command \"%s\" ($%02x) converted to $%02x at line %d, pos $%04x\n",
get_tok_name(tok, 1), tok, program[pos], lineno, pos);
}
@@ -235,7 +238,7 @@ CALLBACK(conv_op) {
program[pos] = op_table[tok];
if(verbose && tok != program[pos])
- fprintf(stderr, "op tok \"%s\" ($%02x) converted to $%02x at line %d, pos $%04x\n",
+ fprintf(stderr, "operator \"%s\" ($%02x) converted to $%02x at line %d, pos $%04x\n",
get_tok_name(tok, 0), tok, program[pos], lineno, pos);
}
@@ -259,5 +262,11 @@ int main(int argc, char **argv) {
open_output(output_filename);
writefile();
+ if(errs) {
+ fprintf(stderr, "%s: program has %d invalid tokens; BASIC/A+ won't RUN it.\n",
+ self, errs);
+ return 1;
+ }
+
return 0;
}
diff --git a/bas2aplus.rst b/bas2aplus.rst
index 0358091..65bcf14 100644
--- a/bas2aplus.rst
+++ b/bas2aplus.rst
@@ -114,10 +114,14 @@ a few keywords to BASIC XL, which also don't exist in A+. These are:
**HITCLR**, **INVERSE**, **NORMAL**, **BLOAD**, **BSAVE**
Not supported in either A+ or XL.
-BASIC XE also allows some syntax that's not valid in either BASIC
-XL or A+. For instance, **IF <condition>** can appear as the last
-statement on a line, and **LVAR** no longer requires an argument.
-**bas2aplus** doesn't detect these constructs.
+BASIC XE also allows some syntax that's not valid in either BASIC XL
+or A+. For instance, **IF <condition>**, without **THEN**, can appear
+as the last statement on a line, and **LVAR** no longer requires an
+argument. **bas2aplus** doesn't detect these constructs.
+
+Actually, BASIC/A+ will **LIST** and **RUN** programs with the **IF**
+issue, but such lines can't be edited in A+. Easy enough to add a
+**:REM** to the end of the line, though.
TURBO BASIC
===========