Ahhhh hang on thar a moment..

65535 just happens to be the highest positive number that can be obtained using 32 bits.
if you check your binary.. 65535 is the highest value that can be obtained from 16bits..
If my history comes correctly the 64k ports comes from the 8bit cpu days where the original systems could only address 65535bytes.. the cpu would work addresses in 16 bit values..
the X25 protocol was 8bit based and was used with early TCP work..

maestr0 has it:
The 32-bit adress is related to the IP portion of the protocol(s) and does not contain any information about ports. The TCP portion of the packet contains two 16-bit fields in the header, one for the source port and one for the destination port.
Cheers