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.

028678,000002:                                                                                                  ## Copyright:   Public domain.
028679,000003:                                                                                                  ## Filename:    GROUND_TRACKING_DETERMINATION_PROGRAM_-_P21.agc
028680,000004:                                                                                                  ## Purpose:     Part of the reconstructed source code for LMY99 Rev 0,
028681,000005:                                                                                                  ##              otherwise known as Luminary Rev 99, the third release
028682,000006:                                                                                                  ##              of the Apollo Guidance Computer (AGC) software for Apollo 11.
028683,000007:                                                                                                  ##              It differs from LMY99 Rev 1 (the flown version) only in the
028684,000008:                                                                                                  ##              placement of a single label. The corrections shown here have
028685,000009:                                                                                                  ##              been verified to have the same bank checksums as AGC developer
028686,000010:                                                                                                  ##              Allan Klumpp's copy of Luminary Rev 99, and so are believed
028687,000011:                                                                                                  ##              to be accurate. This file is intended to be a faithful 
028688,000012:                                                                                                  ##              recreation, except that the code format has been changed to 
028689,000013:                                                                                                  ##              conform to the requirements of the yaYUL assembler rather than 
028690,000014:                                                                                                  ##              the original YUL assembler.
028691,000015:                                                                                                  ##
028692,000016:                                                                                                  ## Assembler:   yaYUL
028693,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
028694,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo.
028695,000019:                                                                                                  ## Pages:       654-657
028696,000020:                                                                                                  ## Mod history: 2009-05-18 RSB  Adapted from the corresponding 
028697,000021:                                                                                                  ##                              Luminary131 file, using page 
028698,000022:                                                                                                  ##                              images from Luminary 1A.
028699,000023:                                                                                                  ##              2016-12-13 RSB  GOTOP00H -> GOTOPOOH
028700,000024:                                                                                                  ##              2016-12-14 RSB  Proofed text comments with octopus/ProoferComments
028701,000025:                                                                                                  ##                              but no errors found.
028702,000026:                                                                                                  ##              2017-03-15 RSB  Comment-text fixes identified in 5-way
028703,000027:                                                                                                  ##                              side-by-side diff of Luminary 69/99/116/131/210.
028704,000028:                                                                                                  ##              2017-08-01 MAS  Created from LMY99 Rev 1.
028705,000029: 
028706,000030:                                                                                                  ## This source code has been transcribed or otherwise adapted from
028707,000031:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
028708,000032:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
028709,000033:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
028710,000034:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
028711,000035:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
028712,000036:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
028713,000037:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
028714,000038:                                                                                                  ## actually created.
028715,000039:                                                                                                  ##
028716,000040:                                                                                                  ## The code has been modified to match LMY99 Revision 0, otherwise
028717,000041:                                                                                                  ## known as Luminary Revision 99, the Apollo 11 software release preceeding
028718,000042:                                                                                                  ## the listing from which it was transcribed. It has been verified to
028719,000043:                                                                                                  ## contain the same bank checksums as AGC developer Allan Klumpp's listing
028720,000044:                                                                                                  ## of Luminary Revision 99 (for which we do not have scans).
028721,000045:                                                                                                  ##
028722,000046:                                                                                                  ## Notations on Allan Klumpp's listing read, in part:
028723,000047:                                                                                                  ##
028724,000048:                                                                                                  ##      ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
028725,000049: 

Page 654

