I'm following those video tutorials on the assembly language. I'm basically trying to work out the "hello world" asm example. Here is what I've got:
.data
str:
.ascii "Hello World"
.text
.globl _start
_start:
movl $4, %eax
movl $1, %ebx
movl $str, %ecx
movl $11, %edx
int $0x80
movl $1, %eax
movl $0, %ebx
int $0x80
This compiles just fine but when I run it, no text is printed to the terminal. I have no idea what I'm doing wrong. Whatever value I mov into the ecx register makes no difference, nothing happens.
Also, other question, how does the syscall work when it call the int 0x80 instruction ? Some data has been moved to the registers but when we get to the syscall, it doesn't "use" any of those values. Does it go and get what has been moved to those registers on it's own ?
Some system info that might be helpful:
dominic-@-freebsd-9 ~/dev/asm/tutorial > uname -a
FreeBSD freebsd-9 5.5-RELEASE FreeBSD 5.5-RELEASE #0: Tue May 23 14:58:27 UTC 2006 [email protected]:/usr/obj/usr/src/sys/GENERIC i386