Is it possible to compile assembly language with Microsoft Visual Studio Code?
The commands would look something like this:
sudo nasm -f elf64 helloWorld.asm
ld helloWorld.o -o helloWorld
./helloWorld
Yes it's possible. Just add this line to your settings:
{
// ...
"code-runner.executorMap": {
// Linux based
"asm": "nasm -felf64 $fileName && ld $fileNameWithoutExt.o -o $fileNameWithoutExt && ./$fileNameWithoutExt",
// Mac
"asm": "nasm -fmacho64 $fileName && ld $fileNameWithoutExt.o -o $fileNameWithoutExt && ./$fileNameWithoutExt",
// Windows (not tested)
"asm": "nasm -win32 $fileName && ld $fileNameWithoutExt.o -o $fileNameWithoutExt.exe && ./$fileNameWithoutExt.exe",
// ...
},
// ...
If anyone can test the windows and mac commands, i think it can be added as a default @formulahendry
EDIT: may be useful to use gcc instead of ld, but idk much about assembly to confirm.
I almost have MASM working also and will share my solution when I get home.
Edit: @maxjf1
Commands to compile assembly for the Kip Irvine library
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin
ml /DM=main example.asm /link /entry:main /subsystem:console
```
ml /DM=main example.asm /link /entry:main /subsystem:windows
## MASM ml x86 command
ml64 /DM=main example.asm /link /entry:main@0 /subsystem:console
ml64 /DM=main example.asm /link /entry:main@0 /subsystem:windows
## Code-Runner settings for cmd.exe
cd $dir && ml /DM=main $fileNameWithoutExt.asm /link /entry:main@0 /subsystem:console /OUT:$fileNameWithoutExt.exe
## Ml64 attempt
ml64 /nologo /Zi /Zd /I C:\Irvine /Fe link /ENTRY:"main" /LARGEADDRESSAWARE:NO C:/Irvine/Project64/Irvine64.obj kernel32.lib
Most helpful comment
Yes it's possible. Just add this line to your settings:
If anyone can test the windows and mac commands, i think it can be added as a default @formulahendry
EDIT: may be useful to use
gccinstead ofld, but idk much about assembly to confirm.