Working with Amiga C using Visual Studio Code

I’ve found it rather difficult to go back to coding on the Amiga with the available editors. Most of them lack decent syntax highlighting, formatting, intellisense and autocomplete.

Professionally I’m used to using the likes of Visual Studio which supplies all those features. Using Visual Studio Code, a free IDE from Microsoft, with a few extensions I’ve been able to code in Amiga C on windows quite well.

In the screenshot below, I have a folder on google drive set up in the following structure.

  • DH0 and DH1 are Workbench and Work respectively
  • Original System is a fresh install of Workbench 3.1 that I can use to setup a new hard drive in a matter of seconds
  • I have a copy of the RKM Companion Disk as a helpful reminder of things
  • A Backup of both DH0 and DH1 when both areworking correctly
  • Various adf’s of Devpac, Dice C, and SAS C v6

I’ll skip the installing of Workbench and SAS/C; suffice it to say it’s a case of inserting disk 1 running the install file and then inserting the other 5 as prompted.

You can obtain SAS/C from tosec or possibly the eab

I have my WinUAE hard drives set up like this: (running as an a1200, fasted possible setting on the CPU)

My copy of Visual Studio Code has the following extensions installed, you may not need all of them but I’m pretty sure you need C/C++ from Microsoft. (see image)

I Create a folder in windows at C:\Users\Joe\Google Drive\_Amiga\DH1\Projects\Joe5, this will be where I store all the files

As this is shared via WinUAE it’s now possible to do the following in CLI:

  • cd Work:/Projects/Joe5
  • scsetup

This creates some files used by/with sas/c

In Visual Studio Code, go to File->Open Folder, and select the Joe5(or relevant) folder, this will give you a window similar to that below:

All be it without the main.c, which needs to be created ( done by clicking on the file icon under the project explorer)

Next, the include files need to be imported. This is currently a bit obtuse in it’s implimentation, but it’s the only realistic way I can find of doing it; by causing a problem in your code.
In the image below I try to reference the exec/types.h, VSCode does not yet know what that file is!

This is advantageous though as Clicking on the ‘Edit “includePath” setting’ allows us to then point VSCode to add Sas/C’s include directory. (your path’s may be different) see below:

When this is set, save and close main.c and you should have intellisense and autocomplete, very useful!.. allowing for things like this:

On the Amiga side, we can now run mkmk to create a makefile, after the make file has been created we can then smake

Due to my sloppy coding, I forgot to do a few things correctly, Which caused errors during the build process, I was able to output the results of the build to a file, also viewable in VSCode:

So I fix the code, and then run smake

Type main (the name of the program)

And that’s it!

P.S. This was written rather quickly, so any spelling mistakes or glaring errors I apologise for!

Download the example project.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.