Source Code

These source-code files were transcribed from a printout in Don Eyles's personal collection, scanned by archive.org, and financially sponsored by Linden Sims. A team of volunteers performed the transcription and proof-reading. The scanned page images are available at the Virtual AGC Project website, as well as higher-quality (but much larger) images at the Virtual AGC Project's collection in the Internet Archive. Report any problems by creating "issues" at the Virtual AGC Project's GitHub Repository.

Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 56 OF AGC PROGRAM ZERLINA BY ZOROASTER
	9:12 OCT. 21,1970
Note that the date is the date of the printout, not the date of the program revision.

048967,000002:                                                                                                  ## Copyright:   Public domain.
048968,000003:                                                                                                  ## Filename:    LATITUDE_LONGITUDE_SUBROUTINES.agc
048969,000004:                                                                                                  ## Purpose:     A log section of Zerlina 56, the final revision of
048970,000005:                                                                                                  ##              Don Eyles's offline development program for the variable 
048971,000006:                                                                                                  ##              guidance period servicer. It also includes a new P66 with LPD 
048972,000007:                                                                                                  ##              (Landing Point Designator) capability, based on an idea of John 
048973,000008:                                                                                                  ##              Young's. Neither of these advanced features were actually flown,
048974,000009:                                                                                                  ##              but Zerlina was also the birthplace of other big improvements to
048975,000010:                                                                                                  ##              Luminary including the terrain model and new (Luminary 1E)
048976,000011:                                                                                                  ##              analog display programs. Zerlina was branched off of Luminary 145,
048977,000012:                                                                                                  ##              and revision 56 includes all changes up to and including Luminary
048978,000013:                                                                                                  ##              183. It is therefore quite close to the Apollo 14 program,
048979,000014:                                                                                                  ##              Luminary 178, where not modified with new features.
048980,000015:                                                                                                  ## Reference:   pp. 1124-1130
048981,000016:                                                                                                  ## Assembler:   yaYUL
048982,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
048983,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
048984,000019:                                                                                                  ## Mod history: 2017-07-28 MAS  Created from Luminary 210.
048985,000020:                                                                                                  ##              2017-08-28 MAS  Updated for Zerlina 56.
048986,000021: 

Page 1124

