aboutsummaryrefslogtreecommitdiff
path: root/listbas.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-07-16 03:07:35 -0400
committerB. Watson <urchlay@slackware.uk>2024-07-16 03:07:35 -0400
commit14595634df55b698f0b924e75572df6f0b809555 (patch)
tree6fba647b2d15b33c537b12d3c2a5a0454b734a42 /listbas.c
parent9b46fa29695efed9a3c7e3ba891e8f69ee155e02 (diff)
downloadbw-atari8-tools-14595634df55b698f0b924e75572df6f0b809555.tar.gz
listbas: handle A+ ERROR- token (required bas.c changes); don't segfault on runaway variable name lookup.
Diffstat (limited to 'listbas.c')
-rw-r--r--listbas.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/listbas.c b/listbas.c
index d542bcd..884f763 100644
--- a/listbas.c
+++ b/listbas.c
@@ -441,6 +441,12 @@ CALLBACK(print_cmd) {
}
void aplus_op_color_on(unsigned char tok) {
+ switch(tok) {
+ default:
+ break;
+ }
+
+ color_on(color_op);
}
void op_color_on(unsigned char tok) {
@@ -535,9 +541,15 @@ CALLBACK(print_varname) {
if(color) color_on(color_varnames);
tok &= 0x7f;
+
for(i = vnstart, count = 0; count < tok; i++) {
if(program[i] & 0x80) count++;
+ if(i == codestart) {
+ fprintf(outfh, "(bad var tok $%02x)", tok | 0x80);
+ return;
+ }
}
+
do {
c = program[i++];
if(color && c == ('(' | 0x80)) {
@@ -640,6 +652,9 @@ int main(int argc, char **argv) {
if(bas_type != B_ATARI && bas_type != B_APLUS)
allow_hex_const = 1;
+ if(bas_type == B_APLUS)
+ aplus_errtok_hack = 1;
+
init_token_tables();
readfile();