Hi
I am going strictly by the comments you have made about your boss' behaviour.
My recommendation would be :-
1) Give us more information about your MD viz. the kind of person he is. If he is the opposite (more or less) of your boss, then go speak with him
2) Also, start looking for another job simultaneously. You must be prepared for the wind to change direction.
3) With respect to sitting late - sit with your boss in the morning or noon when he comes in, draw out a list of activities / tasks for you to perform in discussion with him. At the end of the day, give him a status report on the completeness. SUBTLY imply to him that you would like to make his work easier by doing your work in an organized manner because you plan your day well.
4) With regard to his attitude towards staff, please refer point 2 of this post - there is no other way to deal with it, save for sending him on a development LAB, which doesn't guarantee a 100% change in attitude or behaviour.
5) Do your exit interviews and analysis thereof, and present the report to the MD and mark a cc to your boss. Make sure your data is properly substantiated because you can be sure that your boss will come screaming at you verbally and on email. As a test, you can request the MD to take an exit interview himself, preferably outside office. Ensure that the resigning employee is not met by your boss or one of his allies since he may be threatened by virtue of holding back relieving documents, etc.
In the scenario you describe, I don't see much use in wasting your skills by staying with the organization, except perhaps to complete a year or 2 or service. I am assuming that there is good opportunity for on the job learning for you.
Trust this is useful to you.
Regards
Ryan