048988,000023:                                                                                                  #  SUBROUTINE TO CONVERT RAD VECTOR AT GIVEN TIME TO LAT,LONG AND ALT
048989,000024: 
048990,000025:                                                                                                  #  CALLING SEQUENCE
048991,000026: 
048992,000027:                                                                                                  #    L-1    CALL
048993,000028:                                                                                                  #    L             LAT-LONG
048994,000029:                                                                                                  #  SUBROUTINES USED
048995,000030: 
048996,000031:                                                                                                  #   R-TO-RP,ARCTAN,SETGAMMA,SETRE
048997,000032:                                                                                                  #  ERASABLE INIT. REQ.
048998,000033: 
048999,000034:                                                                                                  #    AXO,-AYO,AZO,TEPHEM (SET AT LAUNCH TIME)
049000,000035:                                                                                                  #  ALPHAV = POSITION VECTOR METERS B-29
049001,000036:                                                                                                  #    MPAC-- TIME  (CSECS B-28)
049002,000037:                                                                                                  #   ERADFLAG =1, TO COMPUTE EARTH RADIUS, =0 FOR FIXED EARTH RADIUS
049003,000038:                                                                                                  #   LUNAFLAG=0 FOR EARTH,1 FOR MOON
049004,000039:                                                                                                  #  OUTPUT
049005,000040: 
049006,000041:                                                                                                  #    LATITUDE IN LAT   (REVS. B-0)
049007,000042:                                                                                                  #    LONGITUDE IN LONG   (REVS. B-0)
049008,000043:                                                                                                  #  ALTITUDE IN ALT METERS B-29
049009,000044: 30,3761                                           BANK     30                                    
049010,000045: 13,2000                                           SETLOC   LATLONG                               
049011,000046: 13,2000                                           BANK                                           
049012,000047: 
049013,000048: 13,2347                                           COUNT*   $$/LT-LG                              
049014,000049: 13,2347  E4,1431                                  EBANK=   ALPHAV                                
049015,000050: 13,2347           40220        LAT-LONG           STQ      SETPD                                 
049016,000051: 13,2350           03674                                    INCORPEX                              
049017,000052: 13,2351           00001                                    0D                                    
049018,000053: 13,2352           24007                           STOVL    6D                                    #  SAVE TIME IN 6-7D FOR R-TO-RP
049019,000054: 13,2353           02032                                    ALPHAV                                
049020,000055: 13,2354           51406                           PUSH     ABVAL                                 #  0-5D= R FOR R-TO-RP
049021,000056: 13,2355           16070                           STODL    ALPHAM                                #  ABS. VALUE OF R FOR ALT FORMULA BELOW
049022,000057: 13,2356           24007                                    ZEROVEC                               #  SET MPAC=0 FOR EARTH,NON-ZERO FOR MOON
049023,000058: 13,2357           71414                           BOFF     COS                                   #  USE COS(0) TO GET NON-ZERO IN MPAC
049024,000059: 13,2360           01743                                    LUNAFLAG                              #  0=EARTH,1=MOON
049025,000060: 13,2361           26362                                    CALLRTRP                              
049026,000061: 13,2362           77624        CALLRTRP           CALL                                           
049027,000062: 13,2363           51644                                    R-TO-RP                               #  RP VECTOR CONVERTED FROM R B-29
049028,000063: 13,2364           77656                           UNIT                                           #  UNIT RP B-1
049029,000064: 13,2365           36032                           STCALL   ALPHAV                                #  U2= 1/2 SINL FOR SETRE SUBR BELOW
049030,000065: 13,2366           26546                                    SETGAMMA                              #   SET GAMMA=B2/A2 FOR EARTH,=1 FOR MOON
049031,000066: 13,2367           77624                           CALL                                           #   SCALED B-1
049032,000067: 13,2370           26556                                    SETRE                                 #  CALC RE METERS B-29
049033,000068: 13,2371           63545                           DLOAD    DSQ                                   
049034,000069: 13,2372           02032                                    ALPHAV                                
049035,000070: 13,2373           63525                           PDDL     DSQ                                   
049036,000071: 13,2374           02034                                    ALPHAV     +2                         
049037,000072: 13,2375           75415                           DAD      SQRT                                  

Page 1125

049039,000074: 13,2376           76405                           DMP      SL1R                                  
049040,000075: 13,2377           00011                                    GAMRP                                 
049041,000076: 13,2400           14021                           STODL    COSTH                                 #  COS(LAT) B-1
049042,000077: 13,2401           02036                                    ALPHAV     +4                         
049043,000078: 13,2402           34023                           STCALL   SINTH                                 #  SIN(LAT) B-1
049044,000079: 13,2403           26506                                    ARCTAN                                
049045,000080: 13,2404           15120                           STODL    LAT                                   #  LAT B0
049046,000081: 13,2405           02032                                    ALPHAV                                
049047,000082: 13,2406           14021                           STODL    COSTH                                 #  COS(LONG) B-1
049048,000083: 13,2407           02034                                    ALPHAV     +2                         
049049,000084: 13,2410           34023                           STCALL   SINTH                                 #  SIN(LONG) B-1
049050,000085: 13,2411           26506                                    ARCTAN                                
049051,000086: 13,2412           15122                           STODL    LONG                                  #  LONG. REVS B-0 IN RANGE -1/2 TO 1/2
049052,000087: 13,2413           02070                                    ALPHAM                                
049053,000088: 13,2414           77625                           DSU                                            #  ALT= R-RE METERS B-29
049054,000089: 13,2415           03673                                    ERADM                                 
049055,000090: 13,2416           35124                           STCALL   ALT                                   #  EXIT WITH ALT METERS B-29
049056,000091: 13,2417           03674                                    INCORPEX                              
049057,000092: 

