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, 1969
Note 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.

027871,000002:                                                                                                  ## Copyright:   Public domain.
027872,000003:                                                                                                  ## Filename:    GROUND_TRACKING_DETERMINATION_PROGRAM.agc
027873,000004:                                                                                                  ## Purpose:     A section of Luminary 1C, revision 131.
027874,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
027875,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13.
027876,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
027877,000008:                                                                                                  ##              that the code format has been changed to conform to the
027878,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the 
027879,000010:                                                                                                  ##              original YUL assembler.
027880,000011:                                                                                                  ## Reference:   pp. 656-659
027881,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
027882,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
027883,000014:                                                                                                  ## Mod history: 05/21/03 RSB.   Began transcribing. 
027884,000015:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
027885,000016:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
027886,000017:                                                                                                  ##                              original harcopy, as opposed to the PDF page
027887,000018:                                                                                                  ##                              numbers in 1701.pdf.
027888,000019:                                                                                                  ##              2017-02-24 RSB  Proofed comment text using octopus/ProoferComments.
027889,000020:                                                                                                  ##              2017-03-01 RSB  Fixed a couple comment-text errors found while
027890,000021:                                                                                                  ##                              diff'ing vs Luminary 116.
027891,000022: 

Page 656

027893,000024:                                                                                                  #  GROUND TRACKING DETERMINATION PROGRAM P21
027894,000025: 
027895,000026:                                                                                                  #  PROGRAM DESCRIPTION
027896,000027:                                                                                                  #        MOD NO - 1
027897,000028:                                                                                                  #        MOD BY - N. M. NEVILLE
027898,000029: 
027899,000030:                                                                                                  #  FUNCTIONAL DECRIPTION -
027900,000031:                                                                                                  #        TO PROVIDE THE ASTRONAUT DETAILS OF THE LM OR CSM GROUND TRACK WITHOUT
027901,000032:                                                                                                  #        THE NEED FOR GROUND COMMUNICATION (REQUESTED BY DSKY).
027902,000033: 
027903,000034:                                                                                                  #  CALLING SEQUENCE -
027904,000035:                                                                                                  #        ASTRONAUT REQUEST THROUGH DSKY V37E21E
027905,000036: 
027906,000037:                                                                                                  #  SUBROUTINES CALLED -
027907,000038:                                                                                                  #        GOPERF4
027908,000039:                                                                                                  #        GOFLASH
027909,000040:                                                                                                  #        THISPREC
027910,000041:                                                                                                  #        OTHPREC
027911,000042:                                                                                                  #        LAT-LONG
027912,000043: 
027913,000044:                                                                                                  #  NORMAL EXIT MODES -
027914,000045:                                                                                                  #        ASTRONAUT REQUEST TROUGH DSKY TO TERMINATE PROGRAM V34E
027915,000046: 
027916,000047:                                                                                                  #  ALARM OR ABORT EXIT MODES -
027917,000048:                                                                                                  #        NONE
027918,000049: 
027919,000050:                                                                                                  #  OUTPUT -
027920,000051:                                                                                                  #        OCTAL DISPLAY OF OPTION CODE AND VEHICLE WHOSE GROUND TRACK IS TO BE
027921,000052:                                                                                                  #        COMPUTED
027922,000053:                                                                                                  #                OPTION CODE     00002
027923,000054:                                                                                                  #                THIS            00001
027924,000055:                                                                                                  #                OTHER           00002
027925,000056:                                                                                                  #        DECIMAL DISPLAY OF TIME TO BE INTEGRATED TO HOURS, MINUTES, SECONDS
027926,000057:                                                                                                  #        DECIMAL DISPLAY OF LAT,LONG,ALT
027927,000058: 
027928,000059:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
027929,000060:                                                                                                  #        AX0     2DEC    4.652459653 E-5 RADIANS         %68-69 CONSTANTS"
027930,000061:                                                                                                  #        -AY0    2DEC    2.147535898 E-5 RADIANS
027931,000062:                                                                                                  #        AZ0     2DEC    .7753206164     REVOLUTIONS
027932,000063:                                                                                                  #  FOR LUNAR ORBITS 504LM VECTOR IS NEEDED
027933,000064:                                                                                                  #        504LM           2DEC    -2.700340600 E-5 RADIANS
027934,000065:                                                                                                  #        504LM _2        2DEC    -7.514128400 E-4 RADIANS
027935,000066:                                                                                                  #        504LM _4        2DEC    _2.553198641 E-4 RADIANS
027936,000067: 
027937,000068:                                                                                                  #  NONE
027938,000069:                                                                                                  #  DEBRIS

Page 657

