Source Code

These source-code files were obtained by digitally photographing an Artemis 72 program listing from a private collection and then modifying pre-existing Comanche 55 (Apollo 11) source files to incorporate changes. Note that the page images presented online are of reduced quality, and that additional images may be available. Report any conversion errors or legibility problems in page images to info@sandroid.org. Notations on the program listing read, in part:

	GAP: ASSEMBLE REVISION 072 OF AGC PROGRAM ARTEMIS 
	BY NASA 2021114-011 11:40 FEB. 26, 1971

	THIS AGC PROGRAM SHALL ALSO BE REFERRED TO AS
				COLOSSUS 3
	THIS PROGRAM IS INTENDED FOR USE IN THE CM AS SPECIFIED
	IN REPORT R-577.  THIS PROGRAM WAS PREPARED UNDER OSR
	PROJECT 55-23890, SPONSORED BY THE MANNED SPACECRAFT
	CENTER OF THE NATIONAL AERONAUTICS AND SPACE
	ADMINISTRATION THROUGH CONTRACT NAS 9-4065 WITH THE
	CHARLES STARK DRAPER LABORATORY, MASSACHUSETTS INSTITUTE OF
	TECHNOLOGY, CAMBRIDGE, MASS.

052685,000002:                                                                                                 #  Copyright:     Public domain.
052686,000003:                                                                                                 #  Filename:      LATITUDE_LONGITUDE_SUBROUTINES.agc
052687,000004:                                                                                                 #  Purpose:       Part of the source code for Artemis (i.e., Colossus 3),
052688,000005:                                                                                                 #                 build 072.  This is for the Command Module's (CM) 
052689,000006:                                                                                                 #                 Apollo Guidance Computer (AGC), we believe for 
052690,000007:                                                                                                 #                 Apollo 15-17.
052691,000008:                                                                                                 #  Assembler:     yaYUL
052692,000009:                                                                                                 #  Contact:       Sergio Navarro <sergionavarrog@gmail.com>
052693,000010:                                                                                                 #  Website:       www.ibiblio.org/apollo/index.html
052694,000011:                                                                                                 #  Page scans:    www.ibiblio.org/apollo/ScansForConversion/Artemis072/
052695,000012:                                                                                                 #  Mod history:   2009-09-03 SN   Adapted from corresponding Comanche 055 file.
052696,000013:                                                                                                 #                 2009-09-04 JL   Fixed typos.
052697,000014:                                                                                                 #                 2010-02-20 RSB  Un-##'d this header.
052698,000015: 

Page 1236

