Are there easier ways to print something like a linebreak after each string rather than hardcoding the \n into the string itself?
Embedded newlines are certainly the easiest way to do this, but definitively not the most versatile way. Embedding the newlines kind of pushes you in the direction that the strings will be used for outputting only. You might want to do lots of other stuff with them too.
I advocate keeping the strings pure and adding the linebreaks, or any other prefix or suffix for that matter, later on. Since you already have to count the characters in the string, you can at the same time copy the string to a buffer (every non-trivial program has some general purpose buffer at the ready). Once you read the zero terminator you store the newline in the buffer. Then you're ready to print the buffer contents for which you now know the length.
In below code PrepStringForOutput is a leaf function which means you can do pretty much anything you like in it. You don't have to follow any register conventions per se.
# Program, print out a list of strings, one per line
SYS_EXIT = 60
SYS_WRITE = 1
SYS_STDOUT = 1
# Empty string means end of strings
Strings: .asciz "Once", "upon", "a", "time", "...", ""
Buffer: .ascii "12345"
; IN (%rbx is asciz) OUT (%rsi is buffer, %rdx is length) MOD (%al)
mov $Buffer, %rsi # Destination
xor %edx, %edx # Length
mov (%rbx, %rdx), %al # Character from asciz string
test %al, %al
mov %al, (%rsi, %rdx) # Store in buffer
mov $10, (%rsi, %rdx) # Adding newline
mov $Strings, %rbx
cmpb $0, (%rbx) # End of list ?
call PrepStringForOutput # -> %rsi is address, %rdx is length
add %rdx, %rbx # Advancing in the list
mov $SYS_STDOUT, %edi
mov $SYS_WRITE, %eax
xor %edi, %edi
mov $SYS_EXIT, %eax
What places can I improve?
You'll easily spot these in above code...
See the nice tabular layout?