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.

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

Page 654

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

Page 655

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

Page 656

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

Page 657

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

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