Page 1126

049059,000094:                                                                                                  #  SUBROUTINE TO CONVERT LAT,LONG,ALT AT GIVEN TIME TO RADIUS VECTOR
049060,000095:                                                                                                  #  CALLING SEQUENCE
049061,000096: 
049062,000097:                                                                                                  #    L-1    CALL
049063,000098:                                                                                                  #    L             LALOTORV
049064,000099:                                                                                                  #  SUBROUTINES USED
049065,000100: 
049066,000101:                                                                                                  #   SETGAMMA,SETRE,RP-TO-R
049067,000102:                                                                                                  #  ERASABLE INIT. REQ.
049068,000103: 
049069,000104:                                                                                                  #    AXO,AYO,AZO,TEPHEM  SET AT LAUNCH TIME
049070,000105:                                                                                                  #    LAT-- LATITUDE  (REVS B0)
049071,000106:                                                                                                  #    LONG-- LONGITUDE  (REVS B0)
049072,000107:                                                                                                  #  ALT--ALTITUDE (METERS) B-29
049073,000108:                                                                                                  #    MPAC-- TIME  (CSECS B-28)
049074,000109:                                                                                                  #    ERADFLAG =1 TO COMPUTE EARTH RADIUS, =0 FOR FIXED EARTH RADIUS
049075,000110:                                                                                                  #   LUNAFLAG=0 FOR EARTH,1 FOR MOON
049076,000111:                                                                                                  #  OUTPUT
049077,000112: 
049078,000113:                                                                                                  #  R-VECTOR IN ALPHAV (METERS B-29)
049079,000114: 13,2420           40220        LALOTORV           STQ      SETPD                                 #  LAT,LONG,ALT TO R VECTOR
049080,000115: 13,2421           03674                                    INCORPEX                              
049081,000116: 13,2422           00001                                    0D                                    
049082,000117: 13,2423           34007                           STCALL   6D                                    #  6-7D= TIME FOR RP-TO-R
049083,000118: 13,2424           26546                                    SETGAMMA                              #  GAMMA=B2/A2 FOR EARTH,1 FOR MOON B-1
049084,000119: 13,2425           73545                           DLOAD    SIN                                   #                COS(LONG)COS(LAT) IN MPAC
049085,000120: 13,2426           01120                                    LAT                                   #       UNIT RP= SIN(LONG)COS(LAT)    2-3D
049086,000121: 13,2427           65275                           DMPR     PDDL                                  #  PD 2          GAMMA*SIN(LAT)       0-1D
049087,000122: 13,2430           00011                                    GAMRP                                 
049088,000123: 13,2431           01120                                    LAT                                   #          0-1D= GAMMA*SIN(LAT) B-2
049089,000124: 13,2432           65346                           COS      PDDL                                  #  PD4      2-3D=COS(LAT) B-1 TEMPORARILY
049090,000125: 13,2433           01122                                    LONG                                  
049091,000126: 13,2434           57356                           SIN      DMPR                                  #  PD 2
049092,000127: 13,2435           71525                           PDDL     COS                                   #  PD 4    2-3D=SIN(LONG)COS(LAT) B-2
049093,000128: 13,2436           01120                                    LAT                                   
049094,000129: 13,2437           71525                           PDDL     COS                                   #  PD 6     4-5D=COS(LAT) B-1 TEMPORARILY
049095,000130: 13,2440           01122                                    LONG                                  
049096,000131: 13,2441           55475                           DMPR     VDEF                                  #  PD 4    MPAC= COS(LONG)COS(LAT) B-2
049097,000132: 13,2442           41456                           UNIT     PUSH                                  #  0-5D= UNIT RP FOR RP-TO-R SUBR.
049098,000133: 13,2443           36032                           STCALL   ALPHAV                                #  ALPHAV +4= SINL FOR SETRE SUBR.
049099,000134: 13,2444           26556                                    SETRE                                 #  RE METERS B-29
049100,000135: 13,2445           43145                           DLOAD    BOFF                                  #  SET MPAC=0 FOR EARTH,NON-ZERO FOR MOON
049101,000136: 13,2446           24007                                    ZEROVEC                               
049102,000137: 13,2447           01743                                    LUNAFLAG                              
049103,000138: 13,2450           26452                                    CALLRPRT                              
049104,000139: 13,2451           77746                           COS                                            #  USE COS(0) TO GET NON-ZERO IN MPAC
049105,000140: 13,2452           77624        CALLRPRT           CALL                                           
049106,000141: 13,2453           55720                                    RP-TO-R                               #  EXIT WITH UNIT R VECTOR IN MPAC
049107,000142: 13,2454           16032                           STODL    ALPHAV                                
049108,000143: 13,2455           03673                                    ERADM                                 

