Apollo Guidance Computer
The Apollo Guidance Computer (AGC) is a digital computer produced for the Apollo program that was installed on board each Apollo command module (CM) and Apollo Lunar Module (LM).
≈ 25 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
The Apollo Guidance Computer (AGC) is a digital computer produced for the Apollo program that was installed on board each Apollo command module (CM) and Apollo Lunar Module (LM). The AGC provided computation and electronic interfaces for guidance, navigation, and control of the spacecraft. The AGC was the first computer based on silicon integrated circuits (ICs).
The computer's performance was comparable to the first generation of home computers from the 1970s, such as the Kenbak-1, Apple II, TRS-80, and Commodore PET. At around in size, the AGC held 4,100 IC packages. The AGC has a 16-bit word length, with 15 data bits and one parity bit.
Most of the software on the AGC is stored in a special read-only memory known as core rope memory, fashioned by weaving wires through and around magnetic cores, though a small amount of read/write core memory is available. Astronauts communicated with the AGC using a numeric display and keyboard called the DSKY (for "display and keyboard", pronounced ).
The AGC and its DSKY user interface were developed in the early 1960s for the Apollo program by the MIT Instrumentation Laboratory and first flew in 1966. The onboard AGC systems were secondary, as NASA conducted primary navigation with mainframe computers in Houston.
Operation
In the earlier Project Gemini program, the astronauts flew manually with control sticks. In the Apollo program however, the flight was controlled by the computer. The astronauts flew manually briefly during lunar landings.
Each Moon flight carried two AGCs, one each in the command module and the Apollo Lunar Module, with the exception of Apollo 7 which was an Earth orbit mission and Apollo 8 which did not need a lunar module for its lunar orbit mission. The AGC in the command module was the center of its guidance, navigation and control (GNC) system.
The AGC in the lunar module ran its Apollo PGNCS (primary guidance, navigation and control system), with the acronym pronounced as pings. Each lunar mission had two additional computers: The Launch Vehicle Digital Computer (LVDC) on the Saturn V booster instrument unit the Abort Guidance System (AGS, pronounced ) of the lunar module, to be used in the event of failure of the LM PGNCS.
The AGS could be used to take off from the Moon, and to rendezvous with the command module, but not to land.
Design
silicon integrated circuits welded to PCB in the Apollo guidance computer The AGC was designed at the MIT Instrumentation Laboratory under Charles Stark Draper, with hardware design led by Eldon C. Hall. Early architectural work came from J. H. Laning Jr., Albert Hopkins, Richard Battin, Ramon Alonso, and Hugh Blair-Smith.
The flight hardware was fabricated by Raytheon, whose Herb Thaler was also on the architectural team. According to Kurinec et al., the chips were welded onto the boards rather than soldered as might be expected. Apollo Guidance Computer logic module drawings specify resistance-welding.
Logic hardware
Following the use of integrated circuit (IC) chips in the Interplanetary Monitoring Platform (IMP) in 1963, IC technology was later adopted for the AGC. The Apollo flight computer was one of the first computers to use silicon IC chips.
While the Block I version used 4,100 ICs, each containing a single three-input NOR gate, the later Block II version (used in the crewed flights) used about 2,800 ICs, mostly dual three-input NOR gates and smaller numbers of expanders and sense amplifiers. The ICs, from Fairchild Semiconductor, were implemented using resistor–transistor logic (RTL) in a flat-pack.
They were welded to printed circuit boards, which were interconnected via wire wrap, and the wiring was then embedded in cast epoxy plastic. The use of a single type of IC (the dual NOR3) throughout the AGC avoided problems that plagued another early IC computer design, the Minuteman II guidance computer, which used a mix of diode–transistor logic and diode logic gates.
NOR gates are universal logic gates from which any other gate can be made, though at the cost of using more gates.
Memory
The Block II computer had 2,048 words of erasable magnetic-core memory and 36,864 words of read-only core rope memory. Both had cycle times of 11.72 microseconds. The memory word length was 16 bits: 15 bits of data and one odd-parity bit. The CPU-internal 16-bit word format was 14 bits of data, one overflow bit, and one sign bit (ones' complement representation).
DSKY interface
The user interface to the AGC was the DSKY, standing for display and keyboard and usually pronounced . It has an array of indicator lights, numeric displays, and a calculator-style keyboard. Commands were entered numerically, as two-digit numbers: Verb and Noun.
Verb described the type of action to be performed and Noun specified which data were affected by the action specified by the Verb command. Each digit was displayed via a green (specified as 530 nm ) high-voltage electroluminescent seven-segment display; these were driven by electromechanical relays, limiting the update rate.
Three five-digit signed numbers could also be displayed in octal or decimal, and were typically used to display vectors such as space craft attitude or a required velocity change (delta-V). Although data was stored internally in metric units, they were displayed as United States customary units. This calculator-style interface was the first of its kind.
The command module has two DSKYs connected to its AGC: one located on the main instrument panel and a second located in the lower equipment bay near a sextant used for aligning the inertial guidance platform. The lunar module had a single DSKY for its AGC.
A flight director attitude indicator (FDAI), controlled by the AGC, was located above the DSKY on the commander's console and on the LM.
Timing
The AGC timing reference came from a 2.048 MHz crystal clock. The clock was divided by two to produce a four-phase 1.024 MHz clock which the AGC used to perform internal operations. The 1.024 MHz clock was also divided by two to produce a 512 kHz signal called the master frequency; this signal was used to synchronize external Apollo spacecraft systems.
The master frequency was further divided through a scaler, first by five using a ring counter to produce a 102.4 kHz signal. This was then divided by two through 17 successive stages called F1 (51.2 kHz) through F17 (0.78125 Hz). The F10 stage (100 Hz) was fed back into the AGC to increment the real-time clock and other involuntary counters using Pinc (discussed below).
The F17 stage was used to intermittently run the AGC when it was operating in the standby mode.
Central registers
The AGC had four 16-bit registers for general computational use, called the central registers: A: The accumulator, for general computation Z: The program counter – the address of the next instruction to be executed Q: The remainder from the DV instruction, and the return address after TC instructions L: The lower product after MP instructions There were also four locations in core memory, at addresses 20–23, dubbed editing locations because whatever was stored there would emerge shifted or rotated by one bit position, except for one that shifted right seven bit positions, to extract one of the seven-bit interpretive op. codes that were packed two to a word. This was common to Block I and Block II AGCs.
Other registers
. The AGC is opened up, showing its logic modules.
The AGC had additional registers that were used internally in the course of operation: S: 12-bit memory address register, the lower portion of the memory address Bank/Fbank: 5-bit ROM bank register, to select the 1-kiloword ROM bank when addressing in the fixed-switchable mode Ebank: 3-bit RAM bank register, to select the 256-word RAM bank when addressing in the erasable-switchable mode Sbank (super-bank): 1-bit extension to Fbank, required because the last 4 kilowords of the 36-kiloword ROM was not reachable using Fbank alone SQ: 4-bit sequence register; the current instruction G: 16-bit memory buffer register, to hold data words moving to and from memory X: The 'x' input to the adder (the adder was used to perform all 1's complement arithmetic) or the increment to the program counter (Z register) Y: The other ('y') input to the adder U: Not really a register, but the output of the adder (the ones' complement sum of the contents of registers X and Y) B: General-purpose buffer register, also used to pre-fetch the next instruction. At the start of the next instruction, the upper bits of B (containing the next op. code) were copied to SQ, and the lower bits (the address) were copied to S. C: Not a separate register, but the ones' complement of the B register IN: Four 16-bit input registers OUT: Five 16-bit output registers
Instruction set
The instruction format used 3 bits for opcode, and 12 bits for address. Block I had 11 instructions: TC , CCS , INDEX , XCH , CS , TS , AD , and MASK (basic), and SU , MP , and DV (extra). The first eight, called basic instructions, were directly accessed by the 3-bit op. code.
The final three were denoted as extracode instructions because they were accessed by performing a special type of TC instruction (called EXTEND ) immediately before the instruction. The Block I AGC instructions consisted of the following: TC (transfer control): An unconditional branch to the address specified by the instruction.
The return address was automatically stored in the Q register, so the TC instruction could be used for subroutine calls. CCS (count, compare, and skip): A complex conditional branch instruction. The A register was loaded with data retrieved from the address specified by the instruction.
(Because the AGC uses ones' complement notation, there are two representations of zero. When all bits are set to zero, this is called plus zero. If all bits are set to one, this is called minus zero.)
The diminished absolute value (DABS) of the data was then computed and stored in the A register. If the number was greater than zero, the DABS decrements the value by 1; if the number was negative, it is complemented before the decrement is applied—this is the absolute value. Diminished means "decremented but not below zero".
Therefore, when the AGC performs the DABS function, positive numbers will head toward plus zero, and so will negative numbers but first revealing their negativity via the four-way skip below. The final step in CCS is a four-way skip, depending upon the data in register A before the DABS. If register A was greater than 0, CCS skips to the first instruction immediately after CCS .
If register A contained plus zero, CCS skips to the second instruction after CCS . Less than zero causes a skip to the third instruction after CCS , and minus zero skips to the fourth instruction after CCS .
The primary purpose of the count was to allow an ordinary loop, controlled by a positive counter, to end in a CCS and a TC to the beginning of the loop, equivalent to an IBM 360's BCT . The absolute value function was deemed important enough to be built into this instruction; when used for only this purpose, the sequence after the CCS was TC *+2, TC *+2, AD ONE.
A curious side effect was the creation and use of CCS -holes when the value being tested was known to be never positive, which occurred more often than one might suppose. That left two whole words unoccupied, and a special committee was responsible for assigning data constants to these holes.
INDEX : Add the data retrieved at the address specified by the instruction to the next instruction. INDEX can be used to add or subtract an index value to the base address specified by the operand of the instruction that follows INDEX .
This method is used to implement arrays and table look-ups; since the addition was done on both whole words, it was also used to modify the op. code in a following (extracode) instruction, and on rare occasions both functions at once. RESUME : A special instance of INDEX ( INDEX 25). This is the instruction used to return from interrupts.
It causes execution to resume at the interrupted location. XCH (exchange): Exchange the contents of memory with the contents of the A register.
If the specified memory address is in fixed (read-only) memory, the memory contents are not affected, and this instruction simply loads register A. If it is in erasable memory, overflow "correction" is achieved by storing the leftmost of the 16 bits in A as the sign bit in memory, but there is no exceptional behavior like that of TS . CS (clear and subtract): Load register A with the ones' complement of the data referenced by the specified memory address.
TS (transfer to storage): Store register A at the specified memory address. TS also detects, and corrects for, overflows in such a way as to propagate a carry for multi-precision add/subtract.
If the result has no overflow (leftmost 2 bits of A the same), nothing special happens; if there is overflow (those 2 bits differ), the leftmost one goes the memory as the sign bit, register A is changed to +1 or −1 accordingly, and control skips to the second instruction following the TS . Whenever overflow is a possible but abnormal event, the TS was followed by a TC to the no-overflow logic; when it is a normal possibility (as in multi-precision add/subtract), the TS is followed by CAF ZERO ( CAF = XCH to fixed memory) to complete the formation of the carry (+1, 0, or −1) into the next higher-precision word.
Angles were kept in single precision, distances and velocities in double precision, and elapsed time in triple precision. AD (add): Add the contents of memory to register A and store the result in A. The 2 leftmost bits of A may be different (overflow state) before and/or after the AD .
The fact that overflow is a state rather than an event forgives limited extents of overflow when adding more than two numbers, as long as none of the intermediate totals exceed twice the capacity of a word. MASK : Perform a bit-wise (boolean) and of memory with register A and store the result in register A. MP (multiply): Multiply the contents of register A by the data at the referenced memory address and store the high-order product in register A and the low-order product in register LP.
The parts of the product agree in sign. DV (divide): Divide the contents of register A by the data at the referenced memory address.
Store the quotient in register A and the absolute value of the remainder in register Q. Unlike modern machines, fixed-point numbers were treated as fractions (notional decimal point just to right of the sign bit), so you could produce garbage if the divisor was not larger than the dividend; there was no protection against that situation. In the Block II AGC, a double-precision dividend started in A and L (the Block II LP), and the correctly signed remainder was delivered in L. That considerably simplified the subroutine for double precision division.
SU (subtract): Subtract (ones' complement) the data at the referenced memory address from the contents of register A and store the result in A. Instructions were implemented in groups of 12 steps, called timing pulses. The timing pulses were named TP1 through TP12. Each set of 12 timing pulses was called an instruction subsequence.
Simple instructions, such as TC, executed in a single subsequence of 12 pulses. More complex instructions required several subsequences. The multiply instruction ( MP ) used 8 subsequences: an initial one called MP0 , followed by an MP1 subsequence which was repeated 6 times, and then terminated by an MP3 subsequence.
This was reduced to 3 subsequences in Block II. Each timing pulse in a subsequence could trigger up to 5 control pulses. The control pulses were the signals which did the actual work of the instruction, such as reading the contents of a register onto the bus, or writing data from the bus into a register.
Memory
(ROM) Block I AGC memory was organized into 1 kiloword banks. The lowest bank (bank 0) was erasable memory (RAM). All banks above bank 0 were fixed memory (ROM).
Each AGC instruction had a 12-bit address field. The lower bits (1–10) addressed the memory inside each bank. Bits 11 and 12 selected the bank: 00 selected the erasable memory bank; 01 selected the lowest bank (bank 1) of fixed memory; 10 selected the next one (bank 2); and 11 selected the Bank register that could be used to select any bank above 2.
Banks 1 and 2 were called fixed-fixed memory, because they were always available, regardless of the contents of the Bank register. Banks 3 and above were called fixed-switchable because the selected bank was determined by the bank register. The Block I AGC initially had 12 kilowords of fixed memory, but this was later increased to 24 kilowords.
Block II had 36 kilowords of fixed memory and 2 kilowords of erasable memory. The AGC transferred data to and from memory through the G register in a process called the memory cycle. The memory cycle took 12 timing pulses (11.72 μs). The cycle began at timing pulse 1 (TP1) when the AGC loaded the memory address to be fetched into the S register.
The memory hardware retrieved the data word from memory at the address specified by the S register. Words from erasable memory were deposited into the G register by timing pulse 6 (TP6); words from fixed memory were available by timing pulse 7. The retrieved memory word was then available in the G register for AGC access during timing pulses 7 through 10.
After timing pulse 10, the data in the G register was written back to memory. The AGC memory cycle occurred continuously during AGC operation. Instructions needing memory data had to access it during timing pulses 7–10.
If the AGC changed the memory word in the G register, the changed word was written back to memory after timing pulse 10. In this way, data words cycled continuously from memory to the G register and then back again to memory. The lower 15 bits of each memory word held AGC instructions or data, with each word being protected by a 16th odd parity bit.
This bit was set to 1 or 0 by a parity generator circuit so a count of the 1s in each memory word would always produce an odd number. A parity checking circuit tested the parity bit during each memory cycle; if the bit didn't match the expected value, the memory word was assumed to be corrupted and a parity alarm panel light was illuminated.
Interrupts and involuntary counters
The AGC had vectored interrupts, including the following: Dsrupt was triggered at regular intervals to update the user display (DSKY). Erupt was generated by various hardware failures or alarms. Keyrupt1, Keyrupt2 signaled a key press from the user's main keyboard or navigation keyboard respectively.
T3Rupt was generated at regular intervals from a hardware timer to update the AGC's real-time clock. Uprupt was generated each time a 16-bit word of uplink data was loaded into the AGC. The AGC responded to each interrupt by temporarily suspending the current program, executing a short interrupt service routine, and then resuming the interrupted program.
The AGC also had 20 involuntary counters. These were memory locations which functioned as up/down counters, or shift registers. The counters would increment, decrement, or shift in response to internal inputs.
The increment (Pinc), decrement (Minc), or shift (Shinc) was handled by one subsequence of microinstructions inserted between any two regular instructions. Interrupts could be triggered when the counters overflowed. The T3rupt and Dsrupt interrupts were produced when their counters, driven by a 100 Hz hardware clock, overflowed after executing many Pinc subsequences.
The Uprupt interrupt was triggered after its counter, executing the Shinc subsequence, had shifted 16 bits of uplink data into the AGC.
Standby mode
The AGC had a power-saving mode controlled by a standby allowed switch. This mode turned off the AGC power, except for the 2.048 MHz clock and the scaler. The F17 signal from the scaler turned the AGC power and the AGC back on at 1.28 second intervals.
In this mode, the AGC performed essential functions, checked the standby allowed switch, and, if still enabled, turned off the power and went back to sleep until the next F17 signal. In the standby mode, the AGC slept most of the time; therefore it was not awake to perform the Pinc instruction needed to update the AGC's real time clock at 10 ms intervals.
To compensate, one of the functions performed by the AGC each time it awoke in the standby mode was to update the real time clock by 1.28 seconds. The standby mode was designed to reduce power by 5–10 W (from 70 W) during midcourse flight when the AGC was not needed. However, in practice, the AGC was left on during all phases of the mission and this feature was never used.
Data buses
The AGC had a 16-bit read bus and a 16-bit write bus. Data from central registers (A, Q, Z, or LP), or other internal registers could be gated onto the read bus with a control signal. The read bus connected to the write bus through a non-inverting buffer, so any data appearing on the read bus also appeared on the write bus.
Other control signals could copy write bus data back into the registers. Data transfers worked like this: To move the address of the next instruction from the B register to the S register, an RB (read B) control signal was issued; this caused the address to move from register B to the read bus, and then to the write bus.
A WS (write S) control signal moved the address from the write bus into the S register. Several registers could be read onto the read bus simultaneously. When this occurred, data from each register was inclusive-ORed onto the bus.
This inclusive-OR feature was used to implement the Mask instruction, which was a logical AND operation. Because the AGC had no native ability to do a logical AND, but could do a logical OR through the bus and could complement (invert) data through the C register, De Morgan's theorem was used to implement the equivalent of a logical AND.
This was accomplished by inverting both operands, performing a logical OR through the bus, and then inverting the result.
Block II
A Block II version of the AGC was designed in 1966. It retained the basic Block I architecture, but increased erasable memory from 1 to 2 kilowords. Fixed memory was expanded from 24 to 36 kilowords.
Instructions were expanded from 11 to 34 and I/O channels were implemented to replace the I/O registers on Block I. The Block II version is the one that actually flew to the moon. Block I was used during the uncrewed Apollo 4 and 6 flights, and was on board the ill-fated Apollo 1.
The decision to expand the memory and instruction set for Block II, but to retain the Block I's restrictive three-bit op. code and 12-bit address had interesting design consequences. Various tricks were employed to squeeze in additional instructions, such as having special memory addresses which, when referenced, would implement a certain function.
For instance, an INDEX to address 25 triggered the RESUME instruction to return from an interrupt. Likewise, INDEX 17 performed an INHINT instruction (inhibit interrupts), while INDEX 16 reenabled them ( RELINT ). Other instructions were implemented by preceding them with a special version of TC called EXTEND .
The address spaces were extended by employing the Bank (fixed) and Ebank (erasable) registers, so the only memory of either type that could be addressed at any given time was the current bank, plus the small amount of fixed-fixed memory and the erasable memory. In addition, the bank register could address a maximum of 32 kilowords, so an Sbank (super-bank) register was required to access the last 4 kilowords.
All across-bank subroutine calls had to be initiated from fixed-fixed memory through special functions to restore the original bank during the return: essentially a system of far pointers. The Block II AGC also has the EDRUPT instruction (the name is a contraction of Ed's Interrupt, after Ed Smally, the programmer who requested it).
This instruction does not generate an interrupt, rather it performs two actions that are common to interrupt processing. The first action, inhibits further interrupts (and requires a RESUME instruction to enable them again).
In the second action, the ZRUPT register is loaded with the current value of the program counter (Z). It was only used once in the Apollo software, for setting up the DAP cycle termination sequence in the Digital Autopilot of the lunar module. It is believed to be responsible for problems emulating the LEM AGC Luminary software.
Applications outside Apollo
The AGC formed the basis of an experimental fly-by-wire (FBW) system installed into an F-8 Crusader to demonstrate the practicality of computer-driven FBW. The AGC used in the first phase of the program was replaced with another machine in the second phase, and research done on the program led to the development of fly-by-wire systems for the Space Shuttle.
The AGC also led, albeit indirectly, to the development of fly-by-wire systems for the generation of fighters that were being developed at the time.
See also
Apollo PGNCS - the Apollo Primary Guidance and Navigation System AP-101 (IBM S/360-derived) computers used in the Space Shuttle Gemini Guidance Computer History of computer hardware
External links
Documentation on the AGC and its development AGC4 Memo #9, Block II Instructions – The infamous memo that served as de facto official documentation of the instruction set Computers in Spaceflight: The NASA Experience – By James Tomayko (Chapter 2, Part 5, The Apollo guidance computer: Hardware) Computers Take Flight – By James Tomayko The Apollo Guidance Computer - A Users View (PDF) – By David Scott, Apollo mission astronaut Lunar Module Attitude Controller Assembly Input Processing (PDF) – By José Portillo Lugo The MIT AGC Project – With comprehensive document archive Luminary software source code listing, for Lunar Module guidance computer. (nb.
622 Mb) Colossus software source code listing, for Command Module guidance computer. (nb.
83 Mb) and Annotations to Eldon Hall's Journey to the Moon – An AGC system programmer discusses some obscure details of the development of AGC, including specifics of Ed's Interrupt Documentation of AGC hardware design, and particularly the use of the new integrated circuits in place of transistors AGC Integrated Circuit Packages Integrated Circuits in the Apollo Guidance Computer Documentation of AGC software operation Delco Electronics, Apollo 15 - Manual for CSM and LEM AGC software used on the Apollo 15 mission, including detailed user interface procedures, explanation of many underlying algorithms and limited hardware information. Note that this document has over 500 pages and is over 150 megabytes in size.
Source code for Command Module code (Comanche054) and Lunar Module code (Luminary099) as text. GitHub Complete Source Code Original Apollo 11 Guidance Computer (AGC) source code for the command and lunar modules. Some AGC-based projects and simulators AGC Replica – John Pultorak's successful project to build a hardware replica of the Block I AGC in his basement.
Mirror site: AGC Replica. Virtual AGC Home Page – Ronald Burkey's AGC simulator, plus source and binary code recovery for the Colossus (CSM) and Luminary (LEM) SW. Moonjs – A web-based AGC simulator based on Virtual AGC.
Eagle Lander 3D Shareware Lunar Lander Simulator with a working AGC and DSKY (Windows only). AGC restarted 45 years later – YouTube Feature Stories Computer for Apollo(1965) MIT Science Reporter – YouTube Weaving the way to the Moon (BBC News) Restorers try to get lunar module guidance computer up and running (Wall Street Journal) Computer for Apollo video – YouTube
Text derived from https://en.wikipedia.org/w/index.php?oldid=1371949536 under CC BY-SA 4.0; modifications have been made.