027940,000071:                                                                                                  #        CENTRALS - A,Q,L
027941,000072:                                                                                                  #        OTHER - THOSE USED BY THE ABOVE LISTED SUBROUTINES
027942,000073:                                                                                                  #        SEE LEMPREC, LAT-LONG
027943,000074: 
027944,000075: 35,2455  30,2000                                  SBANK=   LOWSUPER                              #  FOR LOW 2CADR'S.
027945,000076: 
027946,000077: 33,2200                                           BANK     33                                    
027947,000078: 24,2000                                           SETLOC   P20S                                  
027948,000079: 24,2000                                           BANK                                           
027949,000080: 
027950,000081: 24,3506  E7,1762                                  EBANK=   P21TIME                               
027951,000082: 24,3506                                           COUNT*   $$/P21                                
027952,000083: 24,3506           34753        PROG21             CAF      ONE                                   
027953,000084: 24,3507           55144                           TS       OPTION2                               #  ASSUMED VEHICLE IS LM, R2 = 00001
027954,000085: 24,3510           34752                           CAF      BIT2                                  #  OPTION 2
027955,000086: 24,3511           04616                           TC       BANKCALL                              
027956,000087: 24,3512           20634                           CADR     GOPERF4                               
027957,000088: 24,3513           06001                           TC       GOTOPOOH                              #  TERMINATE
027958,000089: 24,3514           03516                           TC       +2                                    #  PROCEED VALUE OF ASSUMED VEHICLE OK
027959,000090: 24,3515           03510                           TC       -5                                    #  R2 LOADED THROUGH DSKY
027960,000091: 24,3516           34755                           CAF      ZERO                                  #  INITIAL TIME = PRESENT TIME
027961,000092: 24,3517           55044                           TS       DSPTEM1                               
027962,000093: 24,3520           55045                           TS       DSPTEM1    +1                         
027963,000094: 24,3521           33675        P21PROG1           CAF      V6N34                                 #  LOAD DESIRED TIME OF LAT-LONG.
027964,000095: 24,3522           04616                           TC       BANKCALL                              
027965,000096: 24,3523           20477                           CADR     GOFLASH                               
027966,000097: 24,3524           06001                           TC       GOTOPOOH                              #  TERM
027967,000098: 24,3525           03527                           TC       +2                                    #  PROCEED VALUES OK
027968,000099: 24,3526           03521                           TC       -5                                    #  TIME LOADED THROUGH DSKY
027969,000100: 24,3527           06042                           TC       INTPRET                               
027970,000101: 24,3530           53145                           DLOAD    BZE                                   
027971,000102: 24,3531           01045                                    DSPTEM1                               
027972,000103: 24,3532           51667                                    P21PRTM                               
027973,000104: 24,3533           34041        P21PROG2           STCALL   TDEC1                                 #  INTEG TO TIME SPECIFIED IN TDEC1
027974,000105: 24,3534           27410                                    INTSTALL                              
027975,000106: 24,3535           43014                           BON      CLEAR                                 
027976,000107: 24,3536           00304                                    P21FLAG                               
027977,000108: 24,3537           51555                                    P21CONT                               #  ON---RECYCLE USING BASE VECTOR
027978,000109: 24,3540           01674                                    VINTFLAG                              #  OFF--1ST PASS CALL BASE VECTOR
027979,000110: 24,3541           70535                           SLOAD    SR1                                   
027980,000111: 24,3542           01145                                    OPTION2                               
027981,000112: 24,3543           43030                           BHIZ     SET                                   
027982,000113: 24,3544           51546                                    +2                                    #  ZERO--THIS VEHICLE (LM)
027983,000114: 24,3545           01474                                    VINTFLAG                              #  ONE--OTHER VEHICLE (CM)
027984,000115: 24,3546           43014                           CLEAR    CLEAR                                 
027985,000116: 24,3547           01676                                    DIM0FLAG                              
027986,000117: 24,3550           01673                                    INTYPFLG                              #  PRECISION
027987,000118: 24,3551           77624                           CALL                                           
027988,000119: 24,3552           27133                                    INTEGRV                               #  CALCULATE
027989,000120: 24,3553           77650                           GOTO                                           #  -AND

Page 658

