Whats going on with BeebVSC?

bbc micro/electron/atom/risc os coding queries and routines
Post Reply
User avatar
archie456
Posts: 180
Joined: Sat Sep 07, 2019 4:22 pm
Location: Chelmsford
Contact:

Whats going on with BeebVSC?

Post by archie456 »

I've been using VS Code, BeebASM with BeebVSC to code for the Beeb for the last few years and everything worked just fine.

Recently BeebVSC was updated to version 0.2.1 and now VS Code highlights large sections of the code with orange squiggles highlighting errors such as 'Symbol not defined' and 'Fatal error: the second assembler pass has generated different code to the first'.
error.png
I now have a few 1000 errors in the code, but it assembles fine and run as expected with no errors.

Is there any way I can turn off this erroneous error checking? I found that if I roll back to version 0.2.0 it fixes the problem, so maybe that's the answer, but I'm unsure what the error is trying to tell me - maybe its a bug in BeebVSC?

Cheers!
tomhelm
Posts: 21
Joined: Fri Jan 19, 2024 5:18 pm
Contact:

Re: Whats going on with BeebVSC?

Post by tomhelm »

Earlier this year I added new functionality to BeebVSC, including internal parsing of the code based on BeebASM. The intention being to identify problems before going to compile as well as provide lots of information we can use to drive other nice features. However, it is clearly flagging errors that don't exist in this case.

My first guess is that this is an existing project that needs a bit of configuration so we can parse the code correctly. With BeebASM, you compile single file which itself may include various other files. Now BeebVSC needs to know what the entry point is, so it can identify symbols and labels defined in another file.

The built-in BeebVSC method for this is to press F10 (or use the Command Palette and search for "BeebVSC: Create new build target"), then select the target file that you compile with BeebASM. This creates or updates two files in the .vscode folder: tasks.json and settings.json. tasks.json for the build/test tasks and settings.json to store the information about where to start analysing your code. If you already have tasks.json set up as you like it, you could then just revert the changes to that, so the settings.json file is correct.

With the settings.json in place, the next parse should clear the errors. If this isn't working, would it be possible to share a copy of your project so I can debug the extension?
User avatar
archie456
Posts: 180
Joined: Sat Sep 07, 2019 4:22 pm
Location: Chelmsford
Contact:

Re: Whats going on with BeebVSC?

Post by archie456 »

Ah, OK.

So the set up I have is one ASM file then includes many other ASM files.

To build, (when I hit F7), it runs a BAT file which calls BeebASM to create the SSD file and also save the output to a text file, it then calls two DOS command to find some strings in the text file and save them out as a debug file so that BeebEm starts with the debug Watches and Breakpoints I need.

So I deleted the settings and tasks.json files and hit F10 (selected the build target, the main file which includes the others), this created new versions of the JSON files. I've not managed to edit them to get it working with the BAT file again it doesn't build at the moment, but I guess that should be simply enough to change the build tasks to run the BAT file. (Hopefully).

Recreating the JSON files doesn't get rid of the 'Symbol not defined' orange squiggles though... but maybe thats a problem with my setup?

Attached is a smaller version of the large project that I'm writing - this tests out an RLE compression routine by drawing parts of a sprite on the screen.
RLE Compression Test.zip
(7.62 KiB) Downloaded 7 times
One point to note is that in the BuildTasks.bat uses two DOS commands to help with the build, these create the debug file for BeebEm.
FINDSTR - which copies lines of text from the BuildOutput.txt into the debug file that start with WATCH or BP
SED - which adds an & symbol to the debug text for hex memory values.

Thanks for your help!
tomhelm
Posts: 21
Joined: Fri Jan 19, 2024 5:18 pm
Contact:

Re: Whats going on with BeebVSC?

Post by tomhelm »

Thanks for sharing the sample project. It seems okay on my machine at least, so I'm worried there is some environment specific issue.

I deleted the existing tasks.json, then pressed F10 to select Decomp.asm. After that it all looked good. No squiggles, the links to the included files were underlined and clickable, hovers for symbols, labels and keywords all okay.

I'm wondering if it is a packaging issue, so some file I have for development of BeebVSC is missing on other people's systems. Simonm did fix a packaging issue in 0.2.1 which is why I wonder if it is something similar. I'll keep poking and update you if any progress.
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: Whats going on with BeebVSC?

Post by MarkMoxon »

I'm afraid this started happening to me today as well. I have a project that is very heavily based around the INCLUDE directive in BeebAsm, and I have yellow squggly error lines absolutely everywhere!

