rolandshacks / vs64

C64 Development Environment for Visual Studio Code
Other
95 stars 16 forks source link

undefined label #75

Open blongden opened 4 hours ago

blongden commented 4 hours ago

First of all, thanks for the extension - this is a much nicer experience than what you got on the OG hardware!!

I'm just getting back into C64 basic and I thought I'd try a couple of sample bits of code that I know work (and have verified in VICE), however the well known 'POKE ALL THE COLOURS' demo fails to compile in bc and I cannot work out why.

B=53280 : P=53281 : V=53265 : T=646 : R=128
PRINT "{clear}"
30 C=C+1
IF C>15 THEN C=0
FOR W=1 to 15:WAIT V,R:NEXT W
POKE B,C : POKE P, PEEK (B)
POKE T, C
PRINT " POKE ALL THE COLOURS ";
GOTO 30

Above is the code. The bc error is on line 5, undefined label, 'C'. Is there something I need to do to either declare the variable for the bc compiler, or a setting to make it less strict (and truer to how basic 2 runs in the emulator)?

rolandshacks commented 3 hours ago

Hi. Just had a quick look and it seems like you found a bug. Please give a little bit to analyze and fix.

Cheers! Roland

rolandshacks commented 2 hours ago

Found it. Bug / problem is the "THEN C=0": 'C' is incorrectly taken as label, not as variable because there wasn't a lookahead for '='. This is now fixed.

Whenever I find some time, I will do a few quick tests and if everything is fine, publish an update release.

Thanks for reporting, Ben!

Roland

blongden commented 2 hours ago

I dug into the code a little and came to the same conclusion! Thanks for taking a look so quick and your work on this (I'm super impressed there's a full parser for BASIC2.0 embedded in this thing..!)