From 56e65923ce6dd9167fbf49d41559d558c278f78d Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 16 Jul 2024 05:04:53 -0400 Subject: listbas: initial support for BASIC XE. --- listbas.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'listbas.c') 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() { -- cgit v1.2.3