I'm trying to follow your advice for choosing a target, but I'm having problems. Any help gratefully received…
tomhelm wrote: Mon Mar 25, 2024 9:13 am My first guess is that this is an existing project that needs a bit of configuration so we can parse the code correctly. With BeebASM, you compile single file which itself may include various other files. Now BeebVSC needs to know what the entry point is, so it can identify symbols and labels defined in another file.
My project has lots of "entry points" - one for every binary that the project builds, and there are lots of them (about 150 in all). Any advice on which one I should choose? There is no overall parent.
tomhelm wrote: Mon Mar 25, 2024 9:13 am The built-in BeebVSC method for this is to press F10 (or use the Command Palette and search for "BeebVSC: Create new build target"), then select the target file that you compile with BeebASM.
Where do I choose the file from? If I press F10 then the command field changes to "Create new build target: Choose a file", but I don't know what to do next. I was expecting a list of files to drop down from the command field or something, but I don't get that. This an absolutely huge project, with 1000s of .asm files, so might that be an issue?

Bit confused really, so sorry about that! I would like get rid of all these errors, though...

Mark
tomhelm
Posts: 21
Joined: Fri Jan 19, 2024 5:18 pm
Contact:

Re: Whats going on with BeebVSC?

Post by tomhelm »

MarkMoxon wrote: Mon Mar 25, 2024 9:33 pm My project has lots of "entry points" - one for every binary that the project builds, and there are lots of them (about 150 in all). Any advice on which one I should choose? There is no overall parent.
Wow, that's a big project! For these multi-target cases, we want to store the path to all the compile targets. This is to make it consistent with your build process i.e. every BeebASM.exe -i fileXX.asm, we want the path to fileXX.asm in the settings.json file.
As an example, one of the test projects I used is Tricky's PacMan. It builds game.asm and build.asm, and my settings.json looks like this:

Code: Select all

{
    "beebvsc": {
        "sourceFile": [
            "/Users/tomtom/Documents/Beeb/Games/Tricky's PacMan Source/PacManSrc/game.asm",
            "/Users/tomtom/Documents/Beeb/Games/Tricky's PacMan Source/PacManSrc/build.asm"
        ],
        "targetName": "build.ssd"
    }
}
If you're on Windows, I guess the paths will look quite different but hopefully this is something that can be generated fairly easily based on your existing make file.
MarkMoxon wrote: Mon Mar 25, 2024 9:33 pm Where do I choose the file from? If I press F10 then the command field changes to "Create new build target: Choose a file", but I don't know what to do next. I was expecting a list of files to drop down from the command field or something, but I don't get that. This an absolutely huge project, with 1000s of .asm files, so might that be an issue?
The F10 command just searches the workspace root directory in vscode, so probably you have all the files in a subfolder and we aren't picking them up. However, given the large number you mentioned, you won't want to be pressing F10 150 times to add the files one at a time! So just editing the settings.json directly probably makes sense.
MarkMoxon wrote: Mon Mar 25, 2024 9:33 pm Bit confused really, so sorry about that! I would like get rid of all these errors, though...
Sorry it's misbehaving, you may have better luck downgrading to an earlier version. Someone else mentioned they found 0.1.2 working better. It misses out on some nice new features but if changing the settings.json doesn't solve the problem then that could be a temporary fix until we can work out a better solution.

By the way, on startup it will attempt to build a tree of relationships between source files. So the 150 compile targets will be opened and scanned for INCLUDE statements, then recursively do the same for all included source files. It might take a moment depending on how big those are and the disk speed.
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: Whats going on with BeebVSC?

Post by MarkMoxon »

tomhelm wrote: Mon Mar 25, 2024 10:13 pm If you're on Windows, I guess the paths will look quite different but hopefully this is something that can be generated fairly easily based on your existing make file.
I'm on a Mac and this should be pretty easy to do - I'll try this tomorrow. Thanks!

One question: the project also creates multiple SSDs, so how would I set this part up? Your example just has a single targetName entry, so I'm not sure what to do there. The SSDs that are created have names that depend on both build parameters in make, and the group of source files being built, so there is a lot of variety and a lot of SSDs.

Or can I leave this blank? I'm not planning on getting VSCode to do the building, so do I need to set a targetName?

Will let you know how it goes - thanks so much for the help.

Mark
tomhelm
Posts: 21
Joined: Fri Jan 19, 2024 5:18 pm
Contact:

Re: Whats going on with BeebVSC?

Post by tomhelm »

MarkMoxon wrote: Mon Mar 25, 2024 10:31 pm One question: the project also creates multiple SSDs, so how would I set this part up? Your example just has a single targetName entry, so I'm not sure what to do there. The SSDs that are created have names that depend on both build parameters in make, and the group of source files being built, so there is a lot of variety and a lot of SSDs.

Or can I leave this blank? I'm not planning on getting VSCode to do the building, so do I need to set a targetName?
Yes, just leave the targetName blank (or rather an empty string than no parameter at all). We're not doing anything with that value yet.
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: Whats going on with BeebVSC?

Post by MarkMoxon »