028727,000051:                                                                                                  #  GROUND TRACKING DETERMINATION PROGRAM P21
028728,000052:                                                                                                  #  PROGRAM DESCRIPTION
028729,000053:                                                                                                  #        MOD NO - 1
028730,000054:                                                                                                  #        MOD BY - N. M. NEVILLE
028731,000055: 
028732,000056:                                                                                                  #  FUNCTIONAL DECRIPTION -
028733,000057:                                                                                                  #        TO PROVIDE THE ASTRONAUT DETAILS OF THE LM OR CSM GROUND TRACK WITHOUT
028734,000058:                                                                                                  #        THE NEED FOR GROUND COMMUNICATION (REQUESTED BY DSKY).
028735,000059: 
028736,000060:                                                                                                  #  CALLING SEQUENCE -
028737,000061:                                                                                                  #        ASTRONAUT REQUEST THROUGH DSKY V37E21E
028738,000062: 
028739,000063:                                                                                                  #  SUBROUTINES CALLED -
028740,000064:                                                                                                  #        GOPERF4
028741,000065:                                                                                                  #        GOFLASH
028742,000066:                                                                                                  #        THISPREC
028743,000067:                                                                                                  #        OTHPREC
028744,000068:                                                                                                  #        LAT-LONG
028745,000069: 
028746,000070:                                                                                                  #  NORMAL EXIT MODES -
028747,000071:                                                                                                  #        ASTRONAUT REQUEST TROUGH DSKY TO TERMINATE PROGRAM V34E
028748,000072: 
028749,000073:                                                                                                  #  ALARM OR ABORT EXIT MODES -
028750,000074:                                                                                                  #        NONE
028751,000075: 
028752,000076:                                                                                                  #  OUTPUT -
028753,000077:                                                                                                  #        OCTAL DISPLAY OF OPTION CODE AND VEHICLE WHOSE GROUND TRACK IS TO BE
028754,000078:                                                                                                  #        COMPUTED
028755,000079:                                                                                                  #                OPTION CODE     00002
028756,000080:                                                                                                  #                THIS            00001
028757,000081:                                                                                                  #                OTHER           00002
028758,000082:                                                                                                  #        DECIMAL DISPLAY OF TIME TO BE INTEGRATED TO HOURS, MINUTES, SECONDS
028759,000083:                                                                                                  #        DECIMAL DISPLAY OF LAT,LONG,ALT
028760,000084: 
028761,000085:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
028762,000086:                                                                                                  #        AX0             2DEC    4.652459653 E-5 RADIANS         %68-69 CONSTANTS"
028763,000087:                                                                                                  #        -AY0            2DEC    2.147535898 E-5 RADIANS
028764,000088:                                                                                                  #        AZ0             2DEC    .7753206164     REVOLUTIONS
028765,000089:                                                                                                  #        FOR LUNAR ORBITS 504LM VECTOR IS NEEDED
028766,000090:                                                                                                  #        504LM           2DEC    -2.700340600 E-5 RADIANS
028767,000091:                                                                                                  #        504LM _2        2DEC    -7.514128400 E-4 RADIANS
028768,000092:                                                                                                  #        504LM _4        2DEC    _2.553198641 E-4 RADIANS
028769,000093: 
028770,000094:                                                                                                  #        NONE
028771,000095: 
028772,000096:                                                                                                  #  DEBRIS

Page 655