Page 1127

049110,000145: 13,2456           74215                           DAD      VXSC                                  #  (RE + ALT)(UNIT R) METERS B-30
049111,000146: 13,2457           01124                                    ALT                                   
049112,000147: 13,2460           02032                                    ALPHAV                                
049113,000148: 13,2461           77772                           VSL1                                           #  R METERS B-29
049114,000149: 13,2462           36032                           STCALL   ALPHAV                                #  EXIT WITH R IN METERS B-29
049115,000150: 13,2463           03674                                    INCORPEX                              
049116,000151:                                                                                                  #  SUBROUTINE TO COMPUTE EARTH RADIUS
049117,000152: 
049118,000153:                                                                                                  #  INPUT
049119,000154: 
049120,000155:                                                                                                  #    1/2 SIN LAT IN ALPHAV +4
049121,000156: 
049122,000157:                                                                                                  #  OUTPUT
049123,000158: 
049124,000159:                                                                                                  #    EARTH RADIUS IN ERADM AND MPAC  (METERS B-29)
049125,000160: 
049126,000161: 13,2464           63545        GETERAD            DLOAD    DSQ                                   
049127,000162: 13,2465           02036                                    ALPHAV     +4                         #  SIN**2(L)
049128,000163: 13,2466           44352                           SL1      BDSU                                  
049129,000164: 13,2467           24005                                    DP1/2                                 #  COS**2(L)
049130,000165: 13,2470           44275                           DMPR     BDSU                                  
049131,000166: 13,2471           26505                                    EE                                    
049132,000167: 13,2472           24005                                    DP1/2                                 
049133,000168: 13,2473           75465                           BDDV     SQRT                                  
049134,000169: 13,2474           26501                                    B2XSC                                 
049135,000170: 13,2475           77622                           SR4R                                           
049136,000171: 13,2476           03673                           STORE    ERADM                                 
049137,000172: 13,2477           77616                           RVQ                                            
049138,000173: 
049139,000174:                                                                                                  #  THE FOLLOWING CONSTANTS WERE COMPUTED WITH A=6378166,B=6356784 METERS
049140,000175:                                                                                                  #  B2XSC= B**2 SCALED B-51
049141,000176:                                                                                                  #  B2/A2= B**2/A**2 SCALED B-1
049142,000177:                                                                                                  #  EE=(1-B**2/A**2) SCALED B-0
049143,000178: 13,2500           00446 00305  B2XSC              2DEC     .0179450689                            #  B**2 SCALED B-51
049144,000179: 
049145,000180: 13,2502  12,2004               DP1/2              =        XUNIT                                 
049146,000181: 13,2502           17711 05254  B2/A2              2DEC     .9933064884 B-1                        #  GAMMA= B**2/A**2 B-1
049147,000182: 
049148,000183: 13,2504           00155 25250  EE                 2DEC     6.6935116  E-3                        #  (1-B**2/A**2) B-0
049149,000184: 

Page 1128

