Assuming I hate myself and want to avoid external libraries as much as possible, I am trying to write hello world assembly. From what little I understand, in Windows we should link with the kernel32.dll and output from that. Any ideas why my code is not outputting?
code:
extern ExitProcess
extern WriteFile
section .text
global Start ;must be declared for linker (ld)
Start: ;tells linker entry point
mov rdx,len ;message length
mov rcx,msg ;message to write
mov rbx,1 ;file descriptor (stdout)
mov rdx,4 ;system call number (sys_write)
int WriteFile ;call kernel
mov rax,1 ;system call number (sys_exit)
int ExitProcess ;call kernel
section .data
msg db 'Hello, world!', 0xa ;string to be printed
len equ $ - msg ;length of the string
instructions ran:
nasm -f win64 -o hello_world.obj hello_world.asm
golink hello_world.obj kernel32.dll
hello_world.exe
no errors or warnings on running the commands.
Thanks in advance!