Source Code

This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the third release of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 96 and 97. A bug (which had been around since at least Apollo 10, Luminary 69) was discovered in Rev 0 shortly before the Apollo 11 flight, resulting in a last minute revision into Rev 1, which is what actually flew rather than the Rev 0 presented here. A hardcopy of Rev 0 is known to exist — it belonged to AGC developer Allan Klumpp for many years — but unfortunately the Virtual AGC Project has not had access to that hardcopy. Thus the code you see here had been reconstructed (we believe accurately) rather than transcribed. The first step of the reconstruction of the Rev 0 source code was the transcription of the Rev 1 source code from a hardcopy in the MIT Museum collection. The process of reverting the active portion of the source code (i.e., other than program comments) from Rev 1 to Rev 0 was very minor, consisting only of moving the position of the STARTSB1 label in FRESH START AND RESTART. Allan had previously given us the checksums of the memory banks of Rev 0, and we have verified the program presented here has checksums identical to all banks of Allan's listing of Rev 0. The notations on Allan's Rev 0 program listing read, in part:

	GAP:  ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-051

A single program comment is known to differ between Rev 0 and Rev 1, but these are harder to reconstruct and verify than changes to the active portion of the code. Thus it is possible that there are additional differences between the program comments in Rev 0 and Rev 1 that are unknown to us, and therefore are not reflected in the code presented here.

028492,000002:                                                                                                  ## Copyright:   Public domain.
028493,000003:                                                                                                  ## Filename:    LAMBERT_AIMPOINT_GUIDANCE.agc
028494,000004:                                                                                                  ## Purpose:     Part of the reconstructed source code for LMY99 Rev 0,
028495,000005:                                                                                                  ##              otherwise known as Luminary Rev 99, the third release
028496,000006:                                                                                                  ##              of the Apollo Guidance Computer (AGC) software for Apollo 11.
028497,000007:                                                                                                  ##              It differs from LMY99 Rev 1 (the flown version) only in the
028498,000008:                                                                                                  ##              placement of a single label. The corrections shown here have
028499,000009:                                                                                                  ##              been verified to have the same bank checksums as AGC developer
028500,000010:                                                                                                  ##              Allan Klumpp's copy of Luminary Rev 99, and so are believed
028501,000011:                                                                                                  ##              to be accurate. This file is intended to be a faithful 
028502,000012:                                                                                                  ##              recreation, except that the code format has been changed to 
028503,000013:                                                                                                  ##              conform to the requirements of the yaYUL assembler rather than 
028504,000014:                                                                                                  ##              the original YUL assembler.
028505,000015:                                                                                                  ##
028506,000016:                                                                                                  ## Assembler:   yaYUL
028507,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
028508,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo.
028509,000019:                                                                                                  ## Pages:       651-653
028510,000020:                                                                                                  ## Mod history: 2009-05-18 RSB  Transcribed from Luminary 099
028511,000021:                                                                                                  ##                              page images.
028512,000022:                                                                                                  ##              2009-06-05 RSB  Corrected 4 typos.
028513,000023:                                                                                                  ##              2009-06-07 RSB  Fixed a typo.
028514,000024:                                                                                                  ##              2016-12-14 RSB  VNP00H -> VNPOOH.
028515,000025:                                                                                                  ##              2016-12-14 RSB  Proofed text comments with octopus/ProoferComments
028516,000026:                                                                                                  ##                              and corrected the errors found.
028517,000027:                                                                                                  ##              2017-08-01 MAS  Created from LMY99 Rev 1.
028518,000028: 
028519,000029:                                                                                                  ## This source code has been transcribed or otherwise adapted from
028520,000030:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
028521,000031:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
028522,000032:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
028523,000033:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
028524,000034:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
028525,000035:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
028526,000036:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
028527,000037:                                                                                                  ## actually created.
028528,000038:                                                                                                  ##
028529,000039:                                                                                                  ## The code has been modified to match LMY99 Revision 0, otherwise
028530,000040:                                                                                                  ## known as Luminary Revision 99, the Apollo 11 software release preceeding
028531,000041:                                                                                                  ## the listing from which it was transcribed. It has been verified to
028532,000042:                                                                                                  ## contain the same bank checksums as AGC developer Allan Klumpp's listing
028533,000043:                                                                                                  ## of Luminary Revision 99 (for which we do not have scans).
028534,000044:                                                                                                  ##
028535,000045:                                                                                                  ## Notations on Allan Klumpp's listing read, in part:
028536,000046:                                                                                                  ##
028537,000047:                                                                                                  ##      ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
028538,000048: 

Page 651

