vs64 icon indicating copy to clipboard operation
vs64 copied to clipboard

C64 Basic negative DATA entries not working

Open clouddistortion opened this issue 3 months ago • 1 comments

Using a Mac OS Ventura 13.6.6 and Visual Studio Code Version: 1.87.2 (Universal) Commit: 863d2581ecda6849923a2118d93a088b0745d9d6 setup for creating a BASIC script I encountered a weird error:

The following results in a SYNTAX ERROR within VICE.

10 READ B%
20 if B%<0 THEN END
30 ? B% 
40 GOTO 10
50 DATA 9,2,4,5,5,7
60 DATA 0,9,8,7,5,-1

If I then LIST the script and just overwrite the minus character and updating the line 60 it works.

clouddistortion avatar Mar 29 '24 17:03 clouddistortion

Thanks. That's a nice catch...

The "magic" is: the BASIC interpreter handles '-' and '+' differently for DATA lines - which I now had to learn.

  • DATA line: + and - are just characters
  • Any other line: + and - are operators and are converted to a specific "token" byte The LIST command shows everything identically, as the tokens get "de-tokenized" back to "-" and "+" ...

Fix will be rolled out with v2.5.6.

rolandshacks avatar Mar 30 '24 14:03 rolandshacks

Got the latest release v2.5.6 from github (installed manually). Works great thanks a lot

clouddistortion avatar Apr 27 '24 10:04 clouddistortion