
230 Cal.App.3d 1072 (1991)
284 Cal. Rptr. 757
THE PEOPLE, Plaintiff and Respondent,
v.
RUBEN JAMES COTTON, Defendant and Appellant. In re RUBEN JAMES COTTON on Habeas Corpus.
Docket Nos. A050688, A052267.
Court of Appeals of California, First District, Division Five.
May 30, 1991.
*1076 COUNSEL
Edwin J. Wilson, Jr., and John P. Mortimer for Defendant and Appellant.
*1077 Daniel E. Lungren, Attorney General, George Williamson, Chief Assistant Attorney General, John H. Sugiyama, Assistant Attorney General, Herbert F. Willkinson and Martin S. Kay, Deputy Attorneys General, for Plaintiff and Respondent.
OPINION
HANING, J.
Ruben James Cotton appeals his conviction by nolo contendere plea to sale of a controlled substance. (Health & Saf. Code, § 11352.)[1] On appeal and in a consolidated petition for habeas corpus, he contends he was denied effective assistance of counsel at the probation revocation hearing, and that the trial court erred in failing to state reasons for refusing to reinstate probation.

PROCEDURAL HISTORY
On July 7, 1987, appellant pled nolo contendere to violating section 11352 as part of a plea bargain by which imposition of sentence was suspended and he was placed on three years probation with conditions including a jail term. In October 1989 probation was revoked, modified and reinstated.
In April 1990 appellant was arrested for again violating section 11352. Probation was revoked and substitute counsel was appointed after his original counsel declared a conflict. At the hearing following the probation revocation, defense counsel asked the court to permit appellant to remain on probation and enroll in a residential drug treatment program. Appellant specifically wanted to be admitted to the drug crisis center housed in an East Oakland church. The court stated it would consider the possibility of residential drug treatment if appellant would agree to extend his probation from three to five years and waive his back credits so that he was still eligible for a year in county jail as a condition of probation. The court stated it would look into the possibility of a drug treatment program, but cautioned appellant that the chances were remote that the probation department would make such a recommendation, or that the court would go along with it. Appellant agreed to admit the probation violation subject to the understanding that he would receive no more than the mitigated three-year term, and if placed on probation, probation would be extended to five years and all back credits would be *1078 waived. The court referred the matter to the probation department for a recommendation as to whether appellant should be placed in a residential drug treatment program as a condition of extended probation, and suggested that defense counsel be in touch with appellant's probation officer.
The probation report noted that appellant was homeless, had little or no monetary resources, and had not yet enrolled in a residential alcohol treatment program as directed when he was last released on probation in February 1990. The report concluded that appellant's performance on probation was less than satisfactory, but stated that he could benefit from a residential drug treatment program in light of his stated motivation to pursue such treatment. However, it recommended reinstating and modifying probation to include 60 additional days in county jail, with termination of probation upon release.
At the sentencing hearing on the probation violation, defense counsel reminded the court of appellant's request to be placed in a drug treatment program. The court asked appellant if he had made any contact with any drug treatment program. Appellant stated he had not, because the drug treatment center does not accept collect phone calls. The court then sentenced appellant to three years in prison pursuant to the agreement made at the revocation hearing.

APPEAL

I
Appellant contends his appointed counsel for the revocation proceeding rendered ineffective assistance for two reasons: First, appellant contends defense counsel failed to investigate the validity of his underlying nolo contendere plea, which he claims was invalid because he was not advised that as a consequence thereof he would have to register as a narcotics offender. (§ 11590.) He argues that since his original plea was invalid, he had a complete defense to the revocation proceeding. Second, he contends that defense counsel failed to assist him in obtaining admission to a residential drug treatment program.

