Please explain why Pin13 and Serial.write misbehaving

UKHeliBob:
Just as a matter of interest, what is the code supposed to do apart from filling up half the array ?

I'm trying to implement a circular buffer for some experiments