; Simple assembler program using debug64.inc ; Works on Linux and Windows (Intel x64) ; Written by Viktors Berstis include debug64.inc ;debug calls to make this easy to run and debug .data ;put data after this align 16 whatever dq 9876543210 ;just some data .code ;put code after this public mainCRTStartup ;assembler assumes this as entry point name mainCRTStartup: dbgustr 'Hello World!' ;print user string ; the following is extra to demo a couple of debug calls: mov rax,whatever ;load whatever value into rax register call dbgprtfi ;print rax as formatted integer call dbgs ;print following string db '=whatever',13,10,0 ;text followed by carriage return and line feed dbgustr 'Hex dump of "whatever":' lea rsi,whatever ;put address of whatever in rsi register mov rcx,8 ;put length of whatever in rcx register call dbgdump ;dump what rsi points to for rcx bytes ; this exits the program gracefully (look in debug64.inc if you don't want the printed message) call dbgexit ;terminate program END ; Install Microsoft Visual Studio Community 2022 and "add workloads" ; https://visualstudio.microsoft.com/downloads/ ; Download build tools: ; https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022 ; https://aka.ms/vs/17/release/vs_BuildTools.exe ; click on more and install everything. ; get this hello.asm file and debug64.inc file ; To make Windows executable, run these commands on Windows: ; "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" ; ml64 /Sa /Fl /c -DX64 hello.asm ; link /subsystem:console /machine:x64 hello.obj kernel32.lib ; hello.exe ; To make Linux executable, run these commands on Windows: ; "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" ; ml64 /Fl /Dlinuxenvironment /c %1.asm ; link -map /subsystem:console /machine:x64 %1.obj ; copy hello.exe file to a Linux system: ; scp hello.exe youruserid@yourlinuxsystem.com:. ; Run these commands on that Linux system: ; objcopy -O elf64-x86-64 hello.exe hello ; ./hello ; erase hello.exe afterwards .. not useful on windows system nor linux afterwards