027991,000122: 24,3554           51576                                    P21VSAVE                              #  -SAVE BASE VECTOR
027992,000123: 24,3555           77775        P21CONT            VLOAD                                          
027993,000124: 24,3556           03676                                    P21BASER                              #  RECYCLE--INTEG FROM BASE VECTOR
027994,000125: 24,3557           25535                           STOVL    RCV                                   #  --POS
027995,000126: 24,3560           03704                                    P21BASEV                              
027996,000127: 24,3561           15543                           STODL    VCV                                   #  --VEL
027997,000128: 24,3562           03763                                    P21TIME                               
027998,000129: 24,3563           01517                           STORE    TET                                   #  --TIME
027999,000130: 24,3564           43014                           CLEAR    CLEAR                                 
028000,000131: 24,3565           01676                                    DIM0FLAG                              
028001,000132: 24,3566           00263                                    MOONFLAG                              
028002,000133: 24,3567           53135                           SLOAD    BZE                                   
028003,000134: 24,3570           01163                                    P21ORIG                               
028004,000135: 24,3571           51574                                    +3                                    #  ZERO = EARTH
028005,000136: 24,3572           77614                           SET                                            #  ---2 = MOON
028006,000137: 24,3573           00063                                    MOONFLAG                              
028007,000138: 24,3574           77624                 +3        CALL                                           
028008,000139: 24,3575           27106                                    INTEGRVS                              
028009,000140: 24,3576           77745        P21VSAVE           DLOAD                                          #  SAVE CURRENT BASE VECTOR
028010,000141: 24,3577           00015                                    TAT                                   
028011,000142: 24,3600           27763                           STOVL    P21TIME                               #  --TIME
028012,000143: 24,3601           00017                                    RATT1                                 
028013,000144: 24,3602           27676                           STOVL    P21BASER                              #  --POS B-29 OR B-27
028014,000145: 24,3603           00025                                    VATT1                                 
028015,000146: 24,3604           03704                           STORE    P21BASEV                              #  --VEL B-07 OR B-05
028016,000147: 24,3605           53646                           ABVAL    SL*                                   
028017,000148: 24,3606           57576                                    0,2                                   
028018,000149: 24,3607           27712                           STOVL    P21VEL                                #  VEL/ FOR N91 DISP
028019,000150: 24,3610           00001                                    RATT                                  
028020,000151: 24,3611           50256                           UNIT     DOT                                   
028021,000152: 24,3612           00007                                    VATT                                  #  U(R).V
028022,000153: 24,3613           67471                           DDV      ASIN                                  #  U(R).U(V)
028023,000154: 24,3614           03712                                    P21VEL                                
028024,000155: 24,3615           03714                           STORE    P21GAM                                #  SIN-1 U(R).U(V) , -90 TO &90
028025,000156: 24,3616           67334                           SXA,2    SLOAD                                 
028026,000157: 24,3617           01162                                    P21ORIG                               #  0 = EARTH
028027,000158: 24,3620           01145                                    OPTION2                               
028028,000159: 24,3621           46142                           SR1      BHIZ                                  
028029,000160: 24,3622           51625                                    +3                                    
028030,000161: 24,3623           77650                           GOTO                                           
028031,000162: 24,3624           51630                                    +4                                    
028032,000163: 24,3625           77614                 +3        BON                                            
028033,000164: 24,3626           04307                                    SURFFLAG                              
028034,000165: 24,3627           51632                                    P21DSP                                
028035,000166: 24,3630           77614                 +4        SET                                            
028036,000167: 24,3631           00064                                    P21FLAG                               
028037,000168: 24,3632           67214        P21DSP             CLEAR    SLOAD                                 #  GENERATE DISPLAY DATA
028038,000169: 24,3633           01663                                    LUNAFLAG                              
028039,000170: 24,3634           00050                                    X2                                    
028040,000171: 24,3635           43054                           BZE      SET                                   

Page 659

028042,000173: 24,3636           51640                                    +2                                    #  0 = EARTH
028043,000174: 24,3637           01463                                    LUNAFLAG                              
028044,000175: 24,3640           77775                           VLOAD                                          
028045,000176: 24,3641           00001                                    RATT                                  
028046,000177: 24,3642           16032                           STODL    ALPHAV                                
028047,000178: 24,3643           00015                                    TAT                                   
028048,000179: 24,3644           45014                           CLEAR    CALL                                  
028049,000180: 24,3645           00662                                    ERADFLAG                              
028050,000181: 24,3646           26347                                    LAT-LONG                              
028051,000182: 24,3647           77605                           DMP                                            #  MPAC = ALT, METERS B-29
028052,000183: 24,3650           11677                                    K.01                                  
028053,000184: 24,3651           03716                           STORE    P21ALT                                #  ALT/100 FOR N91 DISP
028054,000185: 24,3652           77776                           EXIT                                           
028055,000186: 24,3653           33674                           CAF      V06N43                                #  DISPLAY LAT, LONG, ALT
028056,000187: 24,3654           04616                           TC       BANKCALL                              #  LAT, LONG = 1/2 REVS B0
028057,000188: 24,3655           20477                           CADR     GOFLASH                               #  ALT = KM B14
028058,000189: 24,3656           06001                           TC       GOTOPOOH                              #  TERM
028059,000190: 24,3657           06001                           TC       GOTOPOOH                              
028060,000191: 24,3660           06042                           TC       INTPRET                               #  V32E RECYCLE
028061,000192: 24,3661           43345                           DLOAD    DAD                                   
028062,000193: 24,3662           03763                                    P21TIME                               
028063,000194: 24,3663           11673                                    600SEC                                #  600 SECONDS OR 10 MIN
028064,000195: 24,3664           01045                           STORE    DSPTEM1                               
028065,000196: 24,3665           77634                           RTB                                            
028066,000197: 24,3666           51521                                    P21PROG1                              
028067,000198: 24,3667           52034        P21PRTM            RTB      GOTO                                  
028068,000199: 24,3670           21574                                    LOADTIME                              
028069,000200: 24,3671           51533                                    P21PROG2                              
028070,000201: 24,3672           00003 25140  600SEC             2DEC     60000      B-28                       #  10 MIN
028071,000202: 
028072,000203: 24,3674           01453        V06N43             VN       00643                                 
028073,000204: 24,3675           01442        V6N34              VN       00634                                 
028074,000205: 24,3676           00243 32703  K.01               2DEC     .01                                   
028075,000206: 

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