The Apollo Guidance Computer was used to control the command/service module and lunar module on the missions to the moon. (Definitely a retrocomputer!) As noted in this answer, programs were written in assembly language. There are several emulators available today, including one which can be run in a web browser.
Even though the AGC was invented before the C programming language, is a C compiler possible for this architecture? If not, why?
For the purposes of this question, a satisfactory compiler would support all of the C operators (including arithmetic, boolean, structure, and pointer) the original purpose of the AGC: notably, real-time signal processing and control. It does not have to be a lunar mission; the AGC was also used in a Navy rescue submarine and in the first airplane with computer fly-by-wire control.
Less important but nice to have:
- Originally I included structure and pointer operations as a requirement. However, arrays with indices would probably suffice.
- Ability to act as a general-purpose platform.
- Compliance to one or more standards (including but not limited to K&R, ANSI, and Embedded C).
- Floating point. The original software used fixed-point numbers, with subroutines for subtraction, multiplication, and division. Such numbers can be declared with Embedded C's
fixed
type. We'll call that good enough, even if it is possible to implement IEEE floating point. - Standard libraries or system calls (i.e. stdio should not be a concern).
The compiler would be hosted on another system, not on the AGC itself.
I hope these clarifications help!
(Photograph of Apollo Director of Software Engineering Margaret Hamilton, next to the source code of her team)