Source Code

This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the second release of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 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.

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

Page 654

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

Page 655

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

Page 656

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

Page 657

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

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