028540,000050: 
028541,000051:                                                                                                  #  GENERAL LAMBERT AIMPOINT GUIDANCE **
028542,000052:                                                                                                  #  WRITTEN BY RAMA M AIYAWAR
028543,000053: 
028544,000054:                                                                                                  #  PROGRAM P-31 DESCRIPTION **
028545,000055: 
028546,000056:                                                                                                  #  1.    TO ACCEPT TARGETING PARAMETERS OBTAINED FROM A SOURCE EXTERNAL
028547,000057:                                                                                                  #        TO THE LEM AND COMPUTE THERE FROM THE REQUIRED-VELOCITY AND
028548,000058:                                                                                                  #        OTHER INITIAL CONDITIONS REQUIRED BY LM FOR DESIRED MANEUVER.
028549,000059:                                                                                                  #        THE TARGETING PARAMETERS ARE TIG (TIME OF IGNITION), TARGET 
028550,000060:                                                                                                  #        VECTOR (RTARG), AND THE TIME FROM TIG UNTIL THE TARGET IS
028551,000061:                                                                                                  #        REACHED (DELLT4), DESIRED TIME OF FLIGHT FROM RINIT TO RTARG..
028552,000062: 
028553,000063:                                                                                                  #  ASSUMPTIONS **
028554,000064: 
028555,000065:                                                                                                  #  1.    THE TARGET PARAMETERS MAY HAVE BEEN LOADED PRIOR TO THE
028556,000066:                                                                                                  #        EXECUTION OF THIS PROGRAM.
028557,000067:                                                                                                  #  2.    THIS PROGRAM IS APPLICABLE IN EITHER EARTH OR LUNAR ORBIT.
028558,000068:                                                                                                  #  3.    THIS PROGRAM IS DESIGNED FOR ONE-MAN OPERATION, AND SHOULD
028559,000069:                                                                                                  #        BE SELECTED BY THE ASTRONAUT BY DSKY ENTRY V37 E31.
028560,000070: 
028561,000071:                                                                                                  #  SUBROUTINES USED **
028562,000072:                                                                                                  #  
028563,000073:                                                                                                  #  MANUPARM, TTG/N35, R02BOTH, MIDGIM, DISPMGA, FLAGDOWN, BANKCALL,
028564,000074:                                                                                                  #  GOTOPOOH, ENDOFJOB, PHASCHNG, GOFLASHR, GOFLASH.
028565,000075: 
028566,000076:                                                                                                  #  MANUPARM      CALCULATES APOGEE, PERIGEE ALTITUDES AND DELTAV DESIRED
028567,000077:                                                                                                  #                FOR THE MANEUVER.
028568,000078: 
028569,000079:                                                                                                  #  TTG/N35       CLOCKTASK - UPDATES CLOCK.
028570,000080: 
028571,000081:                                                                                                  #  MIDGIM        CALCULATES MIDDLE GIMBAL ANGLE FOR DISPLAY.
028572,000082: 
028573,000083:                                                                                                  #  R02BOTH       IMU - STATUS CHECK ROUTINE.
028574,000084: 
028575,000085:                                                                                                  #  DISPLAYS USED IN P-31LM **
028576,000086: 
028577,000087:                                                                                                  #  V06N33        DISPLAY SOTRED TIG (IN HRS. MINS. SECS)
028578,000088:                                                                                                  #  V06N42        DISPLAY APOGEE, PERIGEE, DELTAV.
028579,000089:                                                                                                  #  V16N35        DISPLAY TIME FROM TIG.
028580,000090:                                                                                                  #  V06N45        TIME FROM IGNITION AND MIDDLE GIMBAL ANGLE.
028581,000091: 
028582,000092:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED **
028583,000093: 
028584,000094:                                                                                                  #  TIG           TIME OF IGNITION                DP      (B+28) CS.
028585,000095: 
028586,000096:                                                                                                  #  DELLT4        DESIRED TIME OF FLIGHT          DP      (B+28) CS
028587,000097:                                                                                                  #                FROM RINIT TO RTARG.
028588,000098: 
028589,000099:                                                                                                  #  RTARG         RADIUS VECTOR OF TARGET POSITION VECTOR
028590,000100:                                                                                                  #                RADIUS VECTOR SCALED TO (B+29)METERS IF EARTH ORBIT

Page 652

