Source Code

These source-code files derive from a printout of Luminary 210 (Apollo 15-17 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Jim Lawton, and transcribed to source code by a team of volunteers. This colorized, syntax-highlighted form was created by assembling that transcribed source code. Note that the full page images are available on the Virtual AGC project page at archive.org, while reduced-size images are presented at the VirtualAGC project website. Report or fix any transcription errors at the Virtual AGC project code repository.

Notations on the program listing read, in part:

	GAP: ASSEMBLE REVISION 210 OF AGC PROGRAM LUMINARY 
	BY NASA 2021112-161 17:11 MAR. 19,1971
Note that the date is the date of the printout, not the date of the program revision.

028822,000002:                                                                                                  ## Copyright:   Public domain.
028823,000003:                                                                                                  ## Filename:    GROUND_TRACKING_DETERMINATION_PROGRAM_-_P21.agc
028824,000004:                                                                                                  ## Purpose:     A section of Luminary revision 210.
028825,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
028826,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 15-17.
028827,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
028828,000008:                                                                                                  ##              that the code format has been changed to conform to the
028829,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
028830,000010:                                                                                                  ##              original YUL assembler.
028831,000011:                                                                                                  ## Reference:   pp. 657-660
028832,000012:                                                                                                  ## Assembler:   yaYUL
028833,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
028834,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
028835,000015:                                                                                                  ## Mod history: 2016-11-17 JL   Created from Luminary131 version.
028836,000016:                                                                                                  ##              2016-11-29 RRB  Updated from Luminary210 source.
028837,000017:                                                                                                  ##              2016-11-30 HG   fix operand GOTOPOOH -> GOTOP00H
028838,000018:                                                                                                  ##              2016-12-07 HG   unfix and revert P00 -> POO 
028839,000019:                                                                                                  ##              2016-12-25 RSB  Comment-text proofed using ProoferComments
028840,000020:                                                                                                  ##                              and corrected errors found.
028841,000021: 

Page 657

028843,000023:                                                                                                  #  GROUND TRACKING DETERMINATION PROGRAM P21
028844,000024: 
028845,000025:                                                                                                  #  PROGRAM DESCRIPTION
028846,000026:                                                                                                  #        MOD NO - 1
028847,000027:                                                                                                  #        MOD BY - N. M. NEVILLE
028848,000028:                                                                                                  #  FUNCTIONAL DECRIPTION -
028849,000029: 
028850,000030:                                                                                                  #        TO PROVIDE THE ASTRONAUT DETAILS OF THE LM OR CSM GROUND TRACK WITHOUT
028851,000031:                                                                                                  #        THE NEED FOR GROUND COMMUNICATION (REQUESTED BY DSKY).
028852,000032:                                                                                                  #  CALLING SEQUENCE -
028853,000033: 
028854,000034:                                                                                                  #        ASTRONAUT REQUEST THROUGH DSKY V37E21E
028855,000035:                                                                                                  #  SUBROUTINES CALLED -
028856,000036:                                                                                                  #        GOPERF4
028857,000037:                                                                                                  #        GOFLASH
028858,000038:                                                                                                  #        THISPREC
028859,000039:                                                                                                  #        OTHPREC
028860,000040:                                                                                                  #        LAT-LONG
028861,000041:                                                                                                  #  NORMAL EXIT MODES -
028862,000042: 
028863,000043:                                                                                                  #        ASTRONAUT REQUEST TROUGH DSKY TO TERMINATE PROGRAM V34E
028864,000044:                                                                                                  #  ALARM OR ABORT EXIT MODES -
028865,000045: 
028866,000046:                                                                                                  #        NONE
028867,000047:                                                                                                  #  OUTPUT -
028868,000048: 
028869,000049:                                                                                                  #        OCTAL DISPLAY OF OPTION CODE AND VEHICLE WHOSE GROUND TRACK IS TO BE
028870,000050:                                                                                                  #        COMPUTED
028871,000051:                                                                                                  #                OPTION CODE     00002
028872,000052:                                                                                                  #                THIS            00001
028873,000053:                                                                                                  #                OTHER           00002
028874,000054:                                                                                                  #        DECIMAL DISPLAY OF TIME TO BE INTEGRATED TO HOURS, MINUTES, SECONDS
028875,000055:                                                                                                  #        DECIMAL DISPLAY OF LAT,LONG,ALT
028876,000056:                                                                                                  #        ERASABLE INITIALIZATION REQUIRED
028877,000057:                                                                                                  #        AX0      2DEC   4.652459653 E-5 RADIANS         %68-69 CONSTANTS"
028878,000058:                                                                                                  #        -AY0     2DEC   2.147535898 E-5 RADIANS
028879,000059:                                                                                                  #        AZ0      2DEC   .7753206164     REVOLUTIONS
028880,000060:                                                                                                  #        FOR LUNAR ORBITS 504LM VECTOR IS NEEDED
028881,000061:                                                                                                  #        504LM    2DEC   -2.700340600 E-5 RADIANS

Should _2 and _4 be +2 and +4? Value has _ instead of -, I think this is a typo — RRB

028883,000063:                                                                                                  #        504LM _2 2DEC   -7.514128400 E-4 RADIANS     
028884,000064:                                                                                                  #        504LM _4 2DEC   _2.553198641 E-4 RADIANS     
028885,000065: 
028886,000066:                                                                                                  #  NONE
028887,000067:                                                                                                  #  DEBRIS

Page 658

028889,000069: 
028890,000070:                                                                                                  #        CENTRALS-A,Q,L
028891,000071:                                                                                                  #        OTHER-THOSE USED BY THE ABOVE LISTED SUBROUTINES
028892,000072:                                                                                                  #        SEE LEMPREC,LAT-LONG
028893,000073: 
028894,000074: 35,2455  30,2000                                  SBANK=   LOWSUPER                              #  FOR LOW 2CADR'S.
028895,000075: 
028896,000076: 33,2113                                           BANK     33                                    
028897,000077: 24,2000                                           SETLOC   P20S                                  
028898,000078: 24,2000                                           BANK                                           
028899,000079: 
028900,000080: 24,3441  E7,1762                                  EBANK=   P21TIME                               
028901,000081: 24,3441                                           COUNT*   $$/P21                                
028902,000082: 24,3441           34744        PROG21             CAF      ONE                                   
028903,000083: 24,3442           55144                           TS       OPTION2                               #  ASSUMED VEHICLE IS LM, R2 = 00001
028904,000084: 24,3443           34743                           CAF      BIT2                                  #  OPTION 2
028905,000085: 24,3444           04607                           TC       BANKCALL                              
028906,000086: 24,3445           20645                           CADR     GOPERF4                               
028907,000087: 24,3446           06001                           TC       GOTOPOOH                              #  TERMINATE
028908,000088: 24,3447           03451                           TC       +2                                    #  PROCEED VALUE OF ASSUMED VEHICLE OK
028909,000089: 24,3450           03443                           TC       -5                                    #  R2 LOADED THROUGH DSKY
028910,000090: 24,3451           34746                           CAF      ZERO                                  #  INITIAL TIME = PRESENT TIME
028911,000091: 24,3452           55044                           TS       DSPTEM1                               
028912,000092: 24,3453           55045                           TS       DSPTEM1    +1                         
028913,000093: 24,3454           33631        P21PROG1           CAF      V6N34                                 #  LOAD DESIRED TIME OF LAT-LONG.
028914,000094: 24,3455           04607                           TC       BANKCALL                              
028915,000095: 24,3456           20471                           CADR     GOFLASH                               
028916,000096: 24,3457           06001                           TC       GOTOPOOH                              #  TERM
028917,000097: 24,3460           03462                           TC       +2                                    #  PROCEED VALUES OK
028918,000098: 24,3461           03454                           TC       -5                                    #  TIME LOADED THROUGH DSKY
028919,000099: 24,3462           06060                           TC       INTPRET                               
028920,000100: 24,3463           53145                           DLOAD    BZE                                   
028921,000101: 24,3464           01045                                    DSPTEM1                               
028922,000102: 24,3465           51623                                    P21PRTM                               
028923,000103: 24,3466           34041        P21PROG2           STCALL   TDEC1                                 #  INTEG TO TIME SPECIFIED IN TDEC1
028924,000104: 24,3467           27447                                    INTSTALL                              
028925,000105: 24,3470           43014                           BON      CLEAR                                 
028926,000106: 24,3471           00304                                    P21FLAG                               
028927,000107: 24,3472           51510                                    P21CONT                               #  ON---RECYCLE USING BASE VECTOR
028928,000108: 24,3473           01674                                    VINTFLAG                              #  OFF--1ST PASS CALL BASE VECTOR
028929,000109: 24,3474           70535                           SLOAD    SR1                                   
028930,000110: 24,3475           01145                                    OPTION2                               
028931,000111: 24,3476           43030                           BHIZ     SET                                   
028932,000112: 24,3477           51501                                    +2                                    #  ZERO--THIS VEHICLE (LM)
028933,000113: 24,3500           01474                                    VINTFLAG                              #  ONE--OTHER VEHICLE (CM)
028934,000114: 24,3501           43014                           CLEAR    CLEAR                                 
028935,000115: 24,3502           01676                                    DIM0FLAG                              
028936,000116: 24,3503           01673                                    INTYPFLG                              #  PRECISION
028937,000117: 24,3504           77624                           CALL                                           
028938,000118: 24,3505           27172                                    INTEGRV                               #  CALCULATE
028939,000119: 24,3506           77650                           GOTO                                           #  -AND

Page 659

028941,000121: 24,3507           51532                                    P21VSAVE                              #  -SAVE BASE VECTOR
028942,000122: 24,3510           77775        P21CONT            VLOAD                                          
028943,000123: 24,3511           03676                                    P21BASER                              #  RECYCLE -- INTEG FROM BASE VECTOR
028944,000124: 24,3512           25535                           STOVL    RCV                                   #  --POS
028945,000125: 24,3513           03704                                    P21BASEV                              
028946,000126: 24,3514           15543                           STODL    VCV                                   #  --VEL
028947,000127: 24,3515           03763                                    P21TIME                               
028948,000128: 24,3516           01517                           STORE    TET                                   #  --TIME
028949,000129: 24,3517           43014                           CLEAR    CLEAR                                 
028950,000130: 24,3520           01676                                    DIM0FLAG                              
028951,000131: 24,3521           00263                                    MOONFLAG                              
028952,000132: 24,3522           53135                           SLOAD    BZE                                   
028953,000133: 24,3523           01163                                    P21ORIG                               
028954,000134: 24,3524           51527                                    +3                                    #  ZERO=EARTH
028955,000135: 24,3525           77614                           SET                                            #  ---2=MOON
028956,000136: 24,3526           00063                                    MOONFLAG                              
028957,000137: 24,3527           45014                 +3        CLEAR    CALL                                  
028958,000138: 24,3530           01673                                    INTYPFLG                              
028959,000139: 24,3531           27145                                    INTEGRVS                              
028960,000140: 24,3532           77745        P21VSAVE           DLOAD                                          #  SAVE CURRENT BASE VECTOR
028961,000141: 24,3533           00015                                    TAT                                   
028962,000142: 24,3534           27763                           STOVL    P21TIME                               #  --TIME
028963,000143: 24,3535           00017                                    RATT1                                 
028964,000144: 24,3536           27676                           STOVL    P21BASER                              #  --POS B-29 OR B-27
028965,000145: 24,3537           00025                                    VATT1                                 
028966,000146: 24,3540           03704                           STORE    P21BASEV                              #  --VEL B-07 OR B-05
028967,000147: 24,3541           53646                           ABVAL    SL*                                   
028968,000148: 24,3542           57576                                    0,2                                   
028969,000149: 24,3543           27712                           STOVL    P21VEL                                #  VEL/ FOR N91 DISP
028970,000150: 24,3544           00001                                    RATT                                  
028971,000151: 24,3545           50256                           UNIT     DOT                                   
028972,000152: 24,3546           00007                                    VATT                                  #  U(R).V
028973,000153: 24,3547           67471                           DDV      ASIN                                  #  U(R).U(V)
028974,000154: 24,3550           03712                                    P21VEL                                
028975,000155: 24,3551           03714                           STORE    P21GAM                                #  SIN-1 U(R).U(V) , -90 TO &90
028976,000156: 24,3552           67334                           SXA,2    SLOAD                                 
028977,000157: 24,3553           01162                                    P21ORIG                               #  0 = EARTH
028978,000158: 24,3554           01145                                    OPTION2                               
028979,000159: 24,3555           46142                           SR1      BHIZ                                  
028980,000160: 24,3556           51561                                    +3                                    
028981,000161: 24,3557           77650                           GOTO                                           
028982,000162: 24,3560           51564                                    +4                                    
028983,000163: 24,3561           77614                 +3        BON                                            
028984,000164: 24,3562           04307                                    SURFFLAG                              
028985,000165: 24,3563           51566                                    P21DSP                                
028986,000166: 24,3564           77614                 +4        SET                                            
028987,000167: 24,3565           00064                                    P21FLAG                               
028988,000168: 24,3566           67214        P21DSP             CLEAR    SLOAD                                 #  GENERATE DISPLAY DATA
028989,000169: 24,3567           01663                                    LUNAFLAG                              
028990,000170: 24,3570           00050                                    X2                                    

Page 660

028992,000172: 24,3571           43054                           BZE      SET                                   
028993,000173: 24,3572           51574                                    +2                                    #  0 = EARTH
028994,000174: 24,3573           01463                                    LUNAFLAG                              
028995,000175: 24,3574           77775                           VLOAD                                          
028996,000176: 24,3575           00001                                    RATT                                  
028997,000177: 24,3576           16032                           STODL    ALPHAV                                
028998,000178: 24,3577           00015                                    TAT                                   
028999,000179: 24,3600           45014                           CLEAR    CALL                                  
029000,000180: 24,3601           00662                                    ERADFLAG                              
029001,000181: 24,3602           26406                                    LAT-LONG                              
029002,000182: 24,3603           77605                           DMP                                            #  MPAC = ALT, METERS B-29
029003,000183: 24,3604           11633                                    K.01                                  
029004,000184: 24,3605           03716                           STORE    P21ALT                                #  ALT/100 FOR N91 DISP
029005,000185: 24,3606           77776                           EXIT                                           
029006,000186: 24,3607           33630                           CAF      V06N43                                #  DISPLAY LAT, LONG, ALT
029007,000187: 24,3610           04607                           TC       BANKCALL                              #  LAT, LONG = 1/2 REVS B0
029008,000188: 24,3611           20471                           CADR     GOFLASH                               #  ALT = KM B14
029009,000189: 24,3612           06001                           TC       GOTOPOOH                              #  TERM
029010,000190: 24,3613           06001                           TC       GOTOPOOH                              
029011,000191: 24,3614           06060                           TC       INTPRET                               #  V32E RECYCLE
029012,000192: 24,3615           43345                           DLOAD    DAD                                   
029013,000193: 24,3616           03763                                    P21TIME                               
029014,000194: 24,3617           11627                                    600SEC                                #  600 SECONDS OR 10 MIN
029015,000195: 24,3620           01045                           STORE    DSPTEM1                               
029016,000196: 24,3621           77634                           RTB                                            
029017,000197: 24,3622           51454                                    P21PROG1                              
029018,000198: 24,3623           52034        P21PRTM            RTB      GOTO                                  
029019,000199: 24,3624           21603                                    LOADTIME                              
029020,000200: 24,3625           51466                                    P21PROG2                              
029021,000201: 24,3626           00003 25140  600SEC             2DEC     60000      B-28                       #  10 MIN
029022,000202: 
029023,000203: 24,3630           01453        V06N43             VN       00643                                 
029024,000204: 24,3631           01442        V6N34              VN       00634                                 
029025,000205: 24,3632           00243 32703  K.01               2DEC     .01                                   
029026,000206: 

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