052700,000017:                                                                                                 #  SUBROUTINE TO CONVERT RAD VECTOR AT GIVEN TIME TO LAT,LONG AND ALT
052701,000018: 
052702,000019:                                                                                                 #  CALLING SEQUENCE
052703,000020: 
052704,000021:                                                                                                 #         L-1     CALL
052705,000022:                                                                                                 #         L               LAT-LONG
052706,000023: 
052707,000024:                                                                                                 #  SUBROUTINES USED
052708,000025: 
052709,000026:                                                                                                 #         R-TO-RP, ARCTAN, SETGAMMA, SETRE
052710,000027: 
052711,000028:                                                                                                 #  ERASABLE INIT. REQ.
052712,000029: 
052713,000030:                                                                                                 #         AXO, -AYO, AZO, TEPHEM (SET AT LAUNCH TIME)
052714,000031:                                                                                                 #         ALPHAV = POSITION VECTOR METERS B-29
052715,000032:                                                                                                 #         MPAC -- TIME (CSECS B-28)
052716,000033:                                                                                                 #         ERADFLAG =1, TO COMPUTE EARTH RADIUS, =0 FOR FIXED EARTH RADIUS
052717,000034:                                                                                                 #         LUNAFLAG=0 FOR EARTH, 1 FOR MOON
052718,000035: 
052719,000036:                                                                                                 #  OUTPUT
052720,000037: 
052721,000038:                                                                                                 #         LATITUDE IN LAT         (REVS. B-0)
052722,000039:                                                                                                 #         LONGITUDE IN LONG       (REVS. B-0)
052723,000040:                                                                                                 #         ALTITUDE IN ALT METERS B-29
052724,000041: 
052725,000042: 13,2000                                          SETLOC   LATLONG                               
052726,000043: 13,2000                                          BANK                                           
052727,000044: 
052728,000045: 13,2453                                          COUNT*   $$/LT-LG                              
052729,000046: 13,2453  E4,1551                                 EBANK=   ALPHAV                                
052730,000047: 13,2453           40220        LAT-LONG          STQ      SETPD                                 
052731,000048: 13,2454           02241                                   INCORPEX                              
052732,000049: 13,2455           00001                                   0D                                    
052733,000050: 13,2456           24007                          STOVL    6D                                    #  SAVE TIME IN 6-7D FOR R-TO-RP
052734,000051: 13,2457           02152                                   ALPHAV                                
052735,000052: 13,2460           51406                          PUSH     ABVAL                                 #  0-5D= R FOR R-TO-RP
052736,000053: 13,2461           16301                          STODL    ALPHAM                                #  ABS. VALUE OF R FOR ALT FORMULA BELOW
052737,000054: 13,2462           11762                                   ZEROVEC                               #  SET MPAC=0 FOR EARTH, NON-ZERO FOR MOON
052738,000055: 13,2463           71414                          BOFF     COS                                   #  USE COS(0) TO GET NON-ZERO IN MPAC
052739,000056: 13,2464           01743                                   LUNAFLAG                              #  0=EARTH,1=MOON
052740,000057: 13,2465           26466                                   CALLRTRP                              
052741,000058: 13,2466           77624        CALLRTRP          CALL                                           
052742,000059: 13,2467           55370                                   R-TO-RP                               #  RP VECTOR CONVERTED FROM R B-29
052743,000060: 13,2470           77656                          UNIT                                           #  UNIT RP B-1
052744,000061: 13,2471           36152                          STCALL   ALPHAV                                #  U2= 1/2 SINL FOR SETRE SUBR BELOW
052745,000062: 13,2472           35766                                   SETGAMMA                              #   SET GAMMA=B2/A2 FOR EARTH, =1 FOR MOON
052746,000063: 13,2473           77624                          CALL                                           #   SCALED B-1.
052747,000064: 13,2474           26654                                   SETRE                                 #  CALC RE METERS B-29
052748,000065: 13,2475           63545                          DLOAD    DSQ                                   
052749,000066: 13,2476           02152                                   ALPHAV                                
052750,000067: 13,2477           63525                          PDDL     DSQ                                   
052751,000068: 13,2500           02154                                   ALPHAV     +2                         
052752,000069: 13,2501           75415                          DAD      SQRT                                  
052753,000070: 13,2502           76405                          DMP      SL1R                                  

Page 1237

052755,000072: 13,2503           00011                                   GAMRP                                 
052756,000073: 13,2504           14021                          STODL    COSTH                                 #  COS(LAT) B-1
052757,000074: 13,2505           02156                                   ALPHAV     +4                         
052758,000075: 13,2506           34023                          STCALL   SINTH                                 #  SIN(LAT) B-1
052759,000076: 13,2507           26614                                   ARCTAN                                
052760,000077: 13,2510           14747                          STODL    LAT                                   #  LAT B0
052761,000078: 13,2511           02152                                   ALPHAV                                
052762,000079: 13,2512           14021                          STODL    COSTH                                 #  COS(LONG) B-1
052763,000080: 13,2513           02154                                   ALPHAV     +2                         
052764,000081: 13,2514           34023                          STCALL   SINTH                                 #  SIN(LONG) B-1
052765,000082: 13,2515           26614                                   ARCTAN                                
052766,000083: 13,2516           14751                          STODL    LONG                                  #  LONG. REVS B-0 IN RANGE -1/2 TO 1/2
052767,000084: 13,2517           02301                                   ALPHAM                                
052768,000085: 13,2520           77625                          DSU                                            #  ALT= R-RE METERS B-29
052769,000086: 13,2521           02240                                   ERADM                                 
052770,000087: 13,2522           34753                          STCALL   ALT                                   #  EXIT WITH ALT METERS B-29
052771,000088: 13,2523           02241                                   INCORPEX                              
052772,000089: 

