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.

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

Page 656

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

Page 657

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

Page 658

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

Page 659

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

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