Hello world using nasm in windows assembly
The biggest problem is that you are trying to use Linux interupts on windows!int 80 will NOT work on windows.
We are using Assembly, so your entry point can be ANY label you want. The standard entry point that ld looks for is _start, if you want to use another label, you need to tell ld with the -e optionSo if you want your start label to be main, then you need
global mainld -e main test.o -o test.exe
If you are going to use NASM on Windows, I will recommend using GoLink as your linker.Here is a simple windows console app:
STD_OUTPUT_HANDLE equ -11NULL equ 0global GobleyGookextern ExitProcess, GetStdHandle, WriteConsoleAsection .datamsg db "Hello World!", 13, 10, 0msg.len equ $ - msgsection .bssdummy resd 1section .textGobleyGook: push STD_OUTPUT_HANDLE call GetStdHandle push NULL push dummy push msg.len push msg push eax call WriteConsoleA push NULL call ExitProcess
makefile:
hello: hello.obj GoLink.exe /console /entry GobleyGook hello.obj kernel32.dll hello.obj: hello.asm nasm -f win32 hello.asm -o hello.obj