08-15-2010, 01:50 PM
Code:
;sys_write(unsigned int, const char *, size_t) = system call 4
;sys_write(ebx, ecx, edx);
section .text
section .data
msg db 'Hai thar!',0xa ;Our message to display
msglen equ $-msg ;The length of our message
global _start
_start:
mov ebx,1 ;STDOUT is 1
mov ecx,msg ;ecx now contains our message
mov edx,msglen ;edx now contains the length of our message
mov eax,4 ;sys_write is system call 4
int 0x80 ;invoke the kernel
mov eax,1 ;sys_exit is system call 1
mov ebx,0 ;Set exit code to 0
int 0x80 ;invoke the kernel