Source Code
![]() |
This source code is very close to the Apollo Guidance Computer software for the
Apollo 13 Lunar module. This revision of the Luminary 131 program is from December
of 1969, whereas there was a later revision in January of 1970, and still another
revision in February, which is the code that flew on the mission.
As far as this transcription is concerned, it was originally from a copy made in 1991 of
a printout from the collection of AGC developer Don Eyles for collector David Craig.
It was subsequently scanned by Gary Neff, reprocessed for online
presentation at the now-discontinued History of Recent Science and Technology (HRST) website
of MIT's Dibner Institute (the full-quality scans being discarded in the process),
and finally transcribed by Ron Burkey for the Virtual AGC Project. Although a
high-quality replacement scan for a completely illegible page was later provided by Gary
Neff, the reduced legibility of the reprocessed HRST posting nevertheless caused many
errors to be introduced into the transcription. Accordingly, a second scan of the same physical
printout was made in 2017 for the Virtual AGC Project's collection at the Internet Archive,
and used to correct the transcription errors. All of the scanned materials mentioned,
as well as other Luminary 131 related material, are available online.
Don Eyles apprently made additional hand-written notes in printout between 1991 and 2017,
so the two scans are not identical in that respect. The page-headings in the printout read, in part:GAP: ASSEMBLE REVISION 131 OF AGC PROGRAM LUMINARY BY NASA 2021112-091 17:53 DEC. 19, 1969Note that the date is the date the printout was made, not the date on which the program revision was released, although these happen to be very close together. |
015249,000002: ## Copyright: Public domain.
015250,000003: ## Filename: KALCMANU_STEERING.agc
015251,000004: ## Purpose: A section of Luminary 1C, revision 131.
015252,000005: ## It is part of the source code for the Lunar Module's (LM)
015253,000006: ## Apollo Guidance Computer (AGC) for Apollo 13.
015254,000007: ## This file is intended to be a faithful transcription, except
015255,000008: ## that the code format has been changed to conform to the
015256,000009: ## requirements of the yaYUL assembler rather than the
015257,000010: ## original YUL assembler.
015258,000011: ## Reference: pp. 367-371
015259,000012: ## Contact: Ron Burkey <info@sandroid.org>.
015260,000013: ## Website: www.ibiblio.org/apollo/index.html
015261,000014: ## Mod history: 05/11/03 RSB Began transcribing.
015262,000015: ## 05/14/05 RSB Corrected website reference above.
015263,000016: ## 2011-05-07 JL Removed workarounds.
015264,000017: ## 2017-01-06 RSB Page numbers now agree with those on the
015265,000018: ## original harcopy, as opposed to the PDF page
015266,000019: ## numbers in 1701.pdf.
015267,000020: ## 2017-01-28 RSB WTIH -> WITH.
015268,000021: ## 2017-02-23 RSB Proofed comment text using octopus/ProoferComments.
015269,000022: ## 2017-02-28 RSB Fixed lingering typos.
015270,000023: ## 2017-03-17 RSB Comment-text fixes identified in diff'ing
015271,000024: ## Luminary 99 vs Comanche 55.
015272,000025:
![]() |
Page 367 |
015274,000027: # GENERATION OF STEERING COMMANDS FOR DIGITAL AUTOPILOT FREE FALL MANEUVERS
015275,000028:
015276,000029: # NEW COMMANDS WILL BE GENERATED EVERY ONE SECOND DURING THE MANEUVER
015277,000030:
015278,000031: 22,3003 E6,1706 EBANK= TTEMP
015279,000032:
015280,000033: 22,3003 04616 NEWDELHI TC BANKCALL # CHECK FOR AUTO STABILIZATION
015281,000034: 22,3004 54266 CADR ISITAUTO # ONLY
015282,000035: 22,3005 10000 CCS A
015283,000036: 22,3006 12730 TCF NOGO -2
015284,000037: 22,3007 06042 NEWANGL TC INTPRET
015285,000038: 22,3010 75160 AXC,1 AXC,2
015286,000039: 22,3011 03245 MIS # COMPUTE THE NEW MATRIX FROM S/C TO
015287,000040: 22,3012 02230 KEL # STABLE MEMBER AXES
015288,000041: 22,3013 77624 CALL
015289,000042: 22,3014 44312 MXM3
015290,000043: 22,3015 45575 VLOAD STADR
015291,000044: 22,3016 50515 STOVL MIS +12D # CALCULATE NEW DESIRED CDU ANGLES
015292,000045: 22,3017 77626 STADR
015293,000046: 22,3020 50523 STOVL MIS +6D
015294,000047: 22,3021 77626 STADR
015295,000048: 22,3022 74531 STORE MIS
015296,000049: 22,3023 45160 AXC,1 CALL
015297,000050: 22,3024 03245 MIS
015298,000051: 22,3025 44654 DCMTOCDU # PICK UP THE NEW CDU ANGLES FROM MATRIX
015299,000052: 22,3026 77634 RTB
015300,000053: 22,3027 21621 V1STO2S
015301,000054: 22,3030 03303 STORE NCDU # NEW CDU ANGLES
015302,000055: 22,3031 77414 BONCLR EXIT
015303,000056: 22,3032 01215 CALCMAN2
015304,000057: 22,3033 45122 MANUSTAT # TO START MANEUVER
015305,000058: 22,3034 34752 CAF TWO # +0 OTHERWISE
015306,000059: 22,3035 55261 INCRDCDU TS SPNDX
015307,000060: 22,3036 51261 INDEX SPNDX
015308,000061: 22,3037 31675 CA BCDU # INITIAL CDU ANGLES
015309,000062: 22,3040 00006 EXTEND # OR PREVIOUS DESIRED CDU ANGLES
015310,000063: 22,3041 51261 INDEX SPNDX
015311,000064: 22,3042 21702 MSU NCDU
015312,000065: 22,3043 00006 EXTEND
015313,000066: 22,2000 SETLOC KALCMON1
015314,000067: 22,2000 BANK
015315,000068:
015316,000069: 22,3044 73121 MP DT/TAU
015317,000070: 22,3045 10000 CCS A # CONVERT TO 2S COMPLEMENT
015318,000071: 22,3046 64753 AD ONE
015319,000072: 22,3047 13051 TCF +2
015320,000073: 22,3050 40000 COM
015321,000074: 22,3051 51261 INDEX SPNDX
015322,000075: 22,3052 55637 TS DELDCDU # ANGLE INCREMENTS TO BE ADDED TO
015323,000076: 22,3053 51261 INDEX SPNDX # CDUXD, CDUYD, CDUZD EVERY TENTH SECOND
![]() |
Page 368 |
015325,000078: 22,3054 31702 CA NCDU # BY LEM DAP
015326,000079: 22,3055 51261 INDEX SPNDX
015327,000080: 22,3056 57675 XCH BCDU
015328,000081: 22,3057 51261 INDEX SPNDX
015329,000082: 22,3060 55634 TS CDUXD
015330,000083: 22,3061 11261 CCS SPNDX
015331,000084: 22,3062 13035 TCF INCRDCDU # LOOP FOR THREE AXES
015332,000085:
015333,000086: 22,3063 00003 RELINT
015334,000087:
015335,000088: # COMPARE PRESENT TIME WITH TIME TO TERMINATE MANEUVER
015336,000089:
015337,000090: 22,3064 03075 TMANUCHK TC TIMECHK
015338,000091: 22,3065 13170 TCF CONTMANU
015339,000092: 22,3066 34753 CAF ONE
015340,000093: 22,3067 00004 MANUSTAL INHINT # END MAJOR PART OF MANEUVER WITHIN 1 SEC
015341,000094: 22,3070 05203 TC WAITLIST # UNDER WAITLIST CALL TO MANUSTOP
015342,000095: 22,3071 E6,1706 EBANK= TTEMP
015343,000096: 22,3071 03213 44066 2CADR MANUSTOP
015344,000097:
015345,000098: 22,3073 00003 RELINT
015346,000099: 22,3074 15155 TCF ENDOFJOB
015347,000100:
015348,000101: 22,3075 00006 TIMECHK EXTEND
015349,000102: 22,3076 40025 DCS TIME2
015350,000103: 22,3077 53707 DXCH TTEMP
015351,000104: 22,3100 00006 EXTEND
015352,000105: 22,3101 31733 DCA TM
015353,000106: 22,3102 21707 DAS TTEMP
015354,000107: 22,3103 11706 CCS TTEMP
015355,000108: 22,3104 00002 TC Q
015356,000109: 22,3105 13107 TCF +2
015357,000110: 22,3106 13117 TCF 2NDRETRN
015358,000111: 22,3107 11707 CCS TTEMP +1
015359,000112: 22,3110 00002 TC Q
015360,000113: 22,3111 13113 TCF MANUOFF
015361,000114: 22,3112 40000 COM
015362,000115: 22,3113 63166 MANUOFF AD ONESEK +1
015363,000116: 22,3114 00006 EXTEND
015364,000117: 22,3115 63117 BZMF 2NDRETRN
015365,000118: 22,3116 24002 INCR Q
015366,000119: 22,3117 24002 2NDRETRN INCR Q
015367,000120: 22,3120 00002 TC Q
015368,000121:
015369,000122: 22,3121 03146 DT/TAU DEC .1
015370,000123:
015371,000124: 22,3122 77776 MANUSTAT EXIT # INITIALIZATION ROUTINE
015372,000125: 22,3123 00006 EXTEND # FOR AUTOMATIC MANEUVERS
015373,000126: 22,3124 30025 DCA TIME2
![]() |
Page 369 |
015375,000128: 22,3125 21733 DAS TM # TM+T0 MANEUVER COMPLETION TIME
015376,000129: 22,3126 00006 EXTEND
015377,000130: 22,3127 43166 DCS ONESEK
015378,000131: 22,3130 21733 DAS TM # (TM+T0)-1
015379,000132: 22,3131 00004 INHINT
015380,000133: 22,3132 34752 CAF TWO
015381,000134: 22,3133 55700 RATEBIAS TS KSPNDX
015382,000135: 22,3134 60000 DOUBLE
015383,000136: 22,3135 55701 TS KDPNDX
015384,000137: 22,3136 50000 INDEX A
015385,000138: 22,3137 31724 CA BRATE
015386,000139: 22,3140 51700 INDEX KSPNDX # STORE MANEUVER RATE IN
015387,000140: 22,3141 55642 TS OMEGAPD # OMEGAPD, OMEGAQD, OMEGARD
015388,000141: 22,3142 00006 EXTEND
015389,000142: 22,3143 63145 BZMF +2 # COMPUTE ATTITUDE ERROR
015390,000143: 22,3144 40000 COM # OFFSET = (WX)ABS(WX)/2AJX
015391,000144: 22,3145 00006 EXTEND # WHERE AJX= 2-JET ACCELERATION
015392,000145: 22,3146 73167 MP BIASCALE # = -1/16
015393,000146: 22,3147 00006 EXTEND
015394,000147: 22,3150 51701 INDEX KDPNDX
015395,000148: 22,3151 71724 MP BRATE
015396,000149: 22,3152 00006 EXTEND
015397,000150: 22,3153 51700 INDEX KSPNDX
015398,000151: 22,3154 11530 DV 1JACC # = AJX $ 90 DEG/SEC-SEC
015399,000152: 22,3155 51700 INDEX KSPNDX
015400,000153: 22,3156 55274 TS DELPEROR # $ 180 DEG
015401,000154: 22,3157 11700 CCS KSPNDX
015402,000155: 22,3160 13133 TCF RATEBIAS
015403,000156:
015404,000157: 22,3161 30025 CA TIME1
015405,000158: 22,3162 63166 AD ONESEK +1
015406,000159: 22,3163 57705 XCH NEXTIME
015407,000160: 22,3164 13034 TCF INCRDCDU -1
015408,000161:
015409,000162: 22,3165 00000 ONESEK DEC 0 B-14
015410,000163: 22,3166 00144 DEC 100 B-14
015411,000164:
015412,000165: 22,3167 75777 BIASCALE OCT 75777 # = -1/16
015413,000166:
015414,000167: 22,3170 40025 CONTMANU CS TIME1 # RESET FOR NEXT DCDU UPDATE
015415,000168: 22,3171 61705 AD NEXTIME
015416,000169: 22,3172 10000 CCS A
015417,000170: 22,3173 64753 AD ONE
015418,000171: 22,3174 13177 TCF MANUCALL
015419,000172: 22,3175 64735 AD NEGMAX
015420,000173: 22,3176 40000 COM
015421,000174: 22,3177 00004 MANUCALL INHINT # CALL FOR NEXT UPDATE VIA WAITLIST
015422,000175: 22,3200 05203 TC WAITLIST
015423,000176: 22,3201 E6,1706 EBANK= TTEMP
015424,000177: 22,3201 03206 44066 2CADR UPDTCALL
![]() |
Page 370 |
015426,000179: 22,3203 33166 CAF ONESEK +1 # INCREMENT TIME FOR NEXT UPDATE
015427,000180: 22,3204 27705 ADS NEXTIME
015428,000181: 22,3205 15155 TCF ENDOFJOB
015429,000182:
015430,000183: 22,3206 37717 UPDTCALL CAF PRIO26 # SATELLITE PROGRAM TO CALL FOR UPDATE
015431,000184: 22,3207 05105 TC FINDVAC # OF STEERING COMMANDS
015432,000185: 22,3210 E6,1706 EBANK= TTEMP
015433,000186: 22,3210 03003 44066 2CADR NEWDELHI
015434,000187:
015435,000188: 22,3212 05261 TC TASKOVER
015436,000189:
![]() |
Page 371 |
015438,000191: # ROUTINE FOR TERMINATING AUTOMATIC MANEUVERS
015439,000192:
015440,000193: 22,3213 34755 MANUSTOP CAF ZERO # ZERO MANEUVER RATES
015441,000194: 22,3214 55641 TS DELDCDU2
015442,000195: 22,3215 55644 TS OMEGARD
015443,000196: 22,3216 55276 TS DELREROR
015444,000197: 22,3217 55640 TS DELDCDU1
015445,000198: 22,3220 55643 TS OMEGAQD
015446,000199: 22,3221 55275 TS DELQEROR
015447,000200: 22,3222 30323 CA CPSI # SET DESIRED GIMBAL ANGLES TO
015448,000201: 22,3223 55636 TS CDUZD # DESIRED FINAL GIMBAL ANGLES
015449,000202: 22,3224 30322 CA CTHETA
015450,000203: 22,3225 55635 TS CDUYD
015451,000204: 22,3226 30321 ENDROLL CA CPHI # NO FINAL YAW
015452,000205: 22,3227 55634 TS CDUXD
015453,000206: 22,3230 34755 CAF ZERO
015454,000207: 22,3231 55642 TS OMEGAPD # I.E. MANEUVER DID NOT GO THRU
015455,000208: 22,3232 55637 TS DELDCDU # GIMBAL LOCK ORIGINALLY
015456,000209: 22,3233 55274 TS DELPEROR
015457,000210: 22,3234 31306 GOODMANU CA ATTPRIO # RESTORE USERS PRIO
015458,000211: 22,3235 54063 TS NEWPRIO
015459,000212:
015460,000213: 22,3236 34755 CA ZERO # ZERO ATTCADR
015461,000214: 22,3237 53305 DXCH ATTCADR
015462,000215:
015463,000216: 22,3240 05116 TC SPVAC # RETURN TO USER
015464,000217:
015465,000218: 22,3241 05261 TC TASKOVER
015466,000219:
015467,000220:
End of include-file KALCMANU_STEERING.agc. Parent file is MAIN.agc