tomhelm wrote: Mon Mar 25, 2024 10:13 pm
MarkMoxon wrote: Mon Mar 25, 2024 9:33 pm My project has lots of "entry points" - one for every binary that the project builds, and there are lots of them (about 150 in all). Any advice on which one I should choose? There is no overall parent.
Wow, that's a big project! For these multi-target cases, we want to store the path to all the compile targets. This is to make it consistent with your build process i.e. every BeebASM.exe -i fileXX.asm, we want the path to fileXX.asm in the settings.json file.
I'm so sorry, but I'm still stuck. I have created a "beebvsc" node in settings.json, but it hasn't made any difference and the new settings appear faded when looking at settings.json in VSCode, which I think means they have no effect. It certainly hasn't fixed the isssue, so I must be doing something wrong!

Am I supposed to be adding this to the main settings.json file, i.e. /User/xxx/Library/Application Support/Code/User/settings.json? I've also tried adding it to the workspace settings, but that didn't work either.

I attach my settings.json as it's probably something obvious.

Mark
Attachments
settings.json.zip
(1.87 KiB) Downloaded 3 times
tomhelm
Posts: 21
Joined: Fri Jan 19, 2024 5:18 pm
Contact:

Re: Whats going on with BeebVSC?

Post by tomhelm »

MarkMoxon wrote: Tue Mar 26, 2024 10:27 am Am I supposed to be adding this to the main settings.json file, i.e. /User/xxx/Library/Application Support/Code/User/settings.json? I've also tried adding it to the workspace settings, but that didn't work either.
The file contents you've created looks good, however the location isn't right. It is supposed to be in the .vscode folder within the workspace. VSCode will make this folder for you if using the create target command. E.g.
Screenshot 2024-03-26 at 16.45.45.png
I've pushed a new fix to the repository and asked Simon if he would kindly prepare a new release, so hopefully that will avoid the mass reporting of errors when the extension can't figure out the correct compile target. There is definitely more work to be done for these multi-target projects but at least this should remove some of the pain.
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: Whats going on with BeebVSC?

Post by MarkMoxon »

Don't worry, I'll downgrade. I can't auto-create that .vscode folder as I can't allocate a target (all my sources are in subfolders so the file list is empty). And I can't work out where to create that .vscode folder manually as my workspace is a collection of lots of disparate folders, so I don't know where to put it.

Thanks for your help, though! It's great to see this extension getting some love.

Mark
User avatar
simonm
Posts: 363
Joined: Mon May 09, 2016 3:40 pm
Contact:

Re: Whats going on with BeebVSC?

Post by simonm »

Just a heads up that v0.2.2 is now available with a fix from Tom.

Also just quickly, we are having a little fun enhancing this extension at the moment, so please bear with us if we are 'moving fast and breaking things' - what we do, we do for you, dear fellow beeb coders, all 10 of you :lol:

I'd just like to thank Tom for working on the spicier bits of the extension too, effectivelyt porting beebasm to typescript and adding real time code parsing and suchlike in his free time, this is non-trivial and amazing work. =D>

Lastly, ICYMI - the latest extension release has a built in JSBeeb emulator :wink:
viewtopic.php?p=420739#p420739
User avatar
MarkMoxon
Posts: 606
Joined: Thu Jul 18, 2019 4:38 pm
Contact:

Re: Whats going on with BeebVSC?

Post by MarkMoxon »

simonm wrote: Tue Mar 26, 2024 8:36 pm Just a heads up that v0.2.2 is now available with a fix from Tom.
Looks like I'll be upgrading again! Great stuff.
simonm wrote: Tue Mar 26, 2024 8:36 pm Also just quickly, we are having a little fun enhancing this extension at the moment, so please bear with us if we are 'moving fast and breaking things' - what we do, we do for you, dear fellow beeb coders, all 10 of you :lol:
As one of the 10, I have to say I'm loving the enhancements, even at the risk of things breaking. I can't even begin to count the hours that I've spent wrangling 6502 asm with this extension at my side, and I am very grateful. It is wonderful to see it being developed, and with some really impressive features!

Thank you Tom, thank you Simon. =D>

Mark
User avatar
archie456
Posts: 180
Joined: Sat Sep 07, 2019 4:22 pm
Location: Chelmsford
Contact:

Re: Whats going on with BeebVSC?

Post by archie456 »

Tom / Simon,

Just to say I'm back in business now! I'm using version 0.2.2 and after a bit of tweaking the JSON file I've now got it building via the BAT file I use.

It now detects and puts a yellow squiggle below correctly a label that's not been defined, but strangely when I mess about with a label name it triggers the 'symbol not defined' error correctly, but also adds squiggles to the labels below with the error 'Assembled code has changed between 1st and 2nd passes' - I'm not sure why that error shows:
error2.png
(The arrow shows the label I changed, then the yellow squiggles appear to symbols below, not sure why?)

Nonetheless, when I fix the label it compiled and runs fine.

Also, just noticed that you can shift click a symbol and it will take you to where its defined - excellent feature (was that recently added?), this will same me loads of time!

Thanks for you work, its really good to see new features being added!
Post Reply

Return to “programming”