As you can read about herehere the loop instruction decrements ECX, jumps if it's not 0 and continues if it's 0.
edi is used as a pointer to the end of the string.
ecx is set to the length of the string
This line is sneaky: mov esi,OFFSET target - 2
The loop is the equivalent of:
a = 0;
b = source.length - 1;
for (int i = source.length; i >= 0; i++) {
target[a] = source[b];
a++;
b--;
}