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

ATBASIC ERROR in string substrings #163

Open
okwatts opened this issue Sep 5, 2024 · 7 comments
Open

ATBASIC ERROR in string substrings #163

okwatts opened this issue Sep 5, 2024 · 7 comments

Comments

@okwatts
Copy link

okwatts commented Sep 5, 2024

If you try and extract a substring using A$(4,5) it appears that it is treated as a numeric and the left Bracket is used as exponentiation.
ie if B$="AB" and you print B$(1) you get 5.20200002e+53
Edit: This is on nano6502. This is for printing. If you let A$=B$(1) then print A$ you get the correct result.

@ivop
Copy link
Contributor

ivop commented Oct 3, 2024

I can not reproduce this:

atari000

Could you show the exact steps you took and its output?

@okwatts
Copy link
Author

okwatts commented Oct 4, 2024 via email

@venomix666
Copy link
Contributor

venomix666 commented Oct 5, 2024

I can reproduce it on the BBC Micro (using b-em), see screenshot below, but not on the Atari800 (using the atari800 emulator).

atbasic_error_bbcmicro

@venomix666
Copy link
Contributor

I can also reproduce it on the Oric, VIC20 and PET (all emulated) - so somehow it seems to only work on the Atari. Strange!

@ivop
Copy link
Contributor

ivop commented Oct 8, 2024

I suppose some Atari dependency is still left in the source code (Altirra was originally written solely for the Atari), hence it working correctly on the Atari but not on other systems.

@davidgiven
Copy link
Owner

I have vague memories that Atari basic uses hardware to generate random numbers, and that doesn't work on the CP/M-65 port, so it's plausible that there's some other Atari-specific code I've missed. But it's too long ago now and I'd have no idea what it is.

@ivop
Copy link
Contributor

ivop commented Oct 11, 2024

Yes, it reads the Atari Pokey chip's RANDOM register, which is a 17-bit LFSR. I see you replaced that with lda #0 in funRnd 😄

I could add sfc16 from here. That would add better random numbers than the original on the Atari 😉 A simple 16-bit LFSR could also be done, if adding 180 bytes would be too large. xorshift16 for example.

This printing of a sub-string bug does not seem related though. I have no idea where to search for it.

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

4 participants