049151,000186:                                                                                                  #  ARCTAN SUBROUTINE
049152,000187: 
049153,000188: 
049154,000189:                                                                                                  #  CALLING SEQUENCE
049155,000190: 
049156,000191:                                                                                                  #    SIN THETA IN SINTH B-1
049157,000192:                                                                                                  #    COS THETA IN COSTH B-1
049158,000193:                                                                                                  #    CALL ARCTAN
049159,000194: 
049160,000195:                                                                                                  #  OUTPUT
049161,000196:                                                                                                  #     ARCTAN THETA IN MPAC AND THETA B-0 IN RANGE -1/2 TO +1/2
049162,000197: 
049163,000198: 
049164,000199: 13,2506           77600        ARCTAN             BOV                                            
049165,000200: 13,2507           26510                                    CLROVFLW                              
049166,000201: 13,2510           63545        CLROVFLW           DLOAD    DSQ                                   
049167,000202: 13,2511           00023                                    SINTH                                 
049168,000203: 13,2512           63525                           PDDL     DSQ                                   
049169,000204: 13,2513           00021                                    COSTH                                 
049170,000205: 13,2514           77615                           DAD                                            
049171,000206: 13,2515           75454                           BZE      SQRT                                  
049172,000207: 13,2516           26534                                    ARCTANXX                              #  ATAN=0/0  SET THETA=0
049173,000208: 13,2517           40065                           BDDV     BOV                                   
049174,000209: 13,2520           00023                                    SINTH                                 
049175,000210: 13,2521           26541                                    ATAN=90                               
049176,000211: 13,2522           67542                           SR1      ASIN                                  
049177,000212: 13,2523           00025                           STORE    THETA                                 
049178,000213: 13,2524           50125                           PDDL     BMN                                   
049179,000214: 13,2525           00021                                    COSTH                                 
049180,000215: 13,2526           26530                                    NEGCOS                                
049181,000216: 13,2527           43545                           DLOAD    RVQ                                   
049182,000217: 13,2530           57545        NEGCOS             DLOAD    DCOMP                                 
049183,000218: 13,2531           43244                           BPL      DAD                                   
049184,000219: 13,2532           26536                                    NEGOUT                                
049185,000220: 13,2533           24005                                    DP1/2                                 
049186,000221: 13,2534           00025        ARCTANXX           STORE    THETA                                 
049187,000222: 13,2535           77616                           RVQ                                            
049188,000223: 
049189,000224: 13,2536           52025        NEGOUT             DSU      GOTO                                  
049190,000225: 13,2537           24005                                    DP1/2                                 
049191,000226: 13,2540           26534                                    ARCTANXX                              
049192,000227: 13,2541           75345        ATAN=90            DLOAD    SIGN                                  
049193,000228: 13,2542           11011                                    LODP1/4                               
049194,000229: 13,2543           00023                                    SINTH                                 
049195,000230: 13,2544           00025                           STORE    THETA                                 
049196,000231: 13,2545           77616                           RVQ                                            
049197,000232: 
049198,000233: 13,2546  12,2006               2DZERO             =        DPZERO                                
049199,000234: 

Page 1129

049201,000236:                                                                                                  #  ..... SETGAMMA SUBROUTINE .....
049202,000237:                                                                                                  #  SUBROUTINE TO SET GAMMA FOR THE LAT-LONG AND LALOTORV SUBROUTINES
049203,000238: 
049204,000239:                                                                                                  #   GAMMA = B**2/A**2 FOR EARTH (B-1)
049205,000240:                                                                                                  #   GAMMA = 1 FOR MOON (B-1)
049206,000241: 
049207,000242:                                                                                                  #  CALLING SEQUENCE
049208,000243:                                                                                                  #   L       CALL
049209,000244:                                                                                                  #   L+1            SETGAMMA
049210,000245: 
049211,000246:                                                                                                  #  INPUT
049212,000247:                                                                                                  #   LUNAFLAG=0 FOR EARTH,=1 FOR MOON
049213,000248: 
049214,000249:                                                                                                  #  OUTPUT
049215,000250:                                                                                                  #   GAMMA IN GAMRP  (B-1)
049216,000251: 
049217,000252: 13,2546           43145        SETGAMMA           DLOAD    BOFF                                  #  BRANCH FOR EARTH
049218,000253: 13,2547           26503                                    B2/A2                                 #  EARTH GAMMA
049219,000254: 13,2550           01743                                    LUNAFLAG                              
049220,000255: 13,2551           26554                                    SETGMEX                               
049221,000256: 13,2552           77735                           SLOAD                                          
049222,000257: 13,2553           24005                                    1B1                                   #  MOON GAMMA
049223,000258: 13,2554           00011        SETGMEX            STORE    GAMRP                                 
049224,000259: 13,2555           77616                           RVQ                                            
049225,000260: 13,2556                        GAMRP              =        8D                                    
049226,000261: 