A.
(1a) The People rejoin that the first ground for appeal, defense counsel's failure to investigate and challenge the validity of his nolo contendere plea, is not properly before this court because appellant did not comply with the mandatory requirements of Penal Code section 1237.5 which, at the time appellant initiated this appeal, stated, in pertinent part: "No appeal shall be *1079 taken by a defendant from a judgment of conviction upon a plea of guilty or nolo contendere, or a revocation of probation following an admission of violation, except where the defendant has filed as part of the notice of appeal a written statement, executed under oath or penalty of perjury showing reasonable constitutional, jurisdictional, or other grounds going to the legality of the proceedings."
The notice of appeal filed in the instant case merely states that it is an appeal from the final judgment of conviction and is signed by appellant, but not executed under oath or penalty of perjury. Appellant was not represented by counsel when he filed the notice of appeal.
The People also argue that appellant's claim of incompetence of counsel for failing to investigate and challenge the validity of appellant's underlying plea is not cognizable on appeal because appellant is really collaterally challenging the validity of the underlying plea, and that is an issue that could have been appealed in 1987, at which time Penal Code section 1237.5 required a certificate of probable cause. The People argue that because appellant had the right to appeal at that time and raise all matters going to the validity of his 1987 conviction, and because he failed to do so, he cannot raise on this appeal claims of error arising prior to pronouncement of the judgment.
(2) The requirements of Penal Code section 1237.5 are inapplicable where the appellant seeks review on appeal of proceedings occurring subsequent to the entry of the plea. (People v. Osorio (1987) 194 Cal. App.3d 183, 187 [239 Cal. Rptr. 333].) "`In determining the applicability of [Penal Code] section 1237.5, the crucial issue is what the defendant is challenging, not the time or manner in which the challenge is made.... If a defendant challenges the validity of his plea by way of a motion to withdraw the plea, he cannot avoid the requirements of [Penal Code] section 1237.5 by labelling the denial of the motion as an error in a proceeding subsequent to the plea. [Fn. omitted.]'" (People v. Arwood (1985) 165 Cal. App.3d 167, 172 [211 Cal. Rptr. 307], quoting People v. Ribero (1971) 4 Cal.3d 55, 63-64 [92 Cal. Rptr. 692, 480 P.2d 308].)
(1b) In the instant case the appeal attacks the competency of counsel prior to the admission of probation violation. Penal Code section 1237.5 precludes our review of this claim.

B.
Appellant also contends he was denied effective assistance of counsel because his attorney never contacted him or his probation officer between *1080 his admission of violation and the sentencing hearing, and failed to assist him in obtaining admission into a residential drug treatment center.
(3) "To make a successful claim of ineffective assistance of counsel, the defendant must show that (1) counsel's representation was deficient, i.e., it fell below an objective standard of reasonableness under prevailing professional norms; and (2) counsel's deficient representation subjected the defense to prejudice, i.e., there is a reasonable probability that but for counsel's failings the result would have been more favorable." (People v. Bell (1989) 49 Cal.3d 502, 546 [262 Cal. Rptr. 1, 778 P.2d 129]; Strickland v. Washington (1984) 466 U.S. 668, 694 [80 L.Ed.2d 674, 6797-698, 104 S.Ct. 2052].)
(4) Where the record on appeal sheds no light on why counsel acted or failed to act in the manner challenged, the case must be affirmed on appeal unless counsel was asked for an explanation and failed to provide one, or there simply could be no satisfactory answer. (People v. Pope (1979) 23 Cal.3d 412, 426 [152 Cal. Rptr. 732, 590 P.2d 859, 2 A.L.R.4th 1]; People v. Bell, supra, 49 Cal.3d at p. 546.) It appears from the transcript of the July 7, 1987, entry of plea hearing that prior to entering his nolo contendere plea, appellant was not advised on the record of the narcotics offender registration requirement. However, the appellate record sheds no light on what defense counsel did or did not do, and we are unable to conclude that a satisfactory explanation could not have been provided. We therefore must reject appellant's contention on appeal that counsel's performance was deficient.

