Source Code
These source-code files are part of a reconstructed copy of Luminary 96, the
original release of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer
(AGC) software.
The reconstruction began with reconstructed source code for Luminary 97. Changes between revisions 96 and 97 were backed out, as described by anomal report LNY-59. transcribed from a digitized copy of that program. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152D. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 96 listing. 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. |
041972,000002: ## Copyright: Public domain.
041973,000003: ## Filename: LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc
041974,000004: ## Purpose: A section of Luminary revision 96.
041975,000005: ## It is part of the reconstructed source code for the
041976,000006: ## original release of the flight software for the Lunar
041977,000007: ## Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
041978,000008: ## The code has been recreated from a previously reconstructed
041979,000009: ## copy of Luminary 97 by undoing changes described in anomaly
041980,000010: ## report LNY-59. The code has been adapted such that the
041981,000011: ## resulting bugger words exactly match those specified for
041982,000012: ## Luminary 96 in NASA drawing 2021152D, which gives relatively
041983,000013: ## high confidence that the reconstruction is correct.
041984,000014: ## Reference: pp. 984-987
041985,000015: ## Assembler: yaYUL
041986,000016: ## Contact: Ron Burkey <info@sandroid.org>.
041987,000017: ## Website: www.ibiblio.org/apollo/index.html
041988,000018: ## Mod history: 2019-08-04 MAS Created from Luminary 97.
041989,000019:
Page 984 |
041991,000021: # NAME - LSPOS - LOCATE SUN AND MOON DATE - 25 OCT 67
041992,000022: # MOD NO. 1
041993,000023: # MOD BY NEVILLE ASSEMBLY SUNDANCE
041994,000024:
041995,000025: # FUNCTIONAL DESCRIPTION
041996,000026:
041997,000027: # COMPUTES UNIT POSITION VECTOR OF THE SUN AND MOON IN THE BASIC REFERENCE SYSTEM. THE SUN VECTOR S IS
041998,000028: # LOCATED VIA TWO ANGLES. THE FIRST ANGLE(OBLIQUITY) IS THE ANGLE BETWEEN THE EARTH EQUATOR AND THE ECLIPTIC. THE
041999,000029: # SECOND ANGLE IS THE LONGITUDE OF THE SUN MEASURED IN THE ECLIPTIC.
042000,000030: # THE POSITION VECTOR OF THE SUN IS
042001,000031: # -
042002,000032: # S = (COS(LOS), COS(OBL)*SIN(LOS), SIN(OBL)*SIN(LOS)), WHERE
042003,000033:
042004,000034: # LOS = LOS +LOS *T-(C *SIN(2PI*T)/365.24 +C *COS(2PI*T)/365.24)
042005,000035: # 0 R 0 1
042006,000036: # LOS (RAD) IS THE LONGITUDE OF THE SUN FOR MIDNIGHT JUNE 30TH OF THE PARTICULAR YEAR.
042007,000037: # 0
042008,000038: # LOS (RAD/DAY) IS THE MEAN RATE FOR THE PARTICULAR YEAR.
042009,000039: # R
042010,000040:
042011,000041: # LOS AND LOS ARE STORED AS LOSC AND LOSR IN RATESP.
042012,000042: # 0 R
042013,000043: # COS(OBL) AND SIN(OBL) ARE STORED IN THE MATRIX KONMAT.
042014,000044:
042015,000045: # T, TIME MEASURED IN DAYS (24 HOURS), IS STORED IN TIMEP.
042016,000046:
042017,000047: # C AND C ARE FUDGE FACTORS TO MINIMIZE THE DEVIATION. THEY ARE STORED AS ONE CONSTANT (CMOD), SINCE
042018,000048: # 0 1 2 2 1/2
042019,000049: # C *SIN(X)+C *COS(X) CAN BE WRITTEN AS (C +C ) *SIN(X+PHI), WHERE PHI=ARCTAN(C /C ).
042020,000050: # 0 1 0 1 1 0
042021,000051:
042022,000052: # THE MOON IS LOCATED VIA FOUR ANGLES. THE FIRST IS THE OBLIQUITY. THE SECOND IS THE MEAN LONGITUDE OF THE MOON,
042023,000053: # MEASURED IN THE ECLIPTIC FROM THE MEAN EQUINOX TO THE MEAN ASCENDING NODE OF THE LUNAR ORBIT, AND THEN ALONG THE
042024,000054: # ORBIT. THE THIRD ANGLE IS THE ANGLE BETWEEN THE ECLIPTIC AND THE LUNAR ORBIT. THE FOURTH ANGLE IS THE LONGITUDE
042025,000055: # OF THE NODE OF THE MOON, MEASURED IN THE LUNAR ORBIT. LET THESE ANGLES BE OBL,LOM,IM, AND LON RESPECTIVELY.
042026,000056:
042027,000057: # THE SIMPLIFIED POSITION VECTOR OF THE MOON IS
042028,000058: # -
042029,000059: # 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))
042030,000060:
042031,000061: # WHERE
042032,000062: # 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
042033,000063: # 0 R 0 1 0 1
042034,000064: # LON=LON +LON
042035,000065: # 0 R
042036,000066: # A , A , B AND B ARE STORED AS AMOD AND BMOD (SEE DESCRIPTION OF CMOD, ABOVE). COS(OBL), SIN(OBL)*SIN(IM),
042037,000067: # 0 1 0 1
042038,000068: # SIN(OBL), AND COS(OBL)*SIN(IM) ARE STORED IN KONMAT AS K1, K2, K3 AND K4, RESPECTIVELY. LOM , LOM , LON , LON
042039,000069: # ARE STORED AS LOMO, LOMR, LONO, AND LONR IN RATESP. 0 R 0 R
042040,000070: # THE THREE PHIS ARE STORED AS AARG, BARG, AND CARG(SUN). ALL CONSTANTS ARE UPDATED BY YEAR.
042041,000071:
042042,000072: # CALLING SEQUENCE
Page 985 |
042044,000074: # CALL LSPOS. RETURN IS VIA CPRET.
042045,000075:
042046,000076: # ALARMS OR ABORTS
042047,000077: # NONE
042048,000078:
042049,000079: # ERASABLE INITIALIZATION REQUIRED
042050,000080: # TEPHEM - TIME FROM MIDNIGHT 1 JULY PRECEDING THE LAUNCH TO THE TIME OF THE LAUNCH (WHEN THE AGC CLOCK WENT
042051,000081: # TO ZERO). TEPHEM IS TP WITH UNITS OF CENTI-SECONDS.
042052,000082:
042053,000083: # TIME2 AND TIME1 ARE IN MPAC AND MPAC +1 WHEN PROGRAM IS CALLED.
042054,000084:
042055,000085: # OUTPUT
042056,000086: # UNIT POSITIONAL VECTOR OF SUN IN VSUN. (SCALED B-1)
042057,000087: # UNIT POSITIONAL VECTOR OF MOON IN VMOON. (SCALED B-1)
042058,000088:
042059,000089: # SUBROUTINES USED
042060,000090: # NONE
042061,000091:
042062,000092: # DEBRIS
042063,000093: # CURRENT CORE SET, WORK AREA AND FREEFLAG
042064,000094:
042065,000095: 04,3027 BANK 04
042066,000096: 15,2000 SETLOC EPHEM
042067,000097: 15,2000 BANK
042068,000098:
042069,000099: 15,3664 E5,1714 EBANK= VSUN
042070,000100: 15,3664 COUNT* $$/EPHEM
042071,000101: 15,3664 15,3664 LUNPOS EQUALS LSPOS
042072,000102:
042073,000103: 15,3664 54201 LSPOS SETPD SR
042074,000104: 15,3665 00001 0
042075,000105: 15,3666 20617 14D # TP
042076,000106: 15,3667 56371 TAD DDV
The hand-written notation "in centisec B 42" appears to the right. |
042078,000108: 15,3670 01707 TEPHEM # TIME OF LAUNCH
042079,000109: 15,3671 12024 CSTODAY # 24 HOURS-8640000 CENTI-SECS/DAY B-33
The hand-written notation "@ B 9 = 512 days" appears to the right. |
042081,000111: 15,3672 00031 STORE TIMEP # T IN DAYS
The hand-written notation "∴ granularity ≈ 0.164 sec" appears to the right. |
042083,000113: 15,3673 77170 AXT,1 AXT,2
042084,000114: 15,3674 00000 0
042085,000115: 15,3675 00000 0
042086,000116: 15,3676 77614 CLEAR
042087,000117: 15,3677 00274 FREEFLAG # SWITCH BIT
042088,000118: 15,3700 77745 POSITA DLOAD
042089,000119: 15,3701 12004 KONMAT +2 # ZEROS
042090,000120: 15,3702 00027 STORE GTMP
042091,000121: 15,3703 40745 POSITB DLOAD DMP*
042092,000122: 15,3704 00031 TIMEP # T
042093,000123: 15,3705 12050 VAL67 +4,1 # 1/27 OR 1/32 OR 1/365
Page 986 |
042095,000125: 15,3706 42661 SL DAD*
042096,000126: 15,3707 20211 8D
042097,000127: 15,3710 12046 VAL67 +2,1 # AARG
042098,000128: 15,3711 40756 SIN DMP* # SIN(T/27+PHI) OR T/32 OR T/365
042099,000129: 15,3712 12044 VAL67,1 # (A0**2+A1**2)**1/2 SIN(X+PHIA)
042100,000130: 15,3713 62015 DAD INCR,1 # PLUS
042101,000131: 15,3714 00027 GTMP # (B0**2+B1**2)**1/2 SIN(X+PHIB)
042102,000132: 15,3715 77771 DEC -6 B-14
042103,000133: 15,3716 00027 STORE GTMP # OR (C0**2+C1**2)**1/2 SIN(X+PHIC)
042104,000134: 15,3717 77614 BOFSET
042105,000135: 15,3720 00054 FREEFLAG
042106,000136: 15,3721 33703 POSITB
042107,000137: 15,3722 40745 POSITD DLOAD DMP*
042108,000138: 15,3723 00031 TIMEP # T
042109,000139: 15,3724 65747 RATESP,2 # LOMR,LOSR,LONR
042110,000140: 15,3725 42661 SL DAD*
042111,000141: 15,3726 20206 5D
042112,000142: 15,3727 65741 RATESP +6,2 # LOMO,LOSO,LONO
042113,000143: 15,3730 77625 DSU
042114,000144: 15,3731 00027 GTMP
042115,000145: 15,3732 10021 STORE STMP,2 # LOM,LOS,LON
042116,000146: 15,3733 63135 SLOAD INCR,2
042117,000147: 15,3734 00050 X2
042118,000148: 15,3735 77775 DEC -2 B-14
042119,000149: 15,3736 53015 DAD BZE
042120,000150: 15,3737 12026 RCB-13 # PLUS 2
042121,000151: 15,3740 33770 POSITE # 2ND
042122,000152: 15,3741 77644 BPL
042123,000153: 15,3742 33700 POSITA # 1ST
042124,000154: 15,3743 45345 POSITF DLOAD DSU # 3RD
042125,000155: 15,3744 00021 STMP # LOM
042126,000156: 15,3745 00025 STMP +4 # LON
042127,000157: 15,3746 65356 SIN PDDL # SIN(LOM-LON)
042128,000158: 15,3747 00021 STMP
042129,000159: 15,3750 65356 SIN PDDL # SIN LOM
042130,000160: 15,3751 00021 STMP
042131,000161: 15,3752 55546 COS VDEF # COS LOM
042132,000162: 15,3753 53521 MXV UNIT
042133,000163: 15,3754 12002 KONMAT # K1,K2,K3,K4,
042134,000164: 15,3755 02723 STORE VMOON
042135,000165: 15,3756 65345 DLOAD PDDL
042136,000166: 15,3757 12004 KONMAT +2 # ZERO
042137,000167: 15,3760 00023 STMP +2
042138,000168: 15,3761 65356 SIN PDDL # SIN LOS
042139,000169: 15,3762 00023 STMP +2
042140,000170: 15,3763 55546 COS VDEF # COS LOS
042141,000171: 15,3764 53521 MXV UNIT
042142,000172: 15,3765 12002 KONMAT
042143,000173: 15,3766 02715 STORE VSUN
042144,000174: 15,3767 77616 RVQ
Page 987 |
042146,000176: 15,3770 77745 POSITE DLOAD
042147,000177: 15,3771 12004 KONMAT +2 # ZEROS
042148,000178: 15,3772 00027 STORE GTMP
042149,000179: 15,3773 77650 GOTO
042150,000180: 15,3774 33722 POSITD
042151,000181: 15,3775 77616 LUNVEL RVQ # TO FOOL INTEGRATION
042152,000182: 05,2000 SETLOC EPHEM1
042153,000183: 05,2000 BANK
042154,000184:
042155,000185: 05,3506 COUNT* $$/EPHEM
042156,000186: 05,3506 STMP EQUALS 16D
042157,000187: 05,3506 GTMP EQUALS 22D
042158,000188: 05,3506 TIMEP EQUALS 24D
042159,000189:
End of include-file LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc. Parent file is MAIN.agc