From an October 31st, 2014 Rolling Stone interview:

At what point did hard drugs enter the picture?
It was probably about ’78, around the same time that I realized that I was out of control with drinking. Well, I thought I was in control, but in reality I wasn’t.

That was cocaine?
Yeah, coke. I was a heavy user from 1978 until 1986, something like that.

Did you write on coke?
Oh, yeah, I had to. I mean, coke was different from booze. Booze, I could wait, and I didn’t drink or anything. But I used coke all the time.

You had three young kids at the time. It must have been very stressful to keep this huge secret while balancing all your responsibilities.
I don’t remember.

No. That whole time is pretty hazy to me. I just didn’t use it around people. And I wasn’t a social drinker. I used to say that I didn’t want to go to bars because they were full of assholes like me. 

I’m trying to comprehend how you lived this whole secret life of a drug addict for eight years, all the while churning out bestsellers and being a family man.
Well, I can’t comprehend it now, either, but you do what you have to do. And when you’re an addict, you have to use. So you just try to balance things out as best you can. But little by little, the family life started to show cracks.

I was usually pretty good about it. I was able to get up and make the kids breakfast and get them off to school. And I was strong; I had a lot of energy. I would’ve killed myself otherwise. But the books start to show it after a while. Misery is a book about cocaine. Annie Wilkes is cocaine. She was my number-one fan.

Did the quality of your writing start to go down?
Yeah, it did. I mean, The Tommyknockers is an awful book. That was the last one I wrote before I cleaned up my act. And I’ve thought about it a lot lately and said to myself, “There’s really a good book in here, underneath all the sort of spurious energy that cocaine provides, and I ought to go back.” The book is about 700 pages long, and I’m thinking, “There’s probably a good 350-page novel in there.”

It was around this same period King wrote & directed Maximum Overdrive.