II
(5a) Appellant next contends the court erred in failing to state reasons for refusing to reinstate probation after finding that probation had been violated. At the sentencing hearing the court stated: "The defendant's probation having been revoked, it is the judgment of the court that it shall remain in a revoked status and [he] be sentenced to state prison for a period of three years, the mitigated term, which term was agreed to at the time of the revocation petition as a part of [a] plea bargain and because he admitted his responsibility in the underlying offense early in the proceedings."
In People v. Slaughter (1987) 194 Cal. App.3d 95, 99 [239 Cal. Rptr. 337], the majority held that where a court initially suspends imposition of sentence and places a defendant on probation, it need not later, upon revoking probation and imposing sentence, state reasons for choosing imprisonment over reinstatement of probation. All subsequent decisions, however, have disagreed with Slaughter, concluding that a statement of reasons is required. *1081 (People v. Hawthorne (1991) 226 Cal. App.3d 789, 792-794 [277 Cal. Rptr. 85]; People v. Jones (1990) 224 Cal. App.3d 1309, 1312-1315 [274 Cal. Rptr. 527]; People v. Pennington (1989) 213 Cal. App.3d 173, 176-177 [261 Cal. Rptr. 476]; People v. Jackson (1987) 196 Cal. App.3d 380, 387 [242 Cal. Rptr. 1].) We follow the precedent of these cases requiring a statement of reasons.
(6) The record must establish that the trial court understands that two separate and distinct decisions are involved in its sentencing choice: (1) To revoke probation; and (2) to sentence to state prison rather than place the defendant on probation on new or modified conditions. (People v. Hawthorne, supra, 226 Cal. App.3d at p. 795.)
(5b) In the instant case, before appellant admitted violating probation the court explained that it would either extend probation on new terms, or commit him to prison. This explanation sufficiently establishes that the court was aware of its discretion and the sentencing choices available to it upon revocation of probation. However, the court failed to express any reason for the prison commitment, and the only reason that appears inferentially is that appellant failed to exert reasonable efforts to gain entrance into a drug rehabilitation program. The complete record of the sentencing proceeding follows:
"[The Court]: Ruben Cotton [appellant]. [¶] Mr. Cotton does not express any great interest in shaking the devil's influence either. [¶] Mr. Buckley [defense counsel], you are appearing with Mr. Cotton?
"[Defense Counsel]: I am. [¶] As the court may recall, it was at Mr. Cotton's request that he was given the opportunity to make a pitch to the probation department.
"[The Court]: Right. Well, he didn't make much of a pitch.
"[Defense Counsel]: The alternative was a cap.
"[The Court]: Have you made any contact with any drug program, Mr. Cotton?
"[Appellant]: They don't accept collect calls. I've tried. I have a phone number to one over on East 14th, but they don't accept collect phone calls.
"[The Court]: East 14th Street is the 14th Street Clinic?
"[Appellant]: Yes  no, not a clinic. It's a Christian live-in, nine months live-in.
*1082 "[The Court]: All right. I'm going to  is there any reason why we should not proceed to sentencing in this matter?
"[Defense Counsel]: There is none.
"[The Court]: [Appellant's] probation having been revoked, it is the judgment of the court that it shall remain in a revoked status and be sentenced to state prison for a period of three years, the mitigated term, which term was agreed to at the time of the revocation petition as a part of plea bargain and because he admitted his responsibility in the underlying offense early in the proceedings. [¶] He's been in custody for 417 days entitling him to 209 days of additional credit, a total of 626 days credit for time served. [¶] So he's to be remanded to the Sheriff of Alameda County to be delivered by said Sheriff to the Department of Corrections to commence service of this sentence. [¶] I don't know if this is pursuant to [Penal Code section 1203, subdivision (c)] or not, but you will send this probation report and petition forward with him. The probation department or does the court do that?
"[District Attorney]: The court does that.
"[The Court]: You were fined, Mr. Cotton, you were to make a restitution fine or $100.00 pursuant to Government Code section 13967. The responsibility of collecting that fine which remains in effect is transferred to the Department of Corrections. [¶] Good Luck.
"[Appellant]: Wait a minute. Wait a minute. What's happening? Tell me what's happening.
"[The Court]: You went to the joint for three years.
"[Appellant]: But I mean, my back time and all this.
"[The Court]: You got every bit of it. [Six hundred twenty-six] days back time."
At the time it took appellant's admission, the court assured him it would take "a good faith look" at a drug program, and that it would "honestly look at it." It is quite apparent from the record that appellant was incarcerated, without funds, and unable to contact a drug rehabilitation program. Consequently, the court cannot use appellant's inability to contact a drug *1083 program as a reason for committing him to prison, and the matter must be remanded.

HABEAS CORPUS PETITION

