comparison lwasm/output.c @ 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 e10618b48e68
comparison
equal deleted inserted replaced
535:a584b9ddffc4 536:33a59e232a5b
119 fclose(of); 119 fclose(of);
120 } 120 }
121 121
122 int write_code_BASIC_fprintf(FILE *of, int linelength, int *linenumber, int value) 122 int write_code_BASIC_fprintf(FILE *of, int linelength, int *linenumber, int value)
123 { 123 {
124 if (linelength > 247) 124 // 240 should give enough room for a 5 digit value and a comma with a bit of extra
125 // space in case something unusual happens without going over the 249 character
126 // limit Color Basic has on input lines.
127 if (linelength > 240)
125 { 128 {
126 fprintf(of, "\n"); 129 fprintf(of, "\n");
127 linelength = fprintf(of, "%d DATA ", *linenumber); 130 linelength = fprintf(of, "%d DATA ", *linenumber);
128 *linenumber += 10; 131 *linenumber += 10;
129 } 132 }