Source Code
These source-code files are part of a reconstructed copy of Luminary 163, the
first (unflown) release of the Apollo 14 Lunar Module (LM) Apollo Guidance
Computer (AGC) software.
The reconstruction began with reconstructed source code for Luminary 173. Changes between revision 163 and 173 were backed out, as described by Luminary memos 157 and 158. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152N. Note that page numbers in the reconstructed code match those for the baseline log section mentioned in each file's changelog; the page numbers for a real Luminary 163 listing would be different. Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository. |
042201,000002: ## Copyright: Public domain.
042202,000003: ## Filename: LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc
042203,000004: ## Purpose: A section of Luminary revision 163.
042204,000005: ## It is part of the reconstructed source code for the first
042205,000006: ## (unflown) release of the flight software for the Lunar
042206,000007: ## Module's (LM) Apollo Guidance Computer (AGC) for Apollo 14.
042207,000008: ## The code has been recreated from a reconstructed copy of
042208,000009: ## Luminary 173, as well as Luminary memos 157 amd 158.
042209,000010: ## It has been adapted such that the resulting bugger words
042210,000011: ## exactly match those specified for Luminary 163 in NASA
042211,000012: ## drawing 2021152N, which gives relatively high confidence
042212,000013: ## that the reconstruction is correct.
042213,000014: ## Reference: pp. 975-978
042214,000015: ## Assembler: yaYUL
042215,000016: ## Contact: Ron Burkey <info@sandroid.org>.
042216,000017: ## Website: www.ibiblio.org/apollo/index.html
042217,000018: ## Mod history: 2019-08-21 MAS Created from Luminary 173.
042218,000019:
Page 975 |
042220,000021: # NAME - LSPOS - LOCATE SUN AND MOON DATE - 25 OCT 67
042221,000022: # MOD NO.1
042222,000023: # MOD BY NEVILLE ASSEMBLY SUNDANCE
042223,000024:
042224,000025: # FUNCTIONAL DESCRIPTION
042225,000026:
042226,000027: # COMPUTES UNIT POSITION VECTOR OF THE SUN AND MOON IN THE BASIC REFERENCE SYSTEM. THE SUN VECTOR S IS
042227,000028: # LOCATED VIA TWO ANGLES. THE FIRST ANGLE(OBLIQUITY) IS THE ANGLE BETWEEN THE EARTH EQUATOR AND THE ECLIPTIC. THE
042228,000029: # SECOND ANGLE IS THE LONGITUDE OF THE SUN MEASURED IN THE ECLIPTIC.
042229,000030: # THE POSITION VECTOR OF THE SUN IS
042230,000031: # -
042231,000032: # S=(COS(LOS), COS(OBL)*SIN(LOS), SIN(OBL)*SIN(LOS)), WHERE
042232,000033:
042233,000034: # LOS=LOS +LOS *T-(C *SIN(2PI*T)/365.24 +C *COS(2PI*T)/365.24)
042234,000035: # 0 R 0 1
042235,000036: # LOS (RAD) IS THE LONGITUDE OF THE SUN FOR MIDNIGHT JUNE 30TH OF THE PARTICULAR YEAR.
042236,000037: # 0
042237,000038: # LOS (RAD/DAY) IS THE MEAN RATE FOR THE PARTICULAR YEAR.
042238,000039: # R
042239,000040: # LOS AND LOS ARE STORED AS LOSC AND LOSR IN RATESP.
042240,000041: # 0 R
042241,000042: # COS(OBL) AND SIN(OBL) ARE STORED IN THE MATRIX KONMAT.
042242,000043: # T, TIME MEASURED IN DAYS(24 HOURS), IS STORED IN TIMEP.
042243,000044: # C AND C ARE FUDGE FACTORS TO MINIMIZE THE DEVIATION. THEY ARE STORED AS ONE CONSTANT(CMOD), SINCE
042244,000045: # 0 1 2 2 1/2
042245,000046: # C *SIN(X)+C *COS(X) CAN BE WRITTEN AS (C +C ) *SIN(X+PHI), WHERE PHI=ARCTAN(C /C ).
042246,000047: # 0 1 0 1 1 0
042247,000048:
042248,000049: # THE MOON IS LOCATED VIA FOUR ANGLES. THE FIRST IS THE OBLIQUITY. THE SECOND IS THE MEAN LONGITUDE OF THE MOON,
042249,000050: # MEASURED IN THE ECLIPTIC FROM THE MEAN EQUINOX TO THE MEAN ASCENDING NODE OF THE LUNAR ORBIT, AND THEN ALONG THE
042250,000051: # ORBIT. THE THIRD ANGLE IS THE ANGLE BETWEEN THE ECLIPTIC AND THE LUNAR ORBIT. THE FOURTH ANGLE IS THE LONGITUDE
042251,000052: # OF THE NODE OF THE MOON, MEASURED IN THE LUNAR ORBIT. LET THESE ANGLES BE OBL,LOM,IM, AND LON RESPECTIVELY.
042252,000053:
042253,000054: # THE SIMPLIFIED POSITION VECTOR OF THE MOON IS
042254,000055: # -
042255,000056: # 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))
042256,000057:
042257,000058: # WHERE
042258,000059: # 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
042259,000060: # 0 R 0 1 0 1
042260,000061: # LON=LON +LON
042261,000062: # 0 R
042262,000063: # A , A , B AND B ARE STORED AS AMOD AND BMOD (SEE DESCRIPTION OF CMOD, ABOVE). COS(OBL), SIN(OBL)*SIN(IM),
042263,000064: # 0 1 0 1
042264,000065: # SIN(OBL), AND COS(OBL)*SIN(IM) ARE STORED IN KONMAT AS K1, K2, K3 AND K4, RESPECTIVELY. LOM , LOM , LON , LON
042265,000066: # ARE STORED AS LOMO, LOMR, LONO, AND LONR IN RATESP. 0 R 0 R
042266,000067: # THE THREE PHIS ARE STORED AS AARG, BARG, AND CARG(SUN). ALL CONSTANTS ARE UPDATED BY YEAR.
042267,000068:
042268,000069: # CALLING SEQUENCE
Page 976 |
042270,000071: # CALL LSPOS. RETURN IS VIA CPRET.
042271,000072:
042272,000073: # ALARMS OR ABORTS
042273,000074:
042274,000075: # NONE
042275,000076:
042276,000077: # ERASABLE INITIALIZATION REQUIRED
042277,000078:
042278,000079: # TEPHEM - TIME FROM MIDNIGHT 1 JULY PRECEDING THE LAUNCH TO THE TIME OF THE LAUNCH (WHEN THE AGC CLOCK WENT
042279,000080: # TO ZERO). TEPHEM IS TP WITH UNITS OF CENTI-SECONDS.
042280,000081: # TIME2 AND TIME1 ARE IN MPAC AND MPAC +1 WHEN PROGRAM IS CALLED.
042281,000082:
042282,000083: # OUTPUT
042283,000084:
042284,000085: # UNIT POSITIONAL VECTOR OF SUN IN VSUN. (SCALED B-1)
042285,000086: # UNIT POSITIONAL VECTOR OF MOON IN VMOON. (SCALED B-1)
042286,000087:
042287,000088: # SUBROUTINES USED
042288,000089:
042289,000090: # NONE
042290,000091:
042291,000092: # DEBRIS
042292,000093:
042293,000094: # CURRENT CORE SET,WORK AREA AND FREEFLAG
042294,000095: 04,3001 BANK 04
042295,000096: 15,2000 SETLOC EPHEM
042296,000097: 15,2000 BANK
042297,000098:
042298,000099: 15,3641 E5,1714 EBANK= VSUN
042299,000100: 15,3641 COUNT* $$/EPHEM
042300,000101: 15,3641 15,3641 LUNPOS EQUALS LSPOS
042301,000102:
042302,000103: 15,3641 54201 LSPOS SETPD SR
042303,000104: 15,3642 00001 0
042304,000105: 15,3643 20617 14D # TP
042305,000106: 15,3644 56371 TAD DDV
042306,000107: 15,3645 01707 TEPHEM # TIME OF LAUNCH
042307,000108: 15,3646 12024 CSTODAY # 24 HOURS-8640000 CENTI-SECS/DAY B-33
042308,000109: 15,3647 00031 STORE TIMEP # T IN DAYS
042309,000110: 15,3650 77170 AXT,1 AXT,2
042310,000111: 15,3651 00000 0
042311,000112: 15,3652 00000 0
042312,000113: 15,3653 77614 CLEAR
042313,000114: 15,3654 00274 FREEFLAG # SWITCH BIT
042314,000115: 15,3655 77745 POSITA DLOAD
042315,000116: 15,3656 12004 KONMAT +2 # ZEROS
042316,000117: 15,3657 00027 STORE GTMP
042317,000118: 15,3660 40745 POSITB DLOAD DMP*
042318,000119: 15,3661 00031 TIMEP # T
042319,000120: 15,3662 12050 VAL67 +4,1 # 1/27 OR 1/32 OR 1/365
Page 977 |
042321,000122: 15,3663 42661 SL DAD*
042322,000123: 15,3664 20211 8D
042323,000124: 15,3665 12046 VAL67 +2,1 # AARG
042324,000125: 15,3666 40756 SIN DMP* # SIN(T/27+PHI) OR T/32 OR T/365
042325,000126: 15,3667 12044 VAL67,1 # (A0**2+A1**2)**1/2SIN(X+PHIA)
042326,000127: 15,3670 62015 DAD INCR,1 # PLUS
042327,000128: 15,3671 00027 GTMP # (B0**2+B1**2)**1/2SIN(X+PHIB)
042328,000129: 15,3672 77771 DEC -6 B-14
042329,000130: 15,3673 00027 STORE GTMP # OR (C0**2+C1**2)**1/2SIN(X+PHIC)
042330,000131: 15,3674 77614 BOFSET
042331,000132: 15,3675 00054 FREEFLAG
042332,000133: 15,3676 33660 POSITB
042333,000134: 15,3677 40745 POSITD DLOAD DMP*
042334,000135: 15,3700 00031 TIMEP # T
042335,000136: 15,3701 65747 RATESP,2 # LOMR,LOSR,LONR
042336,000137: 15,3702 42661 SL DAD*
042337,000138: 15,3703 20206 5D
042338,000139: 15,3704 65741 RATESP +6,2 # LOMO,LOSO,LONO
042339,000140: 15,3705 77625 DSU
042340,000141: 15,3706 00027 GTMP
042341,000142: 15,3707 10021 STORE STMP,2 # LOM,LOS,LON
042342,000143: 15,3710 63135 SLOAD INCR,2
042343,000144: 15,3711 00050 X2
042344,000145: 15,3712 77775 DEC -2 B-14
042345,000146: 15,3713 53015 DAD BZE
042346,000147: 15,3714 12026 RCB-13 # PLUS 2
042347,000148: 15,3715 33745 POSITE # 2ND
042348,000149: 15,3716 77644 BPL
042349,000150: 15,3717 33655 POSITA # 1ST
042350,000151: 15,3720 45345 POSITF DLOAD DSU # 3RD
042351,000152: 15,3721 00021 STMP # LOM
042352,000153: 15,3722 00025 STMP +4 # LON
042353,000154: 15,3723 65356 SIN PDDL # SIN(LOM-LON)
042354,000155: 15,3724 00021 STMP
042355,000156: 15,3725 65356 SIN PDDL # SIN LOM
042356,000157: 15,3726 00021 STMP
042357,000158: 15,3727 55546 COS VDEF # COS LOM
042358,000159: 15,3730 53521 MXV UNIT
042359,000160: 15,3731 12002 KONMAT # K1,K2,K3,K4,
042360,000161: 15,3732 02723 STORE VMOON
042361,000162: 15,3733 65345 DLOAD PDDL
042362,000163: 15,3734 12004 KONMAT +2 # ZERO
042363,000164: 15,3735 00023 STMP +2
042364,000165: 15,3736 65356 SIN PDDL # SIN LOS
042365,000166: 15,3737 00023 STMP +2
042366,000167: 15,3740 55546 COS VDEF # COS LOS
042367,000168: 15,3741 53521 MXV UNIT
042368,000169: 15,3742 12002 KONMAT
042369,000170: 15,3743 02715 STORE VSUN
042370,000171: 15,3744 77616 RVQ
042371,000172:
Page 978 |
042373,000174: 15,3745 77745 POSITE DLOAD
042374,000175: 15,3746 12004 KONMAT +2 # ZEROS
042375,000176: 15,3747 00027 STORE GTMP
042376,000177: 15,3750 77650 GOTO
042377,000178: 15,3751 33677 POSITD
042378,000179: 05,2000 SETLOC EPHEM1
042379,000180: 05,2000 BANK
042380,000181:
042381,000182: 05,3510 COUNT* $$/EPHEM
042382,000183:
042383,000184: 05,3510 STMP EQUALS 16D
042384,000185:
042385,000186: 05,3510 GTMP EQUALS 22D
042386,000187:
042387,000188: 05,3510 TIMEP EQUALS 24D
End of include-file LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc. Parent file is MAIN.agc