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.

027844,000002:                                                                                                  ## Copyright:   Public domain.
027845,000003:                                                                                                  ## Filename:    GROUND_TRACKING_DETERMINATION_PROGRAM.agc
027846,000004:                                                                                                  ## Purpose:     A section of Luminary 1C, revision 131.
027847,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
027848,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13.
027849,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
027850,000008:                                                                                                  ##              that the code format has been changed to conform to the
027851,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the 
027852,000010:                                                                                                  ##              original YUL assembler.
027853,000011:                                                                                                  ## Reference:   pp. 656-659
027854,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
027855,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
027856,000014:                                                                                                  ## Mod history: 05/21/03 RSB.   Began transcribing. 
027857,000015:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
027858,000016:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
027859,000017:                                                                                                  ##                              original harcopy, as opposed to the PDF page
027860,000018:                                                                                                  ##                              numbers in 1701.pdf.
027861,000019:                                                                                                  ##              2017-02-24 RSB  Proofed comment text using octopus/ProoferComments.
027862,000020:                                                                                                  ##              2017-03-01 RSB  Fixed a couple comment-text errors found while
027863,000021:                                                                                                  ##                              diff'ing vs Luminary 116.
027864,000022: 

Page 656

027866,000024:                                                                                                  #  GROUND TRACKING DETERMINATION PROGRAM P21
027867,000025: 
027868,000026:                                                                                                  #  PROGRAM DESCRIPTION
027869,000027:                                                                                                  #        MOD NO - 1
027870,000028:                                                                                                  #        MOD BY - N. M. NEVILLE
027871,000029: 
027872,000030:                                                                                                  #  FUNCTIONAL DECRIPTION -
027873,000031:                                                                                                  #        TO PROVIDE THE ASTRONAUT DETAILS OF THE LM OR CSM GROUND TRACK WITHOUT
027874,000032:                                                                                                  #        THE NEED FOR GROUND COMMUNICATION (REQUESTED BY DSKY).
027875,000033: 
027876,000034:                                                                                                  #  CALLING SEQUENCE -
027877,000035:                                                                                                  #        ASTRONAUT REQUEST THROUGH DSKY V37E21E
027878,000036: 
027879,000037:                                                                                                  #  SUBROUTINES CALLED -
027880,000038:                                                                                                  #        GOPERF4
027881,000039:                                                                                                  #        GOFLASH
027882,000040:                                                                                                  #        THISPREC
027883,000041:                                                                                                  #        OTHPREC
027884,000042:                                                                                                  #        LAT-LONG
027885,000043: 
027886,000044:                                                                                                  #  NORMAL EXIT MODES -
027887,000045:                                                                                                  #        ASTRONAUT REQUEST TROUGH DSKY TO TERMINATE PROGRAM V34E
027888,000046: 
027889,000047:                                                                                                  #  ALARM OR ABORT EXIT MODES -
027890,000048:                                                                                                  #        NONE
027891,000049: 
027892,000050:                                                                                                  #  OUTPUT -
027893,000051:                                                                                                  #        OCTAL DISPLAY OF OPTION CODE AND VEHICLE WHOSE GROUND TRACK IS TO BE
027894,000052:                                                                                                  #        COMPUTED
027895,000053:                                                                                                  #                OPTION CODE     00002
027896,000054:                                                                                                  #                THIS            00001
027897,000055:                                                                                                  #                OTHER           00002
027898,000056:                                                                                                  #        DECIMAL DISPLAY OF TIME TO BE INTEGRATED TO HOURS, MINUTES, SECONDS
027899,000057:                                                                                                  #        DECIMAL DISPLAY OF LAT,LONG,ALT
027900,000058: 
027901,000059:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
027902,000060:                                                                                                  #        AX0     2DEC    4.652459653 E-5 RADIANS         %68-69 CONSTANTS"
027903,000061:                                                                                                  #        -AY0    2DEC    2.147535898 E-5 RADIANS
027904,000062:                                                                                                  #        AZ0     2DEC    .7753206164     REVOLUTIONS
027905,000063:                                                                                                  #  FOR LUNAR ORBITS 504LM VECTOR IS NEEDED
027906,000064:                                                                                                  #        504LM           2DEC    -2.700340600 E-5 RADIANS
027907,000065:                                                                                                  #        504LM _2        2DEC    -7.514128400 E-4 RADIANS
027908,000066:                                                                                                  #        504LM _4        2DEC    _2.553198641 E-4 RADIANS
027909,000067: 
027910,000068:                                                                                                  #  NONE
027911,000069:                                                                                                  #  DEBRIS

Page 657

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

Page 658

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

Page 659

028015,000173: 24,3636           51640                                    +2                                    #  0 = EARTH
028016,000174: 24,3637           01463                                    LUNAFLAG                              
028017,000175: 24,3640           77775                           VLOAD                                          
028018,000176: 24,3641           00001                                    RATT                                  
028019,000177: 24,3642           16032                           STODL    ALPHAV                                
028020,000178: 24,3643           00015                                    TAT                                   
028021,000179: 24,3644           45014                           CLEAR    CALL                                  
028022,000180: 24,3645           00662                                    ERADFLAG                              
028023,000181: 24,3646           26347                                    LAT-LONG                              
028024,000182: 24,3647           77605                           DMP                                            #  MPAC = ALT, METERS B-29
028025,000183: 24,3650           11677                                    K.01                                  
028026,000184: 24,3651           03716                           STORE    P21ALT                                #  ALT/100 FOR N91 DISP
028027,000185: 24,3652           77776                           EXIT                                           
028028,000186: 24,3653           33674                           CAF      V06N43                                #  DISPLAY LAT, LONG, ALT
028029,000187: 24,3654           04616                           TC       BANKCALL                              #  LAT, LONG = 1/2 REVS B0
028030,000188: 24,3655           20477                           CADR     GOFLASH                               #  ALT = KM B14
028031,000189: 24,3656           06001                           TC       GOTOPOOH                              #  TERM
028032,000190: 24,3657           06001                           TC       GOTOPOOH                              
028033,000191: 24,3660           06042                           TC       INTPRET                               #  V32E RECYCLE
028034,000192: 24,3661           43345                           DLOAD    DAD                                   
028035,000193: 24,3662           03763                                    P21TIME                               
028036,000194: 24,3663           11673                                    600SEC                                #  600 SECONDS OR 10 MIN
028037,000195: 24,3664           01045                           STORE    DSPTEM1                               
028038,000196: 24,3665           77634                           RTB                                            
028039,000197: 24,3666           51521                                    P21PROG1                              
028040,000198: 24,3667           52034        P21PRTM            RTB      GOTO                                  
028041,000199: 24,3670           21574                                    LOADTIME                              
028042,000200: 24,3671           51533                                    P21PROG2                              
028043,000201: 24,3672           00003 25140  600SEC             2DEC     60000      B-28                       #  10 MIN
028044,000202: 
028045,000203: 24,3674           01453        V06N43             VN       00643                                 
028046,000204: 24,3675           01442        V6N34              VN       00634                                 
028047,000205: 24,3676           00243 32703  K.01               2DEC     .01                                   
028048,000206: 

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