People say to me: "Where do you get your ideas?" "Out of the air," I tell them. This is a fact, though not a simple one. The air is different in different places; it is the local atmosphere, the medium through which pass the history of the place and the ideas there indwelling.

The first time I stood in Canterbury Cathedral and tilted my head back to look up, up, up to that numinous fan-vaulting I felt the uprush past me of all the centuries of prayer, of hope and fear and yearning, yearning for answers and, if possible, salvation.

Breathing in this atmosphere I made my way through the nave to those stone steps trodden by successive waves of pilgrims, some with beads, some with cameras. Up those worn- down steps, past the place where the remembered blood of Thomas Becket seethes on the stones, to the north aisle where on one wall remains the faint earth-green tracery of The Legend of St Eustace. Facing it on the opposite wall is Professor Tristram's reconstruction of the 15th-century painting.

Whatever talent I have for writing lies in being friends with my head: I know its vagaries, its twists and turns, its hobo journeys in fast freights, riding the blinds to unknown destinations. Sometimes I get thrown off the train in the middle of nowhere; sometimes I get to the Big Rock Candy Mountain. If you Google for Eustace you'll find that he has no official standing among the beatified. Perhaps his legend turned up on the back of some Middle-Ages cornflakes box and grew from there. Being thus non-factual, Eustace is quite at home in a work of fiction. According to the legend he was a general in the Roman army to begin with, but one day hunting in the forest, he saw a little crucified Jesus between the antlers of a stag, as vividly shown in the 15th-century painting by Pisanello.

This epiphany brought him to his knees and converted him to Christianity. He set out with his wife and their two little sons on a pilgrimage to Jerusalem and this painting by an unknown artist shows, vertically from bottom to top, the ill-starred journey from beginning to end: Eustace's wife is taken by pirates early on, leaving Eustace to soldier on with the children. When he comes to a river he carries one son across and returns for the other only to see a wolf making off with the first child and a lion with the second.

Now we come to the centrepiece of the painting: here is Eustace (larger than everything else, as was the custom in such pictures), treading water in the middle of the river, hands clasped prayerfully, hoping for better times. The times that come are worse, with the family reunited only to be roasted alive in a brazen bull.

Being in the middle of a river of my own just then, I had a strong fellow-feeling for Eustace. This is where Punch and Judy come into it. Being friends with my head, I was given a little something from my mental archive: seven or eight years earlier I had read in the New Yorker magazine two pieces by Edmund Wilson about English Punch and Judy shows and the men who made the puppets and performed with them. ZONK! this freight coupled to the Eustace locomotive and Riddley Walker was off down the line on its five-and-a half-year journey to the buffers at Guy Fawkes day, 1979.

Michelangelo is quoted as saying that he did his David and other works simply by carving away everything that wasn't the statue. I began Riddley Walker in 1974 and by 1976 I had 500 pages that weren't it. I went back to page one, girded up my typewriter and my critical faculty and started over. It wasn't heavy, it was my brother.

I started Riddley Walker in straight English but my characters wouldn't wear it, they insisted on breaking up long words and imposing their own grammar, syntax and pronunciation on their vernacular. The Ardship of Cambry, eyeless and misbegotten, assumed the twisted title of the dignitary of our time; Whitstable became Widders Bell, Herne Bay became Horny Boy and so on. People "vackt their wayt" when they had to leave a place, which is what Erny Orfing does when he has to "voat no kynd of fents" (this expresses a vote of no confidence as well as giving the image of the security he feels he lacks) and leave the Eusa folk. The language slows the reader down to Riddley's speed as he takes in what's happening and so effectively becomes a supporting player in the action. Since Riddley Walker I can't spell properly any more, but what the hell.