Skip to content
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

PUTBASIC auto-line-numbering doesn't like programs starting with line number 0 #62

Open
ZornsLemma opened this issue Aug 10, 2021 · 0 comments

Comments

@ZornsLemma
Copy link
Collaborator

This can be seen by tweaking test/3-directives/basicrhstoken.bas to look like this:

0p=PAGE
PRINT p
?&900=PAGE MOD 256
PRINT FNpage
PRINT ?&900
?&901=TIME MOD 256
PRINT ?&901
PRINT FNtime
END
DEF FNpage
=PAGE
DEF FNtime
=TIME

The corresponding test case then generates the error:

basicrhstoken.6502:1: error: basicrhstoken.bas: Out of sequence line numbers (0 followed by 0) at line 2

(Of course the test would probably fail anyway, as the tokenised BASIC program would have different line numbers and the gold .ssd wouldn't match. I'm just using this as a convenient way to illustrate the problem.)

I suspect the natural fix is as simple as changing the initial value of CurLine from 1 to 0 in ImportBASIC(). This will cause beebasm output using auto-line-numbering of BASIC to change (because line numbers will start at 1 instead of 0); I don't know if it's worth the pain of making a more involved fix.

(Credit to TobyLobster for finding this indirectly; it happens in basictool and I realised PUTBASIC would almost certainly have the same problem.)

mungre added a commit to mungre/beebasm that referenced this issue Oct 16, 2022
mungre added a commit to mungre/beebasm that referenced this issue Oct 16, 2022
mungre added a commit to mungre/beebasm that referenced this issue Oct 17, 2022
mungre added a commit to mungre/beebasm that referenced this issue Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant