As McK4 has suggested, more info would help us to give you suggestions that may be more helpful to you.
To start with I'd like to suggest that this is normal behavior at this age. What is important is to figure out why he's acting this way and find a way to change not only what he's doing but to change the way you are dealing with it so that he is able to change.
My first thought is that often parents have difficulty letting go of all the control. When our children approach the teen years they are internally programmed to seek out the ability to have more self-control. They are further along on the road to independence as adults and need to learn how to successfully control themselves and their lives in a gradual manner as their brain matures. By the way, our brains are not totally mature until our twenties. The last part to mature is the frontal lobe that allows us to make good judgments.
This gives us a clue as to how to help our children grow in independence. We gradually allow them to be included in and then to make decisions in areas that have less severe consequences when they make a mistake.
I suggest you set it up so that he is involved in making rules. For example, if getting his homework done is a problem, turn the problem over to him. Ask him if doing his homework is important to him. Talk about it's importance from your viewpoint only after he's answered that question. Then have a discussion listening and responding to his views without pushing your views. State your opinion and your preference but allow him to make the final decision about how important doing it is to him.
Then ask him to set up a plan for getting it done. If he still say's getting it done is unimportant to him and it's still important to you that he gets it done then tie in a consequence for not getting it done that involves something important to him. An example would be that there is no TV or computer time, other than that needed for homework, until he's shown you that his homework is done. But do allow him to make a plan for actually doing it, i. e., when, where, and how.
The difficult part is the follow thru. This means that you're involved without appearing to be involved. Be sure the TV is off and that he is using the computer for homework only. But do it in a manner that does not intrude on his control. For example, listen for and glance at the screen. Do not talk with him. Do it in such a manner that he's mostly unaware that you're doing it. When parents get intrusive they are setting the child up for feeling the need to rebel if control is the teen's issue.
When enforcing the consequences, do it as calmly and matter of factly as possible. Unplug or turn off the TV or computer without making a comment. Do not respond to his comments. He may try to push your buttons and get you off track in an argument.
By letting him make as many decisions about what affects him as possible you are giving him a sense of control that will set the stage for you and him sharing control. At the same time that you allow him to make decisions you still maintain control over decisions that affect his safety, health, and well being. You still enforce rules such as completing homework, bed time, behavior such as being respectful and not hurting someone else or himself. But involve him in making the rules. Set aside quiet time during which you have discussions and do not issue ultimatums. If the discussions begin to be argumentative, stop them, without blaming your child. Acknowledge your own strong feelings. Do not demand respect. Expect respect by being respectful yourself.
Do not express criticism of him. If you don't agree, tell him you don't agree but do not call him a name or be angry with him for disagreeing. Allow him his own opinion.
If he's not doing what he's supposed to be doing, do not nag him. Give him an immediate consequence in a calm, non-judgmental way. And probably even more important, is to give him at least 6 compliments for every negative comment. If you have to give him a consequence then you also have to give him 6 compliments during that same day. Remember, you do not have to give any negative comments before you give a compliment. :):) Start the day with a sincere compliment and keep them going. Be sincere. You may have to hunt for reasons to compliment but you can find them.
This is very difficult to do at first but becomes easier with time. Keep in mind that you are teaching your child how to behave in this world while allowing him to feel whatever he wants to feel about it. You are teaching! You are not punishing! You are allowing as much as is safe for natural consequences but are also planning other consequences that fit the situation so that he learns from experience and not just because you told him so. He needs to feel in control of his life as much as possible given his maturity level.
I suggest reading some books about child development and parenting skills. Two that I've found particularly useful are Love and Logic by Foster and Kline and Talking so Children/Teens Can Hear or something like that by Adele Ferber.
I'm glad that you asked this question when your son is 12. What you do now is setting up the way your relationship with your son will go for the rest of his teen years. A good start is so important.