Page 1238

052774,000091:                                                                                                 #  SUBROUTINE TO CONVERT LAT,LONG.ALT AT GIVEN TIME TO RADIUS VECTOR
052775,000092: 
052776,000093:                                                                                                 #  CALLING SEQUENCE
052777,000094: 
052778,000095:                                                                                                 #         L-1     CALL
052779,000096:                                                                                                 #         L               LALOTORV
052780,000097: 
052781,000098:                                                                                                 #  SUBROUTINES USED
052782,000099: 
052783,000100:                                                                                                 #         SETGAMMA, SETRE, RP-TO-R
052784,000101: 
052785,000102:                                                                                                 #  ERASABLE INIT. REQ.
052786,000103: 
052787,000104:                                                                                                 #         AXO, AYO, AZO, TEPHEM  SET AT LAUNCH TIME
052788,000105:                                                                                                 #         LAT -- LATITUDE         (REVS B0)
052789,000106:                                                                                                 #         LONG -- LONGITUDE       (REVS B0)
052790,000107:                                                                                                 #         ALT -- ALTITUDE         (METERS) B-29
052791,000108:                                                                                                 #         MPAC -- TIME            (CSECS B-28)
052792,000109:                                                                                                 #         ERADFLAG =1 TO COMPUTE EARTH RADIUS, =0 FOR FIXED EARTH RADIUS
052793,000110:                                                                                                 #         LUNAFLAG=0 FOR EARTH, 1 FOR MOON
052794,000111: 
052795,000112:                                                                                                 #  OUTPUT
052796,000113: 
052797,000114:                                                                                                 #         R-VECTOR IN ALPHAV (METERS B-29)
052798,000115: 
052799,000116: 13,2524           40220        LALOTORV          STQ      SETPD                                 #  LAT,LONG,ALT TO R VECTOR
052800,000117: 13,2525           02241                                   INCORPEX                              
052801,000118: 13,2526           00001                                   0D                                    
052802,000119: 13,2527           34007                          STCALL   6D                                    #  6-7D = TIME FOR RP-TO-R
052803,000120: 13,2530           35766                                   SETGAMMA                              #  GAMMA = B2/A2 FOR EARTH, 1 FOR MOON B-1
052804,000121: 13,2531           73545                          DLOAD    SIN                                   #                    COS(LONG)COS(LAT) IN MPAC
052805,000122: 13,2532           00747                                   LAT                                   #         UNIT  RP = SIN(LONG)COS(LAT)    2-3D
052806,000123: 13,2533           65275                          DMPR     PDDL                                  #  PD 2              GAMMA*SIN(LAT)       0-1D
052807,000124: 13,2534           00011                                   GAMRP                                 
052808,000125: 13,2535           00747                                   LAT                                   #             0-1D = GAMMA*SIN(LAT) B-2
052809,000126: 13,2536           65346                          COS      PDDL                                  #  PD4        2-3D = COS(LAT) B-1 TEMPORARILY
052810,000127: 13,2537           00751                                   LONG                                  
052811,000128: 13,2540           57356                          SIN      DMPR                                  #  PD 2
052812,000129: 13,2541           71525                          PDDL     COS                                   #  PD 4       2-3D = SIN(LONG)COS(LAT) B-2
052813,000130: 13,2542           00747                                   LAT                                   
052814,000131: 13,2543           71525                          PDDL     COS                                   #  PD 6       4-5D = COS(LAT) B-1 TEMPORARILY
052815,000132: 13,2544           00751                                   LONG                                  
052816,000133: 13,2545           55475                          DMPR     VDEF                                  #  PD4        MPAC = COS(LONG)COS(LAT) B-2
052817,000134: 13,2546           41456                          UNIT     PUSH                                  #  0-5D = UNIT RP FOR RP-TO-R SUBR.
052818,000135: 13,2547           36152                          STCALL   ALPHAV                                #  ALPHAV +4= SINL FOR SETRE SUBR.
052819,000136: 13,2550           26654                                   SETRE                                 #  RE METERS B-29
052820,000137: 13,2551           43145                          DLOAD    BOFF                                  #  SET MPAC = 0 FOR EARTH, NON-ZERO FOR MOON
052821,000138: 13,2552           11762                                   ZEROVEC                               
052822,000139: 13,2553           01743                                   LUNAFLAG                              
052823,000140: 13,2554           26556                                   CALLRPRT                              
052824,000141: 13,2555           77746                          COS                                            #  USE COS(0) TO GET NON-ZERO IN MPAC
052825,000142: 13,2556           77624        CALLRPRT          CALL                                           
052826,000143: 13,2557           55345                                   RP-TO-R                               #  EXIT WITH UNIT R VECTOR IN MPAC
052827,000144: 13,2560           16152                          STODL    ALPHAV                                
052828,000145: 13,2561           02240                                   ERADM                                 

