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
Problems with POKE B and POKE W #2
Comments
Something similar applies to the corresponding PEEKW-Function. This code should give you 128 read from memory location 5000, but it gives you 320 read from 1000/1001 instead:
|
If you want to peek the contents of W(1000), the above syntax is wrong. |
True, I guess I was confused by the whole issue, which is something that others might be as well when looking at code like PEEK W(1000) thinking that it should be wrong just as PEEK V(1000) would be. I would still prefer that this gets changed to something like WPOKE/WPEEK instead, which wouldn't suffer from these issues. |
Fixed in V920356 by renaming POKEW -> WPOKE and removing POKEB (just use POKE). |
When POKE is used in conjunction with variable names that begin with B or W, mostly undesirable side effects occur.
The problem came to the attention of a user by chance, because he wondered why PRINT BF(BZ) works in his program and outputs 2594, but a POKE BF(BZ),1 does not put a 1 in the place of 2594. However, a POKE 2594,1 does work.
https://www.forum64.de/index.php?thread/118911-der-mega65-laber-stammtisch/&postID=1843717#post1843717
The reason is that POKE interprets the B of BF as a "POKE byte" and thus undesirably executes POKEB F(BZ),1.
The problem also occurs with variable names that begin with W because of POKE W.
The line POKE WF,65 lets crash the system!
For most people it will be not clear, why line 40 sends a syntax error, but line 20 not?
The text was updated successfully, but these errors were encountered: