You remember it wrongly. The Master is not an insane incarnation of the Doctor. He's a different Time Lord entirely. There was an evil/insane incarnation of the Doctor in The Trial of a Time Lord: the Valeyard. You may be confusing him with the Master. Note that, in "The Trial of a Time Lord", the Master helped the Doctor to defeat the Valeyard.
- The classic series established the Doctor can regenerate 12 times, for 13 lives. This is a condition imposed by the Time Lords and later stories (most notably "The Five Doctors") indicated more regenerations could be added. The Master, in the story "The Deadly Assassin", was on his 13th life and insane from trying to stay alive; in "The Keeper of Traken" he eventually managed to engineer a 13th regeneration of sorts by taking over a body and, in the 1996 TV movie, did it again. The TV series since its return in 2005 has suggested several times that the 13-life limit no longer exists because the Time Lords no longer exists.