
Recently, the President of the United States, Barack Obama, closed the new lunar program of the United States. If you dreamed to jump on the lunar surface during life or fly on vacation to the lunar base, then you should put your plans on hold, sadly review the Futurama series about lunopark and continue to dream of apple trees on Mars. But I want to write a little about it. I want to remember the first attempt of a person to land on the moon and about the computing technology that made this attempt real.
Many probably remember that the American lunar program was called Apollo, and some may even have seen the Apollo 13 film with Tom Hanks starring the dramatic fate of the Apollo thirteenth mission. There is a scene in the film when astronauts reprogram the on-board computer by entering a set of numbers on the keyboard like a large calculator. That's what I want to tell about this computer.
')
(Apollo Guidance Computer with keyboard-display module. Source .)AGC - Apollo Guidance Computer was the first digital on-board computer built on integrated circuits. It was installed on board the command and lunar modules and was responsible for navigating and controlling the ship. AGC was the first computer in which you can see the prototype of modern embedded (embeded) systems. A computer was developed in the early sixties at MIT. The computer used integrated circuits company Fairchild Semiconductor - the creator of the first commercial integrated circuits. The basis of the computer was the logical blocks OR-NOT, built on resistor-transistor-logic (as the instructor in circuitry told us, the RTL circuits were worse than modern computers were heated).
There were two versions of AGC - the earlier BLOCK I and the later BLOCK II. The first version consisted of 4100 integrated circuits, the second 5600. The processor operated with 16-bit words, of which 14 bits were used for data, one bit for the sign and one was an overflow flag. The amount of RAM was 2048 words, and the amount of ROM was 36 kilo-words (72 kilobytes for easier understanding). ROM was based on the same principles that were used in RAM on
ferrite matrices , however, ferrite cores were used only as transformers, it did not change its magnetic state, but only united the reading line with the “bit” excitation line - if the core was connected to the “bit” line "- then there was a signal at the output interpreted as a logical unit, if there was no connection - a logical zero was obtained.
(Enlarged portion of the ferrite matrix. Source .The computer had four main registers:
A: battery;
Z: command counter;
Q: kept the remainder of the division and the return address when transferring control;
LP: kept the lower part of the multiplication command result.
He also had a number of auxiliary registers for managing memory banks, addressing, and I / O.
The instruction set consisted of 12 instructions — arithmetic instructions, control instructions, memory access, and logical bitwise I. Naturally, all calculations were performed with fixed-point numbers. There were five interrupt lines — one to refresh the screen, one to respond to keystrokes on the keyboard, one for the real-time clock, a line to interrupt the end of the word load from memory, and an interrupt signaling a hardware failure. AGC also had 20 independent memory cells that could operate in three modes, depending on the signals at their inputs — a growing counter, a decreasing counter, and a shift register. The overflow of the counter could cause an interrupt to trigger - in particular, this was how the display and clock were updated. They worked when the counters overflowed, controlled by one hundred hertz hardware clocks.
AGC worked at a frequency of 2.048 MHz - such an ordinary microcontroller by today's standards. And this thing led the ship with three astronauts on board to the moon, and landed the Lunar module.
Also, the computer had a low power mode (at full load, it consumed 70 watts). In this mode, the computer was actually turned off, consumed 5-10 watts and woke up every 1.2 seconds. It was supposed to use this mode in the middle parts of the flight, when there is no need for frequent refinement and adjustment of the course, however, they never used it.
(Beginning of the Apollo 13. Lunar Module Program listing. Source .)When AGC was created, there was no such software or programming technique. Software was written in assembly language. On board there was a small real-time operating system with cooperative multitasking, capable of performing up to eight tasks (jobs) "simultaneously." Also in the OS there was a component Wait List (Waitlist) which timer could perform small tasks (tasks), according to the schedule (schedule). These tasks could also add themselves to the schedule as well as start and stop jobs. (All this reminded me of Symbian's active tasks with their scheduler, active objects and its variations - the timer).
All tasks (jobs) had their priority, one of the tasks that had the lowest priority was called dummy job and was an analogue of the modern “System Silence” :) This task performed diagnostic checks and also turned off the activity indicator on the computer panel. If this indicator is off, it means that the computer has nothing to do :)
MIT also developed a virtual machine for AGC, which allowed to execute programs written in a higher level language. This language contained a set of commands allowing to perform calculations with higher accuracy, and also contained more advanced instructions - up to operations on matrices and vectors. It was used for programming navigation calculations, however, like any virtual machine, it was noticeably slower, more voracious from memory, although it had a plus — it allowed to mix high-level and native code in one code. To make life easier for programmers, the YUL version control system was created.
(AGC control panel in the command module. Source .)There was also a similarity to a shell - an astronaut could run tasks (jobs) to display the value of various memory cells in the octal and decimal systems, as well as manage tasks to periodically display some values ​​on the display.
A little closer look at the display and input system. Managing AGC and usability things are somewhat incompatible. All control was carried out using a numeric keypad like a calculator. An astronaut could define an action (verb) and what the action should be performed on (a noun). To display the numerical values, there were three five-digit indicators. Three were not chosen spontaneously - often they displayed the position vector of the ship, its speed, etc. In the command module had two keyboard-display modules, in the Lunar - only one.
(Memo with a list of "verbs" and "nouns" on the panel of the command module. Source .)AGC honorably performed the tasks assigned to it and was even used at the initial stage of developing the control system of the Shuttle electrical control system (AGC was installed on the experimental F8 to demonstrate the potential application of the EMF).
It did not go without errors - during the first landing on the moon two signals of lack of memory and computing resources worked - as it turned out later, the Lunar module program continued to process data from the proximity radar to the command module, which required 14% of the computing resources, while the program landing required 90% of the resources. On the advice of the earth, astronauts ignored these signals and made a successful landing on the moon. Later this software error was eliminated.
AGC, or rather LGC - Lunar Guidance Computer can be safely called the first computer on the moon, and God forbid that not the last.
If you are hooked by this topic, I advise you to visit
this resource (English) - there are a lot of materials on Apollo and Gemini computing systems up to assembler manuals and program listings. Well, or just go on AGC / LGC Apollo. By the way, one madman in 2004 built his analogue AGC :)