cc/ca65 language extension for VS Code

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

cc/ca65 language extension for VS Code

Post by FrankenGraphics »

I don't know if any of you are using Visual Studio Code, but in any case.

fwd from Payton Byrd in the cc65 dev mailing list:
I have just published a VS Code Extension for CC65. It has the following features:

-Syntax highlighting for ca65 (.s,.asm,.mac,.inc)
-Code snippets for assembler
-Build and link files in the /src directory with cc65/ca65/ld65
-Works with Windows and Linux (including WSL)
-Edit in Windows, compile in WSL, etc.
-Execute emulator from VS Code
-Works with Makefiles
-Build with Make
-Test with Make
-Many configurable settings that allow for very flexible usage.

Where to get it:

Download the source from GitHub:

https://github.com/sharpninja/vscode-cc65

Install extension “cc65” from within VS Code.
might be useful for someone or maybe increase some interest in using vs code.
russellsprouts
Posts: 53
Joined: Sun Jan 31, 2016 9:55 pm

Re: cc/ca65 language extension for VS Code

Post by russellsprouts »

This looks great! I started implementing a VSCode plugin along similar lines. I also implemented parsing of debug files to provide Intellisense features -- "Go to definition", etc. I should clean up the code and submit it as a pull request to the project.
User avatar
Banshaku
Posts: 2417
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Re: cc/ca65 language extension for VS Code

Post by Banshaku »

That's a good find, never heard about this extension.

I wanted in the past to try to make one but gave up since I didn't want to be "trapped" again in some MS tools. But now that someone started one I may be interested to use it.

I do use vscode at work and it does the job for TypeScript and angular but its memory footprint is quite big because of electron. Except for that it is quite an interesting IDE.
theinfamousmrmeow
Posts: 11
Joined: Sun Mar 25, 2018 9:02 pm

Re: cc/ca65 language extension for VS Code

Post by theinfamousmrmeow »

Thanks for sharing this! I've been using VS code for my ventures into NESdev, and this is super helpful.

I really tried to use Atom, but it seems to be a massive resource hog. Which is a little bizarre, since both VScode and Atom are built on Electron.
DoctorMikeReddy
Posts: 22
Joined: Fri Aug 06, 2010 4:52 am

Re: cc/ca65 language extension for VS Code

Post by DoctorMikeReddy »

Any news on this? When I try to install in VS Code it says that several dependencies are deprecated now, and it won't install
User avatar
segaloco
Posts: 272
Joined: Fri Aug 25, 2023 11:56 am
Contact:

Re: cc/ca65 language extension for VS Code

Post by segaloco »

Dunno about that one, but I just recently installed Alchemy65, pretty much just for the syntax highlighting though, getting kinda tired of working on my disassemblies monochrome. Apparently the meat of that extension though is support for debugging in a VSCode-native way with Mesen as the target debugger. I haven't tried this as I couldn't get the linked Mesen version in their notes to actually run after building it. That said, I didn't check whether it actually supported arm64, I just ran the build and knocked out build errors til I got a binary.

