Here's your development brief
First, you pad until you have 16 bytes left, using 0x80 for the first byte, bytes valued 0x00 after that.
If you run out of space (you need 17 bytes minimum) then you pad until you reach the end of the block, and continue padding with 0x00 in the next block until you have 16 bytes left for the length.
In most implementations ...
NIST FIPS 180-4 on page 13 defines the padding scheme for SHA-512 as;
Suppose that the length of the message, $M$, is $\ell$
bits. Append the bit 1 to the end of the message, followed by $k$ zero bits, where $k$ is the smallest, non-negative solution to the equation
$$\ell + 1 + k \equiv 896 \bmod 1024$$
So you first append 1, then calculate the ...