Source Code

These source-code files derive from a printout of Luminary 116 (the Apollo 12 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Ron Burkey, 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 116 OF AGC PROGRAM LUMINARY BY NASA 2021112-071
	19:09 AUG. 11,1969
Note that the date is the date of the printout, not the date of the program revision.

027891,000002:                                                                                                  ## Copyright:   Public domain.
027892,000003:                                                                                                  ## Filename:    GROUND_TRACKING_DETERMINATION_PROGRAM_-_P21.agc
027893,000004:                                                                                                  ## Purpose:     A section of Luminary revision 116.
027894,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM) 
027895,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 12.
027896,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
027897,000008:                                                                                                  ##              that the code format has been changed to conform to the
027898,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
027899,000010:                                                                                                  ##              original YUL assembler.
027900,000011:                                                                                                  ## Reference:   pp. 654-657
027901,000012:                                                                                                  ## Assembler:   yaYUL
027902,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
027903,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
027904,000015:                                                                                                  ## Mod history: 2017-01-22 MAS  Created from Luminary 99.
027905,000016:                                                                                                  ##              2017-02-12 NV   Updated for Luminary 116.
027906,000017:                                                                                                  ##              2017-03-01 RSB  Proofed comment text by diff vs Luminary 131
027907,000018:                                                                                                  ##                              but no errors found.
027908,000019: 

Page 654

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

Page 655

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

Page 656

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

Page 657

028059,000170: 24,3635           51637                                    +2                                    #  0 = EARTH
028060,000171: 24,3636           01463                                    LUNAFLAG                              
028061,000172: 24,3637           77775                           VLOAD                                          
028062,000173: 24,3640           00001                                    RATT                                  
028063,000174: 24,3641           16032                           STODL    ALPHAV                                
028064,000175: 24,3642           00015                                    TAT                                   
028065,000176: 24,3643           45014                           CLEAR    CALL                                  
028066,000177: 24,3644           00662                                    ERADFLAG                              
028067,000178: 24,3645           26351                                    LAT-LONG                              
028068,000179: 24,3646           77605                           DMP                                            #  MPAC = ALT, METERS B-29
028069,000180: 24,3647           11676                                    K.01                                  
028070,000181: 24,3650           03716                           STORE    P21ALT                                #  ALT/100 FOR N91 DISP
028071,000182: 24,3651           77776                           EXIT                                           
028072,000183: 24,3652           33673                           CAF      V06N43                                #  DISPLAY LAT, LONG, ALT
028073,000184: 24,3653           04616                           TC       BANKCALL                              #  LAT, LONG = 1/2 REVS B0
028074,000185: 24,3654           20477                           CADR     GOFLASH                               #  ALT = KM B14
028075,000186: 24,3655           06001                           TC       GOTOPOOH                              #  TERM
028076,000187: 24,3656           06001                           TC       GOTOPOOH                              
028077,000188: 24,3657           06042                           TC       INTPRET                               #  V32E RECYCLE
028078,000189: 24,3660           43345                           DLOAD    DAD                                   
028079,000190: 24,3661           03763                                    P21TIME                               
028080,000191: 24,3662           11672                                    600SEC                                #  600 SECONDS OR 10 MIN
028081,000192: 24,3663           01045                           STORE    DSPTEM1                               
028082,000193: 24,3664           77634                           RTB                                            
028083,000194: 24,3665           51520                                    P21PROG1                              
028084,000195: 24,3666           52034        P21PRTM            RTB      GOTO                                  
028085,000196: 24,3667           21574                                    LOADTIME                              
028086,000197: 24,3670           51532                                    P21PROG2                              
028087,000198: 24,3671           00003 25140  600SEC             2DEC     60000      B-28                       #  10 MIN
028088,000199: 
028089,000200: 24,3673           01453        V06N43             VN       00643                                 
028090,000201: 24,3674           01442        V6N34              VN       00634                                 
028091,000202: 24,3675           00243 32703  K.01               2DEC     .01                                   
028092,000203: 

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