Source Code
These source code files are an attempted reconstruction of Sundance revision 306, the Apollo 9
LM (Lunar Module) AGC (Apollo Guidance Computer) flight software, created from binary dumps of
original core rope program modules, as follows:
|
038470,000002: ## Copyright: Public domain.
038471,000003: ## Filename: LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc
038472,000004: ## Purpose: A section of an attempt to reconstruct Sundance revision 306
038473,000005: ## as closely as possible with available information. Sundance
038474,000006: ## 306 is the source code for the Lunar Module's (LM) Apollo
038475,000007: ## Guidance Computer (AGC) for Apollo 9. This program was created
038476,000008: ## using the mixed-revision SundanceXXX as a starting point, and
038477,000009: ## pulling back features from Luminary 69 believed to have been
038478,000010: ## added based on memos, checklists, observed address changes,
038479,000011: ## or the Sundance GSOPs.
038480,000012: ## Assembler: yaYUL
038481,000013: ## Contact: Ron Burkey <info@sandroid.org>.
038482,000014: ## Website: www.ibiblio.org/apollo/index.html
038483,000015: ## Mod history: 2020-07-24 MAS Created from SundanceXXX.
038484,000016: ## 2021-05-30 ABS 2DEC* -> DEC for non extended address field.
038485,000017:
038486,000018:
038487,000019:
038488,000020: # NAME - LSPOS - LOCATE SUN AND MOON DATE - 25 OCT 67
038489,000021: # MOD NO.1
038490,000022: # MOD BY NEVILLE ASSEMBLY SUNDANCE
038491,000023:
038492,000024: # FUNCTIONAL DESCRIPTION
038493,000025:
038494,000026: # COMPUTES UNIT POSITION VECTOR OF THE SUN AND MOON IN THE BASIC REFERENCE SYSTEM. THE SUN VECTOR S IS
038495,000027: # LOCATED VIA TWO ANGLES. THE FIRST ANGLE(OBLIQUITY) IS THE ANGLE BETWEEN THE EARTH EQUATOR AND THE ECLIPTIC. THE
038496,000028: # SECOND ANGLE IS THE LONGITUDE OF THE SUN MEASURED IN THE ECLIPTIC.
038497,000029: # THE POSITION VECTOR OF THE SUN IS
038498,000030: # -
038499,000031: # S = (COS(LOS), COS(OBL)*SIN(LOS), SIN(OBL)*SIN(LOS)), WHERE
038500,000032:
038501,000033: # LOS = LOS +LOS *T-(C *SIN(2PI*T)/365.24 +C *COS(2PI*T)/365.24)
038502,000034: # 0 R 0 1
038503,000035: # LOS (RAD) IS THE LONGITUDE OF THE SUN FOR MIDNIGHT JUNE 30TH OF THE PARTICULAR YEAR.
038504,000036: # 0
038505,000037: # LOS (RAD/DAY) IS THE MEAN RATE FOR THE PARTICULAR YEAR.
038506,000038: # R
038507,000039:
038508,000040: # LOS AND LOS ARE STORED AS LOSC AND LOSR IN RATESP.
038509,000041: # 0 R
038510,000042: # COS(OBL) AND SIN(OBL) ARE STORED IN THE MATRIX KONMAT.
038511,000043: # T, TIME MEASURED IN DAYS (24 HOURS), IS STORED IN TIMEP.
038512,000044: # C AND C ARE FUDGE FACTORS TO MINIMIZE THE DEVIATION. THEY ARE STORED AS ONE CONSTANT (CMOD), SINCE
038513,000045: # 0 1 2 2 1/2
038514,000046: # C *SIN(X)+C *COS(X) CAN BE WRITTEN AS (C +C ) *SIN(X+PHI), WHERE PHI=ARCTAN(C /C ).
038515,000047: # 0 1 0 1 1 0
038516,000048:
038517,000049: # THE MOON IS LOCATED VIA FOUR ANGLES. THE FIRST IS THE OBLIQUITY. THE SECOND IS THE MEAN LONGITUDE OF THE MOON,
038518,000050: # MEASURED IN THE ECLIPTIC FROM THE MEAN EQUINOX TO THE MEAN ASCENDING NODE OF THE LUNAR ORBIT, AND THEN ALONG THE
038519,000051: # ORBIT. THE THIRD ANGLE IS THE ANGLE BETWEEN THE ECLIPTIC AND THE LUNAR ORBIT. THE FOURTH ANGLE IS THE LONGITUDE
038520,000052: # OF THE NODE OF THE MOON, MEASURED IN THE LUNAR ORBIT. LET THESE ANGLES BE OBL,LOM,IM, AND LON RESPECTIVELY.
038521,000053:
038522,000054: # THE SIMPLIFIED POSITION VECTOR OF THE MOON IS
038523,000055: # -
038524,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))
038525,000057:
038526,000058: # WHERE
038527,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
038528,000060: # 0 R 0 1 0 1
038529,000061: # LON=LON +LON
038530,000062: # 0 R
038531,000063: # A , A , B AND B ARE STORED AS AMOD AND BMOD (SEE DESCRIPTION OF CMOD, ABOVE). COS(OBL), SIN(OBL)*SIN(IM),
038532,000064: # 0 1 0 1
038533,000065: # SIN(OBL), AND COS(OBL)*SIN(IM) ARE STORED IN KONMAT AS K1, K2, K3 AND K4, RESPECTIVELY. LOM , LOM , LON , LON
038534,000066: # ARE STORED AS LOMO, LOMR, LONO, AND LONR IN RATESP. 0 R 0 R
038535,000067: # THE THREE PHIS ARE STORED AS AARG, BARG, AND CARG(SUN). ALL CONSTANTS ARE UPDATED BY YEAR.
038536,000068:
038537,000069: # CALLING SEQUENCE
038538,000070: # CALL LSPOS. RETURN IS VIA CPRET.
038539,000071:
038540,000072: # ALARMS OR ABORTS
038541,000073: # NONE
038542,000074:
038543,000075: # ERASABLE INITIALIZATION REQUIRED
038544,000076: # TEPHEM - TIME FROM MIDNIGHT 1 JULY PRECEDING THE LAUNCH TO THE TIME OF THE LAUNCH (WHEN THE AGC CLOCK WENT
038545,000077: # TO ZERO). TEPHEM IS TP WITH UNITS OF CENTI-SECONDS.
038546,000078:
038547,000079: # TIME2 AND TIME1 ARE IN MPAC AND MPAC +1 WHEN PROGRAM IS CALLED.
038548,000080:
038549,000081: # OUTPUT
038550,000082: # UNIT POSITIONAL VECTOR OF SUN IN VSUN. (SCALED B-1)
038551,000083: # UNIT POSITIONAL VECTOR OF MOON IN VMOON. (SCALED B-1)
038552,000084:
038553,000085: # SUBROUTINES USED
038554,000086: # NONE
038555,000087:
038556,000088: # DEBRIS
038557,000089: # CURRENT CORE SET, WORK AREA AND FREEFLAG
038558,000090:
038559,000091: 04,2666 BANK 04
038560,000092: 15,2000 SETLOC EPHEM
038561,000093: 15,2000 BANK
038562,000094:
038563,000095: 15,3236 E5,1714 EBANK= VSUN
038564,000096: 15,3236 COUNT* $$/EPHEM
038565,000097: 15,3236 15,3236 LUNPOS EQUALS LSPOS
038566,000098:
038567,000099: 15,3236 54201 LSPOS SETPD SR
038568,000100: 15,3237 00001 0
038569,000101: 15,3240 20617 14D # TP
038570,000102: 15,3241 56371 TAD DDV
038571,000103: 15,3242 01707 TEPHEM # TIME OF LAUNCH
038572,000104: 15,3243 31334 CSTODAY # 24 HOURS-8640000 CENTI-SECS/DAY B-33
038573,000105: 15,3244 00031 STORE TIMEP # T IN DAYS
038574,000106: 15,3245 77170 AXT,1 AXT,2
038575,000107: 15,3246 00000 0
038576,000108: 15,3247 00000 0
038577,000109: 15,3250 77614 CLEAR
038578,000110: 15,3251 00274 FREEFLAG # SWITCH BIT
038579,000111: 15,3252 77745 POSITA DLOAD
038580,000112: 15,3253 31314 KONMAT +2 # ZEROS
038581,000113: 15,3254 00027 STORE GTMP
038582,000114: 15,3255 40745 POSITB DLOAD DMP*
038583,000115: 15,3256 00031 TIMEP # T
038584,000116: 15,3257 31360 VAL67 +4,1 # 1/27 OR 1/32 OR 1/365
038585,000117: 15,3260 42661 SL DAD*
038586,000118: 15,3261 20211 8D
038587,000119: 15,3262 31356 VAL67 +2,1 # AARG
038588,000120: 15,3263 40756 SIN DMP* # SIN(T/27+PHI) OR T/32 OR T/365
038589,000121: 15,3264 31354 VAL67,1 # (A0**2+A1**2)**1/2 SIN(X+PHIA)
038590,000122: 15,3265 62015 DAD INCR,1 # PLUS
038591,000123: 15,3266 00027 GTMP # (B0**2+B1**2)**1/2 SIN(X+PHIB)
038592,000124: 15,3267 77771 DEC -6 B-14
038593,000125: 15,3270 00027 STORE GTMP # OR (C0**2+C1**2)**1/2 SIN(X+PHIC)
038594,000126: 15,3271 77614 BOFSET
038595,000127: 15,3272 00054 FREEFLAG
038596,000128: 15,3273 33255 POSITB
038597,000129: 15,3274 40745 POSITD DLOAD DMP*
038598,000130: 15,3275 00031 TIMEP # T
038599,000131: 15,3276 46437 RATESP,2 # LOMR,LOSR,LONR
038600,000132: 15,3277 42661 SL DAD*
038601,000133: 15,3300 20206 5D
038602,000134: 15,3301 46431 RATESP +6,2 # LOMO,LOSO,LONO
038603,000135: 15,3302 77625 DSU
038604,000136: 15,3303 00027 GTMP
038605,000137: 15,3304 10021 STORE STMP,2 # LOM,LOS,LON
038606,000138: 15,3305 63135 SLOAD INCR,2
038607,000139: 15,3306 00050 X2
038608,000140: 15,3307 77775 DEC -2 B-14
038609,000141: 15,3310 53015 DAD BZE
038610,000142: 15,3311 31336 RCB-13 # PLUS 2
038611,000143: 15,3312 33342 POSITE # 2ND
038612,000144: 15,3313 77644 BPL
038613,000145: 15,3314 33252 POSITA # 1ST
038614,000146: 15,3315 45345 POSITF DLOAD DSU # 3RD
038615,000147: 15,3316 00021 STMP # LOM
038616,000148: 15,3317 00025 STMP +4 # LON
038617,000149: 15,3320 65356 SIN PDDL # SIN(LOM-LON)
038618,000150: 15,3321 00021 STMP
038619,000151: 15,3322 65356 SIN PDDL # SIN LOM
038620,000152: 15,3323 00021 STMP
038621,000153: 15,3324 55546 COS VDEF # COS LOM
038622,000154: 15,3325 53521 MXV UNIT
038623,000155: 15,3326 31312 KONMAT # K1,K2,K3,K4,
038624,000156: 15,3327 02723 STORE VMOON
038625,000157: 15,3330 65345 DLOAD PDDL
038626,000158: 15,3331 31314 KONMAT +2 # ZERO
038627,000159: 15,3332 00023 STMP +2
038628,000160: 15,3333 65356 SIN PDDL # SIN LOS
038629,000161: 15,3334 00023 STMP +2
038630,000162: 15,3335 55546 COS VDEF # COS LOS
038631,000163: 15,3336 53521 MXV UNIT
038632,000164: 15,3337 31312 KONMAT
038633,000165: 15,3340 02715 STORE VSUN
038634,000166: 15,3341 77616 RVQ
038635,000167: 15,3342 77745 POSITE DLOAD
038636,000168: 15,3343 31314 KONMAT +2 # ZEROS
038637,000169: 15,3344 00027 STORE GTMP
038638,000170: 15,3345 77650 GOTO
038639,000171: 15,3346 33274 POSITD
038640,000172: 15,3347 77616 LUNVEL RVQ # TO FOOL INTEGRATION
038641,000173:
038642,000174: 15,3350 STMP EQUALS 16D
038643,000175:
038644,000176: 15,3350 GTMP EQUALS 22D
038645,000177:
038646,000178: 15,3350 TIMEP EQUALS 24D
038647,000179:
038648,000180: 14,2000 SETLOC EPHEM1
038649,000181: 14,2000 BANK
038650,000182: 14,3311 COUNT* $$/EPHEM
038651,000183:
038652,000184: 14,3311 20000 00000 KONMAT 2DEC 1.0 B-1 # *************
038653,000185: 14,3313 00000 00000 2DEC 0 B-28 # *
038654,000186: 14,3315 00000 00000 2DEC 0 B-28 # *
038655,000187: 14,3317 00000 00000 2DEC 0 B-28 # *
038656,000188: 14,3321 16533 30007 2DEC .91745 B-1 # K1 COS(OBL) *
038657,000189: 14,3323 77333 56654 2DEC -.03571 B-1 # K2 SIN(OBL)SIN(IM) *
038658,000190: 14,3325 00000 00000 2DEC 0 B-28 # *
038659,000191: 14,3327 06273 03275 2DEC .39784 B-1 # K3 SIN(OBL) *
038660,000192:
038661,000193: 14,3331 01242 24467 2DEC .082354 B-1 # K4 COS(OBL)SIN(IM) *
038662,000194: 14,3333 00020 17260 CSTODAY 2DEC 8640000 B-33 # * NOTE *
038663,000195: 14,3335 00002 RCB-13 OCT 00002 # * TABLES CONTAIN *
038664,000196: 14,3336 00000 OCT 00000 # * CONSTANTS FOR *
038665,000197: 14,3337 22572 27214 RATESP 2DEC .03660098 B+4 # * 1968 - 1969 *
038666,000198: 14,3341 01315 26177 2DEC .00273779 B+4 # LOSR *
038667,000199: 14,3343 77731 55217 2DEC -.00014719 B+4 # LONR *
038668,000200: 14,3345 16455 04475 2DEC .455880394 # LOMO *
038669,000201: 14,3347 10637 04312 2DEC .275337971 # LOSO *
038670,000202: 14,3351 01215 26351 2DEC .0398987882 # LONO *
038671,000203: 14,3353 01070 35243 VAL67 2DEC .017361944 B+1 # AMOD *
038672,000204: 14,3355 11126 14467 2DEC .286523072 # AARG *
038673,000205: 14,3357 02245 06475 2DEC .036291712 B+1 # 1/27 *
038674,000206: 14,3361 00163 32331 2DEC .003534722 B+1 # BMOD *
038675,000207: 14,3363 03476 03302 2DEC .113165625 # BARG *
038676,000208: 14,3365 02000 00000 2DEC .03125 B+1 # 1/32 *
038677,000209: 14,3367 00256 25374 2DEC .005330555 B+1 # CMOD *
038678,000210: 14,3371 77525 53143 2DEC -.010415660 # CARG VALUE COMPUTED USING 1/364.24
038679,000211: 14,3373 00131 26730 2DEC .002737925 B+1 # 1/365 *************
038680,000212: # ************************************************************************
End of include-file LUNAR_AND_SOLAR_EPHEMERIDES_SUBROUTINES.agc. Parent file is MAIN.agc