028774,000098:                                                                                                  #        CENTRALS - A,Q,L
028775,000099:                                                                                                  #        OTHER - THOSE USED BY THE ABOVE LISTED SUBROUTINES
028776,000100:                                                                                                  #        SEE LEMPREC, LAT-LONG
028777,000101: 
028778,000102: 35,2545  30,2000                                  SBANK=   LOWSUPER                              #  FOR LOW 2CADR'S.
028779,000103: 
028780,000104: 33,2200                                           BANK     33                                    
028781,000105: 24,2000                                           SETLOC   P20S                                  
028782,000106: 24,2000                                           BANK                                           
028783,000107: 
028784,000108: 24,3505  E7,1762                                  EBANK=   P21TIME                               
028785,000109: 24,3505                                           COUNT*   $$/P21                                
028786,000110: 24,3505           34753        PROG21             CAF      ONE                                   
028787,000111: 24,3506           55145                           TS       OPTION2                               #  ASSUMED VEHICLE IS LM, R2 = 00001
028788,000112: 24,3507           34752                           CAF      BIT2                                  #  OPTION 2
028789,000113: 24,3510           04616                           TC       BANKCALL                              
028790,000114: 24,3511           20633                           CADR     GOPERF4                               
028791,000115: 24,3512           06001                           TC       GOTOPOOH                              #  TERMINATE
028792,000116: 24,3513           03515                           TC       +2                                    #  PROCEED VALUE OF ASSUMED VEHICLE OK
028793,000117: 24,3514           03507                           TC       -5                                    #  R2 LOADED THROUGH DSKY
028794,000118: 24,3515           33665        P21PROG1           CAF      V6N34                                 #  LOAD DESIRED TIME OF LAT-LONG.
028795,000119: 24,3516           04616                           TC       BANKCALL                              
028796,000120: 24,3517           20476                           CADR     GOFLASH                               
028797,000121: 24,3520           06001                           TC       GOTOPOOH                              #  TERM
028798,000122: 24,3521           03523                           TC       +2                                    #  PROCEED VALUES OK
028799,000123: 24,3522           03515                           TC       -5                                    #  TIME LOADED THROUGH DSKY
028800,000124: 24,3523           06037                           TC       INTPRET                               
028801,000125: 24,3524           77745                           DLOAD                                          
028802,000126: 24,3525           01046                                    DSPTEM1                               
028803,000127: 24,3526           34041                           STCALL   TDEC1                                 #  INTEGRATE TO TIME SPECIFIED IN TDEC
028804,000128: 24,3527           27414                                    INTSTALL                              
028805,000129: 24,3530           43014                           BON      CLEAR                                 
028806,000130: 24,3531           00304                                    P21FLAG                               
028807,000131: 24,3532           51550                                    P21CONT                               #  ON --- RECYCLE USING BASE VECTOR
028808,000132: 24,3533           01674                                    VINTFLAG                              #  OFF -- 1ST PASS CALL BASE VECTOR
028809,000133: 24,3534           70535                           SLOAD    SR1                                   
028810,000134: 24,3535           01146                                    OPTION2                               
028811,000135: 24,3536           43030                           BHIZ     SET                                   
028812,000136: 24,3537           51541                                    +2                                    #  ZERO -- THIS VEHICLE (LM)
028813,000137: 24,3540           01474                                    VINTFLAG                              #  ONE -- OTHER VEHICLE (CM)
028814,000138: 24,3541           43014                           CLEAR    CLEAR                                 
028815,000139: 24,3542           01676                                    DIM0FLAG                              
028816,000140: 24,3543           01673                                    INTYPFLG                              #  PRECISION
028817,000141: 24,3544           77624                           CALL                                           
028818,000142: 24,3545           27134                                    INTEGRV                               #  CALCULATE
028819,000143: 24,3546           77650                           GOTO                                           #  -AND
028820,000144: 24,3547           51571                                    P21VSAVE                              #  -SAVE BASE VECTOR
028821,000145: 24,3550           77775        P21CONT            VLOAD                                          
028822,000146: 24,3551           03676                                    P21BASER                              #  RECYCLE -- INTEG FROM BASE VECTOR
028823,000147: 24,3552           25535                           STOVL    RCV                                   #  --POS

Page 656

