aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-02-26 17:11:46 -0500
committerB. Watson <urchlay@slackware.uk>2025-02-26 17:11:46 -0500
commita7acc764849e8d72b5a479599668888914ec4d6c (patch)
tree5f04f73bca583b2b68164363ac52ab3a1e2d8752
parent59406751d8bc07a64b944830560d1d709c105fd3 (diff)
downloadbw-atari8-tools-a7acc764849e8d72b5a479599668888914ec4d6c.tar.gz
listamsb: complain more about lines >255 bytes long.
-rw-r--r--listamsb.112
-rw-r--r--listamsb.c16
-rw-r--r--listamsb.rst12
3 files changed, 35 insertions, 5 deletions
diff --git a/listamsb.1 b/listamsb.1
index 324ab3f..015a492 100644
--- a/listamsb.1
+++ b/listamsb.1
@@ -139,6 +139,18 @@ line \fIL\fP: EOL address \fIA\fP <= previous \fIB\fP
.sp
Corrupt file, or not an AMSB file.
.IP \(bu 2
+line \fIL\fP is suspiciously long
+.sp
+The line is >128 bytes long, but less than 256. AMSB can execute
+lines of this length, but it\(aqs impossible to actually enter them
+in the editor, because a logical line can\(aqt be longer than 3
+screen lines. Possibly corrupted file.
+.IP \(bu 2
+line \fIL\fP is impossibly long
+.sp
+The line is >= 256 bytes long. AMSB will crash, if you try to
+LOAD the file. Corrupted file.
+.IP \(bu 2
line \fIL\fP EOL address doesn\(aqt match actual line length \fIN\fP
.sp
Same as above: corrupt, or not AMSB.
diff --git a/listamsb.c b/listamsb.c
index efcaf00..207c3bb 100644
--- a/listamsb.c
+++ b/listamsb.c
@@ -33,11 +33,13 @@
even with cart-based AMSB2 and no DOS loaded. */
#define MAX_PROGLEN 30000
-/* there should never be a valid line of BASIC longer than this many
+/* there should never be a valid line of BASIC longer than MAX_LINE_LEN
bytes, since there would be no way to enter it in the editor. AMSB
uses the standard E: device, which limits you to 4 screen lines, or
- max 120 bytes. */
+ max 120 bytes. there *cannot* be a line longer than MAX_LINE_LEN_HARD,
+ because AMSB would crash when you try to LOAD such a program. */
#define MAX_LINE_LEN 0x80
+#define MAX_LINE_LEN_HARD 0xff
/* a program whose header has a length less than MIN_PROGLEN can't be
a real AMSB program. EMPTY_PROGLEN is what you get if you
@@ -273,9 +275,13 @@ int next_line(void) {
}
if(len > MAX_LINE_LEN) {
- fprintf(stderr, "%s: line %d is suspiciously long (length %d > %d)\n",
- self, lineno, len, MAX_LINE_LEN);
- warnings++;
+ int hard = len > MAX_LINE_LEN_HARD;
+ fprintf(stderr, "%s: line %d is %s long (length %d > %d)\n",
+ self,
+ lineno,
+ hard ? "impossibly" : "supiciously",
+ len,
+ hard ? MAX_LINE_LEN : MAX_LINE_LEN_HARD);
}
if(last_ptr != -1) {
diff --git a/listamsb.rst b/listamsb.rst
index bf3863b..c5177e0 100644
--- a/listamsb.rst
+++ b/listamsb.rst
@@ -123,6 +123,18 @@ continues processing.
Corrupt file, or not an AMSB file.
+- line *L* is suspiciously long
+
+ The line is >128 bytes long, but less than 256. AMSB can execute
+ lines of this length, but it's impossible to actually enter them
+ in the editor, because a logical line can't be longer than 3
+ screen lines. Possibly corrupted file.
+
+- line *L* is impossibly long
+
+ The line is >= 256 bytes long. AMSB will crash, if you try to
+ LOAD the file. Corrupted file.
+
- line *L* EOL address doesn't match actual line length *N*
Same as above: corrupt, or not AMSB.