-
Notifications
You must be signed in to change notification settings - Fork 27
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
[BASIC] Fix 1E39 bug (Issue #247) #357
Conversation
I don't think any trivial changes like this would solve this completely. It all comes down to how passing strings around happens in BASIC. If the string passed to Your usage of Where the lack of termination in the correct spot will certainly frequently break is if you call The most simple solutions here would probably involve allocating a new string off the heap with a length of the original string +1, and then copying the data to the new location while terminating it, and then allowing garbage collection to reclaim the space later. |
I reverted my chages from As you can see in the screenshot below, the comment is not destroyed, regardless of its length, due to proper string handling, but the e.g. line 10: But I'm so close to fixing this ancient bug. |
I think the primary issue with your current code is that you tried to allocate variables in ROM space. You won't get assembler warnings, it simply won't work because trying to store to a ROM address is essentially a no-op, so your read-back would be the default fill value in ROM. There are locations you can use to store temporary state in BASIC, but you have to be extra careful that there's no stomping on other state. I don't think we need it though.
Unfortunately, I'd structure it something like this:
|
perhaps some cheap bounds checking after |
As an aside, for code style reasons, please use spaces for comments on the same line as assembly code rather than tabs. There should be a maximum of one tab per line, and the first indent character should always be a tab, allowing for good visual alignment regardless of tab width. |
I went with your suggestion, and it fixed the issue. I made my modifications to handle the pointers correctly at the end, by pulling them from the stack that we had saved previously, and added an Even though there is a |
I believe now it can be merged, as a proper, permanent fix has been implemented. |
OK, let's do what you suggested. That should fix it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
The following modifications in
basic/code17.s
fixes the 1E39 bug (see #247) that we inherited from the C64.