028825,000149: 24,3553           03704                                    P21BASEV                              
028826,000150: 24,3554           15543                           STODL    VCV                                   #  --VEL
028827,000151: 24,3555           03763                                    P21TIME                               
028828,000152: 24,3556           01517                           STORE    TET                                   #  --TIME
028829,000153: 24,3557           43014                           CLEAR    CLEAR                                 
028830,000154: 24,3560           01676                                    DIM0FLAG                              
028831,000155: 24,3561           00263                                    MOONFLAG                              
028832,000156: 24,3562           53135                           SLOAD    BZE                                   
028833,000157: 24,3563           01164                                    P21ORIG                               
028834,000158: 24,3564           51567                                    +3                                    #  ZERO = EARTH
028835,000159: 24,3565           77614                           SET                                            #  ---2 = MOON
028836,000160: 24,3566           00063                                    MOONFLAG                              
028837,000161: 24,3567           77624                 +3        CALL                                           
028838,000162: 24,3570           27107                                    INTEGRVS                              
028839,000163: 24,3571           77745        P21VSAVE           DLOAD                                          #  SAVE CURRENT BASE VECTOR
028840,000164: 24,3572           00015                                    TAT                                   
028841,000165: 24,3573           27763                           STOVL    P21TIME                               #  --TIME
028842,000166: 24,3574           00017                                    RATT1                                 
028843,000167: 24,3575           27676                           STOVL    P21BASER                              #  --POS B-29 OR B-27
028844,000168: 24,3576           00025                                    VATT1                                 
028845,000169: 24,3577           03704                           STORE    P21BASEV                              #  --VEL B-07 OR B-05
028846,000170: 24,3600           53646                           ABVAL    SL*                                   
028847,000171: 24,3601           57576                                    0,2                                   
028848,000172: 24,3602           27712                           STOVL    P21VEL                                #  VEL/ FOR N91 DISP
028849,000173: 24,3603           00001                                    RATT                                  
028850,000174: 24,3604           50256                           UNIT     DOT                                   
028851,000175: 24,3605           00007                                    VATT                                  #  U(R).V
028852,000176: 24,3606           67471                           DDV      ASIN                                  #  U(R).U(V)
028853,000177: 24,3607           03712                                    P21VEL                                
028854,000178: 24,3610           03714                           STORE    P21GAM                                #  SIN-1 U(R).U(V) , -90 TO &90
028855,000179: 24,3611           67334                           SXA,2    SLOAD                                 
028856,000180: 24,3612           01163                                    P21ORIG                               #  0 = EARTH
028857,000181: 24,3613           01146                                    OPTION2                               
028858,000182: 24,3614           46142                           SR1      BHIZ                                  
028859,000183: 24,3615           51620                                    +3                                    
028860,000184: 24,3616           77650                           GOTO                                           
028861,000185: 24,3617           51623                                    +4                                    
028862,000186: 24,3620           77614                 +3        BON                                            
028863,000187: 24,3621           04307                                    SURFFLAG                              
028864,000188: 24,3622           51625                                    P21DSP                                
028865,000189: 24,3623           77614                 +4        SET                                            
028866,000190: 24,3624           00064                                    P21FLAG                               
028867,000191: 24,3625           67214        P21DSP             CLEAR    SLOAD                                 #  GENERATE DISPLAY DATA
028868,000192: 24,3626           01663                                    LUNAFLAG                              
028869,000193: 24,3627           00050                                    X2                                    
028870,000194: 24,3630           43054                           BZE      SET                                   
028871,000195: 24,3631           51633                                    +2                                    #  0 = EARTH
028872,000196: 24,3632           01463                                    LUNAFLAG                              
028873,000197: 24,3633           77775                           VLOAD                                          
028874,000198: 24,3634           00001                                    RATT                                  

Page 657

028876,000200: 24,3635           16032                           STODL    ALPHAV                                
028877,000201: 24,3636           00015                                    TAT                                   
028878,000202: 24,3637           45014                           CLEAR    CALL                                  
028879,000203: 24,3640           00662                                    ERADFLAG                              
028880,000204: 24,3641           26351                                    LAT-LONG                              
028881,000205: 24,3642           77605                           DMP                                            #  MPAC = ALT, METERS B-29
028882,000206: 24,3643           11667                                    K.01                                  
028883,000207: 24,3644           03716                           STORE    P21ALT                                #  ALT/100 FOR N91 DISP
028884,000208: 24,3645           77776                           EXIT                                           
028885,000209: 24,3646           33664                           CAF      V06N43                                #  DISPLAY LAT, LONG, ALT
028886,000210: 24,3647           04616                           TC       BANKCALL                              #  LAT, LONG = 1/2 REVS B0
028887,000211: 24,3650           20476                           CADR     GOFLASH                               #  ALT = KM B14
028888,000212: 24,3651           06001                           TC       GOTOPOOH                              #  TERM
028889,000213: 24,3652           06001                           TC       GOTOPOOH                              
028890,000214: 24,3653           06037                           TC       INTPRET                               #  V32E RECYCLE
028891,000215: 24,3654           43345                           DLOAD    DAD                                   
028892,000216: 24,3655           03763                                    P21TIME                               
028893,000217: 24,3656           11663                                    600SEC                                #  600 SECONDS OR 10 MIN
028894,000218: 24,3657           01046                           STORE    DSPTEM1                               
028895,000219: 24,3660           77634                           RTB                                            
028896,000220: 24,3661           51515                                    P21PROG1                              
028897,000221: 24,3662           00003 25140  600SEC             2DEC     60000      B-28                       #  10 MIN
028898,000222: 
028899,000223: 24,3664           01453        V06N43             VN       00643                                 
028900,000224: 24,3665           01442        V6N34              VN       00634                                 
028901,000225: 24,3666           00243 32703  K.01               2DEC     .01                                   
028902,000226: 

End of include-file GROUND_TRACKING_DETERMINATION_PROGRAM_-_P21.agc.  Parent file is MAIN.agc