aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--bxe_tokens.c19
-rw-r--r--bxe_tokens.h2
-rw-r--r--listbas.c23
4 files changed, 42 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index b0221cd..c202ad6 100644
--- a/Makefile
+++ b/Makefile
@@ -63,8 +63,8 @@ vxrefbas: bas.o
cxrefbas: bas.o bcdfp.o linetab.o
-listbas: listbas.c bas.o bcdfp.o tokens.o atables.o turbo_tokens.o aplus_tokens.o bxl_tokens.o
- $(CC) $(CFLAGS) -o listbas listbas.c bas.o bcdfp.o tokens.o atables.o turbo_tokens.o aplus_tokens.o bxl_tokens.o -lm
+listbas: listbas.c bas.o bcdfp.o tokens.o atables.o turbo_tokens.o aplus_tokens.o bxl_tokens.o bxe_tokens.o
+ $(CC) $(CFLAGS) -o listbas listbas.c bas.o bcdfp.o tokens.o atables.o turbo_tokens.o aplus_tokens.o bxl_tokens.o bxe_tokens.o -lm
bas.o: bas.c bas.h
diff --git a/bxe_tokens.c b/bxe_tokens.c
new file mode 100644
index 0000000..5189ee0
--- /dev/null
+++ b/bxe_tokens.c
@@ -0,0 +1,19 @@
+/* BXL and BXE token tables are identical up to 0x56 */
+const char *bxe_cmds[] = {
+ "LOCAL", /* $57 */
+ "EXTEND", /* $58 */
+ "PROCEDURE", /* $59 */
+ 0, /* $5A */
+ "CALL", /* $5B */
+ "SORTUP", /* $5C */
+ "SORTDOWN", /* $5D */
+ "EXIT", /* $5E */
+ "NUM", /* $5F */
+ "HITCLR", /* $60 */
+ "INVERSE", /* $61 */
+ "NORMAL", /* $62 */
+ "BLOAD", /* $63 */
+ "BSAVE" /* $64 */
+};
+
+const int bxe_cmd_size = sizeof(bxe_cmds);
diff --git a/bxe_tokens.h b/bxe_tokens.h
new file mode 100644
index 0000000..25bc14a
--- /dev/null
+++ b/bxe_tokens.h
@@ -0,0 +1,2 @@
+extern const char *bxe_cmds[];
+extern const int bxe_cmd_size;
diff --git a/listbas.c b/listbas.c
index d964baa..5972aa8 100644
--- a/listbas.c
+++ b/listbas.c
@@ -14,9 +14,7 @@
#include "turbo_tokens.h"
#include "aplus_tokens.h"
#include "bxl_tokens.h"
-/*
#include "bxe_tokens.h"
-*/
#include "atables.h"
#include "whichbas.h"
@@ -66,6 +64,8 @@
const char *cmd_tokens[256];
const char *op_tokens[256];
+int dump_tables = 0;
+
int bas_type = B_ATARI;
int output_mode = M_UTF8;
@@ -162,8 +162,9 @@ void parse_args(int argc, char **argv, int from_env) {
optind = 1;
- while( (opt = getopt(argc, argv, "b:UCviamnBdhxulc:")) != -1) {
+ while( (opt = getopt(argc, argv, "Db:UCviamnBdhxulc:")) != -1) {
switch(opt) {
+ case 'D': dump_tables = 1; break;
case 'U': output_mode = M_UTF8; break;
case 'a': output_mode = M_ATASCII; break;
case 'm': output_mode = M_MAG; break;
@@ -669,8 +670,11 @@ void init_bxl_tables() {
memmove(op_tokens + last_operator + 1, bxl_ops, bxl_ops_size);
}
+/* BXE's token table is identical to BXL's, and the commands are the
+ same up to token 0x56 (FAST). */
void init_bxe_tables() {
- die("BASIC XE not supported yet!");
+ init_bxl_tables();
+ memmove(cmd_tokens + 0x57, bxe_cmds, bxe_cmd_size);
}
void init_token_tables() {
@@ -687,6 +691,17 @@ void init_token_tables() {
init_bxl_tables();
else if(bas_type == B_BXE)
init_bxe_tables();
+
+ if(dump_tables) {
+ int i;
+ printf("commands:\n\n");
+ for(i = 0; i < 0x65; i++)
+ printf("%s $%02x\n", (cmd_tokens[i] ? cmd_tokens[i] : "(null)"), i);
+ printf("operators:\n\n");
+ for(i = 0x12; i < 0x69; i++)
+ printf("%s $%02x\n", (op_tokens[i] ? op_tokens[i] : "(null)"), i);
+ exit(0);
+ }
}
void init_bas_dialect() {