%include "IO_DEFS.asm" ; Because my memory is not working ; x /11g $rsp section .data hello db `Hello World x\n`, 0 helloLen equ $ - hello section .bss section .text global _start ; ; note global variable ; ; void PrintHello() { ; cout << hello << endl; ; } PrintHello: mov eax, SYS_WRITE mov edi, STDOUT mov esi, hello mov edx, helloLen syscall ret _start: ; i = 10 ; while (i > 0) { ; --i ; greeting[12] = i+'0' ; PrintHello(); ; } ; r8 is the lcv ; r9 is the address of the character to change. ; r10 is the character, r8+'0' mov r8d, 10 lea r9, [hello+helloLen-3] top: dec r8d mov r10d, r8d add r10d, '0' mov [r9], r10b call PrintHello test r8d, r8d jnz top ; return 0 ; Exit mov eax, SYS_EXIT mov edx, SUCCESS syscall