Source Code
These source-code files derive from a printout of Luminary 210 (Apollo 15-17
Lunar Module guidance computer program), from the personal library of
original AGC developer Don Eyles, digitally photographed at archive.org,
financially sponsored by Jim Lawton, and transcribed to source code by a
team of volunteers. This colorized, syntax-highlighted form was created
by assembling that transcribed source code. Note that the full page images
are available on the
Virtual AGC project page at archive.org, while reduced-size images
are presented at the VirtualAGC project website. Report or fix any
transcription errors at
the Virtual AGC project code repository. Notations on the program listing read, in part: GAP: ASSEMBLE REVISION 210 OF AGC PROGRAM LUMINARY BY NASA 2021112-161 17:11 MAR. 19,1971Note that the date is the date of the printout, not the date of the program revision. |
043168,000002: ## Copyright: Public domain.
043169,000003: ## Filename: LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc
043170,000004: ## Purpose: A section of Luminary revision 210.
043171,000005: ## It is part of the source code for the Lunar Module's (LM)
043172,000006: ## Apollo Guidance Computer (AGC) for Apollo 15-17.
043173,000007: ## This file is intended to be a faithful transcription, except
043174,000008: ## that the code format has been changed to conform to the
043175,000009: ## requirements of the yaYUL assembler rather than the
043176,000010: ## original YUL assembler.
043177,000011: ## Reference: pp. 982-985
043178,000012: ## Assembler: yaYUL
043179,000013: ## Contact: Ron Burkey <info@sandroid.org>.
043180,000014: ## Website: www.ibiblio.org/apollo/index.html
043181,000015: ## Mod history: 2016-11-17 JL Created from Luminary131 version.
043182,000016: ## 2016-11-29 HG Transcribed
043183,000017: ## 2016-12-12 HG Fix for interpretive operands 8D -> 9D
043184,000018: ## 5D -> 6D
043185,000019: ## 2016-12-26 RSB Comment-text proofed using ProoferComments
043186,000020: ## and corrected errors found.
043187,000021: ## 2017-03-13 RSB Comment-text fixes noted in proofing Luminary 116.
043188,000022: ## 2017-08-26 MAS Fixed comment-text errors found while transcribing Zerlina 56.
043189,000023:
Page 982 |
043191,000025: # NAME - LSPOS - LOCATE SUN AND MOON DATE - 25 OCT 67
043192,000026: # MOD NO.2 (DATE OCT 70)
043193,000027: # MOD BY NEVILLE ASSEMBLY SUNDANCE
043194,000028:
043195,000029: # FUNCTIONAL DESCRIPTION
043196,000030:
043197,000031: # COMPUTES UNIT POSITION VECTOR OF THE SUN AND MOON IN THE BASIC REFERENCE SYSTEM. THE SUN VECTOR S IS
043198,000032: # LOCATED VIA TWO ANGLES. THE FIRST ANGLE(OBLIQUITY) IS THE ANGLE BETWEEN THE EARTH EQUATOR AND THE ECLIPTIC. THE
043199,000033: # SECOND ANGLE IS THE LONGITUDE OF THE SUN MEASURED IN THE ECLIPTIC.
043200,000034: # THE POSITION VECTOR OF THE SUN IS
043201,000035: # -
043202,000036: # S=(COS(LOS), COS(OBL)*SIN(LOS), SIN(OBL)*SIN(LOS)), WHERE
043203,000037:
043204,000038: # LOS=LOS +LOS *T-(C *SIN(2PI*T)/365.24 +C *COS(2PI*T)/365.24)
043205,000039: # 0 R 0 1
043206,000040: # LOS (RAD) IS THE LONGITUDE OF THE SUN FOR MIDNIGHT JUNE 30TH OF THE PARTICULAR YEAR.
043207,000041: # 0
043208,000042: # LOS (RAD/DAY) IS THE MEAN RATE FOR THE PARTICULAR YEAR.
043209,000043: # R
043210,000044: # LOS AND LOS ARE STORED AS LOSC AND LOSR IN RATESP.
043211,000045: # 0 R
043212,000046: # COS(OBL) AND SIN(OBL) ARE STORED IN THE MATRIX KONMAT.
043213,000047: # T, TIME MEASURED IN DAYS (24 HOURS), IS STORED IN TIMEP.
043214,000048: # C AND C ARE FUDGE FACTORS TO MINIMIZE THE DEVIATION. THEY ARE STORED AS ONE CONSTANT(CMOD), SINCE
043215,000049: # 0 1 2 2 1/2
043216,000050: # C *SIN(X)+C *COS(X) CAN BE WRITTEN AS (C +C ) *SIN(X+PHI), WHERE PHI=ARCTAN(C /C ).
043217,000051: # 0 1 0 1 1 0
043218,000052:
043219,000053: # THE MOON IS LOCATED VIA FOUR ANGLES. THE FIRST IS THE OBLIQUITY. THE SECOND IS THE MEAN LONGITUDE OF THE MOON,
043220,000054: # MEASURED IN THE ECLIPTIC FROM THE MEAN EQUINOX TO THE MEAN ASCENDING NODE OF THE LUNAR ORBIT, AND THEN ALONG THE
043221,000055: # ORBIT. THE THIRD ANGLE IS THE ANGLE BETWEEN THE ECLIPTIC AND THE LUNAR ORBIT. THE FOURTH ANGLE IS THE LONGITUDE
043222,000056: # OF THE NODE OF THE MOON, MEASURED IN THE LUNAR ORBIT. LET THESE ANGLES BE OBL,LOM,IM, AND LON RESPECTIVELY.
043223,000057:
043224,000058: # THE SIMPLIFIED POSITION VECTOR OF THE MOON IS
043225,000059: # -
043226,000060: # M=(COS(LOM), COS(OBL)*SIN(LOM)-SIN(OBL)*SIN(IM)*SIN(LOM-LON), SIN(OBL)*SIN(LOM)+COS(OBL)*SIN(IM)*SIN(LOM-LON))
043227,000061:
043228,000062: # WHERE
043229,000063: # LOM=LOM +LOM *T-(A *SIN 2PI*T/27.5545+A *COS(2PI*T/27.5545)+B *SIN 2PI*T/32+B *COS(2PI*T/32)), AND
043230,000064: # 0 R 0 1 0 1
043231,000065: # LON=LON +LON
043232,000066: # 0 R
043233,000067: # A , A , B AND B ARE STORED AS AMOD AND BMOD (SEE DESCRIPTION OF CMOD, ABOVE). COS(OBL), SIN(OBL)*SIN(IM),
043234,000068: # 0 1 0 1
043235,000069: # SIN(OBL), AND COS(OBL)*SIN(IM) ARE STORED IN KONMAT AS K1, K2, K3 AND K4, RESPECTIVELY. LOM , LOM , LON , LON
043236,000070: # ARE STORED AS LOMO, LOMR, LONO, AND LONR IN RATESP. 0 R 0 R
043237,000071: # THE THREE PHIS ARE STORED AS AARG, BARG, AND CARG(SUN). ALL CONSTANTS ARE UPDATED BY YEAR.
043238,000072:
043239,000073: # CALLING SEQUENCE
043240,000074:
Page 983 |
043242,000076: # CALL LSPOS. RETURN IS VIA CPRET.
043243,000077:
043244,000078: # ALARMS OR ABORTS
043245,000079:
043246,000080: # NONE
043247,000081:
043248,000082: # ERASABLE INITIALIZATION REQUIRED
043249,000083:
043250,000084: # TEPHEM - TIME FROM MIDNIGHT 1 JULY PRECEDING THE LAUNCH TO THE TIME OF THE LAUNCH (WHEN THE AGC CLOCK WENT
043251,000085: # TO ZERO). TEPHEM IS TP WITH UNITS OF CENTI-SECONDS.
043252,000086: # TIME2 AND TIME1 ARE IN MPAC AND MPAC +1 WHEN PROGRAM IS CALLED.
043253,000087:
043254,000088: # OUTPUT
043255,000089:
043256,000090: # UNIT POSITIONAL VECTOR OF SUN IN VSUN. (SCALED B-1)
043257,000091: # UNIT POSITIONAL VECTOR OF MOON IN VMOON. (SCALED B-1)
043258,000092:
043259,000093: # SUBROUTINES USED
043260,000094:
043261,000095: # NONE
043262,000096:
043263,000097: # DEBRIS
043264,000098:
043265,000099: # CURRENT CORE SET, WORK AREA AND FREEFLAG
043266,000100: 04,3030 BANK 04
043267,000101: 15,2000 SETLOC EPHEM
043268,000102: 15,2000 BANK
043269,000103:
043270,000104: 15,3646 E5,1714 EBANK= VSUN
043271,000105: 15,3646 COUNT* $$/EPHEM
043272,000106: 15,3646 15,3646 LUNPOS EQUALS LSPOS
043273,000107:
043274,000108: 15,3646 54201 LSPOS SETPD SR
043275,000109: 15,3647 00001 0
043276,000110: 15,3650 20617 14D # TP
043277,000111: 15,3651 56371 TAD DDV
043278,000112: 15,3652 01707 TEPHEM # TIME OF LAUNCH
043279,000113: 15,3653 32001 CSTODAY # 24 HOURS-8640000 CENTI-SECS/DAY B-32
043280,000114: 15,3654 00031 STORE TIMEP # T IN DAYS
043281,000115: 15,3655 77170 AXT,1 AXT,2
043282,000116: 15,3656 00000 0
043283,000117: 15,3657 00000 0
043284,000118: 15,3660 77614 CLEAR
043285,000119: 15,3661 00274 FREEFLAG # SWITCH BIT
043286,000120: 15,3662 77745 POSITA DLOAD
043287,000121: 15,3663 12004 KONMAT +2 # ZEROS
043288,000122: 15,3664 00027 STORE GTMP
043289,000123: 15,3665 40745 POSITB DLOAD DMP*
043290,000124: 15,3666 00031 TIMEP # T
043291,000125: 15,3667 12030 VAL67 +4,1 # 1/27 OR 1/32 OR 1/365
Page 984 |
043293,000127: 15,3670 42661 SL DAD*
043294,000128: 15,3671 20212 9D
043295,000129: 15,3672 12026 VAL67 +2,1 # AARG
043296,000130: 15,3673 40756 SIN DMP* # SIN(T/27+PHI) OR T/32 OR T/365
043297,000131: 15,3674 12024 VAL67,1 # (A0**2+A1**2)**1/2 SIN(X+PHIA)
043298,000132: 15,3675 62015 DAD INCR,1 # PLUS
043299,000133: 15,3676 00027 GTMP # (B0**2+B1**2)**1/2 SIN(X+PHIB)
043300,000134: 15,3677 77771 DEC -6 B-14
043301,000135: 15,3700 00027 STORE GTMP # OR (C0**2+C1**2)**1/2 SIN(X+PHIC)
043302,000136: 15,3701 77614 BOFSET
043303,000137: 15,3702 00054 FREEFLAG
043304,000138: 15,3703 33665 POSITB
043305,000139: 15,3704 40745 POSITD DLOAD DMP*
043306,000140: 15,3705 00031 TIMEP # T
043307,000141: 15,3706 67752 RATESP,2 # LOMR,LOSR,LONR
043308,000142: 15,3707 42661 SL DAD*
043309,000143: 15,3710 20207 6D
043310,000144: 15,3711 67744 RATESP +6,2 # LOMO,LOSO,LONO
043311,000145: 15,3712 77625 DSU
043312,000146: 15,3713 00027 GTMP
043313,000147: 15,3714 10021 STORE STMP,2 # LOM,LOS,LON
043314,000148: 15,3715 63135 SLOAD INCR,2
043315,000149: 15,3716 00050 X2
043316,000150: 15,3717 77775 DEC -2 B-14
043317,000151: 15,3720 53015 DAD BZE
043318,000152: 15,3721 32003 RCB-13 # PLUS 2
043319,000153: 15,3722 33752 POSITE # 2ND
043320,000154: 15,3723 77644 BPL
043321,000155: 15,3724 33662 POSITA # 1ST
043322,000156: 15,3725 45345 POSITF DLOAD DSU # 3RD
043323,000157: 15,3726 00021 STMP # LOM
043324,000158: 15,3727 00025 STMP +4 # LON
043325,000159: 15,3730 65356 SIN PDDL # SIN(LOM-LON)
043326,000160: 15,3731 00021 STMP
043327,000161: 15,3732 65356 SIN PDDL # SIN LOM
043328,000162: 15,3733 00021 STMP
043329,000163: 15,3734 55546 COS VDEF # COS LOM
043330,000164: 15,3735 53521 MXV UNIT
043331,000165: 15,3736 12002 KONMAT # K1,K2,K3,K4,
043332,000166: 15,3737 02723 STORE VMOON
043333,000167: 15,3740 65345 DLOAD PDDL
043334,000168: 15,3741 12004 KONMAT +2 # ZERO
043335,000169: 15,3742 00023 STMP +2
043336,000170: 15,3743 65356 SIN PDDL # SIN LOS
043337,000171: 15,3744 00023 STMP +2
043338,000172: 15,3745 55546 COS VDEF # COS LOS
043339,000173: 15,3746 53521 MXV UNIT
043340,000174: 15,3747 12002 KONMAT
043341,000175: 15,3750 02715 STORE VSUN
043342,000176: 15,3751 77616 RVQ
043343,000177:
Page 985 |
043345,000179: 15,3752 77745 POSITE DLOAD
043346,000180: 15,3753 12004 KONMAT +2 # ZEROS
043347,000181: 15,3754 00027 STORE GTMP
043348,000182: 15,3755 77650 GOTO
043349,000183: 15,3756 33704 POSITD
043350,000184: 05,2000 SETLOC EPHEM1
043351,000185: 05,2000 BANK
043352,000186:
043353,000187: 05,3507 COUNT* $$/EPHEM
043354,000188:
043355,000189: 05,3507 STMP EQUALS 16D
043356,000190:
043357,000191: 05,3507 GTMP EQUALS 22D
043358,000192:
043359,000193: 05,3507 TIMEP EQUALS 24D
End of include-file LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc. Parent file is MAIN.agc