One thing I want in Alchemy65 (which if it's open source I might try and experiment with) is support for headers and definitions therein. As far as I can tell, there isn't a "navigate to symbol under cursor" or "open this header" option when using the editor as one would get with, say, C, C#, or TypeScript. Other than that, I can happily say that Alchemy65 doesn't break anything in my VSCode install and it plays nice with other extensions I have installed, something I've had to contend with in the past. If you're just looking for some syntax highlighting, and/or can get the Mesen stuff to work, it'll probably work well for you. Dunno what the delta is between the two extensions, but Alchemy65 appears to be currently supported and work as far as I could get it to work in isolation.
DoctorMikeReddy
Posts: 22
Joined: Fri Aug 06, 2010 4:52 am

Re: cc/ca65 language extension for VS Code

Post by DoctorMikeReddy »

Sadly Mesen is not available for Mac :-(
There is a Linux branch, but for Intel-based machines and I’m on Apple silicon
DoctorMikeReddy
Posts: 22
Joined: Fri Aug 06, 2010 4:52 am

Re: cc/ca65 language extension for VS Code

Post by DoctorMikeReddy »

I’m currently experimenting with the Beeb 6502 extension, but adapting it for cc65 and ca65 by editing the tasks.json file to allow multiple tasks to compile by reverse engineering the compile.sh file from the simple ASM project.
lidnariq
Posts: 11430
Joined: Sun Apr 13, 2008 11:12 am

Re: cc/ca65 language extension for VS Code

Post by lidnariq »

DoctorMikeReddy wrote: Thu Oct 26, 2023 8:11 pm Sadly Mesen is not available for Mac :-(
There is a Linux branch, but for Intel-based machines and I’m on Apple silicon
Mesen2 is available for Mac...
DoctorMikeReddy
Posts: 22
Joined: Fri Aug 06, 2010 4:52 am

Re: cc/ca65 language extension for VS Code

Post by DoctorMikeReddy »

lidnariq wrote: Fri Oct 27, 2023 10:27 am Mesen2 is available for Mac...
I did not know this. However, I did read this at https://github.com/SourMesen/Mesen2

“macOS: Dev builds aren't available for ARM Macs. It's recommended to build it yourself by running make. The macOS build is still experimental and a number of issues/bugs/limitations remain, but it seems to be usable for the most part.”

I’ll have a play tomorrow
DoctorMikeReddy
Posts: 22
Joined: Fri Aug 06, 2010 4:52 am

Re: cc/ca65 language extension for VS Code

Post by DoctorMikeReddy »

Does anyone know if Alchemy65 works with the Mac version of Mesen2? It seems to be quite specific which version it can use, Mesen-X, which is deprecated in favour of Mesen2 (but thanks for the tip).
I did try editing tasks.json to use FCEUX instead, but while it launches the emulator nothing then runs; it did say it requires Mesen, presumably because it uses Lua scripting to interact
User avatar
segaloco
Posts: 272
Joined: Fri Aug 25, 2023 11:56 am
Contact:

Re: cc/ca65 language extension for VS Code

Post by segaloco »

Ideally an emulator would just expose something compatible with gdbserver, then the whole gdb ecosystem (including VSCode/gdb integrations) comes into play. I seem to recall BlastEm does this, I was able to get breakpoint debugging working in VSCode without any additional packages because it used a well-adopted, standard interface. I don't know why emu devs keep trying to reinvent the wheel on debugging, just shunt that off to a ubiquitous interface, then devs can use anything in that expansive ecosystem, so CLI tools, IDE extensions, you name it, rather than you must use this exact extension with this exact emulator and this exact debugger and this exact IDE. Abstractions exist for a reason...
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: cc/ca65 language extension for VS Code

Post by tepples »

I've been told that part of the difficulty in creating gdb stubs for NES, SMS, and GB emulators is how to represent the concept of banks to gdb. Is there a solution for this in some other homebrew scene?
Fiskbit
Posts: 890
Joined: Sat Nov 18, 2017 9:15 pm

Re: cc/ca65 language extension for VS Code

Post by Fiskbit »

Emulators' debuggers are very frequently used for debugging without source, and emulators tend to offer many other tools beside the debugger. Source debugging is one feature of a much larger suite.

Regarding banking, how does GDB deal with paging on x86? I'd imagine the solution would be similar.
Joe
Posts: 649
Joined: Mon Apr 01, 2013 11:17 pm

Re: cc/ca65 language extension for VS Code

Post by Joe »

tepples wrote: Fri Oct 27, 2023 11:45 amI've been told that part of the difficulty in creating gdb stubs for NES, SMS, and GB emulators is how to represent the concept of banks to gdb.
GDB supports overlays, so it should be possible. Is it just a matter of communicating which banks are currently mapped?
Fiskbit wrote: Fri Oct 27, 2023 5:29 pmRegarding banking, how does GDB deal with paging on x86?
It doesn't. Nobody uses paging for bank switching on x86.
Post Reply