The Medrash (39:7) relates that Avraham was afraid to leave Terach because people would say he left his aging father, and this would cause a chilul Hashem. Hashem responded, "Lech lecha" (12:1), I exempt you ("lecha") from kibud av, but nobody else. And I will record Terach's death before your journey.
The Maharal (Rashi 11:32) explains the uniqueness of Avraham's circumstance and the "death" of Terach as follows. Since Avraham began an entirely new era when he left Terach, his connection to Terach was completely severed. Therefore, Hashem exempted him, and only him, from kibud av, and emphasized the total break by viewing Terach as dead before Avraham's journey to Eretz Yisroel.
This Medrash corroborates the Rambam's view (Mamrim 6:11) that one must honor a parent who is a rasha. According to the Tur (Yoreh Deah 240: 18), a rasha need not be honored by his son and Avraham was not unique at all.
The Tur proves his position from the Gemara (Bava Kamma 94b) which states that a son, after his father's death, does not have to repay interest that his father accrued over his lifetime. Chizkiyahu's shabby treatment of his rasha father's body, which Chazal endorsed (Pesachim 56a), also support's the Tur's view.
To defend the Rambam, we must assume that kibbud av contains an interpersonal (bein adam lechavero ) component (see Minchas Chinuch No.33). However, this bein adam lechavero aspect applies only while the father is alive (see Maharam Schick, Y.D. 218). The obligation to honor a deceased parent (Kiddushin 31b) is purely bein adam lamakom.
The Ramban (Shmos 20:12) suggests that kibbud av is included in the honor of Hashem because parents are Hashem's partner in creation (Kiddushin 30b). Therefore, a rasha, who is unworthy of being treated as Hashem's partner, is excluded from the bein adam lamakom dimension of kibbud av.
Thus, the Rambam requires one to honor a parent who is a rasha only because of the bein adam lachavero component. But because interpersonal obligations do not apply to one who died, one need not honor a deceased rasha. Hence, the Gemara (Bava Kamma, Pesachim) refers to a dead parent, while the Rambam refers to a rasha who is still alive.
The Gemara (Kiddushin 31b) relates that R. Assi left Eretz Yisroel to greet his mother. When he discovered that she had died and her coffin was coming, he said, "Had I known I would not have left." Why would he not have left? Isn't attending a parent's funeral a fulfillment of kibbud av?
A more basic question can be raised. How was R. Assi permitted to leave? Tosfos (Avodah Zarah 13a) permits leaving Eretz Yisroel only to learn Torah or to get married. In fact, the issue of leaving Eretz Yisroel for kibbud av is disputed by the poskim (Pischei Teshuvah, Even Haezer 75:6, Yechave Daas 3:69)
Perhaps, the bein adam lamakom aspect of kibbud av does not warrant leaving Eretz Yisroel, as Tosfos implies. Therefore once Rav Asi discovered that his mother had died, and only the bein adam lamakom aspect of kibud av remained intact, he no longer had any justification to leave Eretz Yisroel. However, just as one is required to pay a personal debt, even if as a result he must leave Eretz Yisroel, so too one must repay his debt to his parents (see Chinuch #33) and honor them even by leaving Eretz Yisroel. Therefore, R. Assi was permitted to leave Eretz Yisroel to honor his mother- a bein adam lechavero obligation.
If we equate remaining outside Eretz Yisroel with leaving it, there is further proof that kibud av overrides living in Eretz Yisroel from the Medrash. Only Avraham was exempted from kibud av to live in Eretz Yisroel, as derived from Lech Lecha. All others must honor even a rasha father, even if as a result the mitzva of living in Eretz Yisroel cannot be fulfilled.