These days Irvine Welsh lives in Chicago and winters in Miami.

"Chicago winters are brutal," he says. "Being Scottish, you want to trade up." Yet he still feels at home in Leith. He's at home today, sitting in the Now Rest cafe, Bonnington Road, one of his old haunts. "This place was the Canasta back then. It used to be run by this old Italian guy. A very grumpy character. I remember coming in here many a time, hungover or f***** and drinking this really milky coffee."

It's black tea this morning. Black tea, black jumper, bald head and a spill of words, some inevitably profane. He's still a little jetlagged from his flight but he's already been on the set of the forthcoming film of his novel Filth, starring James McAvoy and Jamie Bell. And at least he has the consolation of familiarity. After all, his past is all around us. He looks out through the window and talks about his aunts and uncles who lived in the streets around us. As a child, even after his own family moved to Muirhouse, he'd come to Leith at weekends. "I feel comfortable around here," he says. "I feel like my DNA is imprinted all over the place."

We're also talking about the past because his new book, Skagboys, is very much a look back. It's about Scotland – and in particular Edinburgh – in the 1980s. It's about heroin, politics, class and revisiting past glories. Skagboys is a prequel to Trainspotting, the book that made Welsh famous and helped make living in Chicago and wintering in Miami possible. It's the story of Renton (studenty type), Begbie (psycho), Spud (naive) and Sick Boy (sex-obsessed) before Trainspotting. It's not a happy story (though it's often funny), tracing as it does the arrival of heroin and HIV in Leith.

It is also, I reckon, pretty fantastic. There are flaws, sure, but for the most part it's a thrilling, visceral read and proof to any naysayers who would write Welsh off as a one-trick pony. Since Trainspotting he has written 10 books, reactions to which have been varied. He's been a good writer. At times he's been a bad writer. But not since Trainspotting has he been a great writer. With Skagboys, he is once again.

In some senses the book itself is a throwback. Welsh reread 100,000 words he'd discarded when writing Trainspotting and found they held up pretty well. "It wasn't finished and formed but there was good stuff there. The more I read the more I got into these characters again. It was like meeting old pals." That was the starting point for the book. He's reworked, rewritten and hugely expanded those 100,000 words. The result is more than twice as long and has all the hooligan energy of Trainspotting. But it's also less close-up, more wide shot. "You get more reflective when you're older and you want to know about cause and effect," he says.

Naturally, I want to look at the cause and effect in Welsh's own life. This may be a problem, however. He is not, he says, a naturally reflective person. "I'm a bit like a shark, swimming forward all the time. I'm not good at looking back. It worries me because I think I should be better. You learn a lot from looking back because you avoid making the same mistakes, obviously, but I don't know if it's in my nature or the time of life I'm at, but I'm always very much in the now. Maybe I just don't have that good a memory.

"When I'm sitting in years to come, old and toothless in a gated community in Florida, I'll be thinking about this stuff. But you've got limited headspace. I'm working on another novel and on this TV thing with HBO in the States. I've just been filming Filth. I'm one of the producers and writers on this film called The Magnificent 11 which is going to Cannes in May and Ecstasy is coming out. I'm more concerned with stuff in the here and now."

Hmm, I say, the next half-hour is going to be fun for you. He has the good manners to laugh at that.

The Welsh legend is well established. Hibs fan. Not great at school. Went through a hotchpotch of jobs (TV repair man, waiter, removal man), became a junkie, moved to London, became a property developer, came back to Edinburgh, worked for the council, started writing about four Edinburgh radges messing about with drugs, got published, and then, bang, supernova – suddenly he's a literary pop star and the spokesman for the ecstasy generation (particularly after Ewan McGregor and Robert Carlyle starred in the movie version of Trainspotting in 1996).

Yet in many ways Welsh is a creation of the early 1980s. What's interesting about Skagboys is that it looks back at the Thatcher years and the politics of the time. In the book, the miners' strike stands for the death of Labour; the death of a culture of working hard and drinking on a Saturday, the culture of Welsh's father and uncles. "I suppose I was the first generation where that was taken away," he says. He's not sorry. "Personally, I hated Thatcher and everything like that, but in a way I was one of the people who benefited. It was a kind of liberation. I didn't have a job. I had to think about what I was going to do, what were my own resources?"

He became one of Thatcher's entrepreneurial class, then? "Well, kind of. Not that I'd ever thank the bastard for it. That's one thing I admired about the Scots. We all bought our [British] Telecom shares. We all bought our council houses but we still hated the bastards because we could see the bigger picture, that this is actually making us into not nice people, and this is actually going to go tits up. We had the sense that this is good for us in the short term but it's no f****** way to live."

Skagboys is quite a male book, all drugs and drink and football and sex. There's a lot of sex in the book, Irvine. "Is there? There is actually, aye. Sex is a way of looking for something. You don't admit it to yourself when you're in your teens and early twenties but when you're actually getting involved in a sexual scenario with someone you're looking for a lot more than a shag."

That's the (admittedly rough-spoken) romantic in him, I reckon. Despite his image as a very masculine writer, Welsh doesn't perceive much difference between men and women. "There are basic issues – women have kids; they've got that ultimate responsibility men don't – but when you come to write a character in fiction there is just a common humanity. I hate when you see male writers writing about women and they're always fastening and unfastening their bras and stuff like that. Do they think it makes it more authentic? It seems ridiculous and f****** creepy. Just write in character. You start off from a position of common humanity. Everyone experiences the same triumphs and humiliations, basically."

Indeed. Which is why it's so tempting to map the experiences of Renton and his mates on to Welsh's own life. In a way, Skagboys is Welsh's story too. The smart boy who got himself a drug habit (before reinventing himself spectacularly). It's very Rentonesque, no?

