/* To build this one: as loop.s -o loop.o --32 ld loop.o -o loop -m elf_i386 */ .section .data hwmessage: .asciz "Hello World\n" .section .text .globl _start _start: /* Counter is in ecx */ mov $0, %ecx top_of_loop: cmp $10, %ecx je end_of_loop inc %ecx /* Save ecx on the stack before our system call */ push %ecx /* This part prints hello world */ movl $4, %eax movl $1, %ebx movl $hwmessage, %ecx movl $12, %edx int $0x80 /* Restore ecx from the stack */ pop %ecx /* Go back to the top of the loop */ jmp top_of_loop end_of_loop: movl $27, %ebx movl $1, %eax int $0x80