Source Code
These source-code files were obtained by digitally photographing
an Artemis 72 (Apollo 15-17 Command Module) program listing from a private
collection and then
modifying pre-existing Comanche 55 (Apollo 11) source files to
incorporate changes. Photography was by Ron Burkey, and transcription
was performed by a team of volunteers. Note that the page images
presented online are of reduced quality, and that additional images
may be available. Report any conversion errors or legibility
problems in page images to info@sandroid.org.
Notations on the program listing read, in part:GAP: ASSEMBLE REVISION 072 OF AGC PROGRAM ARTEMIS BY NASA 2021114-011 11:40 FEB. 26, 1971Note that the date is the date of the printout, not the date of the program revision. |
058471,000002: ## Copyright: Public domain.
058472,000003: ## Filename: POWERED_FLIGHT_SUBROUTINES.agc
058473,000004: ## Purpose: Part of the source code for Artemis (i.e., Colossus 3),
058474,000005: ## build 072. This is for the Command Module's (CM)
058475,000006: ## Apollo Guidance Computer (AGC), for
058476,000007: ## Apollo 15-17.
058477,000008: ## Assembler: yaYUL
058478,000009: ## Contact: Jim Lawton <jim DOT lawton AT gmail DOT com>
058479,000010: ## Website: www.ibiblio.org/apollo/index.html
058480,000011: ## Page Scans: www.ibiblio.org/apollo/ScansForConversion/Artemis072/
058481,000012: ## Mod history: 2009-08-21 JL Adapted from corresponding Comanche 055 file.
058482,000013: ## 2010-02-20 RSB Un-##'d this header.
058483,000014: ## 2017-02-08 RSB Proofed comment text by diff'ing vs Comanche 55.
058484,000015:
Page 1364 |
058486,000017:
058487,000018: 23,2000 SETLOC POWFLITE
058488,000019: 23,2000 BANK
058489,000020:
058490,000021: 23,3530 0142 EBANK= DEXDEX
058491,000022: 23,3530 COUNT* $$/POWFL
058492,000023:
058493,000024: # CDUTRIG, CDUTRIG1, CDUTRIG2, AND CD*TR*GS ALL COMPUTE THE SINES AND
058494,000025: # COSINES OF THREE 2'S COMPLEMENT ANGLES AND PLACE THE RESULT, DOUBLE
058495,000026: # PRECISION, IN THE SAME ORDER AS THE INPUTS, AT SINCDU AND COSCDU. AN
058496,000027: # ADDITIONAL OUTPUT IS THE 1'S COMPLEMENT ANGLES AT CDUSPOT. THESE
058497,000028: # ROUTINES GO OUT OF THEIR WAY TO LEAVE THE MPAC AREA AS THEY FIND IT,
058498,000029: # EXCEPT FOR THE GENERALLY UNIMPORTANT MPAC +2. THEY DIFFER ONLY IN
058499,000030: # WHERE THEY GET THE ANGLES, AND IN METHOD OF CALLING.
058500,000031:
058501,000032: # CDUTRIG (AND CDUTRIG1, WHICH CAN BE CALLED IN BASIC) COMPUTE THE
058502,000033: # SINES AND COSINES FROM THE CURRENT CONTENTS OF THE CDU REGISTERS.
058503,000034: # THE CONTENTS OF CDUTEMP, ETC., ARE NOT TOUCHED SO THAT THEY MAY
058504,000035: # CONTINUE TO FORM A CONSISTENT SET WITH THE LATEST PIPA READINGS.
058505,000036:
058506,000037: # CDUTRIG1 IS LIKE CDUTRIG EXCEPT THAT IT CAN BE CALLED IN BASIC.
058507,000038:
058508,000039: # CD*TR*GS FINDS CDU VALUES IN CDUSPOT RATHER THAN IN CDUTEMP. THIS
058509,000040: # ALLOWS USERS TO MAKE TRANSFORMATIONS USING ARBITRARY ANGLES, OR REAL
058510,000041: # ANGLES IN AN ORDER OTHER THAN X Y Z. A CALL TO THIS ROUTINE IS
058511,000042: # NECESSARY IN PREPARATION FOR A CALL TO AX*SR*T IN EITHER OF ITS TWO
058512,000043: # MODES (SMNB OR NBSM). SINCE AX*SR*T EXPECTS TO FIND THE SINES AND
058513,000044: # COSINES IN THE ORDER Y Z X THE ANGLES MUST HAVE BEEN PLACED IN CDUSPOT
058514,000045: # IN THIS ORDER. CD*TR*GS NEED NOT BE REPEATED WHEN AX*SR*T IS CALLED
058515,000046: # MORE THAN ONCE, PROVIDED THE ANGLES HAVE NOT CHANGED. NOTE THAT SINCE
058516,000047: # IT CLOBBERS BUF2 (IN THE SINE AND COSINE ROUTINES) CD*TR*GS CANNOT BE
058517,000048: # CALLED USING BANKCALL. SORRY.
058518,000049:
058519,000050: # CD*TR*G IS LIKE CD*TR*GS EXCEPT THAT IT CAN BE CALLED IN
058520,000051: # INTERPRETIVE.
058521,000052:
058522,000053: 23,3530 77776 CDUTRIG EXIT
058523,000054: 23,3531 03534 TC CDUTRIGS
058524,000055: 23,3532 06006 TC INTPRET
058525,000056: 23,3533 77616 RVQ
058526,000057:
058527,000058: 23,3534 30032 CDUTRIGS CA CDUX
058528,000059: 23,3535 55175 TS CDUSPOT +4
058529,000060: 23,3536 30033 CA CDUY
058530,000061: 23,3537 55171 TS CDUSPOT
058531,000062: 23,3540 30034 CA CDUZ
058532,000063: 23,3541 55173 TS CDUSPOT +2
058533,000064:
058534,000065: 23,3542 00006 CD*TR*GS EXTEND
058535,000066: 23,3543 22142 QXCH TEM2
058536,000067: 23,3544 34766 CAF FOUR
Page 1365 |
058538,000069: 23,3545 76211 TR*GL**P MASK SIX # MAKE IT EVEN AND SMALLER
058539,000070: 23,3546 54143 TS TEM3
058540,000071: 23,3547 50143 INDEX TEM3
058541,000072: 23,3550 31171 CA CDUSPOT
058542,000073: 23,3551 52155 DXCH MPAC # STORING 2'S COMP ANGLE, LOADING MPAC
058543,000074: 23,3552 52127 DXCH VBUF +4 # STORING MPAC FOR LATER RESTORATION
058544,000075: 23,3553 04733 TC USPRCADR
058545,000076: 23,3554 51754 CADR CDULOGIC
058546,000077: 23,3555 00006 EXTEND
058547,000078: 23,3556 30155 DCA MPAC
058548,000079: 23,3557 50143 INDEX TEM3
058549,000080: 23,3560 53172 DXCH CDUSPOT # STORING 1'S COMPLEMENT ANGLE
058550,000081: 23,3561 04733 TC USPRCADR
058551,000082: 23,3562 01514 CADR COSINE
058552,000083: 23,3563 52155 DXCH MPAC
058553,000084: 23,3564 50143 INDEX TEM3
058554,000085: 23,3565 53150 DXCH COSCDU # STORING COSINE
058555,000086: 23,3566 00006 EXTEND
058556,000087: 23,3567 50143 INDEX TEM3
058557,000088: 23,3570 31172 DCA CDUSPOT # LOADING 1'S COMPLEMENT ANGLE
058558,000089: 23,3571 04733 TC USPRCADR
058559,000090: 23,3572 01526 CADR SINE +1 # SINE +1 EXPECTS ARGUMENT IN A AND L
058560,000091: 23,3573 52127 DXCH VBUF +4 # BRINGING UP PRIOR MPAC TO BE RESTORED
058561,000092: 23,3574 52155 DXCH MPAC
058562,000093: 23,3575 50143 INDEX TEM3
058563,000094: 23,3576 53142 DXCH SINCDU
058564,000095: 23,3577 10143 CCS TEM3
058565,000096: 23,3600 13545 TCF TR*GL**P
058566,000097: 23,3601 00142 TC TEM2
058567,000098:
Page 1366 |
058569,000100:
058570,000101: # ****************************************************************************************************************
058571,000102:
058572,000103: # QUICTRIG, INTENDED FOR GUIDANCE CYCLE USE WHERE TIME IS CRITICAL, IS A MUCH FASTER VERSION OF CD*TR*GS.
058573,000104: # QUICTRIG COMPUTES AND STORES THE SINES AND COSINES OF THE 2'S COMPLEMENT ANGLES AT CDUSPOT, CDUSPOT +2,
058574,000105: # AND CDUSPOT +4. UNLIKE CD*TR*GS, QUICTRIG DOES NOT LEAVE THE 1'S COMPLEMENT VERSIONS OF THE ANGLES IN
058575,000106: # CDUSPOT. QUICTRIG'S EXECUTION TIME IS 4.1 MS; THIS IS 10 TIMES AS FAST AS CD*TR*GS. QUICTRIG MAY BE
058576,000107: # CALLED FROM INTERPRETIVE AS AN RTB OP-CODE, OR FROM BASIC VIA BANKCALL OR IBNKCALL.
058577,000108:
058578,000109: 23,3602 00004 QUICTRIG INHINT # INHINT SINCE DAP USES THE SAME TEMPS
058579,000110: 23,3603 00006 EXTEND
058580,000111: 23,3604 22061 QXCH ITEMP1
058581,000112: 23,3605 34766 CAF FOUR
058582,000113: 23,3606 76211 +4 MASK SIX
058583,000114: 23,3607 54062 TS ITEMP2
058584,000115: 23,3610 50062 INDEX ITEMP2
058585,000116: 23,3611 31171 CA CDUSPOT
058586,000117: 23,3612 05061 TC SPSIN
058587,000118: 23,3613 00006 EXTEND
058588,000119: 23,3614 74753 MP BIT14 # SCALE DOWN TO MATCH INTERPRETER OUTPUTS
058589,000120: 23,3615 50062 INDEX ITEMP2
058590,000121: 23,3616 53142 DXCH SINCDU
058591,000122: 23,3617 50062 INDEX ITEMP2
058592,000123: 23,3620 31171 CA CDUSPOT
058593,000124: 23,3621 05060 TC SPCOS
058594,000125: 23,3622 00006 EXTEND
058595,000126: 23,3623 74753 MP BIT14
058596,000127: 23,3624 50062 INDEX ITEMP2
058597,000128: 23,3625 53150 DXCH COSCDU
058598,000129: 23,3626 10062 CCS ITEMP2
058599,000130: 23,3627 13606 TCF QUICTRIG +4
058600,000131: 23,3630 30061 CA ITEMP1
058601,000132: 23,3631 00003 RELINT
058602,000133: 23,3632 00000 TC A
058603,000134:
Page 1367 |
058605,000136:
058606,000137: # ****************************************************************************************************************
058607,000138:
058608,000139: # THESE INTERFACE ROUTINES MAKE IT POSSIBLE TO CALL AX*SR*T, ETC., IN
058609,000140: # INTERPRETIVE. LATER, WHERE POSSIBLE, THEY WILL BE ELIMINATED.
058610,000141:
058611,000142: # THESE INTERFACE ROUTINES ARE PERMANENT. ALL RESTORE USER'S EBANK
058612,000143: # SETTING. ALL ARE STRICT INTERPRETIVE SUBROUTINES, CALLED USING "CALL",
058613,000144: # RETURNING VIA QPRET. ALL EXPECT AND RETURN THE VECTOR TO BE TRANSFOR-
058614,000145: # MED INTERPRETER-STYLE IN MPAC; COMPONENTS AT MPAC, MPAC +3, AND MPAC +5.
058615,000146:
058616,000147: # TRG*SMNB AND TRG*NBSM BOTH EXPECT TO SEE THE 2'S COMPLEMENT ANGLES
058617,000148: # AT CDUSPOT (ORDER Y Z X, AT CDUSPOT, CDUSPOT +2, AND CDUSPOT +4; ODD
058618,000149: # LOCATIONS NEED NOT BE ZEROED). TRG*NBSM DOES THE NB TO SM TRANSFOR-
058619,000150: # MATION; TRG*SMNB, VICE VERSA.
058620,000151:
058621,000152: # CDU*NBSM DOES ITS TRANSFORMATION USING THE PRESENT CONTENTS OF
058622,000153: # THE CDU COUNTERS. OTHERWISE IT IS LIKE TRG*NBSM.
058623,000154:
058624,000155: # CDU*SMNB IS THE COMPLEMENT OF CDU*NBSM.
058625,000156:
058626,000157: 23,3633 77776 *SMNB* EXIT
058627,000158: 23,3634 07466 C*MM*N1 TC MPACVBUF # AX*SR*T EXPECTS VECTOR IN VBUF
058628,000159: 23,3635 46214 CS THREE # SIGNAL FOR SM TO NB TRANSFORMATION
058629,000160: 23,3636 03651 C*MM*N2 TC AX*SR*T
058630,000161: 23,3637 06006 TC INTPRET
058631,000162: 23,3640 43575 VLOAD RVQ
058632,000163: 23,3641 00123 VBUF
058633,000164:
058634,000165: 23,3642 77776 TRG*NBSM EXIT
058635,000166: 23,3643 03542 TC CD*TR*GS
058636,000167: 23,3644 07466 C*MM*N3 TC MPACVBUF # FOR AX*SR*T
058637,000168: 23,3645 36214 CA THREE # SIGNAL FOR NB TO SM TRANSFORMATION
058638,000169: 23,3646 13636 TCF C*MM*N2
058639,000170:
058640,000171: # *NBSM* AND *SMNB* EXPECT TO SEE THE SINES AND COSINES (AT SINCDU
058641,000172: # AND COSCDU) RATHER THAN THE ANGLES THEMSELVES. OTHERWISE THEY ARE
058642,000173: # LIKE TRG*NBSM AND TRG*SMNB.
058643,000174:
058644,000175: # NOTE THAT JUST AS CD*TR*GS NEED BE CALLED ONLY ONCE FOR EACH SERIES
058645,000176: # OF TRANSFORMATIONS USING THE SAME ANGLES, SO TOO ONLY ONE OF TRG*NBSM
058646,000177: # AND TRG*SMNB NEED BE CALLED FOR EACH SERIES. FOR SUBSEQUENT TRANSFOR-
058647,000178: # MATIONS USE *NBSM* AND *SMNB*.
058648,000179:
058649,000180: 23,3647 77776 *NBSM* EXIT
058650,000181: 23,3650 13644 TCF C*MM*N3
058651,000182:
058652,000183: # AX*SR*T COMBINES THE OLD SMNB AND NBSM. FOR THE NB TO SM
058653,000184: # TRANSFORMATION, ENTER WITH +3 IN A. FOR SM TO NB, ENTER WITH -3.
058654,000185: # THE VECTOR TO BE TRANSFORMED ARRIVES, AND IS RETURNED, IN VBUF.
Page 1368 |
058656,000187: # AX*SR*T EXPECTS TO FIND THE SINES AND COSINES OF THE ANGLES OF ROTATION
058657,000188: # AT SINCDU AND COSCDU, IN THE ORDER Y Z X. A CALL TO CD*TR*GS, WITH
058658,000189: # THE 2'S COMPLEMENT ANGLES (ORDER Y Z X) AT CDUSPOT, WILL TAKE CARE OF
058659,000190: # THIS. HERE IS A SAMPLE CALLING SEQUENCE:-
058660,000191:
058661,000192: # TC CDUTRIGS
058662,000193: # CS THREE ("CA THREE" FOR NBSM)
058663,000194: # TC AX*SR*T
058664,000195:
058665,000196: # THE CALL TO CD*TR*GS NEED NOT BE REPEATED, WHEN AX*SR*T IS CALLED MORE
058666,000197: # THAN ONCE, UNLESS THE ANGLES HAVE CHANGED.
058667,000198:
058668,000199: # AX*SR*T IS GUARANTEED SAFE ONLY FOR VECTORS OF MAGNITUDE LESS THAN
058669,000200: # UNITY. A LOOK AT THE CASE IN WHICH A VECTOR OF GREATER MAGNITUDE
058670,000201: # HAPPENS TO LIE ALONG AN AXIS OF THE SYSTEM TO WHICH IT IS TO BE TRANS-
058671,000202: # FORMED CONVINCES ONE THAT THIS IS A RESTRICTION WHICH MUST BE ACCEPTED.
058672,000203:
058673,000204: 23,3651 54142 AX*SR*T TS DEXDEX # WHERE IT BECOMES THE INDEX OF INDEXES
058674,000205: 23,3652 00006 EXTEND
058675,000206: 23,3653 22145 QXCH RTNSAVER
058676,000207:
058677,000208: 23,3654 10142 R*TL**P CCS DEXDEX # +3 --> 0 -3 --> 2
058678,000209: 23,3655 40142 CS DEXDEX # THUS: +2 --> 1 -2 --> 1
058679,000210: 23,3656 66214 AD THREE # +1 --> 2 -1 --> 0
058680,000211: 23,3657 00006 EXTEND
058681,000212: 23,3660 50000 INDEX A
058682,000213: 23,3661 33740 DCA INDEXI
058683,000214: 23,3662 52144 DXCH DEXI
058684,000215:
058685,000216: 23,3663 34770 CA ONE
058686,000217: 23,3664 54130 TS BUF
058687,000218: 23,3665 00006 EXTEND
058688,000219: 23,3666 50143 INDEX DEX1
058689,000220: 23,3667 40123 DCS VBUF
058690,000221: 23,3670 13672 TCF LOOP1 # REALLY BE A SUBTRACT, AND VICE VERSA
058691,000222:
058692,000223: 23,3671 52131 LOOP2 DXCH BUF # LOADING VECTOR COMPONENT, STORING INDEX
058693,000224:
058694,000225: 23,3672 52155 LOOP1 DXCH MPAC
058695,000226: 23,3673 33736 CA SINESLOC
058696,000227: 23,3674 60143 AD DEX1
058697,000228: 23,3675 54116 TS ADDRWD
058698,000229:
058699,000230: 23,3676 07056 TC DMPSUB # MULTIPLY BY SIN(CDUANGLE)
058700,000231: 23,3677 10142 CCS DEXDEX
058701,000232: 23,3700 52155 DXCH MPAC # NBSM CASE
058702,000233: 23,3701 13704 TCF +3
058703,000234: 23,3702 00006 EXTEND # SMNB CASE
058704,000235: 23,3703 40155 DCS MPAC
058705,000236: 23,3704 52134 DXCH TERM1TMP
058706,000237:
Page 1369 |
058708,000239: 23,3705 36211 CA SIX # SINCDU AND COSCDU (EACH 6 WORDS) MUST
058709,000240: 23,3706 26116 ADS ADDRWD # BE CONSECUTIVE AND IN THAT ORDER
058710,000241:
058711,000242: 23,3707 00006 EXTEND
058712,000243: 23,3710 50130 INDEX BUF
058713,000244: 23,3711 50143 INDEX DEX1
058714,000245: 23,3712 30123 DCA VBUF
058715,000246: 23,3713 52155 DXCH MPAC
058716,000247: 23,3714 07056 TC DMPSUB # MULTIPLY BY COS(CDUANGLE)
058717,000248: 23,3715 52155 DXCH MPAC
058718,000249: 23,3716 20134 DAS TERM1TMP
058719,000250: 23,3717 52134 DXCH TERM1TMP
058720,000251: 23,3720 20001 DDOUBL
058721,000252: 23,3721 50130 INDEX BUF
058722,000253: 23,3722 50143 INDEX DEX1
058723,000254: 23,3723 52123 DXCH VBUF
058724,000255: 23,3724 52131 DXCH BUF # LOADING INDEX, STORING VECTOR COMPONENT
058725,000256:
058726,000257: 23,3725 10000 CCS A # 'CAUSE THAT'S WHERE THE INDEX NOW IS
058727,000258: 23,3726 13671 TCF LOOP2
058728,000259:
058729,000260: 23,3727 00006 EXTEND
058730,000261: 23,3730 26142 DIM DEXDEX # DECREMENT MAGNITUDE PRESERVING SIGN
058731,000262:
058732,000263: 23,3731 10142 TSTPOINT CCS DEXDEX # ONLY THE BRANCHING FUNCTION IS USED
058733,000264: 23,3732 13654 TCF R*TL**P
058734,000265: 23,3733 00145 TC RTNSAVER
058735,000266: 23,3734 13654 TCF R*TL**P
058736,000267: 23,3735 00145 TC RTNSAVER
058737,000268:
058738,000269: 23,3736 01141 SINESLOC ADRES SINCDU # FOR USE IN SETTING ADDRWD
058739,000270:
058740,000271: 23,3737 00004 INDEXI DEC 4 B-14 # ********** DON'T **********
058741,000272: 23,3740 00002 DEC 2 B-14 # ********** TOUCH **********
058742,000273: 23,3741 00000 DEC 0 B-14 # ********** THESE **********
058743,000274: 23,3742 00004 DEC 4 B-14 # ********** CONSTANTS **********
058744,000275:
058745,000276: # ****************************************************************************************************************
058746,000277:
Page 1370 |
058748,000279:
058749,000280: # THIS SUBROUTINE COMPUTES INCREMENTAL CHANGES IN CDU(GIMBAL) ANGLES FROM INCREMENTAL CHANGES ABOUT SM AXES. IT
058750,000281: # REQUIRES SM INCREMENTS AS A DP VECTOR SCALED AT ONE REVOLUTION(DTHETASM,+2,+4). SIN,COS(CDUY,Z,X) ARE IN
058751,000282: # SINCDU,+2,+4 AND COSCDU,+2,+4 RESPECTIVELY, SCALED TO ONE HALF. CDU INCREENTS ARE PLACED IN DCDU,+2,+4 SCALED TO
058752,000283: # ONE REVOLUTION.
058753,000284:
058754,000285: # * COS(IGA)SEC(MGA) 0 -SIN(IGA)SEC(MGA) *
058755,000286: # * *
058756,000287: # * -COS(IGA)TAN(MGA) 1 SIN(IGA)TAN(MGA) *
058757,000288: # * *
058758,000289: # * SIN(IGA) 0 COS(IGA) *
058759,000290:
058760,000291: 23,2000 SETLOC POWFLIT1
058761,000292: 23,2000 BANK
058762,000293: 23,3743 COUNT* $$/POWFL
058763,000294: 23,3743 41345 SMCDURES DLOAD DMP
058764,000295: 23,3744 03212 DTHETASM
058765,000296: 23,3745 01150 COSCDUY
058766,000297:
058767,000298: 23,3746 41325 PDDL DMP
058768,000299: 23,3747 03216 DTHETASM +4
058769,000300: 23,3750 01142 SINCDUY
058770,000301:
058771,000302: 23,3751 77621 BDSU
058772,000303: 23,3752 77671 DDV
058773,000304: 23,3753 01152 COSCDUZ
058774,000305: 23,3754 03204 STORE DCDU
058775,000306:
058776,000307: 23,3755 72405 DMP SL1 # SCALE
058777,000308: 23,3756 01144 SINCDUZ
058778,000309: 23,3757 77621 BDSU
058779,000310:
058780,000311: 23,3760 03214 DTHETASM +2
058781,000312: 23,3761 17206 STODL DCDU +2
058782,000313: 23,3762 03212 DTHETASM
058783,000314:
058784,000315: 23,3763 65205 DMP PDDL
058785,000316: 23,3764 01142 SINCDUY
058786,000317: 23,3765 03216 DTHETASM +4
058787,000318:
058788,000319: 23,3766 43205 DMP DAD
058789,000320: 23,3767 01150 COSCDUY
058790,000321: 23,3770 77752 SL1
058791,000322: 23,3771 03210 STORE DCDU +4
058792,000323: 23,3772 77616 RVQ
End of include-file POWERED_FLIGHT_SUBROUTINES.agc. Parent file is MAIN.agc