By madman, I assume you mean a psychopath CEO. There are many of these. Psychopaths can make pretty effective founders, because they can get things off the ground. Then usually, they can’t scale past 20–50 employees or so.
The good news is the psychopath CEO does not care about you. At all. And the good news, is that means actually psychopaths often don’t hold huge grudges. Because you were just a means to an end.
So … key your head down. Don’t complain, don’t make waves. Quietly leave. Never complain. Let it all go. Today. Say thank you, pack up you desk, and move on.
And he will quickly forget you ever contributed anything to the company.