Page 1239

052830,000147: 13,2562           74215                          DAD      VXSC                                  #  (RE + ALT)(UNIT R) METERS B-30
052831,000148: 13,2563           00753                                   ALT                                   
052832,000149: 13,2564           02152                                   ALPHAV                                
052833,000150: 13,2565           77772                          VSL1                                           #  R METERS B-29
052834,000151: 13,2566           36152                          STCALL   ALPHAV                                #  EXIT WITH R IN METERS B-29
052835,000152: 13,2567           02241                                   INCORPEX                              
052836,000153: 
052837,000154:                                                                                                 #  SUBROUTINE TO COMPUTE EARTH RADIUS
052838,000155: 
052839,000156:                                                                                                 #  INPUT
052840,000157: 13,2570                        '                                                                
052841,000158:                                                                                                 #         1/2 SIN LAT IN ALPHAV +4
052842,000159: 
052843,000160:                                                                                                 #  OUTPUT
052844,000161: 
052845,000162:                                                                                                 #         EARTH RADIUS IN ERADM AND MPAC  (METERS B-29)
052846,000163: 
052847,000164: 13,2570           63545        GETERAD           DLOAD    DSQ                                   
052848,000165: 13,2571           02156                                   ALPHAV     +4                         #  SIN**2(L)
052849,000166: 13,2572           44352                          SL1      BDSU                                  
052850,000167: 13,2573           11760                                   DP1/2                                 #  COS**2(L)
052851,000168: 13,2574           44275                          DMPR     BDSU                                  
052852,000169: 13,2575           26611                                   EE                                    
052853,000170: 13,2576           11760                                   DP1/2                                 
052854,000171: 13,2577           75465                          BDDV     SQRT                                  
052855,000172: 13,2600           26605                                   B2XSC                                 
052856,000173: 13,2601           77622                          SR4R                                           
052857,000174: 13,2602           02240                          STORE    ERADM                                 
052858,000175: 13,2603           77616                          RVQ                                            
052859,000176: 
052860,000177:                                                                                                 #  THE FOLLOWING CONSTANTS WERE COMPUTED WITH A=6378166, B=6356784 METERS
052861,000178:                                                                                                 #  B2XSC = B**2 SCALED B-51
052862,000179:                                                                                                 #  B2/A2 = B**2/A**2  SCALED B-1
052863,000180:                                                                                                 #  EE = (1-B**2/A**2) SCALED B-0
052864,000181: 
052865,000182: 13,2604           00446 00305  B2XSC             2DEC     .0179450689                            #  B**2 SCALED B-51
052866,000183: 13,2606  04,3757               DP1/2             =        XUNIT                                 
052867,000184: 13,2606           17711 05254  B2/A2             2DEC     .9933064884 B-1                        #  GAMMA= B**2/A**2 B-1
052868,000185: 13,2610           00155 25250  EE                2DEC     6.6935116  E-3                        #  (1-B**2/A**2) B-0
052869,000186: 13,2612           00302 17755  ERAD              2DEC     6373338    B-29                       #  PAD RADIUS
052870,000187: 

Page 1240

