The running gags, the mispronunciations, the irreverent treatment of "Vanilla Redgrave" and "Andrew Privet" and that wonderful, now poignant, song-and-dance routine to Bring Me Sunshine. In the 1970s, Morecambe and Wise were Britain's favourite entertainers - and even today, 23 years after Eric's death and eight years after Ernie's, they could perhaps still lay claim to that honour.

Their success was built on their audience's huge affection for them, which was in turn a response to the two men's obvious friendship. Eddie Braben, who scripted most of their BBC material, summed it up by saying that when other big stars came on stage, you got an "oooh" from the audience, but when Eric and Ernie came on, you got an "ahhh".

Their double-act ended suddenly and tragically in 1984 when Eric, at 58, suffered a fatal heart attack. By that time, the pair had a hugely successful 20-year TV career behind them: their 1977 Christmas Show was watched by half the UK population (28 million people), a record for a light entertainment programme that still stands. But, as a new book reveals, the television years are only half the story. The duo spent 25 years earning a precarious living in variety theatres, doing two performances a night and three on Saturdays. They survived the famously frightening Glasgow Empire, went through periods of unemployment and even had a stint supporting performing birds. Morecambe and Wise Untold tells the story through the reminiscences of those they met along the way.

"I think that experience had a huge effect on them as people and on their stage personas," says William Cook, the book's author and an authority on British comedy. "People right from the start thought they were good, but they went through a long period in no-man's-land between being child and adult stars. Even after that, it was no overnight success. But when they became household names, their act was built on very firm foundations."

John Eric Bartholomew and Ernest Wiseman were 13 and 14 respectively when they became friends. They had both been talent-spotted and joined the touring variety show Youth Takes a Bow. Eric's mother Sadie came with them - and, to save money in guest houses, the two boys would share a double bed while Sadie would take the single.

They performed their double-act for the first time at the Liverpool Empire in 1941. Ernie had already shortened his name; Eric changed his to that of his home town, and Morecambe and Wise were born. But they had a daunting start. In their first week they played the Glasgow Empire, the theatre Ken Dodd called the House of Terror and where Des O'Connor once fainted mid-routine. "It was a palace, a beautiful theatre, and the audience knew their stuff," says Cook. "English acts had a tougher time of it - or, at least, felt that they did." On their first outing there, Eric and Ernie walked off stage to a deafening silence. "They're beginning to like you," the stage manager told them.

Morecambe & Wise's next show, Strike a New Note at the London Hippodrome, was seen by such luminaries as Alfred Hitchcock, Clark Gable and James Stewart - but when the pair turned 18 they were called up to serve their country, Ernie joining the merchant navy and Eric going down the mines as a Bevin Boy.

After being demobbed, they met up - by chance - in a show called Lord Sanger's Circus and Variety, which Cook describes as "a showbiz misadventure of almost Pythonesque proportions". The idea was to combine circus and variety in a big top. Eric and Ernie were at the foot of the bill, below Peter the Equine Marvel and a flock of performing pigeons. They had to help put up the tent and sell tickets, and Eric even led a donkey along Weymouth beach with an advertising placard tied to its rump.

Back in London, the pair persevered - but struggled. During one 14-month period they had less than six weeks' work. They eventually got a spot at the Windmill Theatre, famous for running shows featuring nudes - motionless ones, as nudity was banned in performance but not in art. Their stint there was short-lived, but it helped them get an agent and a contract on the Moss Empire circuit, the best variety theatres in the country, for £35 a week (plus £10 extra for the Glasgow Empire - officially for the rail fare, but really danger money).

All the while, they were amassing gags and honing their act. But it became increasingly clear that their forte was the way they interacted. Eric is often regarded as the great comic and Ernie as his foil, but Cook rejects this. "If you see them on TV when they're dancing, Ernie is supposed to be the straight man - but if you cover him up, Eric wasn't nearly as funny, just chaotic." Ernie could have been a great solo song-and-dance man, says Cook, but was committed to Eric's career as well as his own. "It was a very fine and selfless thing that he did."

By the 1950s, they had made it to the second spot on the bill. They did pantomime in winter and variety in summer, but their fortunes were still mixed. Their first solo TV series in 1953, Running Wild, failed. That hurt. Years later, Eric still carried around with him a newspaper clipping that said: "Definition of the week: TV set - the box in which they buried Morecambe and Wise." That, of course, could not have been more wrong: in 1961, they got their own series with ATV, and in 1968 with the BBC.

It was just as well. As the 1960s dawned, variety went into terminal decline, killed off by television. Five years earlier, Blackpool's 11 theatres had been employing around 5000 people at peak season; now, there and everywhere else, they were being sold off to developers. The Glasgow Empire closed in 1963.

But Eric and Ernie never forgot their roots. Their TV act harked back to variety and featured many old colleagues, including the harmonica player Arthur Tolcher, always interrupted with the phrase: "Not now, Arthur!"

Cook, however, says he sees a renewed interest in variety-style acts, partly fuelled by TV talent shows. He thinks several modern comedians - Harry Hill, for example - would work well on a variety bill, and agrees with Eric's son Gary that Ant and Dec have something of Morecambe and Wise about them.

But while nostalgia for the pair is alive and well, one thing is clear, says Cook: "We'll not see their likes again." Morecambe & Wise Untold by William Cook (HarperCollins, £18.99).

They brought sunshine John Eric Bartholomew was born on May 14, 1926, in Morecambe, Lancashire. His mother, Sadie, paid for him to have dance lessons. He performed song-and-dance routines at working men's clubs - and, by 12, was earning more than his father. Eric eventually auditioned in Manchester for the impresario Jack Hylton. Next to Hylton in the stalls was a professional of Eric's own age: Ernest Wiseman. Ernie was born on November 27, 1925, in Ardsley, near Leeds. One of five children, he performed song-and-dance routines with his father all over west Yorkshire. He was invited to London to audition for Hylton, who was so impressed he put him on stage in the West End that evening. In their first show together, Youth Takes a Bow, Ernie was paid £7 a week while Eric got £5. Ernie was still being paid more eight years later. At the Edinburgh Empire, now the Festival Theatre, Eric met a singer called Joan Bartlett. They married on December 11, 1952. Ernie and his girlfriend Doreen, a dancer, married a month later. Ernie and Doreen had no children; Eric and Joan had two, Gail and Gary, and an adopted son, Steven.