So much has been written about Iain Banks in the week since his death, one wonders what there is to add.

The tributes that have flowed confirmed that he held a special place in Scottish literature, in part because of his wickedly inventive imagination and his double life as a writer of mainstream fiction and sci-fi, but equally because he was such a popular man, a decent and generous guy who was fearlessly outspoken about politics, but would, one suspects, have opened his door to any waif or stray who knocked.

The Quarry, which we are told was written following his diagnosis, captures both those sides of Banks, but many others too. In choosing as his narrator the teenage Kit, who is somewhere on the Asperger's scale (he tells us that he has been around "one point eight decades"), Banks signals that nothing has changed since he started out as a novelist. No conventional storyteller for him, and nothing easy about the circumstances Kit faces either. But while what follows is nowhere as visceral as The Wasp Factory or The Bridge, it contains more of Banks's old asperity and rage than recent works.

It's not hard to see why. Kit's father Guy is in his late thirties and in the advanced stages of terminal cancer. The Quarry is Kit's account of a final weekend spent with Guy's university chums in his dilapidated north of England house, but it is Guy's voice that dominates. A bitter, furious voice it is too, as he rails against his fate: "Obviously I don't want to die, but I am trying to find what positives I can in the s****y circumstances, and one of those is that I shall be glad to see the back of this poxy little country and this f***ed-up world and this bunch of f***ing morons constituting my fellow stakeholders in the species Homo so-called sapiens."

In the process of decrying the inadequacies of modern Britain, Guy also swings for those who love him most, above all his son. Even now, with only months to live, Guy refuses to tell Kit who his mother is. He found his baby son on his doorstep, Kit informs us. "He tells people he came back drunk from the pub that night and assumed the warm bundle inside the front porch was a takeaway meal delivery he'd forgotten ordering. He claims to have been quite peeved when he discovered it was actually a newborn baby."

As the weekend unfolds, a more pressing search shapes events. Each of the guests wants to find a video of an embarrassing film they once made together, which they know Guy is in possession of, but which could damage their careers. It's a lacklustre device in comparison with the verve with which Banks depicts Kit, and his drolly nerdish ruminations, a series of monologues and conversations from which he extracts humour as he follows a strictly logical and unemotional mind. The hunt for the tape, meanwhile, is clumsy and unconvincing, and leads inevitably to the quarry which lies a few metres from Guy and Kit's teetering house. This gaping hole stands no doubt as a metaphor for the abyss that will one day swallow us all. As the distance between its lip and the house shrinks, so does the time left to Guy.

A vividly stitched series of cameos, some wildly tangential to the story, some crucial to the plot, The Quarry is a self-indulgent but unsentimental work in which Banks gives his characters free rein to denounce the pervasive ails of the western world.

These rants are nicely countered, in the person of Kit, with moments of child-like wonder at the things that fascinate him about the world. But for the adults, one feels, there is little left to marvel at. In his portrayal of long-time friends, and the fragility of their bonds, Banks is pin-sharp and clear-eyed. As each of the group proves less than wholly trustworthy, Kit emerges truly as the hero, not only for his courage and compassion, but for his unwavering moral compass. In this, Banks ends on an optimistic note, leaving a buoyant youth holding the future in his hands.

Despite its occasional soap-box tone, this is a powerful and affecting book. There is a throat-catching pathos to Banks's unflinching descriptions of Guy's physical condition and, as this much diminished and frightened man gets closer to the end of his life, The Quarry reaches a pitch of emotion that only a reader made of granite could read without tears. One salutes a writer who to the very end wrote about what mattered most to him, and at what must have been great personal cost.