Trying to get build tasks working using VASM

Not sure if this is the best place for this but as I can’t seem to find any support for VASM so figured someone might know the answer to this.

VASM is a 6502 assembler. I’m trying to configure tasks.json which I have more or less working but running into a strange issue when trying to specify the output file.

If I run this from the terminal it works.

vasm6502_oldstyle -Fbin -o demo.bin demo.s -dotdir

However with this in the tasks.json

{   
    "version": "2.0.0",
    "tasks": [
        {
            "label": "vasm",
            "type": "shell",
            "command": "/usr/bin/vasm6502_oldstyle",
            "args": [
                "-Fbin",
                "-o demo.bin",
                "${file}",
                "-dotdir"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": []
        }
    ]
}

I get

error 15: unknown option <-o demo.bin>
The terminal process "/usr/bin/bash '-c', '/usr/bin/vasm6502_oldstyle -Fbin '-o demo.bin' /home/greg/nfs/PlatformIO/DevEnvironmentDemo-main/demo.s -dotdir'" failed to launch (exit code: 1).

Not sure why is works on the CLI but not from VSC.

Is there something I’m missing in my json file?

If I exclude the “-o demo.bin” it works but then defaults to a filename of a.out.
Guess worst case I could run some postinst script to rename the file?

Use

            "args": [
                "-Fbin",
                "-o",
                "demo.bin",
                "${file}",
                "-dotdir"
            ],

Instead.

Perfect, that did it. Thanks.

Guess it was the space screwing things up.

Yes, if you wrote "-o demo.bin" it tries to transport that is a single argument and escapes it accordingly, but it must be two separate arguments (each properly escaped on their own, but not needed here), so that the program receives -o and demo.bin as two consecutive arguments, not -o demo.bin as one entry of argv[].

And in fact, it would be quite cool to have PlatformIO support for 6502 assembly (or even, C?), for old retro computers or things like the Commander X16… If there aren’t VSCode extensions for that already.

Thanks for the explanation. Makes sense.

That would be cool. Trying my hand at some 6502. Been many many moons since I last used it.