changeset 536:33a59e232a5b

Fix basic output target to keep lines below 249 characters The line length limiter in the basic output was not properly moving to the next before 249 characters, which is the limit Color Basic can read in an ASCII basic program. Changed the line limiter to 240 from 247 to account for a possible 5 digit number plus a comma and just a bit of extra breathing space.
author William Astle <lost@l-w.ca>
date Thu, 16 Jun 2022 13:55:34 -0600
parents a584b9ddffc4
children 3f81d8b11e5b
files lwasm/output.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/output.c	Sat May 14 21:30:59 2022 -0600
+++ b/lwasm/output.c	Thu Jun 16 13:55:34 2022 -0600
@@ -121,7 +121,10 @@
 
 int write_code_BASIC_fprintf(FILE *of, int linelength, int *linenumber, int value)
 {
-	if (linelength > 247)
+	// 240 should give enough room for a 5 digit value and a comma with a bit of extra
+	// space in case something unusual happens without going over the 249 character
+	// limit Color Basic has on input lines.
+	if (linelength > 240)
 	{
 		fprintf(of, "\n");
 		linelength = fprintf(of, "%d DATA ", *linenumber);