i am using windows 7 for learning assembly language.I am using NASM for creating object files and mingw for creating executable files.
i am using the following commands for compile and run executable files
del hello.o
del hello.exe
nasm -f elf hello.asm
ld hello.o -o hello.exe
hello
while running the hello.exe file,an error message showing “hello.exe has stoped working”
while using the following command
nasm -f bin hello.asm -o program.exe
i have got an error shown below

my program code
global _start ; global entry point export for ld
section .text
_start:
; sys_write(stdout, message, length)
mov eax, 4 ; sys_write syscall
mov ebx, 1 ; stdout
mov ecx, message ; message address
mov edx, length ; message string length
int 80h
; sys_exit(return_code)
mov eax, 1 ; sys_exit syscall
mov ebx, 0 ; return 0 (success)
int 80h
section .data
message: db 'Hello, world!',0x0A ; message and newline
length: equ $-message ; NASM definition pseudo-instruction
What you have there is Linux code (
int 0x80,sys_writeandsys_exitbeing kernel system calls for rather low-level stuff).I’m not convinced it’s a good idea to try and call the Linux kernel when you’re running on the Windows operating system. That’s unlikely to end well 🙂
MinGW is minimalist GNU for Windows, a way of using the
gcctoolchain for writing Windows applications. You have to therefore follow the Windows rules.