Source Code
These source-code files are part of a reconstructed copy of Artemis 071, the
first release of the Apollo 15 through 17 Command Module (CM) Apollo Guidance
Computer (AGC) software.
The reconstruction began with source code of Artemis 072 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes between the two versions. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021154-. Note that page numbers in the reconstructed code match those on the Artemis 072 printout, although the changed code would likely have changed page numbers for a real Artemis 071 listing. Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository. |
058317,000002: ## Copyright: Public domain.
058318,000003: ## Filename: POWERED_FLIGHT_SUBROUTINES.agc
058319,000004: ## Purpose: A section of Artemis revision 071.
058320,000005: ## It is part of the reconstructed source code for the first
058321,000006: ## release of the flight software for the Command Module's
058322,000007: ## (CM) Apollo Guidance Computer (AGC) for Apollo 15 through
058323,000008: ## 17. The code has been recreated from a copy of Artemis 072.
058324,000009: ## It has been adapted such that the resulting bugger words
058325,000010: ## exactly match those specified for Artemis 071 in NASA
058326,000011: ## drawing 2021154-, which gives relatively high confidence
058327,000012: ## that the reconstruction is correct.
058328,000013: ## Reference: 1364
058329,000014: ## Assembler: yaYUL
058330,000015: ## Contact: Ron Burkey <info@sandroid.org>.
058331,000016: ## Website: www.ibiblio.org/apollo/index.html
058332,000017: ## Mod history: 2019-08-14 MAS Created from Artemis 072.
058333,000018:
Page 1364 |
058335,000020:
058336,000021: 23,2000 SETLOC POWFLITE
058337,000022: 23,2000 BANK
058338,000023:
058339,000024: 23,3530 0142 EBANK= DEXDEX
058340,000025: 23,3530 COUNT* $$/POWFL
058341,000026:
058342,000027: # CDUTRIG, CDUTRIG1, CDUTRIG2, AND CD*TR*GS ALL COMPUTE THE SINES AND
058343,000028: # COSINES OF THREE 2'S COMPLEMENT ANGLES AND PLACE THE RESULT, DOUBLE
058344,000029: # PRECISION, IN THE SAME ORDER AS THE INPUTS, AT SINCDU AND COSCDU. AN
058345,000030: # ADDITIONAL OUTPUT IS THE 1'S COMPLEMENT ANGLES AT CDUSPOT. THESE
058346,000031: # ROUTINES GO OUT OF THEIR WAY TO LEAVE THE MPAC AREA AS THEY FIND IT,
058347,000032: # EXCEPT FOR THE GENERALLY UNIMPORTANT MPAC +2. THEY DIFFER ONLY IN
058348,000033: # WHERE THEY GET THE ANGLES, AND IN METHOD OF CALLING.
058349,000034:
058350,000035: # CDUTRIG (AND CDUTRIG1, WHICH CAN BE CALLED IN BASIC) COMPUTE THE
058351,000036: # SINES AND COSINES FROM THE CURRENT CONTENTS OF THE CDU REGISTERS.
058352,000037: # THE CONTENTS OF CDUTEMP, ETC., ARE NOT TOUCHED SO THAT THEY MAY
058353,000038: # CONTINUE TO FORM A CONSISTENT SET WITH THE LATEST PIPA READINGS.
058354,000039:
058355,000040: # CDUTRIG1 IS LIKE CDUTRIG EXCEPT THAT IT CAN BE CALLED IN BASIC.
058356,000041:
058357,000042: # CD*TR*GS FINDS CDU VALUES IN CDUSPOT RATHER THAN IN CDUTEMP. THIS
058358,000043: # ALLOWS USERS TO MAKE TRANSFORMATIONS USING ARBITRARY ANGLES, OR REAL
058359,000044: # ANGLES IN AN ORDER OTHER THAN X Y Z. A CALL TO THIS ROUTINE IS
058360,000045: # NECESSARY IN PREPARATION FOR A CALL TO AX*SR*T IN EITHER OF ITS TWO
058361,000046: # MODES (SMNB OR NBSM). SINCE AX*SR*T EXPECTS TO FIND THE SINES AND
058362,000047: # COSINES IN THE ORDER Y Z X THE ANGLES MUST HAVE BEEN PLACED IN CDUSPOT
058363,000048: # IN THIS ORDER. CD*TR*GS NEED NOT BE REPEATED WHEN AX*SR*T IS CALLED
058364,000049: # MORE THAN ONCE, PROVIDED THE ANGLES HAVE NOT CHANGED. NOTE THAT SINCE
058365,000050: # IT CLOBBERS BUF2 (IN THE SINE AND COSINE ROUTINES) CD*TR*GS CANNOT BE
058366,000051: # CALLED USING BANKCALL. SORRY.
058367,000052:
058368,000053: # CD*TR*G IS LIKE CD*TR*GS EXCEPT THAT IT CAN BE CALLED IN
058369,000054: # INTERPRETIVE.
058370,000055:
058371,000056: 23,3530 77776 CDUTRIG EXIT
058372,000057: 23,3531 03534 TC CDUTRIGS
058373,000058: 23,3532 06006 TC INTPRET
058374,000059: 23,3533 77616 RVQ
058375,000060:
058376,000061: 23,3534 30032 CDUTRIGS CA CDUX
058377,000062: 23,3535 55175 TS CDUSPOT +4
058378,000063: 23,3536 30033 CA CDUY
058379,000064: 23,3537 55171 TS CDUSPOT
058380,000065: 23,3540 30034 CA CDUZ
058381,000066: 23,3541 55173 TS CDUSPOT +2
058382,000067:
058383,000068: 23,3542 00006 CD*TR*GS EXTEND
058384,000069: 23,3543 22142 QXCH TEM2
058385,000070: 23,3544 34766 CAF FOUR
Page 1365 |
058387,000072: 23,3545 76211 TR*GL**P MASK SIX # MAKE IT EVEN AND SMALLER
058388,000073: 23,3546 54143 TS TEM3
058389,000074: 23,3547 50143 INDEX TEM3
058390,000075: 23,3550 31171 CA CDUSPOT
058391,000076: 23,3551 52155 DXCH MPAC # STORING 2'S COMP ANGLE, LOADING MPAC
058392,000077: 23,3552 52127 DXCH VBUF +4 # STORING MPAC FOR LATER RESTORATION
058393,000078: 23,3553 04733 TC USPRCADR
058394,000079: 23,3554 51754 CADR CDULOGIC
058395,000080: 23,3555 00006 EXTEND
058396,000081: 23,3556 30155 DCA MPAC
058397,000082: 23,3557 50143 INDEX TEM3
058398,000083: 23,3560 53172 DXCH CDUSPOT # STORING 1'S COMPLEMENT ANGLE
058399,000084: 23,3561 04733 TC USPRCADR
058400,000085: 23,3562 01514 CADR COSINE
058401,000086: 23,3563 52155 DXCH MPAC
058402,000087: 23,3564 50143 INDEX TEM3
058403,000088: 23,3565 53150 DXCH COSCDU # STORING COSINE
058404,000089: 23,3566 00006 EXTEND
058405,000090: 23,3567 50143 INDEX TEM3
058406,000091: 23,3570 31172 DCA CDUSPOT # LOADING 1'S COMPLEMENT ANGLE
058407,000092: 23,3571 04733 TC USPRCADR
058408,000093: 23,3572 01526 CADR SINE +1 # SINE +1 EXPECTS ARGUMENT IN A AND L
058409,000094: 23,3573 52127 DXCH VBUF +4 # BRINGING UP PRIOR MPAC TO BE RESTORED
058410,000095: 23,3574 52155 DXCH MPAC
058411,000096: 23,3575 50143 INDEX TEM3
058412,000097: 23,3576 53142 DXCH SINCDU
058413,000098: 23,3577 10143 CCS TEM3
058414,000099: 23,3600 13545 TCF TR*GL**P
058415,000100: 23,3601 00142 TC TEM2
058416,000101:
Page 1366 |
058418,000103:
058419,000104: # ****************************************************************************************************************
058420,000105:
058421,000106: # QUICTRIG, INTENDED FOR GUIDANCE CYCLE USE WHERE TIME IS CRITICAL, IS A MUCH FASTER VERSION OF CD*TR*GS.
058422,000107: # QUICTRIG COMPUTES AND STORES THE SINES AND COSINES OF THE 2'S COMPLEMENT ANGLES AT CDUSPOT, CDUSPOT +2,
058423,000108: # AND CDUSPOT +4. UNLIKE CD*TR*GS, QUICTRIG DOES NOT LEAVE THE 1'S COMPLEMENT VERSIONS OF THE ANGLES IN
058424,000109: # CDUSPOT. QUICTRIG'S EXECUTION TIME IS 4.1 MS; THIS IS 10 TIMES AS FAST AS CD*TR*GS. QUICTRIG MAY BE
058425,000110: # CALLED FROM INTERPRETIVE AS AN RTB OP-CODE, OR FROM BASIC VIA BANKCALL OR IBNKCALL.
058426,000111:
058427,000112: 23,3602 00004 QUICTRIG INHINT # INHINT SINCE DAP USES THE SAME TEMPS
058428,000113: 23,3603 00006 EXTEND
058429,000114: 23,3604 22061 QXCH ITEMP1
058430,000115: 23,3605 34766 CAF FOUR
058431,000116: 23,3606 76211 +4 MASK SIX
058432,000117: 23,3607 54062 TS ITEMP2
058433,000118: 23,3610 50062 INDEX ITEMP2
058434,000119: 23,3611 31171 CA CDUSPOT
058435,000120: 23,3612 05061 TC SPSIN
058436,000121: 23,3613 00006 EXTEND
058437,000122: 23,3614 74753 MP BIT14 # SCALE DOWN TO MATCH INTERPRETER OUTPUTS
058438,000123: 23,3615 50062 INDEX ITEMP2
058439,000124: 23,3616 53142 DXCH SINCDU
058440,000125: 23,3617 50062 INDEX ITEMP2
058441,000126: 23,3620 31171 CA CDUSPOT
058442,000127: 23,3621 05060 TC SPCOS
058443,000128: 23,3622 00006 EXTEND
058444,000129: 23,3623 74753 MP BIT14
058445,000130: 23,3624 50062 INDEX ITEMP2
058446,000131: 23,3625 53150 DXCH COSCDU
058447,000132: 23,3626 10062 CCS ITEMP2
058448,000133: 23,3627 13606 TCF QUICTRIG +4
058449,000134: 23,3630 30061 CA ITEMP1
058450,000135: 23,3631 00003 RELINT
058451,000136: 23,3632 00000 TC A
058452,000137:
Page 1367 |
058454,000139:
058455,000140: # ****************************************************************************************************************
058456,000141:
058457,000142: # THESE INTERFACE ROUTINES MAKE IT POSSIBLE TO CALL AX*SR*T, ETC., IN
058458,000143: # INTERPRETIVE. LATER, WHERE POSSIBLE, THEY WILL BE ELIMINATED.
058459,000144:
058460,000145: # THESE INTERFACE ROUTINES ARE PERMANENT. ALL RESTORE USER'S EBANK
058461,000146: # SETTING. ALL ARE STRICT INTERPRETIVE SUBROUTINES, CALLED USING "CALL",
058462,000147: # RETURNING VIA QPRET. ALL EXPECT AND RETURN THE VECTOR TO BE TRANSFOR-
058463,000148: # MED INTERPRETER-STYLE IN MPAC; COMPONENTS AT MPAC, MPAC +3, AND MPAC +5.
058464,000149:
058465,000150: # TRG*SMNB AND TRG*NBSM BOTH EXPECT TO SEE THE 2'S COMPLEMENT ANGLES
058466,000151: # AT CDUSPOT (ORDER Y Z X, AT CDUSPOT, CDUSPOT +2, AND CDUSPOT +4; ODD
058467,000152: # LOCATIONS NEED NOT BE ZEROED). TRG*NBSM DOES THE NB TO SM TRANSFOR-
058468,000153: # MATION; TRG*SMNB, VICE VERSA.
058469,000154:
058470,000155: # CDU*NBSM DOES ITS TRANSFORMATION USING THE PRESENT CONTENTS OF
058471,000156: # THE CDU COUNTERS. OTHERWISE IT IS LIKE TRG*NBSM.
058472,000157:
058473,000158: # CDU*SMNB IS THE COMPLEMENT OF CDU*NBSM.
058474,000159:
058475,000160: 23,3633 77776 *SMNB* EXIT
058476,000161: 23,3634 07466 C*MM*N1 TC MPACVBUF # AX*SR*T EXPECTS VECTOR IN VBUF
058477,000162: 23,3635 46214 CS THREE # SIGNAL FOR SM TO NB TRANSFORMATION
058478,000163: 23,3636 03651 C*MM*N2 TC AX*SR*T
058479,000164: 23,3637 06006 TC INTPRET
058480,000165: 23,3640 43575 VLOAD RVQ
058481,000166: 23,3641 00123 VBUF
058482,000167:
058483,000168: 23,3642 77776 TRG*NBSM EXIT
058484,000169: 23,3643 03542 TC CD*TR*GS
058485,000170: 23,3644 07466 C*MM*N3 TC MPACVBUF # FOR AX*SR*T
058486,000171: 23,3645 36214 CA THREE # SIGNAL FOR NB TO SM TRANSFORMATION
058487,000172: 23,3646 13636 TCF C*MM*N2
058488,000173:
058489,000174: # *NBSM* AND *SMNB* EXPECT TO SEE THE SINES AND COSINES (AT SINCDU
058490,000175: # AND COSCDU) RATHER THAN THE ANGLES THEMSELVES. OTHERWISE THEY ARE
058491,000176: # LIKE TRG*NBSM AND TRG*SMNB.
058492,000177:
058493,000178: # NOTE THAT JUST AS CD*TR*GS NEED BE CALLED ONLY ONCE FOR EACH SERIES
058494,000179: # OF TRANSFORMATIONS USING THE SAME ANGLES, SO TOO ONLY ONE OF TRG*NBSM
058495,000180: # AND TRG*SMNB NEED BE CALLED FOR EACH SERIES. FOR SUBSEQUENT TRANSFOR-
058496,000181: # MATIONS USE *NBSM* AND *SMNB*.
058497,000182:
058498,000183: 23,3647 77776 *NBSM* EXIT
058499,000184: 23,3650 13644 TCF C*MM*N3
058500,000185:
058501,000186: # AX*SR*T COMBINES THE OLD SMNB AND NBSM. FOR THE NB TO SM
058502,000187: # TRANSFORMATION, ENTER WITH +3 IN A. FOR SM TO NB, ENTER WITH -3.
058503,000188: # THE VECTOR TO BE TRANSFORMED ARRIVES, AND IS RETURNED, IN VBUF.
Page 1368 |
058505,000190: # AX*SR*T EXPECTS TO FIND THE SINES AND COSINES OF THE ANGLES OF ROTATION
058506,000191: # AT SINCDU AND COSCDU, IN THE ORDER Y Z X. A CALL TO CD*TR*GS, WITH
058507,000192: # THE 2'S COMPLEMENT ANGLES (ORDER Y Z X) AT CDUSPOT, WILL TAKE CARE OF
058508,000193: # THIS. HERE IS A SAMPLE CALLING SEQUENCE:-
058509,000194:
058510,000195: # TC CDUTRIGS
058511,000196: # CS THREE ("CA THREE" FOR NBSM)
058512,000197: # TC AX*SR*T
058513,000198:
058514,000199: # THE CALL TO CD*TR*GS NEED NOT BE REPEATED, WHEN AX*SR*T IS CALLED MORE
058515,000200: # THAN ONCE, UNLESS THE ANGLES HAVE CHANGED.
058516,000201:
058517,000202: # AX*SR*T IS GUARANTEED SAFE ONLY FOR VECTORS OF MAGNITUDE LESS THAN
058518,000203: # UNITY. A LOOK AT THE CASE IN WHICH A VECTOR OF GREATER MAGNITUDE
058519,000204: # HAPPENS TO LIE ALONG AN AXIS OF THE SYSTEM TO WHICH IT IS TO BE TRANS-
058520,000205: # FORMED CONVINCES ONE THAT THIS IS A RESTRICTION WHICH MUST BE ACCEPTED.
058521,000206:
058522,000207: 23,3651 54142 AX*SR*T TS DEXDEX # WHERE IT BECOMES THE INDEX OF INDEXES
058523,000208: 23,3652 00006 EXTEND
058524,000209: 23,3653 22145 QXCH RTNSAVER
058525,000210:
058526,000211: 23,3654 10142 R*TL**P CCS DEXDEX # +3 --> 0 -3 --> 2
058527,000212: 23,3655 40142 CS DEXDEX # THUS: +2 --> 1 -2 --> 1
058528,000213: 23,3656 66214 AD THREE # +1 --> 2 -1 --> 0
058529,000214: 23,3657 00006 EXTEND
058530,000215: 23,3660 50000 INDEX A
058531,000216: 23,3661 33740 DCA INDEXI
058532,000217: 23,3662 52144 DXCH DEXI
058533,000218:
058534,000219: 23,3663 34770 CA ONE
058535,000220: 23,3664 54130 TS BUF
058536,000221: 23,3665 00006 EXTEND
058537,000222: 23,3666 50143 INDEX DEX1
058538,000223: 23,3667 40123 DCS VBUF
058539,000224: 23,3670 13672 TCF LOOP1 # REALLY BE A SUBTRACT, AND VICE VERSA
058540,000225:
058541,000226: 23,3671 52131 LOOP2 DXCH BUF # LOADING VECTOR COMPONENT, STORING INDEX
058542,000227:
058543,000228: 23,3672 52155 LOOP1 DXCH MPAC
058544,000229: 23,3673 33736 CA SINESLOC
058545,000230: 23,3674 60143 AD DEX1
058546,000231: 23,3675 54116 TS ADDRWD
058547,000232:
058548,000233: 23,3676 07056 TC DMPSUB # MULTIPLY BY SIN(CDUANGLE)
058549,000234: 23,3677 10142 CCS DEXDEX
058550,000235: 23,3700 52155 DXCH MPAC # NBSM CASE
058551,000236: 23,3701 13704 TCF +3
058552,000237: 23,3702 00006 EXTEND # SMNB CASE
058553,000238: 23,3703 40155 DCS MPAC
058554,000239: 23,3704 52134 DXCH TERM1TMP
058555,000240:
Page 1369 |
058557,000242: 23,3705 36211 CA SIX # SINCDU AND COSCDU (EACH 6 WORDS) MUST
058558,000243: 23,3706 26116 ADS ADDRWD # BE CONSECUTIVE AND IN THAT ORDER
058559,000244:
058560,000245: 23,3707 00006 EXTEND
058561,000246: 23,3710 50130 INDEX BUF
058562,000247: 23,3711 50143 INDEX DEX1
058563,000248: 23,3712 30123 DCA VBUF
058564,000249: 23,3713 52155 DXCH MPAC
058565,000250: 23,3714 07056 TC DMPSUB # MULTIPLY BY COS(CDUANGLE)
058566,000251: 23,3715 52155 DXCH MPAC
058567,000252: 23,3716 20134 DAS TERM1TMP
058568,000253: 23,3717 52134 DXCH TERM1TMP
058569,000254: 23,3720 20001 DDOUBL
058570,000255: 23,3721 50130 INDEX BUF
058571,000256: 23,3722 50143 INDEX DEX1
058572,000257: 23,3723 52123 DXCH VBUF
058573,000258: 23,3724 52131 DXCH BUF # LOADING INDEX, STORING VECTOR COMPONENT
058574,000259:
058575,000260: 23,3725 10000 CCS A # 'CAUSE THAT'S WHERE THE INDEX NOW IS
058576,000261: 23,3726 13671 TCF LOOP2
058577,000262:
058578,000263: 23,3727 00006 EXTEND
058579,000264: 23,3730 26142 DIM DEXDEX # DECREMENT MAGNITUDE PRESERVING SIGN
058580,000265:
058581,000266: 23,3731 10142 TSTPOINT CCS DEXDEX # ONLY THE BRANCHING FUNCTION IS USED
058582,000267: 23,3732 13654 TCF R*TL**P
058583,000268: 23,3733 00145 TC RTNSAVER
058584,000269: 23,3734 13654 TCF R*TL**P
058585,000270: 23,3735 00145 TC RTNSAVER
058586,000271:
058587,000272: 23,3736 01141 SINESLOC ADRES SINCDU # FOR USE IN SETTING ADDRWD
058588,000273:
058589,000274: 23,3737 00004 INDEXI DEC 4 B-14 # ********** DON'T **********
058590,000275: 23,3740 00002 DEC 2 B-14 # ********** TOUCH **********
058591,000276: 23,3741 00000 DEC 0 B-14 # ********** THESE **********
058592,000277: 23,3742 00004 DEC 4 B-14 # ********** CONSTANTS **********
058593,000278:
058594,000279: # ****************************************************************************************************************
058595,000280:
Page 1370 |
058597,000282:
058598,000283: # THIS SUBROUTINE COMPUTES INCREMENTAL CHANGES IN CDU(GIMBAL) ANGLES FROM INCREMENTAL CHANGES ABOUT SM AXES. IT
058599,000284: # REQUIRES SM INCREMENTS AS A DP VECTOR SCALED AT ONE REVOLUTION(DTHETASM,+2,+4). SIN,COS(CDUY,Z,X) ARE IN
058600,000285: # SINCDU,+2,+4 AND COSCDU,+2,+4 RESPECTIVELY, SCALED TO ONE HALF. CDU INCREENTS ARE PLACED IN DCDU,+2,+4 SCALED TO
058601,000286: # ONE REVOLUTION.
058602,000287:
058603,000288: # * COS(IGA)SEC(MGA) 0 -SIN(IGA)SEC(MGA) *
058604,000289: # * *
058605,000290: # * -COS(IGA)TAN(MGA) 1 SIN(IGA)TAN(MGA) *
058606,000291: # * *
058607,000292: # * SIN(IGA) 0 COS(IGA) *
058608,000293:
058609,000294: 23,2000 SETLOC POWFLIT1
058610,000295: 23,2000 BANK
058611,000296: 23,3743 COUNT* $$/POWFL
058612,000297: 23,3743 41345 SMCDURES DLOAD DMP
058613,000298: 23,3744 03212 DTHETASM
058614,000299: 23,3745 01150 COSCDUY
058615,000300:
058616,000301: 23,3746 41325 PDDL DMP
058617,000302: 23,3747 03216 DTHETASM +4
058618,000303: 23,3750 01142 SINCDUY
058619,000304:
058620,000305: 23,3751 77621 BDSU
058621,000306: 23,3752 77671 DDV
058622,000307: 23,3753 01152 COSCDUZ
058623,000308: 23,3754 03204 STORE DCDU
058624,000309:
058625,000310: 23,3755 72405 DMP SL1 # SCALE
058626,000311: 23,3756 01144 SINCDUZ
058627,000312: 23,3757 77621 BDSU
058628,000313:
058629,000314: 23,3760 03214 DTHETASM +2
058630,000315: 23,3761 17206 STODL DCDU +2
058631,000316: 23,3762 03212 DTHETASM
058632,000317:
058633,000318: 23,3763 65205 DMP PDDL
058634,000319: 23,3764 01142 SINCDUY
058635,000320: 23,3765 03216 DTHETASM +4
058636,000321:
058637,000322: 23,3766 43205 DMP DAD
058638,000323: 23,3767 01150 COSCDUY
058639,000324: 23,3770 77752 SL1
058640,000325: 23,3771 03210 STORE DCDU +4
058641,000326: 23,3772 77616 RVQ
End of include-file POWERED_FLIGHT_SUBROUTINES.agc. Parent file is MAIN.agc