Source Code
These source code files are a reconstruction of Sundance, the Apollo 9 LM (Lunar Module) AGC
(Apollo Guidance Computer) flight software, created from binary dumps of original core rope
program modules, as follows:
Since only binary dumps (rather than listings) of Sundance are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing. |
043767,000002: ## Copyright: Public domain.
043768,000003: ## Filename: PLANETARY_INERTIAL_ORIENTATION.agc
043769,000004: ## Purpose: A section of a reconstructed, mixed version of Sundance
043770,000005: ## It is part of the reconstructed source code for the Lunar
043771,000006: ## Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
043772,000007: ## No original listings of this program are available;
043773,000008: ## instead, this file was created via disassembly of dumps
043774,000009: ## of various revisions of Sundance core rope modules.
043775,000010: ## Assembler: yaYUL
043776,000011: ## Contact: Ron Burkey <info@sandroid.org>.
043777,000012: ## Website: www.ibiblio.org/apollo/index.html
043778,000013: ## Mod history: 2020-06-17 MAS Created from Luminary 69.
043779,000014:
043780,000015: ## Sundance 302
043781,000016:
043782,000017: # ..... RP-TO-R SUBROUTINE .....
043783,000018: # SUBROUTINE TO CONVERT RP (VECTOR IN PLANETARY COORDINATE SYSTEM, EITHER
043784,000019: # EARTH-FIXED OR MOON-FIXED) TO R (SAME VECTOR IN THE BASIC REF. SYSTEM)
043785,000020:
043786,000021: # R = MT(T)*(RP + LP X RP) MT = M MATRIX TRANSPOSE
043787,000022:
043788,000023: # CALLING SEQUENCE
043789,000024: # L CALL
043790,000025: # L+1 RP-TO-R
043791,000026:
043792,000027: # SUBROUTINES USED
043793,000028: # EARTHMX,MOONMX,EARTHL
043794,000029:
043795,000030: # ITEMS AVAILABLE FROM LAUNCH DATA
043796,000031: # 504LM = THE LIBRATION VECTOR L OF THE MOON AT TIME TIMSUBL,EXPRESSED
043797,000032: # IN THE MOON-FIXED COORD. SYSTEM RADIANS B0
043798,000033:
043799,000034: # ITEMS NECESSARY FOR SUBR. USED (SEE DESCRIPTION OF SUBR.)
043800,000035:
043801,000036: # INPUT
043802,000037: # MPAC= 0 FOR EARTH, NON-ZERO FOR MOON
043803,000038: # 0-5D= RP VECTOR
043804,000039: # 6-7D= TIME
043805,000040:
043806,000041: # OUTPUT
043807,000042: # MPAC = R VECTOR METERS B-29 FOR EARTH, B-27 FOR MOON
043808,000043:
043809,000044: 24,2000 SETLOC PLANTIN
043810,000045: 24,2000 BANK
043811,000046:
043812,000047: 24,3220 COUNT* $$/LUROT
043813,000048:
043814,000049: 24,3220 46020 RP-TO-R STQ BHIZ
043815,000050: 24,3221 00050 RPREXIT
043816,000051: 24,3222 51235 RPTORA
043817,000052: 24,3223 77624 CALL # COMPUTE M MATRIX FOR MOON
043818,000053: 24,3224 51275 MOONMX # LP=LM FOR MOON RADIANS B0
043819,000054: 24,3225 77775 VLOAD
043820,000055: 24,3226 02011 504LM
043821,000056: 24,3227 53235 RPTORB VXV VAD
043822,000057: 24,3230 00001 504RPR
043823,000058: 24,3231 00001 504RPR
043824,000059: 24,3232 52105 VXM GOTO
043825,000060: 24,3233 00025 MMATRIX # MPAC=R=MT(T)*(RP+LPXRP)
043826,000061: 24,3234 51263 RPRPXXXX # RESET PUSHLOC TO 0 BEFORE EXITING
043827,000062: 24,3235 77624 RPTORA CALL # EARTH COMPUTATIONS
043828,000063: 24,3236 51447 EARTHMX # M MATRIX B-1
043829,000064: 24,3237 77624 CALL
043830,000065: 24,3240 51501 EARTHL # L VECTOR RADIANS B0
043831,000066: 24,3241 76521 MXV VSL1 # LP=M(T)*L RAD B-0
043832,000067: 24,3242 00025 MMATRIX
043833,000068: 24,3243 77650 GOTO
043834,000069: 24,3244 51227 RPTORB
043835,000070:
043836,000071: # ..... R-TO-RP SUBROUTINE .....
043837,000072: # SUBROUTINE TO CONVERT R (VECTOR IN REFERENCE COORD. SYSTEM) TO RP
043838,000073: # (VECTOR IN PLANETARY COORD SYSTEM) EITHER EARTH-FIXED OR MOON-FIXED
043839,000074:
043840,000075: # RP = M(T)*(R - L X R)
043841,000076:
043842,000077: # CALLING SEQUENCE
043843,000078: # L CALL
043844,000079: # L+1 R-TO-RP
043845,000080:
043846,000081: # SUBROUTINES USED
043847,000082: # EARTHMX,MOONMX,EARTHL
043848,000083:
043849,000084: # INPUT
043850,000085: # MPAC= 0 FOR EARTH,NON-ZERO FOR MOON
043851,000086: # 0-5D= R VECTOR
043852,000087: # 6-7D= TIME
043853,000088:
043854,000089: # ITEMS AVAILABLE FROM LAUNCH DATA
043855,000090: # 504LM = THE LIBRATION VECTOR L OF THE MOON AT TIME TIMSUBL,EXPRESSED
043856,000091: # IN THE MOON-FIXED COORD. SYSTEM RADIANS B0
043857,000092:
043858,000093: # ITEMS NECESSARY FOR SUBROUTINES USED (SEE DESCRIPTION OF SUBR.)
043859,000094:
043860,000095: # OUTPUT
043861,000096: # MPAC = RP VECTOR METERS B-29 FOR EARTH, B-27 FOR MOON
043862,000097:
043863,000098: 24,3245 46020 R-TO-RP STQ BHIZ
043864,000099: 24,3246 00050 RPREXIT
043865,000100: 24,3247 51267 RTORPA
043866,000101: 24,3250 77624 CALL
043867,000102: 24,3251 51275 MOONMX
043868,000103: 24,3252 61375 VLOAD VXM
043869,000104: 24,3253 02011 504LM # LP=LM
043870,000105: 24,3254 00025 MMATRIX
043871,000106: 24,3255 77772 VSL1 # L=MT(T)*LP RADIANS B0
043872,000107: 24,3256 51235 RTORPB VXV BVSU
043873,000108: 24,3257 00001 504RPR
043874,000109: 24,3260 00001 504RPR
043875,000110: 24,3261 77721 MXV # M(T)*(R-LXR) B-2
043876,000111: 24,3262 00025 MMATRIX
043877,000112: 24,3263 40372 RPRPXXXX VSL1 SETPD
043878,000113: 24,3264 00001 0D
043879,000114: 24,3265 77650 GOTO
043880,000115: 24,3266 00050 RPREXIT
043881,000116: 24,3267 77624 RTORPA CALL # EARTH COMPUTATIONS
043882,000117: 24,3270 51447 EARTHMX
043883,000118: 24,3271 77624 CALL
043884,000119: 24,3272 51501 EARTHL
043885,000120: 24,3273 77650 GOTO # MPAC=L=(-AX,-AY,0) RAD B-0
043886,000121: 24,3274 51256 RTORPB
043887,000122:
043888,000123: # ..... MOONMX SUBROUTINE .....
043889,000124: # SUBROUTINE TO COMPUTE THE TRANSFORMATION MATRIX M FOR THE MOON
043890,000125:
043891,000126: # CALLING SEQUENCE
043892,000127: # L CALL
043893,000128: # L+1 MOONMX
043894,000129:
043895,000130: # SUBROUTINES USED
043896,000131: # NEWANGLE
043897,000132:
043898,000133: # INPUT
043899,000134: # 6-7D= TIME
043900,000135:
043901,000136: # ITEMS AVAILABLE FROM LAUNCH DATA
043902,000137: # BSUBO,BDOT
043903,000138: # TIMSUBO,NODIO,NODDOT,FSUBO,FDOT
043904,000139: # COSI= COS(I) B-1
043905,000140: # SINI= SIN(I) B-1
043906,000141: # I IS THE ANGLE BETWEEN THE MEAN LUNAR EQUATORIAL PLANE AND THE
043907,000142: # PLANE OF THE ECLIPTIC (1 DEGREE 32.1 MINUTES)
043908,000143:
043909,000144: # OUTPUT
043910,000145: # MMATRIX= 3X3 M MATRIX B-1 (STORED IN VAC AREA)
043911,000146:
043912,000147: 24,3275 40220 MOONMX STQ SETPD
043913,000148: 24,3276 00051 EARTHMXX
043914,000149: 24,3277 00011 8D
043915,000150: 24,3300 77770 AXT,1 # B REQUIRES SL 0, SL 5 IN NEWANGLE
043916,000151: 24,3301 00005 5
043917,000152: 24,3302 65345 DLOAD PDDL # PD 10D 8-9D=BSUBO
043918,000153: 24,3303 11531 BSUBO # 10-11D=BDOT
043919,000154: 24,3304 11523 BDOT
043920,000155: 24,3305 45006 PUSH CALL # PD 12D
043921,000156: 24,3306 51422 NEWANGLE # EXIT WITH PD 8D AND MPAC= B REVS B0
043922,000157: 24,3307 71406 PUSH COS # PD 10D
043923,000158: 24,3310 14041 STODL COB # PD 8D COS(B) B-1
043924,000159: 24,3311 77756 SIN # SIN(B) B-1
043925,000160: 24,3312 14043 STODL SOB # SETUP INPUT FOR NEWANGLE
043926,000161: 24,3313 11527 FSUBO # 8-9D=FSUBO
043927,000162: 24,3314 41525 PDDL PUSH # PD 10D THEN 12D 10-11D=FDOT
043928,000163: 24,3315 11521 FDOT
043929,000164: 24,3316 45170 AXT,1 CALL # F REQUIRES SL 1, SL 6 IN NEWANGLE
043930,000165: 24,3317 00004 4
043931,000166: 24,3320 51422 NEWANGLE # EXIT WITH PD 8D AND MPAC= F REVS B0
043932,000167: 24,3321 14027 STODL AVECTR +2 # SAVE F TEMP
043933,000168: 24,3322 11525 NODIO # 8-9D=NODIO
043934,000169: 24,3323 41525 PDDL PUSH # PD 10D THEN 12D 10-11D=NODDOT
043935,000170: 24,3324 11517 NODDOT # MPAC=T
043936,000171: 24,3325 45170 AXT,1 CALL # NODE REQUIRES SL 0, SL 5 IN NEWANGLE
043937,000172: 24,3326 00005 5
043938,000173: 24,3327 51422 NEWANGLE # EXIT WITH PD 8D AND MPAC= NODI REVS B0
043939,000174: 24,3330 71406 PUSH COS # PD 10D 8-9D= NODI REVS B0
043940,000175: 24,3331 77606 PUSH # PD 12D 10-11D= COS(NODI) B-1
043941,000176: 24,3332 00025 STORE AVECTR
043942,000177: 24,3333 76405 DMP SL1R
043943,000178: 24,3334 00041 COB # COS(NODI) B-1
043944,000179: 24,3335 14035 STODL BVECTR +2 # PD 10D 20-25D=AVECTR= COB*SIN(NODI)
043945,000180: 24,3336 76405 DMP SL1R # SOB*SIN(NODI)
043946,000181: 24,3337 00043 SOB
043947,000182: 24,3340 14037 STODL BVECTR +4 # PD 8D
043948,000183: 24,3341 41556 SIN PUSH # PD 10D -SIN(NODI) B-1
043949,000184: 24,3342 77676 DCOMP # 26-31D=BVECTR= COB*COS(NODI)
043950,000185: 24,3343 14033 STODL BVECTR # PD 8D SOB*COS(NODI)
043951,000186: 24,3344 00027 AVECTR +2 # MOVE F FROM TEMP LOC. TO 504F
043952,000187: 24,3345 14007 STODL 504F
043953,000188: 24,3346 76405 DMP SL1R
043954,000189: 24,3347 00041 COB
043955,000190: 24,3350 14027 STODL AVECTR +2
043956,000191: 24,3351 00011 SINNODI # 8-9D=SIN(NODI) B-1
043957,000192: 24,3352 76405 DMP SL1R
043958,000193: 24,3353 00043 SOB
043959,000194: 24,3354 14031 STODL AVECTR +4 # 0
043960,000195: 24,3355 06233 HI6ZEROS # 8-13D= CVECTR= -SOB B-1
043961,000196: 24,3356 57525 PDDL DCOMP # PD 10D COB
043962,000197: 24,3357 00043 SOB
043963,000198: 24,3360 63325 PDDL PDVL # PD 12D THEN PD 14D
043964,000199: 24,3361 00041 COB
043965,000200: 24,3362 00033 BVECTR
043966,000201: 24,3363 63361 VXSC PDVL # PD 20D BVECTR*SINI B-2
043967,000202: 24,3364 11515 SINI
043968,000203: 24,3365 00011 CVECTR
043969,000204: 24,3366 53361 VXSC VAD # PD 14D CVECTR*COSI B-2
043970,000205: 24,3367 11513 COSI
043971,000206: 24,3370 77772 VSL1
043972,000207: 24,3371 24041 STOVL MMATRIX +12D # PD 8D M2=BVECTR*SINI+CVECTR*COSI B-1
043973,000208: 24,3372 63361 VXSC PDVL # PD 14D
043974,000209: 24,3373 11515 SINI # CVECTR*SINI B-2
043975,000210: 24,3374 00033 BVECTR
043976,000211: 24,3375 52361 VXSC VSU # PD 8D BVECTR*COSI B-2
043977,000212: 24,3376 11513 COSI
043978,000213: 24,3377 65372 VSL1 PDDL # PD 14D
043979,000214: 24,3400 00007 504F # 8-13D=DVECTR=BVECTR*COSI-CVECTR*SINI B-1
043980,000215: 24,3401 74346 COS VXSC
043981,000216: 24,3402 00011 DVECTR
043982,000217: 24,3403 73525 PDDL SIN # PD 20D 14-19D= DVECTR*COSF B-2
043983,000218: 24,3404 00007 504F
043984,000219: 24,3405 52361 VXSC VSU # PD 14D AVECTR*SINF B-2
043985,000220: 24,3406 00025 AVECTR
043986,000221: 24,3407 77772 VSL1
043987,000222: 24,3410 14033 STODL MMATRIX +6 # M1= AVECTR*SINF-DVECTR*COSF B-1
043988,000223: 24,3411 00007 504F
043989,000224: 24,3412 74356 SIN VXSC # PD 8D
043990,000225: 24,3413 71525 PDDL COS # PD 14D 8-13D=DVECTR*SINF B-2
043991,000226: 24,3414 00007 504F
043992,000227: 24,3415 53361 VXSC VAD # PD 8D AVECTR*COSF B-2
043993,000228: 24,3416 00025 AVECTR
043994,000229: 24,3417 57572 VSL1 VCOMP
043995,000230: 24,3420 34025 STCALL MMATRIX # M0= -(AVECTR*COSF+DVECTR*SINF) B-1
043996,000231: 24,3421 00051 EARTHMXX
043997,000232:
043998,000233: # COMPUTE X=X0+(XDOT)(T+T0)
043999,000234: # 8-9D= XO (REVS B-0), PUSHLOC SET AT 12D
044000,000235: # 10-11D=XDOT (REVS/CSEC) SCALED B+23 FOR WEARTH,B+28 FOR NODDOT AND BDOT
044001,000236: # AND B+27 FOR FDOT
044002,000237: # X1=DIFFERENCE IN 23 AND SCALING OF XDOT,=0 FOR WEARTH,5 FOR NODDOT AND
044003,000238: # BDOT AND 4 FOR FDOT
044004,000239: # 6-7D=T (CSEC B-28), TIMSUBO= (CSEC B-42 TRIPLE PREC.)
044005,000240:
044006,000241: 24,3422 54345 NEWANGLE DLOAD SR # ENTER PD 12D
044007,000242: 24,3423 00007 6D
044008,000243: 24,3424 20617 14D
044009,000244: 24,3425 72371 TAD TLOAD # CHANGE MODE TO TP
044010,000245: 24,3426 01707 TIMSUBO
044011,000246: 24,3427 00155 MPAC
044012,000247: 24,3430 14017 STODL TIMSUBM # T+T0 CSEC B-42
044013,000248: 24,3431 00020 TIMSUBM +1
044014,000249: 24,3432 77605 DMP # PD 10D MULT BY XDOT IN 10-11D
044015,000250: 24,3433 43257 SL* DAD # PD 8D ADD XO IN 8-9D AFTER SHIFTING
044016,000251: 24,3434 20206 5,1 # SUCH THAT SCALING IS B-0
044017,000252: 24,3435 67206 PUSH SLOAD # PD 10D SAVE PARTIAL (X0+XDOT*T) IN 8-9D
044018,000253: 24,3436 00017 TIMSUBM
044019,000254: 24,3437 41261 SL DMP
044020,000255: 24,3440 20212 9D
044021,000256: 24,3441 00013 10D # XDOT
044022,000257: 24,3442 43257 SL* DAD # PD 8D SHIFT SUCH THAT THIS PART OF X
044023,000258: 24,3443 20213 10D,1 # IS SCALED REVS/CSEC B-0
044024,000259: 24,3444 77600 BOV # TURN OFF OVERFLOW IF SET BY SHIFT
044025,000260: 24,3445 51446 +1 # INSTRUCTION BEFORE EXITING
044026,000261: 24,3446 77616 RVQ # MPAC=X= X0+(XDOT)(T+T0) REVS B0
044027,000262:
044028,000263: # ..... EARTHMX SUBROUTINE .....
044029,000264: # SUBROUTINE TO COMPUTE THE TRANSFORMATION MATRIX M FOR THE EARTH
044030,000265:
044031,000266: # CALLING SEQUENCE
044032,000267: # L CALL
044033,000268: # L+1 EARTHMX
044034,000269:
044035,000270: # SUBROUTINES USED
044036,000271: # NEWANGLE
044037,000272:
044038,000273: # INPUT
044039,000274: # INPUT AVAILABLE FROM LAUNCH DATA AZO REVS B-0
044040,000275: # TEPHEM CSEC B-42
044041,000276: # 6-7D= TIME CSEC B-28
044042,000277:
044043,000278: # OUTPUT
044044,000279: # MMATRIX= 3X3 M MATRIX B-1 (STORED IN VAC AREA)
044045,000280:
044046,000281: 24,3447 40220 EARTHMX STQ SETPD # SET 8-9D=AZO
044047,000282: 24,3450 00051 EARTHMXX
044048,000283: 24,3451 00011 8D # 10-11D=WEARTH
044049,000284: 24,3452 77770 AXT,1 # FOR SL 5, AND SL 10 IN NEWANGLE
044050,000285: 24,3453 00000 0
044051,000286: 24,3454 65345 DLOAD PDDL # LEAVING PD SET AT 12D FOR NEWANGLE
044052,000287: 24,3455 01712 AZO
044053,000288: 24,3456 11533 WEARTH
044054,000289: 24,3457 45006 PUSH CALL
044055,000290: 24,3460 51422 NEWANGLE
044056,000291: 24,3461 41401 SETPD PUSH # 18-19D=504AZ
044057,000292: 24,3462 00023 18D # COS(AZ) SIN(AZ) 0
044058,000293: 24,3463 65346 COS PDDL # 20-37D= MMATRIX= -SIN(AZ) COS(AZ) 0 B-1
044059,000294: 24,3464 00023 504AZ # 0 0 1
044060,000295: 24,3465 65356 SIN PDDL
044061,000296: 24,3466 06233 HI6ZEROS
044062,000297: 24,3467 73525 PDDL SIN
044063,000298: 24,3470 00023 504AZ
044064,000299: 24,3471 65276 DCOMP PDDL
044065,000300: 24,3472 00023 504AZ
044066,000301: 24,3473 63346 COS PDVL
044067,000302: 24,3474 06233 HI6ZEROS
044068,000303: 24,3475 41525 PDDL PUSH
044069,000304: 24,3476 06231 HIDPHALF
044070,000305: 24,3477 77650 GOTO
044071,000306: 24,3500 00051 EARTHMXX
044072,000307:
044073,000308: # ..... EARTHL SUBROUTINE .....
044074,000309: # SUBROUTINE TO COMPUTE L VECTOR FOR EARTH
044075,000310:
044076,000311: # CALLING SEQUENCE
044077,000312: # L CALL
044078,000313: # L+1 EARTHL
044079,000314:
044080,000315: # INPUT
044081,000316: # AXO,AYO SET AT LAUNCH TIME WITH AYO IMMEDIATELY FOLLOWING AXO IN CORE
044082,000317:
044083,000318: # OUTPUT
044084,000319: # -AX
044085,000320: # MPAC= -AY RADIANS B-0
044086,000321: # 0
044087,000322:
044088,000323: 24,3501 57545 EARTHL DLOAD DCOMP
044089,000324: 24,3502 01716 AXO
044090,000325: 24,3503 14017 STODL 504LPL
044091,000326: 24,3504 01714 -AYO
044092,000327: 24,3505 14021 STODL 504LPL +2
044093,000328: 24,3506 06233 HI6ZEROS
044094,000329: 24,3507 24023 STOVL 504LPL +4
044095,000330: 24,3510 00017 504LPL
044096,000331: 24,3511 77616 RVQ
044097,000332:
044098,000333: # CONSTANTS AND ERASABLE ASSIGNMENTS
044099,000334:
044100,000335: 24,3512 17775 01734 COSI 2DEC .99964115 B-1 # COS(1 DEG 32.1 MIN) B-1
044101,000336: 24,3514 00333 16153 SINI 2DEC .02678760 B-1 # SIN(1 DEG 32.1 MIN) B-1
044102,000337: 24,3516 77665 42175 NODDOT 2DEC -.457335143 E-2 # REVS/CSEC B+28=-1.07047016 E-8 RAD/SEC
044103,000338: 24,3520 22211 00265 FDOT 2DEC .570862491 # REVS/CSEC B+27= 2.67240019 E-6 RAD/SEC
044104,000339:
044105,000340: 24,3522 77777 77767 BDOT 2DEC -3.07500412 E-8 # REVS/CSEC B+28=-7.19756666 E-14 RAD/SEC
044106,000341: 24,3524 41215 66331 NODIO 2DEC -.960101269 # REVS B-O = -6.03249419 RAD
044107,000342: 24,3526 15237 26751 FSUBO 2DEC .415998375 # REVS B-O = 2.61379488 RAD
044108,000343: 24,3530 02052 35713 BSUBO 2DEC .0651205006 # REVS B-O = 0.409164173 RAD
044109,000344: 24,3532 37116 32630 WEARTH 2DEC .973561855 # REVS/CSEC B+23=7.29211515 E-5 RAD/SEC
044110,000345:
044111,000346: 24,3534 11,2273 1B1 = DP1/2 # 1 SCALED B-1
044112,000347: 24,3534 0000050 RPREXIT = S1 # R-TO-RP AND RP-TO-R SUBR EXIT
044113,000348: 24,3534 0000051 EARTHMXX = S2 # EARTHMX,MOONMX SUBR. EXITS
044114,000349: 24,3534 504RPR = 0D # 6 REGS R OR RP VECTOR
044115,000350: 24,3534 SINNODI = 8D # 2 SIN(NODI)
044116,000351: 24,3534 DVECTR = 8D # 6 D VECTOR MOON
044117,000352: 24,3534 CVECTR = 8D # 6 C VECTR MOON
044118,000353: 24,3534 504AZ = 18D # 2 AZ
044119,000354: 24,3534 TIMSUBM = 14D # 3 TIME SUB M (MOON) T+T0 IN GETAZ
044120,000355: 24,3534 504LPL = 14D # 6 L OR LP VECTOR
044121,000356: 24,3534 AVECTR = 20D # 6 A VECTOR (MOON)
044122,000357: 24,3534 BVECTR = 26D # 6 B VECTOR (MOON)
044123,000358: 24,3534 MMATRIX = 20D # 18 M MATRIX
044124,000359: 24,3534 COB = 32D # 2 COS(B) B-1
044125,000360: 24,3534 SOB = 34D # 2 SIN(B) B-1
044126,000361: 24,3534 504F = 6D # 2 F(MOON)
044127,000362:
End of include-file PLANETARY_INERTIAL_ORIENTATION.agc. Parent file is MAIN.agc