Source Code
These source-code files are part of a reconstructed copy of Comanche 67, the
Apollo Guidance Computer (AGC) Command Module (CM) software for Apollo 12.
They have been adapted from sources files for Comanche 55, and updated via disassembly of binary dumps of original core rope memory modules, part numbers 2003972-1081, 2003972-1091, 2003972-1111, 2003972-1121, 2003972-1131, and 2003972-1141. Since only binary dumps (rather than listings) of Comanche 67 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. |
051505,000002: ## Copyright: Public domain.
051506,000003: ## Filename: PLANETARY_INERTIAL_ORIENTATION.agc
051507,000004: ## Purpose: A section of Comanche revision 067.
051508,000005: ## It is part of the reconstructed source code for the flight
051509,000006: ## software for the Command Module's (CM) Apollo Guidance Computer
051510,000007: ## (AGC) for Apollo 12. No original listings of this program are
051511,000008: ## available; instead, this file was created via dissassembly of
051512,000009: ## dumps of Comanche 067 core rope modules and comparison with
051513,000010: ## other AGC programs.
051514,000011: ## Assembler: yaYUL
051515,000012: ## Contact: Ron Burkey <info@sandroid.org>.
051516,000013: ## Website: www.ibiblio.org/apollo/index.html
051517,000014: ## Mod history: 2023-08-16 MAS Created from Comanche 055.
051518,000015: ## 2024-05-13 MAS Updated for Comanche 067.
051519,000016:
051520,000017: # ..... RP-TO-R SUBROUTINE .....
051521,000018: # SUBROUTINE TO CONVERT RP (VECTOR IN PLANETARY COORDINATE SYSTEM, EITHER
051522,000019: # EARTH-FIXED OR MOON-FIXED) TO R (SAME VECTOR IN THE BASIC REF. SYSTEM)
051523,000020: # R = MT(T) * (RP + LP X RP) MT = M MATRIX TRANSPOSE
051524,000021:
051525,000022: # CALLING SEQUENCE
051526,000023: # L CALL
051527,000024: # L+1 RP-TO-R
051528,000025:
051529,000026: # SUBROUTINES USED
051530,000027: # EARTHMX, MOONMX, EARTHL
051531,000028:
051532,000029: # ITEMS AVAILABLE FROM LAUNCH DATA
051533,000030: # 504LM = THE LIBRATION VECTOR L OF THE MOON AT TIME TIMSUBL, EXPRESSED
051534,000031: # IN THE MOON-FIXED COORD. SYSTEM RADIANS B0
051535,000032:
051536,000033: # ITEMS NECESSARY FOR SUBR. USED (SEE DESCRIPTION OF SUBR.)
051537,000034:
051538,000035: # INPUT
051539,000036: # MPAC = 0 FOR EARTH, NON-ZERO FOR MOON
051540,000037: # 0-5D = RP VECTOR
051541,000038: # 6-7D = TIME
051542,000039:
051543,000040: # OUTPUT
051544,000041: # MPAC = R VECTOR METERS B-29 FOR EARTH, B-27 FOR MOON
051545,000042:
051546,000043: 26,2000 SETLOC PLANTIN
051547,000044: 26,2000 BANK
051548,000045:
051549,000046: 26,3343 COUNT* $$/LUROT
051550,000047:
051551,000048: 26,3343 46020 RP-TO-R STQ BHIZ
051552,000049: 26,3344 00050 RPREXIT
051553,000050: 26,3345 55360 RPTORA
051554,000051: 26,3346 77624 CALL # COMPUTE M MATRIX FOR MOON
051555,000052: 26,3347 55420 MOONMX # LP=LM FOR MOON RADIANS B0
051556,000053: 26,3350 77775 VLOAD
051557,000054: 26,3351 02012 504LM
051558,000055: 26,3352 53235 RPTORB VXV VAD
051559,000056: 26,3353 00001 504RPR
051560,000057: 26,3354 00001 504RPR
051561,000058: 26,3355 52105 VXM GOTO
051562,000059: 26,3356 00025 MMATRIX # MPAC=R=MT(T)*(RP+LPXRP)
051563,000060: 26,3357 55406 RPRPXXXX # RESET PUSHLOC TO 0 BEFORE EXITING
051564,000061: 26,3360 77624 RPTORA CALL # EARTH COMPUTATIONS
051565,000062: 26,3361 55572 EARTHMX # M MATRIX B-1
051566,000063: 26,3362 77624 CALL
051567,000064: 26,3363 55624 EARTHL # L VECTOR RADIANS B0
051568,000065: 26,3364 76521 MXV VSL1 # LP=M(T)*L RAD B-0
051569,000066: 26,3365 00025 MMATRIX
051570,000067: 26,3366 77650 GOTO
051571,000068: 26,3367 55352 RPTORB
051572,000069:
051573,000070: # ..... R-TO-RP SUBROUTINE .....
051574,000071: # SUBROUTINE TO CONVERT R (VECTOR IN REFERENCE COORD. SYSTEM) TO RP
051575,000072: # (VECTOR IN PLANETARY COORD SYSTEM) EITHER EARTH-FIXED OR MOON-FIXED
051576,000073: # RP = M(T) * (R - L X R)
051577,000074:
051578,000075: # CALLING SEQUENCE
051579,000076: # L CALL
051580,000077: # L+1 R-TO-RP
051581,000078:
051582,000079: # SUBROUTINES USED
051583,000080: # EARTHMX, MOONMX, EARTHL
051584,000081:
051585,000082: # INPUT
051586,000083: # MPAC = 0 FOR EARTH, NON-ZERO FOR MOON
051587,000084: # 0-5D = R VECTOR
051588,000085: # 6-7D = TIME
051589,000086:
051590,000087: # ITEMS AVAILABLE FROM LAUNCH DATA
051591,000088: # 504LM = THE LIBRATION VECTOR L OF THE MOON AT TIME TIMSUBL, EXPRESSED
051592,000089: # IN THE MOON-FIXED COORD. SYSTEM RADIANS B0
051593,000090:
051594,000091: # ITEMS NECESSARY FOR SUBROUTINES USED (SEE DESCRIPTION OF SUBR.)
051595,000092:
051596,000093: # OUTPUT
051597,000094: # MPAC = RP VECTOR METERS B-29 FOR EARTH, B-27 FOR MOON
051598,000095:
051599,000096: 26,3370 46020 R-TO-RP STQ BHIZ
051600,000097: 26,3371 00050 RPREXIT
051601,000098: 26,3372 55412 RTORPA
051602,000099: 26,3373 77624 CALL
051603,000100: 26,3374 55420 MOONMX
051604,000101: 26,3375 61375 VLOAD VXM
051605,000102: 26,3376 02012 504LM # LP=LM
051606,000103: 26,3377 00025 MMATRIX
051607,000104: 26,3400 77772 VSL1 # L = MT(T)*LP RADIANS B0
051608,000105: 26,3401 51235 RTORPB VXV BVSU
051609,000106: 26,3402 00001 504RPR
051610,000107: 26,3403 00001 504RPR
051611,000108: 26,3404 77721 MXV # M(T)*(R-LXR) B-2
051612,000109: 26,3405 00025 MMATRIX
051613,000110: 26,3406 40372 RPRPXXXX VSL1 SETPD
051614,000111: 26,3407 00001 0D
051615,000112: 26,3410 77650 GOTO
051616,000113: 26,3411 00050 RPREXIT
051617,000114: 26,3412 77624 RTORPA CALL # EARTH COMPUTATIONS
051618,000115: 26,3413 55572 EARTHMX
051619,000116: 26,3414 77624 CALL
051620,000117: 26,3415 55624 EARTHL
051621,000118: 26,3416 77650 GOTO # MPAC=L=(-AX,-AY,0) RAD B-0
051622,000119: 26,3417 55401 RTORPB
051623,000120:
051624,000121: # ..... MOONMX SUBROUTINE .....
051625,000122: # SUBROUTINE TO COMPUTE THE TRANSFORMATION MATRIX M FOR THE MOON
051626,000123:
051627,000124: # CALLING SEQUENCE
051628,000125: # L CALL
051629,000126: # L+1 MOONMX
051630,000127:
051631,000128: # SUBROUTINES USED
051632,000129: # NEWANGLE
051633,000130:
051634,000131: # INPUT
051635,000132: # 6-7D = TIME
051636,000133:
051637,000134: # ITEMS AVAILABLE FROM LAUNCH DATA
051638,000135: # BSUBO, BDOT
051639,000136: # TIMSUBO, NODIO, NODDOT, FSUBO, FDOT
051640,000137: # COSI = COS(I) B-1
051641,000138: # SINI = SIN(I) B-1
051642,000139: # I IS THE ANGLE BETWEEN THE MEAN LUNAR EQUATORIAL PLANE AND THE
051643,000140: # PLANE OF THE ECLIPTIC (1 DEGREE 32.1 MINUTES)
051644,000141:
051645,000142: # OUTPUT
051646,000143: # MMATRIX = 3X3 M MATRIX B-1 (STORED IN VAC AREA)
051647,000144:
051648,000145: 26,3420 40220 MOONMX STQ SETPD
051649,000146: 26,3421 00051 EARTHMXX
051650,000147: 26,3422 00011 8D
051651,000148: 26,3423 77770 AXT,1 # B REQUIRES SL 0, SL 5 IN NEWANGLE
051652,000149: 26,3424 00005 5
051653,000150: 26,3425 65345 DLOAD PDDL # PD 10D 8-9D=BSUBO
051654,000151: 26,3426 15654 BSUBO # 10-11D=BDOT
051655,000152: 26,3427 15646 BDOT
051656,000153: 26,3430 45006 PUSH CALL # PD 12D
051657,000154: 26,3431 55545 NEWANGLE # EXIT WITH PD 8D AND MPAC= B REVS B0
051658,000155: 26,3432 71406 PUSH COS # PD 10D
051659,000156: 26,3433 14041 STODL COB # PD 8D COS(B) B-1
051660,000157: 26,3434 77756 SIN # SIN(B) B-1
051661,000158: 26,3435 14043 STODL SOB # SETUP INPUT FOR NEWANGLE
051662,000159: 26,3436 15652 FSUBO # 8-9D=FSUBO
051663,000160: 26,3437 41525 PDDL PUSH # PD 10D THEN 12D 10-11D=FDOT
051664,000161: 26,3440 15644 FDOT
051665,000162: 26,3441 45170 AXT,1 CALL # F REQUIRES SL 1, SL 6 IN NEWANGLE
051666,000163: 26,3442 00004 4
051667,000164: 26,3443 55545 NEWANGLE # EXIT WITH PD 8D AND MPAC= F REVS B0
051668,000165: 26,3444 14027 STODL AVECTR +2 # SAVE F TEMP
051669,000166: 26,3445 15650 NODIO # 8-9D=NODIO
051670,000167: 26,3446 41525 PDDL PUSH # PD 10D THEN 12D 10-11D=NODDOT
051671,000168: 26,3447 15642 NODDOT # MPAC=T
051672,000169: 26,3450 45170 AXT,1 CALL # NODE REQUIRES SL 0, SL 5 IN NEWANGLE
051673,000170: 26,3451 00005 5
051674,000171: 26,3452 55545 NEWANGLE # EXIT WITH PD 8D AND MPAC= NODI REVS B0
051675,000172: 26,3453 71406 PUSH COS # PD 10D 8-9D= NODI REVS B0
051676,000173: 26,3454 77606 PUSH # PD 12D 10-11D= COS(NODI) B-1
051677,000174: 26,3455 00025 STORE AVECTR
051678,000175: 26,3456 76405 DMP SL1R
051679,000176: 26,3457 00041 COB # COS(NODI) B-1
051680,000177: 26,3460 14035 STODL BVECTR +2 # PD 10D 20-25D=AVECTR=COB*SIN(NODI)
051681,000178: 26,3461 76405 DMP SL1R # SOB*SIN(NODI)
051682,000179: 26,3462 00043 SOB
051683,000180: 26,3463 14037 STODL BVECTR +4 # PD 8D
051684,000181: 26,3464 41556 SIN PUSH # PD 10D -SIN(NODI) B-1
051685,000182: 26,3465 77676 DCOMP # 26-31D=BVECTR=COB*COS(NODI)
051686,000183: 26,3466 14033 STODL BVECTR # PD 8D SOB*COS(NODI)
051687,000184: 26,3467 00027 AVECTR +2 # MOVE F FROM TEMP LOC. TO 504F
051688,000185: 26,3470 14007 STODL 504F
051689,000186: 26,3471 76405 DMP SL1R
051690,000187: 26,3472 00041 COB
051691,000188: 26,3473 14027 STODL AVECTR +2
051692,000189: 26,3474 00011 SINNODI # 8-9D=SIN(NODI) B-1
051693,000190: 26,3475 76405 DMP SL1R
051694,000191: 26,3476 00043 SOB
051695,000192: 26,3477 14031 STODL AVECTR +4 # 0
051696,000193: 26,3500 15334 HI6ZEROS # 8-13D= CVECTR= -SOB B-1
051697,000194: 26,3501 57525 PDDL DCOMP # PD 10D COB
051698,000195: 26,3502 00043 SOB
051699,000196: 26,3503 63325 PDDL PDVL # PD 12D THEN PD 14D
051700,000197: 26,3504 00041 COB
051701,000198: 26,3505 00033 BVECTR
051702,000199: 26,3506 63361 VXSC PDVL # PD 20D BVECTR*SINI B-2
051703,000200: 26,3507 15640 SINI
051704,000201: 26,3510 00011 CVECTR
051705,000202: 26,3511 53361 VXSC VAD # PD 14D CVECTR*COSI B-2
051706,000203: 26,3512 15636 COSI
051707,000204: 26,3513 77772 VSL1
051708,000205: 26,3514 24041 STOVL MMATRIX +12D # PD 8D M2=BVECTR*SINI+CVECTR*COSI B-1
051709,000206: 26,3515 63361 VXSC PDVL # PD 14D
051710,000207: 26,3516 15640 SINI # CVECTR*SINI B-2
051711,000208: 26,3517 00033 BVECTR
051712,000209: 26,3520 52361 VXSC VSU # PD 8D BVECTR*COSI B-2
051713,000210: 26,3521 15636 COSI
051714,000211: 26,3522 65372 VSL1 PDDL # PD 14D
051715,000212: 26,3523 00007 504F # 8-13D=DVECTR=BVECTR*COSI-CVECTR*SINI B-1
051716,000213: 26,3524 74346 COS VXSC
051717,000214: 26,3525 00011 DVECTR
051718,000215: 26,3526 73525 PDDL SIN # PD 20D 14-19D= DVECTR*COSF B-2
051719,000216: 26,3527 00007 504F
051720,000217: 26,3530 52361 VXSC VSU # PD 14D AVECTR*SINF B-2
051721,000218: 26,3531 00025 AVECTR
051722,000219: 26,3532 77772 VSL1
051723,000220: 26,3533 14033 STODL MMATRIX +6 # M1= AVECTR*SINF-DVECTR*COSF B-1
051724,000221: 26,3534 00007 504F
051725,000222: 26,3535 74356 SIN VXSC # PD 8D
051726,000223: 26,3536 71525 PDDL COS # PD 14D 8-13D=DVECTR*SINF B-2
051727,000224: 26,3537 00007 504F
051728,000225: 26,3540 53361 VXSC VAD # PD 8D AVECTR*COSF B-2
051729,000226: 26,3541 00025 AVECTR
051730,000227: 26,3542 57572 VSL1 VCOMP
051731,000228: 26,3543 34025 STCALL MMATRIX # M0= -(AVECTR*COSF+DVECTR*SINF) B-1
051732,000229: 26,3544 00051 EARTHMXX
051733,000230:
051734,000231: # COMPUTE X=X0+(XDOT)(T+T0)
051735,000232: # 8-9D= XO (REVS B-0), PUSHLOC SET AT 12D
051736,000233: # 10-11D=XDOT (REVS/CSEC) SCALED B+23 FOR WEARTH,B+28 FOR NODDOT AND BDOT
051737,000234: # AND B+27 FOR FDOT
051738,000235: # X1=DIFFERENCE IN 23 AND SCALING OF XDOT, =0 FOR WEARTH, 5 FOR NODDOT AND
051739,000236: # BDOT AND 4 FOR FDOT
051740,000237: # 6-7D=T (CSEC B-28), TIMSUBO= (CSEC B-42 TRIPLE PREC.)
051741,000238:
051742,000239: 26,3545 54345 NEWANGLE DLOAD SR # ENTER PD 12D
051743,000240: 26,3546 00007 6D
051744,000241: 26,3547 20617 14D
051745,000242: 26,3550 72371 TAD TLOAD # CHANGE MODE TO TP
051746,000243: 26,3551 01707 TIMSUBO
051747,000244: 26,3552 00155 MPAC
051748,000245: 26,3553 14017 STODL TIMSUBM # T+T0 CSEC B-42
051749,000246: 26,3554 00020 TIMSUBM +1
051750,000247: 26,3555 77605 DMP # PD 10D MULT BY XDOT IN 10-11D
051751,000248: 26,3556 43257 SL* DAD # PD 8D ADD XO IN 8-9D AFTER SHIFTING
051752,000249: 26,3557 20206 5,1 # SUCH THAT SCALING IS B-0
051753,000250: 26,3560 67206 PUSH SLOAD # PD 10D SAVE PARTIAL (X0+XDOT*T) IN 8-9D
051754,000251: 26,3561 00017 TIMSUBM
051755,000252: 26,3562 41261 SL DMP
051756,000253: 26,3563 20212 9D
051757,000254: 26,3564 00013 10D # XDOT
051758,000255: 26,3565 43257 SL* DAD # PD 8D SHIFT SUCH THAT THIS PART OF X
051759,000256: 26,3566 20213 10D,1 # IS SCALED REVS/CSEC B-0
051760,000257: 26,3567 77600 BOV # TURN OFF OVERFLOW IF SET BY SHIFT
051761,000258: 26,3570 55571 +1 # INSTRUCTION BEFORE EXITING
051762,000259: 26,3571 77616 RVQ # MPAC=X= X0+(XDOT)(T+T0) REVS B0
051763,000260:
051764,000261: # ..... EARTHMX SUBROUTINE .....
051765,000262: # SUBROUTINE TO COMPUTE THE TRANSFORMATION MATRIX M FOR THE EARTH
051766,000263:
051767,000264: # CALLING SEQUENCE
051768,000265: # L CALL
051769,000266: # L+1 EARTHMX
051770,000267:
051771,000268: # SUBROUTINES USED
051772,000269: # NEWANGLE
051773,000270:
051774,000271: # INPUT
051775,000272: # INPUT AVAILABLE FROM LAUNCH DATA AZO REVS B-0
051776,000273: # TEPHEM CSEC B-42
051777,000274: # 6-7D= TIME CSEC B-28
051778,000275:
051779,000276: # OUTPUT
051780,000277: # MMATRIX= 3X3 M MATRIX B-1 (STORED IN VAC AREA)
051781,000278:
051782,000279: 26,3572 40220 EARTHMX STQ SETPD # SET 8-9D=AZO
051783,000280: 26,3573 00051 EARTHMXX
051784,000281: 26,3574 00011 8D # 10-11D=WEARTH
051785,000282: 26,3575 77770 AXT,1 # FOR SL 5, AND SL 10 IN NEWANGLE
051786,000283: 26,3576 00000 0
051787,000284: 26,3577 65345 DLOAD PDDL # LEAVING PD SET AT 12D FOR NEWANGLE
051788,000285: 26,3600 01712 AZO
051789,000286: 26,3601 15656 WEARTH
051790,000287: 26,3602 45006 PUSH CALL
051791,000288: 26,3603 55545 NEWANGLE
051792,000289: 26,3604 41401 SETPD PUSH # 18-19D=504AZ
051793,000290: 26,3605 00023 18D # COS(AZ) SIN(AZ) 0
051794,000291: 26,3606 65346 COS PDDL # 20-37D= MMATRIX= -SIN(AZ) COS(AZ) 0 B-1
051795,000292: 26,3607 00023 504AZ # 0 0 1
051796,000293: 26,3610 65356 SIN PDDL
051797,000294: 26,3611 15334 HI6ZEROS
051798,000295: 26,3612 73525 PDDL SIN
051799,000296: 26,3613 00023 504AZ
051800,000297: 26,3614 65276 DCOMP PDDL
051801,000298: 26,3615 00023 504AZ
051802,000299: 26,3616 63346 COS PDVL
051803,000300: 26,3617 15334 HI6ZEROS
051804,000301: 26,3620 41525 PDDL PUSH
051805,000302: 26,3621 15332 HIDPHALF
051806,000303: 26,3622 77650 GOTO
051807,000304: 26,3623 00051 EARTHMXX
051808,000305:
051809,000306: # ..... EARTHL SUBROUTINE .....
051810,000307: # SUBROUTINE TO COMPUTE L VECTOR FOR EARTH
051811,000308:
051812,000309: # CALLING SEQUENCE
051813,000310: # L CALL
051814,000311: # L+1 EARTHL
051815,000312:
051816,000313: # INPUT
051817,000314: # AXO,AYO SET AT LAUNCH TIME WITH AYO IMMEDIATELY FOLLOWING AXO IN CORE
051818,000315:
051819,000316: # OUTPUT
051820,000317: # -AX
051821,000318: # MPAC= -AY RADIANS B-0
051822,000319: # 0
051823,000320:
051824,000321: 26,3624 57545 EARTHL DLOAD DCOMP
051825,000322: 26,3625 01716 AXO
051826,000323: 26,3626 14017 STODL 504LPL
051827,000324: 26,3627 01714 -AYO
051828,000325: 26,3630 14021 STODL 504LPL +2
051829,000326: 26,3631 15334 HI6ZEROS
051830,000327: 26,3632 24023 STOVL 504LPL +4
051831,000328: 26,3633 00017 504LPL
051832,000329: 26,3634 77616 RVQ
051833,000330:
051834,000331: # CONSTANTS AND ERASABLE ASSIGNMENTS
051835,000332:
051836,000333: 26,3635 04,3563 1B1 = DP1/2 # 1 SCALED B-1
051837,000334: 26,3635 17775 02052 COSI 2DEC .99964173 B-1 # COS(5521.5 SEC) B-1
051838,000335:
051839,000336: 26,3637 00333 10374 SINI 2DEC .02676579 B-1 # SIN(5521.5 SEC) B-1
051840,000337:
051841,000338: 26,3641 0000050 RPREXIT = S1 # R-TO-RP AND RP-TO-R SUBR EXIT
051842,000339: 26,3641 0000051 EARTHMXX = S2 # EARTHMX, MOONMX SUBR. EXITS
051843,000340: 26,3641 504RPR = 0D # 6 REGS R OR RP VECTOR
051844,000341: 26,3641 SINNODI = 8D # 2 SIN(NODI)
051845,000342: 26,3641 DVECTR = 8D # 6 D VECTOR MOON
051846,000343: 26,3641 CVECTR = 8D # 6 C VECTR MOON
051847,000344: 26,3641 504AZ = 18D # 2 AZ
051848,000345: 26,3641 TIMSUBM = 14D # 3 TIME SUB M (MOON) T+T0 IN GETAZ
051849,000346: 26,3641 504LPL = 14D # 6 L OR LP VECTOR
051850,000347: 26,3641 AVECTR = 20D # 6 A VECTOR (MOON)
051851,000348: 26,3641 BVECTR = 26D # 6 B VECTOR (MOON)
051852,000349: 26,3641 MMATRIX = 20D # 18 M MATRIX
051853,000350: 26,3641 COB = 32D # 2 COS(B) B-1
051854,000351: 26,3641 SOB = 34D # 2 SIN(B) B-1
051855,000352: 26,3641 504F = 6D # 2 F(MOON)
051856,000353: 26,3641 77665 42175 NODDOT 2DEC* -1.703706190 E-11 B28* # REV/CSEC
051857,000354:
051858,000355: 26,3643 22211 00636 FDOT 2DEC* 4.253263473 E-9 B27* # REV/CSEC
051859,000356:
051860,000357: 26,3645 77777 77767 BDOT 2DEC* -1.145529388 E-16 B28* # REV/CSEC
051861,000358:
051862,000359: 26,3647 37436 01614 NODIO 2DEC* 9.862094363 E-1* # REV
051863,000360:
051864,000361: 26,3651 32417 32011 FSUBO 2DEC* 8.290901511 E-1* # REV
051865,000362:
051866,000363: 26,3653 02052 35552 BSUBO 2DEC 6.512013939 E-2 # REVS
051867,000364:
051868,000365: 26,3655 37116 32631 WEARTH 2DEC* 1.160576171 E-7 B23* # REV/CSEC
051869,000366:
End of include-file PLANETARY_INERTIAL_ORIENTATION.agc. Parent file is MAIN.agc