You'll need to count the timer overflows and use them as the high word of the period after a capture.
Then change all the math, because the values will be larger than 16-bits.

Since you are using an 877A, you won't have the luxury of using LONG variables.