052872,000189:                                                                                                 #  ARCTAN SUBROUTINE
052873,000190: 
052874,000191:                                                                                                 #  CALLING SEQUENCE
052875,000192: 
052876,000193:                                                                                                 #         SIN THETA IN SINTH B-1
052877,000194:                                                                                                 #         COS THETA IN COSTH B-1
052878,000195:                                                                                                 #         CALL ARCTAN
052879,000196: 
052880,000197:                                                                                                 #  OUTPUT
052881,000198:                                                                                                 #         ARCTAN THETA IN MPAC AND THETA B-0 IN RANGE -1/2 TO +1/2
052882,000199: 
052883,000200: 13,2614           77600        ARCTAN            BOV                                            
052884,000201: 13,2615           26616                                   CLROVFLW                              
052885,000202: 13,2616           63545        CLROVFLW          DLOAD    DSQ                                   
052886,000203: 13,2617           00023                                   SINTH                                 
052887,000204: 13,2620           63525                          PDDL     DSQ                                   
052888,000205: 13,2621           00021                                   COSTH                                 
052889,000206: 13,2622           77615                          DAD                                            
052890,000207: 13,2623           75454                          BZE      SQRT                                  
052891,000208: 13,2624           26642                                   ARCTANXX                              #  ATAN=0/0  SET THETA=0
052892,000209: 13,2625           40065                          BDDV     BOV                                   
052893,000210: 13,2626           00023                                   SINTH                                 
052894,000211: 13,2627           26647                                   ATAN=90                               
052895,000212: 13,2630           67542                          SR1      ASIN                                  
052896,000213: 13,2631           00025                          STORE    THETA                                 
052897,000214: 13,2632           50125                          PDDL     BMN                                   
052898,000215: 13,2633           00021                                   COSTH                                 
052899,000216: 13,2634           26636                                   NEGCOS                                
052900,000217: 13,2635           43545                          DLOAD    RVQ                                   
052901,000218: 13,2636           57545        NEGCOS            DLOAD    DCOMP                                 
052902,000219: 13,2637           43244                          BPL      DAD                                   
052903,000220: 13,2640           26644                                   NEGOUT                                
052904,000221: 13,2641           11760                                   DP1/2                                 
052905,000222: 13,2642           00025        ARCTANXX          STORE    THETA                                 
052906,000223: 13,2643           77616                          RVQ                                            
052907,000224: 
052908,000225: 13,2644           52025        NEGOUT            DSU      GOTO                                  
052909,000226: 13,2645           11760                                   DP1/2                                 
052910,000227: 13,2646           26642                                   ARCTANXX                              
052911,000228: 13,2647           75345        ATAN=90           DLOAD    SIGN                                  
052912,000229: 13,2650           33412                                   LODP1/4                               
052913,000230: 13,2651           00023                                   SINTH                                 
052914,000231: 13,2652           00025                          STORE    THETA                                 
052915,000232: 13,2653           77616                          RVQ                                            
052916,000233: 
052917,000234: 13,2654  04,3761               2DZERO            =        DPZERO                                
052918,000235: 

Page 1241

052920,000237:                                                                                                 #  ..... SETGAMMA SUBROUTINE .....
052921,000238:                                                                                                 #  SUBROUTINE TO SET GAMMA FOR THE LAT-LONG AND LALOTORV SUBROUTINES
052922,000239: 
052923,000240:                                                                                                 #  GAMMA = B**2/A**2 FOR EARTH (B-1)
052924,000241:                                                                                                 #  GAMMA = 1 FOR MOON (B-1)
052925,000242: 
052926,000243:                                                                                                 #  CALLING SEQUENCE
052927,000244:                                                                                                 #         L       CALL
052928,000245:                                                                                                 #         L+1             SETGAMMA
052929,000246: 
052930,000247:                                                                                                 #  INPUT
052931,000248:                                                                                                 #         LUNAFLAG=0 FOR EARTH, =1 FOR MOON
052932,000249: 
052933,000250:                                                                                                 #  OUTPUT
052934,000251:                                                                                                 #         GAMMA IN GAMRP  (B-1)
052935,000252: 
052936,000253: 16,2000                                          SETLOC   LATLONG1                              
052937,000254: 16,2000                                          BANK                                           
052938,000255: 16,3766                                          COUNT*   $$/LT-LG                              
052939,000256: 
052940,000257: 16,3766           43145        SETGAMMA          DLOAD    BOFF                                  #  BRANCH FOR EARTH
052941,000258: 16,3767           26607                                   B2/A2                                 #  EARTH GAMMA
052942,000259: 16,3770           01743                                   LUNAFLAG                              
052943,000260: 16,3771           35774                                   SETGMEX                               
052944,000261: 16,3772           77735                          SLOAD                                          
052945,000262: 16,3773           11760                                   1B1                                   #  MOON GAMMA
052946,000263: 16,3774           00011        SETGMEX           STORE    GAMRP                                 
052947,000264: 16,3775           77616                          RVQ                                            
052948,000265: 16,3776                        GAMRP             =        8D                                    
052949,000266: 13,2000                                          SETLOC   LATLONG                               
052950,000267: 13,2000                                          BANK                                           
052951,000268: 

