Fix broken line length in xt_words - #271
Conversation
xt_words didn't respect MAX_LINE_LENGTH because at the end of each line it set the length counter to 0. Instead it should be set to the word about to be printed because that's already in memory so its length needs to be taken into consideration. This commit fixes that behaviour and also adds one extra character to the count to account for the added space.
|
Hi wkjagt - I just wanted to give you an update that Tali Forth 2 development will be moving over to my repository shortly as I am taking over development from Scot. I need to get my repository synced up with Scot's and then I will incorporate your patch (hopefully by this weekend). Thanks for issuing a pull request and for such a clear description of the issue. |
|
Hi wkjagt - I have my repository all set up and have already pulled this pull request through to my repository and merged it. You will want to change your upstream to SamCoVT/TaliForth2/master-ophis if you'd like to stay with the Ophis assembler or master-64tass (preferred) if you can handle switching to the 64tass assembler. I've merged your pull request in both places. |
What is broken
wordsoutput formatting is broken, because the lines it outputs are too long:The fix in this PR:
xt_wordsdoesn't respectMAX_LINE_LENGTHcorrectly because at the end of each line it resets the length counter to0, while the next word is already in memory to be printed on the next line. So effectively, for each line after the first, it starts counting the line length from0after printing the first word on that line. Instead it needs be set to the length of that first word (plus 1, for a space) so it's taken into consideration when the count continues after that word. This commit resets the counter to the length of the word already in memory (the first word to be printed on the new line), and increments it once to account for the space printed after the word. The length of that word is still on the stack at this point, put there byxt_name_to_string, so it can be taken directly from there withlda 0,x, exactly like the routine already does right above when adding the length of the word to the counter.Output after the fix:
Fixes #270