.file "skel.c" # generated skeleton main program .data msg: .ascii "Hello world\n" len = . - msg # length of string. # '.' is the location symbol .text .align 2 .globl main .type main,@function main: pushl %ebp movl %esp, %ebp subl $8, %esp # probably done for safety cushion andl $-16, %esp pushl %ebx # said to be a "callee save" # direct call to kernel for writing a string ---------- mov $msg,%ecx # Address of message mov $len, %edx # length of message -- yes, you need $ for all consts. mov $1, %ebx # STDOUT mov $4, %eax # sys_write service int $0x80 # kernel call (interrupt) -- even here a $. # by contrast, the same string can be written by calling printf # of course printf has more capabilities push $msg # push argument (addr. of string) on stack call printf # call the function add $4, %esp # remove argument from stack exitcode: # return 0; popl %ebx # movl $0, %eax # subl %eax, %esp movl $0, %eax leave ret .Lfe1: .size main,.Lfe1-main .ident "GCC: (GNU) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)"