How They Built it: The Software of Apollo 11

2292

When Apollo 11‘s Lunar Module landed on the Moon 40 years ago today, the software that helped take humans to another celestial body was essentially built using paper-tape rolls and thick cardstock that was punched with special holes.

It wasn’t open source in the sense we know today, but it was built for NASA under contract, then was tested, modified and fine-tuned by NASA engineers in ways that are similar to open source projects nowadays.

“Well, in today’s definition it was open source–the source code was publicly available,” to mission engineers, said John “Jack” Garman, who was a 24-year-old NASA computer engineer when Apollo 11 lifted off July 16, 1969, on its way to the Moon. “But ‚ ‘open source‚’ in the Linux sense generally means that anyone can contribute additions and improvements, and of course that wasn’t the case for the Apollo software.”

Garman helped test and re-write the software before Apollo 11 ever left the ground, then continued to monitor it while it was used in the onboard computers. “The software was programmed on IBM punch cards. They had 80-columns and were ‚’assembled‚’ to instruction binary on mainframes‚ and it took hours.”

During the mission, most of the software code couldn’t be changed because it was hard- coded into the hardware, like ROM today, he said. But during pre-launch design simulations, problems that came up in the code could sometimes be finessed by Garman and the other computer engineers using a small amount of erasable memory that was available for the programs.

“Some of us NASA engineers who also worked in Mission Control would [literally guess and] ‚’make up‚’ minor changes to the software to work around [hypothetical] ‚’failures‚’ that were thrown at the flight control team during simulations,” Garman said. “In a sense, that fits the open source model, but only within the NASA and NASA Contractor domain.” NASA staff members had full access to the program code through their contracts with the Apollo hardware vendors, so they were able to change the code to make the program behave differently as needed.

The software used a low-level assembly language and was controlled using pairs or segments of numbers entered into a square-shaped, numeric-only keyboard called a Display and Keyboard Unit, or DSKY, inside each the Apollo capsule and the Lunar Module. The two-digit codes stood for ‘nouns’ or ‘verbs’ and were used to enter commands (verbs) or data (nouns), such as spacecraft docking angles or time spans for operations.

The Apollo Guidance Computer (AGC) systems on each craft were designed and built by teams of researchers and students at the Massachusetts Institute of Technology (MIT), led by the late Dr. Charles Stark Draper, under contract with NASA. Garman was one of the many NASA workers who helped run, test and debug the fledgling MIT code that would run the Moon mission from launch to splashdown. Some dedicated hobbyists have even designed and built their own computers to replicate the original Apollo devices.

“The AGC was very slow, but very reliable and very small for that time in the history of digital computers,” Garman said. “It was the earliest to use integrated circuits.”

The software as it was designed was built basically from scratch by MIT, he said. How did they know what to start with? “MIT didn’t really–they sort of made it up as they went along. Neither NASA nor MIT had built software for digital flight control and guidance systems in the past–no one had near this magnitude. So it took some soul-searching on both NASA and MIT’s sides to write down requirements and create hard schedules and test plans.”

A wide range of different modules were needed for different phases of the Moon mission, from the operating system to the user interface and the programs for each phase of the flight in both the command module computer and the lunar module computer. That meant applications for ascent, orbit, the trans-lunar injection on the way to the Moon, coasting, lunar orbit, trans-Earth injection on the return to Earth and re-entry. The same sorts of applications were needed for the Lunar Module, including descent, surface operations, ascent, rendezvous and descent abort, if it would be needed.

But while most of the software programs couldn’t be rewritten during a mission since they were largely held in ROM and couldn’t be changed in flight, the order in which the programs ran could be rearranged during the mission, if needed. That allowed flight controllers to change when and how programs ran to give different results during the flight. It’s not like today’s manned Space Shuttle missions, but it worked.

During the Apollo 11 Lunar Module’s descent to the Moon 40 years ago today, Garman played a direct role in preventing a mission abort. Several warning lights and computer overload alarms came on as the craft descended just above the Moon’s surface, causing worry in Mission Control, but all of Garman’s pre-flight simulation experiences told him that the alarms were not critical and the landing could continue. Without hesitating, and without panicking, the 24-year-old NASA computer engineer confidently gave the ‘go’ to continue the mission.

Granville Paules, was a 32-year-old guidance officer for one of the Apollo 11 mission teams and remembers that moment well.

“The alarms went off on during descent,” Paules said. “It was a conflict between the on-board systems and the computer was starting to get overloaded. Garman had a simulation where a similar thing had occurred about three weeks before that, so he knew what to do. It probably would have been a lot scarier, possibly even an abort for the landing, if we had not had that simulation. I can say that the odds of aborting that lunar landing were a lot higher than people want to believe. That simulation gave everybody the confidence to turn off the alarm and ignore it.”

While this was all going on, “the entire Mission Control Center was like the inside of a mausoleum,” he said. “You couldn’t hear a sound until he landed and then everybody exhaled at once. It was palpable.”

It was truly an amazing milestone, said Gene Kranz, one of several flight directors for Apollo 11.

“We landed on the Moon with less than 17 seconds of fuel remaining,” Kranz recalled. “When we shut that engine down we had fulfilled the pledge we had made to President (John F.) Kennedy and to the crew of Apollo 1.” [Kennedy launched the U.S. goal to land a man on the Moon in a May 1961 speech but was assassinated two years later and never saw his dream fulfilled, while the three-man crew of Apollo 1 died in a flash fire on the launch pad in January 1967 while training for what was to be the first Apollo flight into Earth orbit.]

Seven months after the Apollo 11 mission, Kranz would play another huge role in NASA’s Apollo program. He was one of the key heroes who helped bring the three-man Apollo 13 crew home to Earth in April, 1970, after an oxygen tank exploded as the craft made its way toward to Moon.

“The real key [to the success of Apollo 11’s first moon landing] was the absolutely spectacular training we had, the teams we had and the trusting leadership we had,” Kranz said. “I still marvel about the trust I had that day and that I engendered with my team.”

Jerry Bostick was 30 years old and was a member of Kranz’s White Team for Apollo 11.

“I started out in the mission planning division, designing missions,” he said. “We would write the requirements for all of the software in both the ground-based and the onboard computers, working primarily with MIT and IBM.”

“We would give instructions to the programs by punching cards,” Bostick said. “You had to wait at least 12 hours to see if it would work right.” The early programming was done in the real-time computing complex in Houston using IBM 7094 computers with 64K of memory. There were no hard disks. All the data was stored on magnetic tape, with each computer having about eight tape drives. Most programs used for the mission were written in Fortran, Bostick said. “After Apollo 1, we upgraded to the biggest and the best equipment that government money could buy, the IBM 360 with an unheard of 1MB of memory. We went all the way from 64K to 1MB.”

Today, Bostick says he is still amazed. “I have to admit, I sometimes wonder, oh man did we really do that?” he said. “I recognize that I was involved in one of the greatest accomplishments of mankind at the time, but none of us dwelled on that then. It was just a job we had to do that the President had laid out and told us to go out and figure out how to do it.”

Jay H. Greene was a 27-year-old flight dynamics officer for Apollo 11 for the Lunar Module’s descent to the moon. “We never thought about what we couldn’t do,” Greene said. “We were so involved in getting the job done that we had no doubts that it was possible.”

“It was pretty primitive stuff,” Greene said of the computers and programs that took Americans to the moon for Apollo 11. “I wouldn’t say crude. I would say elegant. Yes, Apollo 11 was neat. I consider myself very fortunate to have been involved in it.”