.data beginStr: .ascii "This is something to print.\n" endStr: # this is the same as endStr = . .text .global _start _start: subl $endStr-beginStr,%esp # reserve bytes movl %esp,%eax # eax is dest ptr movl $beginStr,%ebx # ebx is src ptr copyAgain: movb (%ebx),%cl # copy a byte movb %cl,(%eax) addl $1,%eax # increment ptrs addl $1,%ebx cmpl $endStr,%ebx # check end jb copyAgain # if not end, do it again pushl $endStr-beginStr call putstr # print the string addl $endStr-beginStr,%esp # deallocate bytes movl $1, %eax movl $0, %ebx int $0x80 putstr: pushl %eax pushl %ebx pushl %ecx pushl %edx movl $4,%eax movl $1,%ebx movl %esp,%ecx addl $24,%ecx movl 20(%esp),%edx int $0x80 pop %edx pop %ecx pop %ebx pop %eax ret