Page 1242

052953,000270:                                                                                                 #  ..... SETRE SUBROUTINE .....
052954,000271:                                                                                                 #  SUBROUTINE TO SET RE (EARTH OR MOON RADIUS)
052955,000272: 
052956,000273:                                                                                                 #   RE = RM FOR MOON
052957,000274:                                                                                                 #   RE = RREF FOR FIXED EARTH RADIUS OR COMPUTED RF FOR FISCHER ELLIPSOID
052958,000275: 
052959,000276:                                                                                                 #  CALLING SEQUENCE
052960,000277:                                                                                                 #   L     CALL
052961,000278:                                                                                                 #   L+1           SETRE
052962,000279: 
052963,000280:                                                                                                 #  SUBROUTINES USED
052964,000281:                                                                                                 #   GETERAD
052965,000282: 
052966,000283:                                                                                                 #  INPUT
052967,000284:                                                                                                 #   ERADFLAG = 0 FOR FIXED RE, 1 FOR COMPUTED RE
052968,000285:                                                                                                 #   ALPHAV +4 = 1/2 SINL IF GETERAD IS CALLED
052969,000286:                                                                                                 #   LUNAFLAG = 0 FOR EARTH, =1 FOR MOON
052970,000287: 
052971,000288:                                                                                                 #  OUTPUT
052972,000289:                                                                                                 #   ERADM = 504RM FOR MOON (METERS B-29)
052973,000290:                                                                                                 #   ERADM = ERAD OR COMPUTED RE FOR EARTH (METERS B-29)
052974,000291: 
052975,000292: 13,2654           71220        SETRE             STQ      DLOAD                                 
052976,000293: 13,2655           00051                                   SETREX                                
052977,000294: 13,2656           26701                                   504RM                                 
052978,000295: 13,2657           71214                          BON      DLOAD                                 #  BRANCH FOR MOON
052979,000296: 13,2660           01703                                   LUNAFLAG                              
052980,000297: 13,2661           26671                                   TSTRLSRM                              
052981,000298: 13,2662           26613                                   ERAD                                  
052982,000299: 13,2663           45014                          BOFF     CALL                                  #  ERADFLAG=0 FOR FIXED RE, 1 FOR COMPUTED
052983,000300: 13,2664           00742                                   ERADFLAG                              
052984,000301: 13,2665           26667                                   SETRXX                                
052985,000302: 13,2666           26570                                   GETERAD                               
052986,000303: 13,2667           36240        SETRXX            STCALL   ERADM                                 #  EXIT WITH RE OR RM METERS B-29
052987,000304: 13,2670           00051                                   SETREX                                
052988,000305: 13,2671           77214        TSTRLSRM          BON      VLOAD                                 #  ERADFLAG=0, SET R0=RLS
052989,000306: 13,2672           00702                                   ERADFLAG                              #          =1      R0=RM
052990,000307: 13,2673           26667                                   SETRXX                                
052991,000308: 13,2674           02026                                   RLS                                   
052992,000309: 13,2675           64446                          ABVAL    SR2R                                  #  SCALE FROM B-27 TO B-29
052993,000310: 13,2676           77650                          GOTO                                           
052994,000311: 13,2677           26667                                   SETRXX                                
052995,000312: 13,2700  0000051               SETREX            =        S2                                    
052996,000313: 13,2700           00065 01265  504RM             2DEC     1738090    B-29                       #  METERS B-29 (MOON RADIUS)

End of include-file LATITUDE_LONGITUDE_SUBROUTINES.agc.  Parent file is MAIN.agc