-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Pretty printer" for BASIC #11
Comments
See also the thread here: https://twitter.com/bbc_micro/status/1334247124142321668 Things to note:
|
It seems in practice you can have up to at least 259 characters before tokenisation: If I add more characters to that input owlet seems to get unhappy, but looking at http://8bs.com/basic/basic4-8db2.htm I don't really see why it wouldn't handle a longer input provided the tokenised output fits... But even if only the tokenised output needs to fit in the line length limit, the need to add spaces in some places when expanding tokens means that this would still sometimes be an issue. |
I've worked it out - in the BASIC ROM's tokeniser code there's a loop to copy the tail of the line down after substituting a token, indexed on Y. If the untokenised tail is more than 255 bytes then Y wraps. So the limit isn't the size of the input, but the size of the input after the first keyword. I've opened mattgodbolt/jsbeeb#314 which intercepts PC reaching this loop and copies the tail in JS instead - with that we can tokenise any line which fits after tokenising. |
Expanding out the whole thing from the (sometimes) compressed mass of
P."moo";:?A=1:MO.2
into separate lines. Would need to handle line numbering cleverly.The text was updated successfully, but these errors were encountered: