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.
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.The same thing happens if you assign a$ as a variable:
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.