diff options
author | B. Watson <urchlay@slackware.uk> | 2024-07-16 02:34:58 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-07-16 02:34:58 -0400 |
commit | 9b46fa29695efed9a3c7e3ba891e8f69ee155e02 (patch) | |
tree | 4445b2a59c650a1c918f443436d7b6893342baca | |
parent | 3bef7994fd351fe65e56c8cc406a38fa3b821fad (diff) | |
download | bw-atari8-tools-9b46fa29695efed9a3c7e3ba891e8f69ee155e02.tar.gz |
listbas: initial (incomplete) support for BASIC/A+.
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | aplus_tokens.c | 179 | ||||
-rw-r--r-- | aplus_tokens.h | 5 | ||||
-rw-r--r-- | listbas.c | 13 |
4 files changed, 192 insertions, 9 deletions
@@ -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.c - $(CC) $(CFLAGS) -o listbas listbas.c bas.o bcdfp.o tokens.o atables.o turbo_tokens.c -lm +listbas: listbas.c bas.o bcdfp.o tokens.o atables.o turbo_tokens.o aplus_tokens.o + $(CC) $(CFLAGS) -o listbas listbas.c bas.o bcdfp.o tokens.o atables.o turbo_tokens.o aplus_tokens.o -lm bas.o: bas.c bas.h diff --git a/aplus_tokens.c b/aplus_tokens.c new file mode 100644 index 0000000..8d2249e --- /dev/null +++ b/aplus_tokens.c @@ -0,0 +1,179 @@ +/* these have to be full sets of tokens, because A+'s tokens don't + match Atari BASIC's */ + +const char *aplus_cmds[] = { + "REM", /* $00 */ + "DATA", /* $01 */ + "INPUT", /* $02 */ + "LIST", /* $03 */ + "ENTER", /* $04 */ + "LET", /* $05 */ + "IF", /* $06 */ + "FOR", /* $07 */ + "NEXT", /* $08 */ + "GOTO", /* $09 */ + "RENUM", /* $0a */ + "GOSUB", /* $0b */ + "TRAP", /* $0c */ + "BYE", /* $0d */ + "CONT", /* $0e */ + "CLOSE", /* $0f */ + "CLR", /* $10 */ + "DEG", /* $11 */ + "DIM", /* $12 */ + "WHILE", /* $13 */ + "ENDWHILE", /* $14 */ + "TRACEOFF", /* $15 */ + "TRACE", /* $16 */ + "ELSE", /* $17 */ + "ENDIF", /* $18 */ + "END", /* $19 */ + "NEW", /* $1a */ + "OPEN", /* $1b */ + "LOAD", /* $1c */ + "SAVE", /* $1d */ + "STATUS", /* $1e */ + "NOTE", /* $1f */ + "POINT", /* $20 */ + "XIO", /* $21 */ + "ON", /* $22 */ + "POKE", /* $23 */ + "DPOKE", /* $24 */ + "PRINT", /* $25 */ + "RAD", /* $26 */ + "READ", /* $27 */ + "RESTORE", /* $28 */ + "RETURN", /* $29 */ + "RUN", /* $2a */ + "STOP", /* $2b */ + "POP", /* $2c */ + "?", /* $2d */ + "GET", /* $2e */ + "PUT", /* $2f */ + "LOMEM", /* $30 */ + "DEL", /* $31 */ + "RPUT", /* $32 */ + "RGET", /* $33 */ + "BPUT", /* $34 */ + "BGET", /* $35 */ + "TAB", /* $36 */ + "CP", /* $37 */ + "DOS", /* $38 */ + "ERASE", /* $39 */ + "PROTECT", /* $3a */ + "UNPROTECT", /* $3b */ + "DIR", /* $3c */ + "RENAME", /* $3d */ + "MOVE", /* $3e */ + "COLOR", /* $3f */ + "GRAPHICS", /* $40 */ + "PLOT", /* $41 */ + "POSITION", /* $42 */ + "DRAWTO", /* $43 */ + "SETCOLOR", /* $44 */ + "LOCATE", /* $45 */ + "SOUND", /* $46 */ + "LPRINT", /* $47 */ + "CSAVE", /* $48 */ + "CLOAD", /* $49 */ + "MISSILE", /* $4a */ + "PMCLR", /* $4b */ + "PMCOLOR", /* $4c */ + "PMGRAPHICS", /* $4d */ + "PMMOVE", /* $4e */ + "PMWIDTH", /* $4f */ + "SET", /* $50 */ + "LVAR", /* $51 */ + "", /* $52, silent LET */ + "ERROR-" /* $53 */ +}; + +const int aplus_cmd_size = sizeof(aplus_cmds); + +const char *aplus_ops[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, + ",", /* $12 */ + "$", /* $13 */ + ":", /* $14 */ + ";", /* $15 */ + "", /* $16 */ + "GOTO", /* $17 */ + "GOSUB", /* $18 */ + "TO", /* $19 */ + "STEP", /* $1a */ + "THEN", /* $1b */ + "USING", /* $1c */ + "#", /* $1d */ + "<=", /* $1e */ + "<>", /* $1f */ + ">=", /* $20 */ + "<", /* $21 */ + ">", /* $22 */ + "=", /* $23 */ + "^", /* $24 */ + "*", /* $25 */ + "+", /* $26 */ + "-", /* $27 */ + "/", /* $28 */ + "NOT", /* $29 */ + "OR", /* $2a */ + "AND", /* $2b */ + "!", /* $2c */ + "&", /* $2d */ + "(", /* $2e */ + ")", /* $2f */ + "=", /* $30 */ + "=", /* $31 */ + "<=", /* $32 */ + "<>", /* $33 */ + ">=", /* $34 */ + "<", /* $35 */ + ">", /* $36 */ + "=", /* $37 */ + "+", /* $38 */ + "-", /* $39 */ + "(", /* $3a */ + "", /* $3b */ + "", /* $3c */ + "(", /* $3d */ + "(", /* $3e */ + ",", /* $3f */ + "STR$", /* $40 */ + "CHR$", /* $41 */ + "USR", /* $42 */ + "ASC", /* $43 */ + "VAL", /* $44 */ + "LEN", /* $45 */ + "ADR", /* $46 */ + "BUMP", /* $47 */ + "FIND", /* $48 */ + "DPEEK", /* $49 */ + "ATN", /* $4a */ + "COS", /* $4b */ + "PEEK", /* $4c */ + "SIN", /* $4d */ + "RND", /* $4e */ + "FRE", /* $4f */ + "EXP", /* $50 */ + "LOG", /* $51 */ + "CLOG", /* $52 */ + "SQR", /* $53 */ + "SGN", /* $54 */ + "ABS", /* $55 */ + "INT", /* $56 */ + "SYS", /* $57 */ + "PADDLE", /* $58 */ + "STICK", /* $59 */ + "PTRIG", /* $5a */ + "STRIG", /* $5b */ + "VSTICK", /* $5c */ + "HSTICK", /* $5d */ + "PMADR", /* $5e */ + "ERR", /* $5f */ + "TAB", /* $60 */ + "PEN", /* $61 */ +}; + +const int aplus_ops_size = sizeof(aplus_ops); diff --git a/aplus_tokens.h b/aplus_tokens.h new file mode 100644 index 0000000..f0c905d --- /dev/null +++ b/aplus_tokens.h @@ -0,0 +1,5 @@ +extern const char *aplus_cmds[]; +extern const char *aplus_ops[]; + +extern const int aplus_cmd_size; +extern const int aplus_ops_size; @@ -12,8 +12,8 @@ #include "bcdfp.h" #include "tokens.h" #include "turbo_tokens.h" -/* #include "aplus_tokens.h" +/* #include "bxl_tokens.h" #include "bxe_tokens.h" */ @@ -490,9 +490,11 @@ void op_color_on(unsigned char tok) { color_on(color_cmd); return; default: - color_on(color_op); + break; } } + + color_on(color_op); } CALLBACK(print_op) { @@ -596,11 +598,8 @@ void init_bas_tables() { } void init_aplus_tables() { - die("BASIC A+ not supported yet!"); - /* - memmove(cmd_tokens, aplus_commands, (last_aplus_command + 1) * sizeof(char *)); - memmove(op_tokens, aplus_operators, (last_aplus_operator + 1) * sizeof(char *)); - */ + memmove(cmd_tokens, aplus_cmds, aplus_cmd_size); + memmove(op_tokens, aplus_ops, aplus_ops_size); } void init_turbo_tables() { |