They gave him three months. The year was 2012. And Simpsons co-creator Sam Simon, who had until then rocketed through Hollywood and earned the descriptions of “brilliantly funny” and “mentally unbalanced,” had just learned he was going to die.

The doctor said it was cancer, flashing a series of ominous looking scans. “I said, ‘Is it curable?'” he recalled in an interview with NBC. “And the doctor goes, ‘We don’t use that word. I will say that I can’t cure you, but I can keep you alive.’ He’s done a remarkable job. I’ve never been happier.”

Simon decided then and there to donate his substantial personal fortune of $100 million to charity. He doesn’t drive anymore. He doesn’t do much writing, either. But he said he does give.

“The sort of lifetime achievement stuff that I’m getting now is kind of like Tom Sawyer’s funeral because they all know I’m sick,” the childless writer told Hollywood Reporter last year. “I am getting buildings named after me and awards and stuff. The truth is, I have more money than I’m interested in spending. Everyone in my family is taken care of. And I enjoy this.”

A longtime advocate for animal rights, he put much of the money into his Sam Simon Foundation, which provides assistance dogs for the disabled and for Iraq and Afghanistan veterans afflicted with post-traumatic stress disorder. For a man who once dreamed up the buffoonery of Homer Simpson, that money — those donations — is what occupies his thoughts now.

“In the field of comedy writing, full to overflowing with the sedentary, the professionally whiny, and the proudly self-involved, Sam Simon stands out as an anomaly,” wrote Merrill Markoe in a recent Vanity Fair profile. “Diagnosed with terminal colon cancer in 2012 and given three to six months to live, he is now focused like a laser, in a race against time, making sure that all that money — hundreds of millions of dollars — made from his years of work on The Simpsons and other television shows is being channeled directly into the charitable causes he loves.”

Simon speaks of his charity more simply. “You know, I’m not married, and I don’t have kids,” he told Hollywood reporter. He likes to give, he said. So he does it. It’s that simple.

That thought solidified into action following what he characterized as an “emergency operation.” “I really did come very close to dying,” he said. “My colon cancer perforated my colon. When I woke up in the hospital, even though I did have a will, it did become that much more important to me to set this stuff up for the future.”

Born in 1955 in Los Angeles, Simon emerged from a chaotic family setting and glided into the Hollywood life following his graduation from Stanford University. He got a job doodling cartoons for the San Francisco Chronicle and San Francisco Examiner, but soon grew tired of it and dispatched an episode of “Taxi” on spec. It aired, and Simon got hired. He was 25.

That penchant for comedy eventually landed him on the “Simpsons” team, where he penned numerous early shows. But there was a volatility to Simon that made him clash sometimes with other writers and co-creator Matt Groening, and he left the show in 1993.

“I can’t honestly say we were getting along as well at that point as when the project started,” he told Vanity Fair, adding that he nonetheless came out with some significant royalties. “It worked out for everyone. Everyone should be happy.” He joked: “I make tens of millions of dollars a year, which may not sound like a lot, but over 25 years, it adds up.”

It hasn’t been enough, however, to save Simon, who began to feel unwell several years ago. He was originally misdiagnosed as having a “viral illness,” he said on a radio show. “The diagnosis was — I was feeling bad for a couple years, and I was diagnosing myself from television talk shows, so I was taking antidepressants and I was trying to get my testosterone levels up.”

The eventual news of his terminal cancer, though devastating, was also in some ways liberating for Simon, he told NBC this week. “Cancer has been a fight,” he said, today bald from chemotherapy. “It’s been an adventure. It’s been an education. It’s been the most amazing experience of my life.”