No. That's too facile, Welsh says. "Trainspotting was written in such an urgent first-person voice it was tempting for lots of people to say, 'This is just reportage, a kind of drug memoir rather than a novel.' But I was determined that I wasn't going to do that. I was going to write a novel, construct characters. Yeah, I can see bits of Renton and Sick Boy, even wee bits of Begbie in myself – hopefully not too much of Begbie – but I can see them all."

Welsh was a heroin user for 18 months in his early twenties. Back then, in the early 1980s, it was possible not to know what the long-term consequences could be. "As a kid I was told by my parents, 'If anyone offers you cannabis don't touch it. It will kill you.' The thing about that is if you have a joint of cannabis and it doesn't kill you then you don't believe anything else will. The drug education was counterproductive. Now it's interesting to see how things have changed."

When the film version of Trainspotting was released, there was no shortage of media voices calling it an advertisement for drug-taking. Today, Welsh reckons, Trainspotting "could almost be a drugs education film". "All the drug education and anti-drug advertisements take that trajectory," he says. "They show people having a good time and enjoying themselves, then they show people coming down and then they show people f***** and begging on the streets."

At one point in Skagboys, drug addiction is described as a disease of stupidity. Is that what Welsh came to believe? "That's being a bit crass about it. People need to do something. They need a void to be filled. If there's no work available, no outlet for their energy and creativity, they'll turn it on themselves because everybody needs compelling drama in their life, particularly when they're young. It gives them something to do, going out and looking for drugs.

"That's why it's different being a middle-class addict. You've had some kind of education, you've got contacts. You've got something to actually come off the drug for. If you're living off a giro in a scheme, there is nothing there. What are you going to do when you come off drugs? You've no education, no money, no opportunities; nobody gives a toss about you. Why should you give a toss about yourself?"

The last time we met, three years ago, Welsh conceded that the death of his father and the breakdown of a relationship had had much to do with his own attempts to self-medicate with drink and drugs.

"People can have all kinds of things going on in their lives," he says now, "bereavement issues, relationship breakdowns. You might respond inappropriately. You might go out and get drunk for days on end, you might shoot heroin or go out partying every night on ecstasy" – he has done all of those – "but these things pass. The emotional stress passes over and once these things have passed over there has to be something else fuelling it.

"The difficult thing with heroin is that it's a physical addiction. But that's just two weeks of real solid s*** to get through and then maybe another few months of depression. It's kind of doable."

What brought him to the point where he felt it was doable? "There was no big epiphany," he says. No matter how messed up he was, he always envisioned himself being off drugs. "Obviously it's not that easy. There were one or two false starts. It's like any physical addiction. You've just got to go right through it, then when you come out the other side there's no turning back into it. It's just gone."

Before writing Porno, the sequel to Trainspotting, he'd tried heroin again, to relive the experience. It wasn't much fun, he admits. This time he didn't feel the need. He can't imagine feeling the need again. "It would be almost impossible – you never say never if something's in your emotional vocabulary – but if the wife left me or someone close to me died I don't think I'd respond in that way. It's kind of gone from me now."

In 2005 Welsh married Beth Quinn, whom he met while teaching creative writing in Chicago. He's 53, she's 31. It's his second marriage. His first, to Anne Antsy, ended in 2003. Has this relationship changed him? "I think, yeah, it's - um -" For a rare moment he's almost tongue-tied. "I think you're always happier when you're in love with someone. Love and art are the things we aspire to and if I don't have these two things in my life then I'm frustrated and constantly looking for them. Fortunately, I've got them now and I'm in a good place."

That said, what he's realised, growing older, is that love is not enough. There have to be some areas of shared interest there, too, "because no matter how much you love each other, if you're very different people then eventually you'll get on each other's tits". What is his area of compatibility with Beth, then? "It's just a general vibe – an interest in the same things and being able to share each other's interests. My wife is really into horses. She's got a horse and she's working towards competing. And horses to me were the bookies. But we got this horse and I'd no interest, but now I love this f****** horse."

Welsh says Falco – apparently named after the Austrian pop star who gave us Rock Me Amadeus – is "one of my best mates". Does Welsh ride him? "No. He's a Rolls-Royce. You couldn't trust me behind the wheel of that."

Irvine Welsh likes horses, lives in Chicago and winters in Miami. Here's the thing, though. He still thinks of himself as Scottish. Well, some of the time. "You don't really see yourself particularly as Scottish until you're aware that other people do."

On the day we meet, David Cameron is in Edinburgh, reminding Scots why we should stay in the Union. "It's great to know he cares, like," Welsh says. "One thing that surprises me is I just can't understand why they f****** want us. We're never going to thank them for it. Why don't they just say, 'Go ahead and do what you want to do.'

"I think Scotland is on the brink of great and exciting things. It's actually beginning to realise itself now. The nationalist debate seems to have got a lot more mature. All this f****** Bannockburn, Culloden nonsense has gone out the window."

Instead, he says, there's a Scottish aspiration for social democracy that's not shared south of the Border. "The two countries have gone their separate ways, so [independence] seems inevitable.

"I always think the Union is nature's way of stopping the Scots ruling the world. We'd be unstoppable if we were independent. We'd still emigrate in droves but we'd do it from a very entrenched position of confidence. All that ambition and arrogance would be unbridled right across the world. It would be a sight to behold."

What does that make Irvine Welsh? A Caledonian cultural crusader, perhaps. He gets up to go. Heading into the future. Via Chicago and Miami. n

Skagboys is published by Jonathan Cape on Thursday, priced £12.99. Irvine Welsh will be reading from Skagboys at the Caves, 8-12 Niddry Street South, Edinburgh on April 20. Visit www.bookslam.com.