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.

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

Page 657

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

028877,000063:                                                                                                  #        504LM _2 2DEC   -7.514128400 E-4 RADIANS     
028878,000064:                                                                                                  #        504LM _4 2DEC   _2.553198641 E-4 RADIANS     
028879,000065: 
028880,000066:                                                                                                  #  NONE
028881,000067:                                                                                                  #  DEBRIS

Page 658

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

Page 659

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

Page 660

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

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