A.
(7a) Appellant claims his defense counsel was incompetent for failing to investigate the validity of his nolo contendere plea and defend against the alleged probation violation by moving to set aside the underlying conviction on the ground that when entering his plea, appellant was not advised of the controlled substance offender registration requirement. (§ 11590.)
(8) The People argue that we should not entertain this argument by way of a habeas corpus proceeding because it is nothing more than an alternative appeal on the merits and would frustrate the purpose of Penal Code section 1237.5. We disagree. Because appellant's claim of ineffective assistance of counsel relies on matters outside the appellate record, a petition for habeas corpus is a proper vehicle for getting the matter before the court. (See People v. Pope, supra, 23 Cal.3d at p. 426; cf., People v. Guzman (1991) 226 Cal. App.3d 1060, 1066 [277 Cal. Rptr. 286].)
The transcript of the July 7, 1987, entry of plea confirms that prior to entering his nolo contendere plea appellant was not advised of the narcotics offender registration requirement. Appellant's declaration in support of the habeas corpus petition alleges that (1) prior to pleading nolo contendere neither the court, the prosecutor nor defense counsel ever told him about the narcotics registration requirement, (2) had he been advised of the registration requirement consequences of the conviction he would not have entered the nolo contendere plea, and (3) at no time during the proceedings surrounding his probation violation was he ever advised that there might have been a defense to the revocation proceeding.
The declaration of John Mortimer, appellant's appellate counsel, in support of the petition states that he spoke with appellant's trial counsel, and that trial counsel told him he did not inquire into the procedural basis for the underlying plea and did not review the transcript of the entry of plea proceeding. Mortimer also declared that he spoke with the prosecutor who attended the July 1987 change of plea hearing, who had no recollection of advising appellant of the narcotics registration requirement.
(9) Before accepting a plea of guilty or nolo contendere the court must make certain that the accused has a full understanding of what the plea connotes and its consequences, and ensure an adequate record for review. *1084 (Boykin v. Alabama (1969) 395 U.S. 238, 243-244 [23 L.Ed.2d 274, 279-280, 89 S.Ct. 1709]; In re Tahl (1969) 1 Cal.3d 122, 130 [81 Cal. Rptr. 577, 460 P.2d 449].) Where the registration requirement of section 11590 is applicable, the defendant must be properly advised of it as a direct consequence of conviction. (See Bunnell v. Superior Court (1975) 13 Cal.3d 592, 605 [119 Cal. Rptr. 302, 531 P.2d 1086]; People v. McIntyre (1989) 209 Cal. App.3d 548, 556 [257 Cal. Rptr. 271].) However, the requirement that an accused be advised of the consequences of the plea is not constitutionally compelled, and failure to so advise requires that the plea be set aside only if prejudice is demonstrated. (People v. Edelbacher (1989) 47 Cal.3d 983, 1031 [254 Cal. Rptr. 586, 766 P.2d 1]; People v. Wright (1987) 43 Cal.3d 487, 494-495 [233 Cal. Rptr. 69, 729 P.2d 260].)
In response to the habeas petition the People have submitted copies of February 1988 and August 1989 probation department petitions to revoke probation and related probation reports alleging appellant's failure to register as a narcotics offender pursuant to his 1987 conviction. The August 1989 report states: "... Previously, this defendant indicated since he had no permanent address he was unable to register as a narcotics offender per the Central Identification Bureau." The People argue that in light of such evidence, appellant knew of the narcotics registration requirement, knew of the incomplete voir dire prior to entry of his plea and, therefore, defense counsel cannot be faulted for failing to investigate the validity of the plea. We disagree.
(7b) Whenever a sentence is enhanced or probation is revoked due to a prior conviction, it is counsel's obligation to examine the validity of the prior or underlying conviction. "Counsel's first duty is to investigate the facts of his client's case and to research the law applicable to those facts." (People v. Ledesma (1987) 43 Cal.3d 171, 222 [233 Cal. Rptr. 404, 729 P.2d 839].) While the August 1989 probation report suggests that appellant knew of the narcotics registration requirement prior to the probation revocation proceeding, there is no evidence that he knew of the registration requirement prior to entering his plea. In fact, the transcript from the October 1989 modification of probation hearing indicates that appellant was again not adequately advised of his rights.
The People also argue that appellant's counsel had no reason to challenge the underlying conviction in this case because the basis for the probation revocation was a new sale of cocaine charge which the People describe as an "open-and-shut" case. They argue that if the underlying conviction was invalidated, he would be tried and convicted on the new charges and subject to the narcotics registration requirement. Thus, they conclude, since appellant *1085 would gain nothing from challenging the underlying conviction, he cannot establish prejudice from any ineffectiveness of counsel.
We have no basis for evaluating the strength of the new case, but we recognize the distinct possibility that it was a strong case for the People. If so, trial counsel could have made a tactical decision to accept the mitigated term on the revocation, further reduced by time served, rather than face a potentially longer sentence on the new offense. Appellant has not negated this possibility, and thus has not demonstrated ineffective assistance on this ground. (See People v. Pope, supra, 23 Cal.3d at pp. 425-426.)

