X16Community / x16-rom

Other
46 stars 27 forks source link

1E39 bug carried over from C64 #247

Closed tomxp411 closed 2 months ago

tomxp411 commented 11 months ago

Browsing YouTube today, I found a video about the VAL function and self destructing programs. This bug still exists in Commander X16 BASIC

https://www.youtube.com/watch?v=6j8kel86F60

The statement: 10 PRINT VAL("1E39") : REM MORE STUFF will cause anything after the 9 to be removed from the program line when executed.

10 PRINT VAL("1E39"):REM TEST
20 REM LINE 20
READY.
RUN
?OVERFLOW ERROR IN 10
READY.
LIST
10 PRINT VAL("1E39
20 REM LINE 20
READY.

The same thing happens if you assign a$ as a variable:

10 A$="1E39":REM TEST
20 PRINT VAL(A$):REM MORE TEXT
becomes
10 A$="1E39
20 PRINT VAL(A$):REM MORE TEXT

This has apparently been fixed in the Commodore 128 and in the 264 series. So maybe porting the function from the Plus 4 or 128 can correct this issue.

calmsacibis995 commented 2 months ago

OK, some progress has been made, but it's still not perfect, as you can see, the last character of the comment is cut off.

2024-08-31_23-05

mooinglemur commented 2 months ago

Closed by #357