2:50 PM PT -- The hearing didn't end. The judge just called it quits for the day and the hearing will pick up tomorrow morning.
10:08 AM PT -- The former D.A. just testified he did indeed make a deal with Cosby that he would not be prosecuted in the Constand case and he says the deal was meant to be binding on his successors. The parties are now in the judge's chambers.
The D.A. also said there were "serious flaws" in the case.
Bill Cosby came to court Tuesday dressed for success ... a successful argument he hopes his lawyers can make to make his criminal sexual assault case go away.
Cosby -- cane in hand -- was gingerly guided into the courthouse by 2 bodyguards.
The comedian's lawyer will argue he got a solid promise from the former D.A. in suburban Philadelphia that he would NOT be prosecuted in the case of Andrea Constand. Based on that promise he sat for a deposition on Constand's civil case where he admitted he had given her 3 half-pills of Benadryl before a 2004 sexual encounter. She says it was assault ... he says it was consensual.
The former D.A. is scheduled to testify on behalf of Cosby ... saying he indeed made the promise not to prosecute.
Story developing ...