B.
(10a) Appellant also contends his trial counsel was ineffective for failing to assist him in obtaining admission to a residential drug treatment program by: (1) Failing to help him contact a drug treatment program; (2) failing to contact him or the probation department prior to the sentencing hearing; and (3) failing to remind the court at sentencing that appellant did everything he could to contact a drug program and failing to argue that the court should reinstate and extend probation.
Appellant's declaration in support of his habeas corpus petition alleges that between the May 16, 1990, hearing following probation revocation and the June 12, 1990, sentencing hearing, he was never contacted by defense counsel. He also states: "[A]s far as I know, [defense counsel] never contacted my probation officer." He further declares that he attempted to call some rehabilitation centers, but was unable to do so because he had no funds and they would not accept collect calls. He declares that, "No one ever permitted me a real opportunity to make a reasonable attempt to get admitted into such a program but the only reason I admitted the alleged probation violation was because the judge promised that he would take an honest look at a drug program."
The declaration of appellant's appellate counsel alleges that appellant's trial counsel told him he provided appellant no assistance in getting into a drug rehabilitation program and had no contact with appellant or appellant's probation officer between the May and June 1990 hearings.
(11) Counsel's duty at sentencing is to be familiar with the sentencing alternatives available to the court, to make sure that the court is aware of such alternatives, to explain to his or her client the consequences of the various dispositions available and to be certain that the sentence imposed is based on complete and accurate information. (People v. Cropper (1979) 89 *1086 Cal. App.3d 716, 719 [152 Cal. Rptr. 555]; 5 Witkin & Epstein, Cal. Criminal Law (2d ed. 1989) § 2777, p. 3366.)
A reasonably competent attorney acting as a diligent advocate (People v. Pope, supra, 23 Cal.3d at p. 425) in defending against criminal charges should be aware of sentencing alternatives and the availability of rehabilitation centers and similar programs in the community. Since over 90 percent of all criminal cases filed result in conviction (see 1990 Ann. Rep.  Judicial Council of Cal.), criminal lawyers should be considering and preparing for the sentencing process well before the entry of plea or admission of probation violation. Counsel representing indigent defendants who are incarcerated without funds must exert reasonable efforts to assist and prepare their clients for sentencing. In the instant case such efforts would require, at a minimum, assistance at obtaining the client's admission into a drug rehabilitation program, and appropriate communication with the probation department.
(10b) The declarations in support of the habeas petition suggest that defense counsel failed to render effective assistance by failing to assist appellant in gaining admittance into a drug rehabilitation program, and not contacting the probation department to urge it to recommend reinstating probation pursuant to appellant's enrollment in a drug rehabilitation program. Given appellant's indigency and incarceration, counsel had an obligation to assist him in finding a suitable program that would accept him, and thereafter to inform the court that such efforts had been made, and to advocate for appellant's referral to such a program.
The People argue that even if counsel rendered ineffective assistance, appellant was not prejudiced. (12) "[I]n cases in which a claim of ineffective assistance of counsel is based on acts or omissions not amounting to withdrawal of a defense, a defendant may prove such ineffectiveness if he establishes that his counsel failed to perform with reasonable competence and that it is reasonably probable a determination more favorable to the defendant would have resulted in the absence of counsel's failings. [Citations.]" (People v. Fosselman (1983) 33 Cal.3d 572, 584 [189 Cal. Rptr. 855, 659 P.2d 1144].) We therefore must determine whether appellant has made a sufficient showing that but for counsel's conduct, the court would have reinstated probation rather than sentencing him to state prison.
(10c) The probation department concluded that appellant was not a drug dealer, but rather "a bungling fool and opportunist." The probation report noted that appellant could benefit from a residential drug treatment program, and recommended restoring and modifying probation by an additional county jail term, with probation to terminate upon release. We conclude it is *1087 reasonably probable that had counsel taken steps to gain appellant's admittance into an appropriate residential drug treatment program, the probation department would have specifically recommended such placement as a condition of restoring probation.
At the time it took his admission, the court told appellant it thought it unlikely that the probation department would recommend a drug program. Given the court's concern about appellant's efforts to gain admittance into a drug treatment program and its apparent displeasure that appellant had not made "much of a pitch" at gaining admittance, combined with the failure of defense counsel to render any assistance in this regard, we have additional reason for remand.
The judgment of commitment to the Department of Corrections is reversed and remanded with directions to conduct a new sentencing hearing. We do not suggest that the court would abuse its discretion by committing appellant to the Department of Corrections, but merely require that appellant be given a fair opportunity to demonstrate his eligibility for a drug rehabilitation program, as he was assured, before the trial court exercises its sentencing discretion.
In light of our disposition of the appeal, the habeas petition becomes moot, and for that reason is denied.
Low, P.J., and King, J., concurred.
NOTES
[1]  Unless otherwise indicated, all further statutory references are to the Health and Safety Code.
