0

I have written this nasm code to print "hello world!", but it does not. Can someone explain why ? I am running Windows XP on a pentium (x86).

segment .text       ;code segment
    global main     ;must be declared for linker
main:               ;tell linker entry point
    mov edx,len     ;message length
    mov ecx,msg     ;message to write
    mov ebx,1       ;file descriptor (stdout)
    mov eax,4       ;system call number (sys_write)
    int 0x80        ;call kernel

    mov eax,1       ;system call number (sys_exit)
    int 0x80        ;call kernel

segment .data
msg db 'Hello, World!', 0xa ;our dear string
len equ $ - msg             ;length of our dear string
rjdkolb
  • 10,377
  • 11
  • 69
  • 89
  • 1
    _"I run windowsXP"_ Because you're using Linux system calls. Console I/O is platform-specific (unless you use helper functions like `puts`/`printf` etc). – Michael Jul 31 '17 at 09:11
  • Find a windows tutorial.this is from a 32-bit Linux tutorial and `int 0x80` doesn't apply to Windows. – Michael Petch Jul 31 '17 at 10:12
  • 2
    Possible duplicate of [Hello world using nasm in windows assembly](https://stackoverflow.com/questions/12574924/hello-world-using-nasm-in-windows-assembly) – Michael Petch Jul 31 '17 at 10:14
  • I changed the question to better explain what the problem is. – rjdkolb Jul 31 '17 at 11:08

0 Answers0