028592,000102:                                                                                                  #                RADIUS VECTOR SCALED TO (B+27)METERS IF MOON ORBIT
028593,000103: 
028594,000104:                                                                                                  #  OUTPUT **
028595,000105: 
028596,000106:                                                                                                  #  HAPO          APOGEE ALTITUDE
028597,000107:                                                                                                  #  HPER          PERIGEE ALTITUDE
028598,000108:                                                                                                  #  VGDISP        MAG. OF DELTAV FOR DISPLAY, SCALING     B+7 M/CS EARTH
028599,000109:                                                                                                  #                MAG. OF DELTAV FOR DISPLAY, SCALING     B+5 M/CS MOON
028600,000110:                                                                                                  #  MIDGIM        MIDDLE GIMBAL ANGLE
028601,000111:                                                                                                  #  XDELVFLG      RESETS XDELVFLG FOR LAMBERT VG COMPUTATIONS
028602,000112: 
028603,000113:                                                                                                  #  ALARMS OR ABORTS      NONE **
028604,000114: 
028605,000115:                                                                                                  #  RESTARTS ARE VIA GROUP 4 **
028606,000116: 
028607,000117: 35,2000                                           SETLOC   GLM                                   
028608,000118: 35,2000                                           BANK                                           
028609,000119: 
028610,000120: 35,2450  E7,1470                                  EBANK=   SUBEXIT                               
028611,000121: 
028612,000122: 35,2450                                           COUNT*   $$/P31                                
028613,000123: 35,2450           02361        P31                TC       P20FLGON                              
028614,000124: 35,2451           32025                           CAF      V06N33                                #  TIG
028615,000125: 35,2452           03712                           TC       VNPOOH                                
028616,000126: 35,2453           06037                           TC       INTPRET                               
028617,000127: 35,2454           71214                           CLEAR    DLOAD                                 
028618,000128: 35,2455           00670                                    UPDATFLG                              
028619,000129: 35,2456           03442                                    TIG                                   
028620,000130: 35,2457           34041                           STCALL   TDEC1                                 #  INTEGRATE STATE VECTORS TO TIG
028621,000131: 35,2460           27057                                    LEMPREC                               
028622,000132: 35,2461           40375                           VLOAD    SETPD                                 
028623,000133: 35,2462           00001                                    RATT                                  
028624,000134: 35,2463           00001                                    0D                                    
028625,000135: 35,2464           03642                           STORE    RTIG                                  
028626,000136: 35,2465           26323                           STOVL    RINIT                                 
028627,000137: 35,2466           00007                                    VATT                                  
028628,000138: 35,2467           03650                           STORE    VTIG                                  
028629,000139: 35,2470           16331                           STODL    VINIT                                 
028630,000140: 35,2471           32420                                    P30ZERO                               
028631,000141: 35,2472           65206                           PUSH     PDDL                                  #  E4 AND NUMIT = 0
028632,000142: 35,2473           03452                                    DELLT4                                
028633,000143: 35,2474           66015                           DAD      SXA,1                                 
028634,000144: 35,2475           03442                                    TIG                                   
028635,000145: 35,2476           02776                                    RTX1                                  
028636,000146: 35,2477           03631                           STORE    TPASS4                                
028637,000147: 35,2500           45134                           SXA,2    CALL                                  
028638,000148: 35,2501           02777                                    RTX2                                  
028639,000149: 35,2502           22000                                    INITVEL                               
028640,000150: 35,2503           41575                           VLOAD    PUSH                                  

Page 653

028642,000152: 35,2504           02366                                    DELVEET3                              
028643,000153: 35,2505           03656                           STORE    DELVSIN                               
028644,000154: 35,2506           43046                           ABVAL    CLEAR                                 
028645,000155: 35,2507           01267                                    XDELVFLG                              
028646,000156: 35,2510           37664                           STCALL   VGDISP                                
028647,000157: 35,2511           15733                                    GET.LVC                               
028648,000158: 35,2512           63375                           VLOAD    PDVL                                  
028649,000159: 35,2513           03642                                    RTIG                                  
028650,000160: 35,2514           02337                                    VIPRIME                               
028651,000161: 35,2515           77624                           CALL                                           
028652,000162: 35,2516           46316                                    PERIAPO1                              
028653,000163: 35,2517           77624                           CALL                                           
028654,000164: 35,2520           46426                                    SHIFTR1                               
028655,000165: 35,2521           77624                           CALL                                           #  LIMIT DISPLAY TO 9999.9 N. MI.
028656,000166: 35,2522           45636                                    MAXCHK                                
028657,000167: 35,2523           16321                           STODL    HPER                                  
028658,000168: 35,2524           00005                                    4D                                    
028659,000169: 35,2525           77624                           CALL                                           
028660,000170: 35,2526           46426                                    SHIFTR1                               
028661,000171: 35,2527           77624                           CALL                                           #  LIMIT DISPLAY TO 9999.9 N. MI.
028662,000172: 35,2530           45636                                    MAXCHK                                
028663,000173: 35,2531           02317                           STORE    HAPO                                  
028664,000174: 35,2532           77776                           EXIT                                           
028665,000175: 35,2533           33727                           CAF      V06N81                                #  DELVLVC
028666,000176: 35,2534           03712                           TC       VNPOOH                                
028667,000177: 35,2535           32026                           CAF      V06N42                                #  HAPO, HPER, VGDISP
028668,000178: 35,2536           03712                           TC       VNPOOH                                
028669,000179: 35,2537           06037                           TC       INTPRET                               
028670,000180: 35,2540           45014        REVN1645           SET      CALL                                  #  TRKMKCNT, TTOGO, +MGA
028671,000181: 35,2541           01071                                    FINALFLG                              
028672,000182: 35,2542           73606                                    VN1645                                
028673,000183: 35,2543           77650                           GOTO                                           
028674,000184: 35,2544           72540                                    REVN1645                              
028675,000185: 

End of include-file LAMBERT_AIMPOINT_GUIDANCE.agc.  Parent file is MAIN.agc