Page 1130

049228,000263:                                                                                                  #  .....SETRE SUBROUTINE .....
049229,000264:                                                                                                  #  SUBROUTINE TO SET RE (EARTH OR MOON RADIUS)
049230,000265: 
049231,000266:                                                                                                  #  RE= RM FOR MOON
049232,000267:                                                                                                  #   RE= RREF FOR FIXED EARTH RADIUS OR COMPUTED RF FOR FISCHER ELLIPSOID
049233,000268: 
049234,000269:                                                                                                  #  CALLING SEQUENCE
049235,000270:                                                                                                  #   L       CALL
049236,000271:                                                                                                  #   L+1            SETRE
049237,000272: 
049238,000273:                                                                                                  #  SUBROUTINES USED
049239,000274:                                                                                                  #   GETERAD
049240,000275: 
049241,000276:                                                                                                  #  INPUT
049242,000277:                                                                                                  #   ERADFLAG=0 FOR FIXED RE, 1 FOR COMPUTED RE
049243,000278:                                                                                                  #   ALPHAV +4= 1/2 SINL IF GETERAD IS CALLED
049244,000279:                                                                                                  #   LUNAFLAG=0 FOR EARTH,=1 FOR MOON
049245,000280: 
049246,000281:                                                                                                  #  OUTPUT
049247,000282:                                                                                                  #   ERADM= 504RM FOR MOON (METERS B-29)
049248,000283:                                                                                                  #   ERADM= ERAD OR COMPUTED RF FOR EARTH (METERS B-29)
049249,000284: 
049250,000285: 13,2556           71220        SETRE              STQ      DLOAD                                 
049251,000286: 13,2557           00051                                    SETREX                                
049252,000287: 13,2560           10003                                    504RM                                 
049253,000288: 13,2561           71214                           BON      DLOAD                                 #  BRANCH FOR MOON
049254,000289: 13,2562           01703                                    LUNAFLAG                              
049255,000290: 13,2563           26573                                    TSTRLSRM                              
049256,000291: 13,2564           10001                                    ERAD                                  
049257,000292: 13,2565           45014                           BOFF     CALL                                  #  ERADFLAG=0 FOR FIXED RE,1 FOR COMPUTED
049258,000293: 13,2566           00742                                    ERADFLAG                              
049259,000294: 13,2567           26571                                    SETRXX                                
049260,000295: 13,2570           26464                                    GETERAD                               
049261,000296: 13,2571           37673        SETRXX             STCALL   ERADM                                 #  EXIT WITH RE OR RM METERS B-29
049262,000297: 13,2572           00051                                    SETREX                                
049263,000298: 13,2573           77214        TSTRLSRM           BON      VLOAD                                 #  ERADFLAG=0,SET R0=RLS
049264,000299: 13,2574           00702                                    ERADFLAG                              #          =1     R0=RM
049265,000300: 13,2575           26571                                    SETRXX                                
049266,000301: 13,2576           02021                                    RLS                                   
049267,000302: 13,2577           64446                           ABVAL    SR2R                                  #  SCALE FROM B-27 TO B-29
049268,000303: 13,2600           77650                           GOTO                                           
049269,000304: 13,2601           26571                                    SETRXX                                
049270,000305: 13,2602  0000051               SETREX             =        S2                                    

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