section .data hello: db 'Hello world!',10 ; 'Hello world!' plus a linefeed character helloLen: equ $-hello ; Length of the 'Hello world!' string timespec: db 00,00,00,00,00,00,00,20 ; 1 second char: db '0' ; 1 char section .text global _start f_print: mov eax,4 ; The system call for write (sys_write) mov ebx,1 ; File descriptor 1 - standard output mov ecx,hello ; Put the offset of hello in ecx mov edx,helloLen ; helloLen is a constant, so we don't need to say ; mov edx,[helloLen] to get it's actual value int 80h ; Call the kernel ret _start: mov ecx,0 push ecx l_for: pop ecx cmp ecx,7 jge f_exit push ecx ; increment char mov al,[char] add al,cl mov [char],al ; end ; print char mov eax,4 mov ebx,1 mov ecx,char mov edx,1 int 80h ; end ; obtain counter pop ecx push ecx ; re-save counter ; decrement char mov al,[char] sub al,cl mov [char],al ; end ; sleep 1 second mov eax,162 mov ebx,timespec mov ecx,timespec int 80h ; end ; call function call f_print ; increment loop pop ecx inc ecx push ecx ; loop jmp l_for f_exit: mov eax,1 ; The system call for exit (sys_exit) mov ebx,0 ; Exit with return code of 0 (no error) int 80h