Richard Llewellyn, 77, a novelist and playwright whose best-selling book "How Green Was My Valley" was made into an Oscar-winning film, died Nov. 30 at St. Vincent's Hospital in Dublin after a heart attack. He had lived in Ireland for several years.

"How Green Was My Valley" was an impassioned portrayal of the hard and dangerous life of a close-knit Welsh mining community during the 1930s. The book, published in 1939, sold widely in Britain and the United States. The film won the Academy Award for best picture in 1941.

Huw, the boy-hero of the novel, appeared in three other books by Mr. Llewellyn--"Up into the Singing Mountain," which was published in 1963, "Down Where the Moon is Small," which appeared in 1966, and "Green Green My Valley Now," published in 1975. None achieved the sweeping success enjoyed by "How Green Was My Valley."

Mr. Llewellyn also wrote "A Flame for Doubting Thomas," a philosophical thriller published in 1954 and set in the United States where he was then living. Other novels included "None But the Lonely Heart," published in 1943, and "A Man in a Mirror," published in 1964, which was about life among the Masai tribesmen of Kenya. His plays included "Poison Pen," a psychological thriller written in 1938, which enjoyed a successful run on the London stage, "The Scarlet Suit," "Ecce," and "Hat."

Mr. Llewellyn was born Richard Dafydd Vivian Llewellyn Lloyd. Richard Llewellyn was his pen name. His father was a hotel manager in Pembrokeshire in rural southwest Wales far from the coal mining valleys of south Wales, which he wrote about with such passion. After leaving school, Mr. Llewellyn was sent to Italy to learn hotel management but soon gave this up and joined the British Army in India, where he started writing.

He quit the army and lived for a time in China before returning to Britain in 1932, where he frequently was down-and-out on the streets. He had decided to take up writing full time, but knew little about coal mining. He went to work in a coal mine in the Rhondda Valley in south Wales to obtain the background he needed for his novels.

He also had worked as a film director, producer and actor, and at one point was a Hollywood scriptwriter. He was an inveterate wanderer and lived at various times in Brazil, Argentina, Kenya and Israel, in addition to Britain and Ireland.

In 1952, Mr. Llewellyn married Nona Theresa Sonsteby. That marriage ended in divorce 16 years later.

Survivors include his wife, the former Susan Frances Heimann, whom he married in 1974.