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. |
037620,000002: ## Copyright: Public domain.
037621,000003: ## Filename: CM_BODY_ATTITUDE.agc
037622,000004: ## Purpose: A section of Comanche revision 067.
037623,000005: ## It is part of the reconstructed source code for the flight
037624,000006: ## software for the Command Module's (CM) Apollo Guidance Computer
037625,000007: ## (AGC) for Apollo 12. No original listings of this program are
037626,000008: ## available; instead, this file was created via dissassembly of
037627,000009: ## dumps of Comanche 067 core rope modules and comparison with
037628,000010: ## other AGC programs.
037629,000011: ## Assembler: yaYUL
037630,000012: ## Contact: Ron Burkey <info@sandroid.org>.
037631,000013: ## Website: www.ibiblio.org/apollo/index.html
037632,000014: ## Mod history: 2023-08-16 MAS Created from Comanche 055.
037633,000015:
037634,000016: 35,3477 BANK 35
037635,000017:
037636,000018: 37,2000 SETLOC BODYATT
037637,000019: 37,2000 BANK
037638,000020:
037639,000021: 37,3473 COUNT 37/CMBAT
037640,000022:
037641,000023: # PDL 12D - 15D SAFE.
037642,000024:
037643,000025: # VALUES OF GIMBAL AND BODY ANGLES VALID AT PIP TIME ARE SAVED DURING READACCS.
037644,000026:
037645,000027: 37,3473 E7,1451 EBANK= RTINIT # LET INTERPRETER SET EB
037646,000028:
037647,000029: 37,3473 06006 CM/POSE TC INTPRET # COME HERE VIA AVEGEXIT.
037648,000030:
037649,000031: 37,3474 77201 SETPD VLOAD
037650,000032: 37,3475 00001 0
037651,000033: 37,3476 01177 VN # KVSCALE = (12800/ .3048) /2VS
037652,000034: 37,3477 63361 VXSC PDVL
037653,000035: 37,3500 37772 -KVSCALE # KVSCALE = .81491944
037654,000036: 37,3501 01714 UNITW # FULL UNIT VECTOR
037655,000037: 37,3502 74235 VXV VXSC # VREL = V - WE*R
037656,000038: 37,3503 01760 UNITR
037657,000039: 37,3504 15244 KWE
037658,000040: 37,3505 45455 VAD STADR
037659,000041: 37,3506 74251 STORE -VREL # SAVE FOR ENTRY GUIDANCE. REF COORDS
037660,000042:
037661,000043: 37,3507 72056 UNIT LXA,1
037662,000044: 37,3510 00044 36D # ABVAL( -VREL) TO X1
037663,000045: 37,3511 03542 STORE UXA/2 # -UVREL REF COORDS
037664,000046:
037665,000047: 37,3512 57435 VXV VCOMP
037666,000048: 37,3513 01760 UNITR # .5 UNIT REF COORDS
037667,000049: 37,3514 66256 UNIT SSP # THE FOLLOWING IS TO PROVIDE A STABLE
037668,000050: 37,3515 00051 S1 # UN FOR THE END OF THE TERMINAL PHASE.
037669,000051: 37,3516 00476 SPVQUIT DEC .019405 # 1000/ 2 VS
037670,000052: 37,3517 77300 TIX,1 VLOAD # IF V-VQUIT POS, BRANCH.
037671,000053: 37,3520 77522 CM/POSE2 # SAVE UYA IN OLDUYA
037672,000054: 37,3521 03534 OLDUYA # OTHERWISE CONTINUE TO USE OLDUYA.
037673,000055: 37,3522 03550 CM/POSE2 STORE UYA/2 # REF COORDS
037674,000056:
037675,000057: 37,3523 03534 STORE OLDUYA # RESTORE, OR SAVE AS CASE MAY BE.
037676,000058:
037677,000059: 37,3524 57435 VXV VCOMP
037678,000060: 37,3525 03542 UXA/2 # FINISH OBTAINING TRAJECTORY TRIAD.
037679,000061: 37,3526 77772 VSL1
037680,000062: 37,3527 03556 STORE UZA/2 # REF COORDS
037681,000063: 37,3530 77751 TLOAD # PICK UP CDUX, CDUY, CDUZ CORRESPONDING
037682,000064: 37,3531 03270 AOG/PIP # TO PIPUP TIME IN 2S,C AND SAVE.
037683,000065: 37,3532 14031 CM/TRIO STODL 24D
037684,000066: 37,3533 00032 25D # AIG/PIP
037685,000067:
037686,000068: 37,3534 41434 RTB PUSH # TO PDL0
037687,000069: 37,3535 45513 CDULOGIC
037688,000070: 37,3536 77746 COS
037689,000071: 37,3537 17564 STODL UBX/2 # CI /2
037690,000072: # AIG/PIP FROM PDL 0
037691,000073: 37,3540 57556 SIN DCOMP
037692,000074: 37,3541 17570 STODL UBX/2 +4 # -SI /2
037693,000075: 37,3542 00033 26D # AMG/PIP
037694,000076: 37,3543 41434 RTB PUSH # TO PDL 0
037695,000077: 37,3544 45513 CDULOGIC
037696,000078: 37,3545 65356 SIN PDDL # XCH PDL 0. SAVE SM /2
037697,000079: 37,3546 65346 COS PDDL # CM /2 TO PDL 2
037698,000080: 37,3547 00001 0 # SM /2
037699,000081: 37,3550 74276 DCOMP VXSC
037700,000082: 37,3551 03564 UBX/2
037701,000083: 37,3552 77772 VSL1 # NOISE WONT OVFL.
037702,000084: 37,3553 17572 STODL UBY/2 # =(-SMCI, NOISE, SMSI)/2
037703,000085: 37,3554 00003 2 # CM /2 REPLACES NOISE
037704,000086: 37,3555 17574 STODL UBY/2 +2 # UBY/2=(-SMCI, CM, SMSI)/2
037705,000087: 37,3556 00031 24D # AOG/PIP
037706,000088: 37,3557 41434 RTB PUSH # TO PDL 4
037707,000089: 37,3560 45513 CDULOGIC
037708,000090: 37,3561 65356 SIN PDDL # XCH PDL 4. SAVE SO /2
037709,000091: 37,3562 74346 COS VXSC # CO /2
037710,000092: 37,3563 03572 UBY/2
037711,000093: 37,3564 17572 STODL UBY/2 # UBY/2=(-COSMCI, COCM, COSMSI)/4
037712,000094: 37,3565 00005 4D # SO /2
037713,000095: 37,3566 57405 DMP DCOMP
037714,000096: 37,3567 03570 UBX/2 +4 # -SI /2
037715,000097: 37,3570 77615 DAD
037716,000098: 37,3571 03572 UBY/2 # INCREMENT BY (SOSI /4)
037717,000099: 37,3572 17572 STODL UBY/2
037718,000100: # SO /2 FROM PDL 4
037719,000101: 37,3573 43205 DMP DAD
037720,000102: 37,3574 03564 UBX/2 # CI /2
037721,000103: 37,3575 03576 UBY/2 +4
037722,000104: 37,3576 27576 STOVL UBY/2 +4 # YB/4 PLATFORM COORDS
037723,000105:
037724,000106: # YB = (-COSMCI + SOSI , COCM , COSMSI + SOCI )
037725,000107:
037726,000108: 37,3577 03572 UBY/2
037727,000109: 37,3600 72505 VXM VSL2
037728,000110: 37,3601 01736 REFSMMAT # .5 UNIT
037729,000111: 37,3602 17572 STODL UBY/2 # YB/2 DONE REF COORDS
037730,000112: # CM /2 FROM PDL 2
037731,000113: 37,3603 76561 VXSC VSL1
037732,000114: 37,3604 03564 UBX/2
037733,000115: 37,3605 17564 STODL UBX/2 # =( CMCI, NOISE, -CMSI)/2
037734,000116: 37,3606 77626 STADR # SM /2 FROM PDL 0
037735,000117: 37,3607 50211 STOVL UBX/2 +2 # SM /2 REPLACES NOISE
037736,000118: 37,3610 03564 UBX/2 # XB/2 PLATFORM COORDS
037737,000119:
037738,000120: # XB = ( CMCI , SM , -CMSI )
037739,000121:
037740,000122: 37,3611 76505 VXM VSL1
037741,000123: 37,3612 01736 REFSMMAT # .5 UNIT
037742,000124: 37,3613 03564 STORE UBX/2 # XB/2 DONE REF COORDS
037743,000125:
037744,000126: 37,3614 76435 VXV VSL1
037745,000127: 37,3615 03572 UBY/2
037746,000128: 37,3616 27600 STOVL UBZ/2 # ZB/2 DONE REF COORDS
037747,000129:
037748,000130: # EQUIVALENT TO
037749,000131: # ZB = ( SOSMCI + COSI , -SOCM , -SOSMSI + COCI )
037750,000132:
037751,000133: 37,3617 03542 UXA/2 # -UVREL/2 = -UVA/2
037752,000134: 37,3620 53435 VXV UNIT # GET UNIT(-UVREL*UBY)/2 = UL/2
037753,000135: 37,3621 03572 UBY/2 # YB/2
037754,000136: 37,3622 50206 PUSH DOT # UL/2 TO PDL 0,5
037755,000137: 37,3623 03556 UZA/2 # UNA/2
037756,000138: 37,3624 24021 STOVL COSTH # COS(ROLL)/4
037757,000139: 37,3625 00001 0 # UL/2
037758,000140:
037759,000141: 37,3626 77641 DOT
037760,000142: 37,3627 03550 UYA/2
037761,000143: 37,3630 34023 STCALL SINTH # -SIN(ROLL)/4
037762,000144: 37,3631 47260 ARCTRIG
037763,000145: 37,3632 24007 STOVL 6D # -(ROLL/180) /2
037764,000146: 37,3633 03572 UBY/2
037765,000147: 37,3634 72441 DOT SL1 # -UVA.UBY = -SIN(BETA)
037766,000148: 37,3635 03542 UXA/2 # -UVREL/2
037767,000149: 37,3636 77736 ARCSIN
037768,000150: 37,3637 24010 STOVL 7D # -(BETA/180) /2
037769,000151: 37,3640 03564 UBX/2 # XB/2
037770,000152: 37,3641 77641 DOT # UL.UBX = -SIN(ALFA)
037771,000153: 37,3642 00001 0 # UL/2
037772,000154: 37,3643 24023 STOVL SINTH # -SIN(ALFA)/4
037773,000155: 37,3644 77641 DOT # UL/2 FROM PDL 0
037774,000156: 37,3645 03600 UBZ/2
037775,000157: 37,3646 34021 STCALL COSTH # COS(ALFA)/4
037776,000158: 37,3647 47260 ARCTRIG
037777,000159: 37,3650 24011 STOVL 8D # -(ALFA/180) /2
037778,000160: 37,3651 01760 UNITR # UR/2 REF COORDS
037779,000161: 37,3652 72441 DOT SL1
037780,000162: 37,3653 03556 UZA/2 # MORE ACCURATE AT LARGE ARG.
037781,000163: 37,3654 77726 ARCCOS
037782,000164: 37,3655 00013 STORE 10D # (-GAMA/180)/2
037783,000165:
037784,000166: 37,3656 77551 TLOAD EXIT # ANGLES IN MPAC IN THE ORDER
037785,000167: # -( (ROLL, BETA, ALFA) /180)/2
037786,000168: 37,3657 00007 6D # THESE VALUES CORRECT AT PIPUP TIME.
037787,000169:
037788,000170: # SPACER
037789,000171: # BASIC SUBROUTINE TO UPDATE ATTITUDE ANGLES
037790,000172:
037791,000173: 37,3660 E6,1661 EBANK= AOG
037792,000174:
037793,000175: 37,3660 35073 CM/ATUP CA EBAOG
037794,000176: 37,3661 54003 TS EBANK
037795,000177: 37,3662 50120 CMTR1 INDEX FIXLOC
037796,000178: 37,3663 40012 CS 10D # (GAMA/180)/2
037797,000179: 37,3664 57722 XCH GAMA
037798,000180: 37,3665 54001 TS L
037799,000181:
037800,000182: 37,3666 00004 INHINT
037801,000183: # MUST REMAIN INHINTED UNTIL UPDATE OF BODY
037802,000184: # ANGLES, SO THAT GAMDIFSW IS VALID FIRST PASS
037803,000185: # INDICATOR.
037804,000186:
037805,000187: 37,3667 40102 CS CM/FLAGS
037806,000188: 37,3670 75021 MASK BIT11 # GAMDIFSW=94D BIT11 INITLY=0
037807,000189: 37,3671 00006 EXTEND # DONT CALC GAMA DOT UNTIL HAVE FORMD
037808,000190: # ONE DIFFERENCE.
037809,000191: 37,3672 13675 BZF DOGAMDOT # IS OK, GO ON.
037810,000192: 37,3673 26102 ADS CM/FLAGS # KNOW BIT IS 0
037811,000193: 37,3674 03710 TC NOGAMDOT # SET GAMDOT = 0
037812,000194:
037813,000195: 37,3675 40001 DOGAMDOT CS L
037814,000196: 37,3676 61722 AD GAMA # DEL GAMA/360= T GAMDOT/360
037815,000197: 37,3677 00006 EXTEND
037816,000198: 37,3700 73773 MP TCDU # TCDU = .1 SEC, T = 2 SEC.
037817,000199: 37,3701 55723 TS GAMDOT # GAMA DOT TCDU / 180
037818,000200:
037819,000201: 37,3702 00006 EXTEND # IGNORE GAMDOT IF LEQ .5 DEG/SEC
037820,000202: 37,3703 63705 BZMF +2
037821,000203: 37,3704 40000 COM
037822,000204: 37,3705 65036 AD FIVE
037823,000205: 37,3706 00006 EXTEND
037824,000206: 37,3707 63712 BZMF +3 # SET GAMDOT=+0 AS TAG IF TOO SMALL.
037825,000207:
037826,000208: 37,3710 35035 NOGAMDOT CA ZERO # COME HERE INHINTED.
037827,000209: 37,3711 55723 TS GAMDOT
037828,000210: # FOR NOW LEAVE IN 2S,C
037829,000211: # UPDATE ANGLES BY CORRECTING EUILER ANG
037830,000212: # FOR ACCRUED INCREMENT SINCE PIPUP
037831,000213: # R = R EUIL + R(NOW) - R(PIPUP)
037832,000214: 37,3712 40154 CS MPAC # GET (R EUL/180) /2
037833,000215: 37,3713 60000 DOUBLE # POSSIBLE OVERFLOW
037834,000216: 37,3714 03763 TC CORANGOV # CORRECT FOR OVFL IF ANY
037835,000217: 37,3715 00006 EXTEND
037836,000218: 37,3716 61672 SU ROLL/PIP # GET INCR SINCE PIPUP
037837,000219: 37,3717 61664 AD ROLL/180 # ONLY SINGLE OVFL POSSIBLE.
037838,000220: 37,3720 03763 TC CORANGOV # CORRECT FOR OVFL IF ANY
037839,000221: 37,3721 55770 TS TEMPROLL
037840,000222:
037841,000223: 37,3722 40156 CS MPAC +2 # GET (ALFA EUL/180) /2
037842,000224: 37,3723 60000 DOUBLE # SAME AS FOR ROLL. NEEDED FOR EXT ATM DAP
037843,000225: 37,3724 03763 TC CORANGOV # CORRECT FOR OVFL IF ANY
037844,000226: 37,3725 00006 EXTEND
037845,000227: 37,3726 61673 SU ALFA/PIP
037846,000228: 37,3727 61665 AD ALFA/180
037847,000229: 37,3730 03763 TC CORANGOV # CORRECT FOR OVFL IF ANY
037848,000230: 37,3731 55771 TS TEMPALFA
037849,000231:
037850,000232: 37,3732 40155 CS MPAC +1 # GET (BETA EUL/180) /2
037851,000233: 37,3733 60000 CMTR2 DOUBLE
037852,000234: 37,3734 00006 EXTEND
037853,000235: 37,3735 61674 SU BETA/PIP
037854,000236: 37,3736 61666 AD BETA/180
037855,000237: 37,3737 57772 XCH TEMPBETA # OVFL NOT EXPECTED.
037856,000238:
037857,000239: 37,3740 35065 CA EBANK3
037858,000240: 37,3741 54003 TS EBANK
037859,000241:
037860,000242: 37,3742 E3,1446 EBANK= PHSNAME5
037861,000243: 37,3742 00006 EXTEND
037862,000244: 37,3743 33775 DCA REPOSADR # THIS ASSUMES THAT THE TC PHASCHNG
037863,000245: 37,3744 53447 DXCH PHSNAME5 # IS NOT CHANGED IN OCT 10035
037864,000246: # SERVICER.
037865,000247:
037866,000248: 37,3745 35073 CA EBAOG
037867,000249: 37,3746 54003 TS EBANK
037868,000250:
037869,000251: 37,3747 E6,1661 EBANK= AOG
037870,000252: 37,3747 00006 REDOPOSE EXTEND # RE-STARTS COME HERE
037871,000253: 37,3750 31771 DCA TEMPROLL
037872,000254: 37,3751 53665 DXCH ROLL/180
037873,000255: 37,3752 31772 CA TEMPBETA
037874,000256: 37,3753 55666 TS BETA/180
037875,000257:
037876,000258: 37,3754 00003 RELINT
037877,000259:
037878,000260: 37,3755 06006 TC INTPRET # CANT TC DANZIG AFTER PHASCHNG.
037879,000261: 37,3756 51575 CM/POSE3 VLOAD ABVAL # RETURN FROM CM/ATUP. (RESTART)
037880,000262: 37,3757 01177 VN # 2(-7) M/CS
037881,000263: 37,3760 03723 STORE VMAGI # FOR DISPLAY ON CALL.
037882,000264:
037883,000265: 37,3761 77650 GOTO
037884,000266: 37,3762 03324 POSEXIT # ENDEXIT, STARTENT, OR SCALEPOP.
037885,000267:
037886,000268: 37,3763 54001 CORANGOV TS L
037887,000269: 37,3764 00002 TC Q
037888,000270: 37,3765 50000 INDEX A
037889,000271: 37,3766 35014 CA LIMITS
037890,000272: 37,3767 26001 ADS L
037891,000273: 37,3770 00002 TC Q # COSTS 2 MCT TO USE. SEE ANGOVCOR.
037892,000274:
037893,000275: 37,3771 45730 53410 -KVSCALE 2DEC -.81491944 # -12800/(2 VS .3048)
037894,000276:
037895,000277: 37,3773 03146 TCDU DEC .1 # TCDU = .1 SEC.
037896,000278:
037897,000279: 37,3774 E6,1661 EBANK= AOG
037898,000280: 37,3774 03747 76066 REPOSADR 2CADR REDOPOSE
037899,000281:
End of include-file CM_BODY_ATTITUDE.agc. Parent file is MAIN.agc