Thursday, 1 June 2017

Using Visual Studio Code as your Editor on a Mac

I have managed to get VS Code to work for my development

Download Visual Studio Code



I am assuming you are using PASMO as your command line assembler, but the following tutorial should work with your command line assembler of choice.

To set up PASMO on a Mac, see this awesome tutorial

Create the Test Project
Like all my Angular and Node development, I now create a new folder for each spectrum project.

I also create a "DIST" subfolder, for the assembled TAP file to live.

Once you have created it, from VS Code choose "Open Folder" and point to the newly created folder.

You should see no files, except for a "DIST" folder

Create a test "hello..asm" file (Shoutout to Juho Vähä-Herttua)

org $8000

; Define some ROM routines
cls EQU $0D6B
opench EQU $1601
print EQU $203C

; Define our string to print
string:
db 'Hello world!',13

start:
; Clear screen
call cls

; Open upper screen channel
ld a,2
call opench

; Print string
ld de,string
ld bc,13
call print

; Return to the operating system
ret

end start 


Configure tasks.json
To create your tasks.json file, follow this tutorial (Just need to complete the "Hello World" bit)

This part assumes that "Pasmo" is in your environments $PATH and can be called from anywhere.

If not, you will need to add it to your environment path. Replace the default task in task.json with the following
{
"command": "pasmo",
"args": ["--tapbas", "-d", "${fileBasename}", "dist/${fileBasenameNoExtension}.tap"],
"showOutput": "always"


Edit your keybindings.json (VS->Preferences->Key Mappings->keybindings.jscon) with:

{
"key": "cmd+q",
"command": "workbench.action.tasks.runTask",
"args": "pasmo"


Go Go Go
Select the file you want to assemble ("hello.asm") and then do CMD+Q, and it will assemble your code and put the TAP file in your DIST folder.

Now open with FUSE, SPECTACULATOR etc and you are away. I

No comments:

Post a Comment