Source Code
These source code files are an attempted reconstruction of Sundance revision 306, the Apollo 9
LM (Lunar Module) AGC (Apollo Guidance Computer) flight software, created from binary dumps of
original core rope program modules, as follows:
|
049087,000002: ## Copyright: Public domain.
049088,000003: ## Filename: POWERED_FLIGHT_SUBROUTINES.agc
049089,000004: ## Purpose: A section of an attempt to reconstruct Sundance revision 306
049090,000005: ## as closely as possible with available information. Sundance
049091,000006: ## 306 is the source code for the Lunar Module's (LM) Apollo
049092,000007: ## Guidance Computer (AGC) for Apollo 9. This program was created
049093,000008: ## using the mixed-revision SundanceXXX as a starting point, and
049094,000009: ## pulling back features from Luminary 69 believed to have been
049095,000010: ## added based on memos, checklists, observed address changes,
049096,000011: ## or the Sundance GSOPs.
049097,000012: ## Assembler: yaYUL
049098,000013: ## Contact: Ron Burkey <info@sandroid.org>.
049099,000014: ## Website: www.ibiblio.org/apollo/index.html
049100,000015: ## Mod history: 2020-07-24 MAS Created from SundanceXXX.
049101,000016: ## 2021-05-30 ABS SINSLOC -> SINESLOC
049102,000017:
049103,000018:
049104,000019:
049105,000020: 14,3375 BANK 14 # SAME FBANK AS THE FINDCDUD SUB-PROGRAM
049106,000021: 23,2000 SETLOC POWFLITE
049107,000022: 23,2000 BANK
049108,000023:
049109,000024: 23,3335 0142 EBANK= DEXDEX
049110,000025: 23,3335 COUNT* $$/POWFL
049111,000026:
049112,000027: # CDUTRIG, CDUTRIG1, CDUTRIG2, AND CD*TR*GS ALL COMPUTE THE SINES AND
049113,000028: # COSINES OF THREE 2'S COMPLEMENT ANGLES AND PLACE THE RESULT, DOUBLE
049114,000029: # PRECISION, IN THE SAME ORDER AS THE INPUTS, AT SINCDU AND COSCDU. AN
049115,000030: # ADDITIONAL OUTPUT IS THE 1'S COMPLEMENT ANGLES AT CDUSPOT. THESE
049116,000031: # ROUTINES GO OUT OF THEIR WAY TO LEAVE THE MPAC AREA AS THEY FIND IT,
049117,000032: # EXCEPT FOR THE GENERALLY UNIMPORTANT MPAC +2. THEY DIFFER ONLY IN
049118,000033: # WHERE THEY GET THE ANGLES, AND IN METHOD OF CALLING.
049119,000034:
049120,000035: # CDUTRIG (AND CDUTRIG1, WHICH CAN BE CALLED IN BASIC) COMPUTE THE
049121,000036: # SINES AND COSINES FROM THE CURRENT CONTENTS OF THE CDU REGISTERS.
049122,000037: # THE CONTENTS OF CDUTEMP, ETC., ARE NOT TOUCHED SO THAT THEY MAY
049123,000038: # CONTINUE TO FORM A CONSISTENT SET WITH THE LATEST PIPA READINGS.
049124,000039:
049125,000040: # CDUTRIG1 IS LIKE CDUTRIG EXCEPT THAT IT CAN BE CALLED IN BASIC.
049126,000041:
049127,000042: # CD*TR*GS FINDS CDU VALUES IN CDUSPOT RATHER THAN IN CDUTEMP. THIS
049128,000043: # ALLOWS USERS TO MAKE TRANSFORMATIONS USING ARBITRARY ANGLES, OR REAL
049129,000044: # ANGLES IN AN ORDER OTHER THAN X Y Z. A CALL TO THIS ROUTINE IS
049130,000045: # NECESSARY IN PREPARATION FOR A CALL TO AX*SR*T IN EITHER OF ITS TWO
049131,000046: # MODES (SMNB OR NBSM). SINCE AX*SR*T EXPECTS TO FIND THE SINES AND
049132,000047: # COSINES IN THE ORDER Y Z X THE ANGLES MUST HAVE BEEN PLACED IN CDUSPOT
049133,000048: # IN THIS ORDER. CD*TR*GS NEED NOT BE REPEATED WHEN AX*SR*T IS CALLED
049134,000049: # MORE THAN ONCE, PROVIDED THE ANGLES HAVE NOT CHANGED. NOTE THAT SINCE
049135,000050: # IT CLOBBERS BUF2 (IN THE SINE AND COSINE ROUTINES) CD*TR*GS CANNOT BE
049136,000051: # CALLED USING BANKCALL. SORRY.
049137,000052:
049138,000053: # CD*TR*G IS LIKE CD*TR*GS EXCEPT THAT IT CAN BE CALLED IN
049139,000054: # INTERPRETIVE.
049140,000055:
049141,000056: 23,3335 77776 CDUTRIG EXIT
049142,000057: 23,3336 03345 TC CDUTRIGS
049143,000058: 23,3337 06014 TC INTPRET
049144,000059: 23,3340 77616 RVQ
049145,000060:
049146,000061: 23,3341 77776 CD*TR*G EXIT
049147,000062: 23,3342 03353 TC CD*TR*GS
049148,000063: 23,3343 06014 TC INTPRET
049149,000064: 23,3344 77616 RVQ
049150,000065:
049151,000066: 23,3345 30032 CDUTRIGS CA CDUX
049152,000067: 23,3346 54772 TS CDUSPOT +4
049153,000068: 23,3347 30033 CA CDUY
049154,000069: 23,3350 54766 TS CDUSPOT
049155,000070: 23,3351 30034 CA CDUZ
049156,000071: 23,3352 54770 TS CDUSPOT +2
049157,000072:
049158,000073: 23,3353 00006 CD*TR*GS EXTEND
049159,000074: 23,3354 22142 QXCH TEM2
049160,000075: 23,3355 35024 CAF FOUR
049161,000076: 23,3356 76216 TR*GL**P MASK SIX # MAKE IT EVEN AND SMALLER
049162,000077: 23,3357 54143 TS TEM3
049163,000078: 23,3360 50143 INDEX TEM3
049164,000079: 23,3361 30766 CA CDUSPOT
049165,000080: 23,3362 52155 DXCH MPAC # STORING 2'S COMP ANGLE, LOADING MPAC
049166,000081: 23,3363 52127 DXCH VBUF +4 # STORING MPAC FOR LATER RESTORATION
049167,000082: 23,3364 04766 TC USPRCADR
049168,000083: 23,3365 21457 CADR CDULOGIC
049169,000084: 23,3366 00006 EXTEND
049170,000085: 23,3367 30155 DCA MPAC
049171,000086: 23,3370 50143 INDEX TEM3
049172,000087: 23,3371 52767 DXCH CDUSPOT # STORING 1'S COMPLEMENT ANGLE
049173,000088: 23,3372 04766 TC USPRCADR
049174,000089: 23,3373 01516 CADR COSINE
049175,000090: 23,3374 52155 DXCH MPAC
049176,000091: 23,3375 50143 INDEX TEM3
049177,000092: 23,3376 52745 DXCH COSCDU # STORING COSINE
049178,000093: 23,3377 00006 EXTEND
049179,000094: 23,3400 50143 INDEX TEM3
049180,000095: 23,3401 30767 DCA CDUSPOT # LOADING 1'S COMPLEMENT ANGLE
049181,000096: 23,3402 04766 TC USPRCADR
049182,000097: 23,3403 01530 CADR SINE +1 # SINE +1 EXPECTS ARGUMENT IN A AND L
049183,000098: 23,3404 52127 DXCH VBUF +4 # BRINGING UP PRIOR MPAC TO BE RESTORED
049184,000099: 23,3405 52155 DXCH MPAC
049185,000100: 23,3406 50143 INDEX TEM3
049186,000101: 23,3407 52737 DXCH SINCDU
049187,000102: 23,3410 10143 CCS TEM3
049188,000103: 23,3411 13356 TCF TR*GL**P
049189,000104: 23,3412 00142 TC TEM2
049190,000105: # ****************************************************************************************************************
049191,000106: # QUICTRIG, INTENDED FOR GUIDANCE CYCLE USE WHERE TIME IS CRITICAL, IS A MUCH FASTER VERSION OF CD*TR*GS.
049192,000107: # QUICTRIG COMPUTES AND STORES THE SINES AND COSINES OF THE 2'S COMPLEMENT ANGLES AT CDUSPOT, CDUSPOT +2,
049193,000108: # AND CDUSPOT +4. UNLIKE CD*TR*GS, QUICTRIG DOES NOT LEAVE THE 1'S COMPLEMENT VERSIONS OF THE ANGLES IN
049194,000109: # CDUSPOT. QUICTRIG'S EXECUTION TIME IS 4.1 MS; THIS IS 10 TIMES AS FAST AS CD*TR*GS. QUICTRIG MAY BE
049195,000110: # CALLED FROM INTERPRETIVE AS AN RTB OP-CODE, OR FROM BASIC VIA BANKCALL OR IBNKCALL.
049196,000111:
049197,000112: 23,3413 00006 QUICTRIG EXTEND
049198,000113: 23,3414 22142 QXCH TEM2
049199,000114: 23,3415 35024 CAF FOUR
049200,000115: 23,3416 76216 +4 MASK SIX
049201,000116: 23,3417 54143 TS TEM3
049202,000117: 23,3420 50143 INDEX TEM3
049203,000118: 23,3421 30766 CA CDUSPOT
049204,000119: 23,3422 05103 TC SPSIN
049205,000120: 23,3423 00006 EXTEND
049206,000121: 23,3424 75011 MP BIT14 # SCALE DOWN TO MATCH INTERPRETER OUTPUTS
049207,000122: 23,3425 50143 INDEX TEM3
049208,000123: 23,3426 52737 DXCH SINCDU
049209,000124: 23,3427 50143 INDEX TEM3
049210,000125: 23,3430 30766 CA CDUSPOT
049211,000126: 23,3431 05102 TC SPCOS
049212,000127: 23,3432 00006 EXTEND
049213,000128: 23,3433 75011 MP BIT14
049214,000129: 23,3434 50143 INDEX TEM3
049215,000130: 23,3435 52745 DXCH COSCDU
049216,000131: 23,3436 10143 CCS TEM3
049217,000132: 23,3437 13416 TCF QUICTRIG +3
049218,000133: 23,3440 00142 TC TEM2
049219,000134:
049220,000135: # ****************************************************************************************************************
049221,000136: # THESE INTERFACE ROUTINES MAKE IT POSSIBLE TO CALL AX*SR*T, ETC., IN
049222,000137: # INTERPRETIVE. LATER, WHERE POSSIBLE, THEY WILL BE ELIMINATED.
049223,000138:
049224,000139: # NBSM WILL BE THE FIRST TO GO. IT SHOULD NOT BE USED.
049225,000140:
049226,000141: 23,3441 77620 NBSM STQ
049227,000142: 23,3442 00047 X2
049228,000143: 23,3443 76740 LXC,1 VLOAD*
049229,000144: 23,3444 00050 S1 # BASE ADDRESS OF THE CDU ANGLES IS IN S1
049230,000145: 23,3445 00001 0,1
049231,000146: 23,3446 24767 STOVL CDUSPOT
049232,000147: 23,3447 00041 32D # VECTOR TO BE TRANSFORMED IS IN 32D
049233,000148: 23,3450 77624 CALL
049234,000149: 23,3451 47472 TRG*NBSM
049235,000150: 23,3452 34041 STCALL 32D # SINCE THERE'S NO STGOTO
049236,000151: 23,3453 00047 X2
049237,000152:
049238,000153: # THESE INTERFACE ROUTINES ARE PERMANENT. ALL RESTORE USER'S EBANK
049239,000154: # SETTING. ALL ARE STRICT INTERPRETIVE SUBROUTINES, CALLED USING "CALL",
049240,000155: # RETURNING VIA QPRET. ALL EXPECT AND RETURN THE VECTOR TO BE TRANSFOR-
049241,000156: # MED INTERPRETER-STYLE IN MPAC; COMPONENTS AT MPAC, MPAC +3, AND MPAC +5.
049242,000157:
049243,000158: # TRG*SMNB AND TRG*NBSM BOTH EXPECT TO SEE THE 2'S COMPLEMENT ANGLES
049244,000159: # AT CDUSPOT (ORDER Y Z X, AT CDUSPOT, CDUSPOT +2, AND CDUSPOT +4; ODD
049245,000160: # LOCATIONS NEED NOT BE ZEROED). TRG*NBSM DOES THE NB TO SM TRANSFOR-
049246,000161: # MATION; TRG*SMNB, VICE VERSA.
049247,000162:
049248,000163: # CDU*NBSM DOES ITS TRANSFORMATION USING THE PRESENT CONTENTS OF
049249,000164: # THE CDU COUNTERS. OTHERWISE IT IS LIKE TRG*NBSM.
049250,000165:
049251,000166: # CDU*SMNB IS THE COMPLEMENT OF CDU*NBSM.
049252,000167:
049253,000168: 23,3454 77776 CDU*SMNB EXIT
049254,000169: 23,3455 03345 TC CDUTRIGS
049255,000170: 23,3456 13461 TCF C*MM*N1
049256,000171:
049257,000172: 23,3457 77776 TRG*SMNB EXIT
049258,000173: 23,3460 03353 TC CD*TR*GS
049259,000174: 23,3461 07504 C*MM*N1 TC MPACVBUF # AX*SR*T EXPECTS VECTOR IN VBUF
049260,000175: 23,3462 46221 CS THREE # SIGNAL FOR SM TO NB TRANSFORMATION
049261,000176: 23,3463 03503 C*MM*N2 TC AX*SR*T
049262,000177: 23,3464 06014 TC INTPRET
049263,000178: 23,3465 43575 VLOAD RVQ
049264,000179: 23,3466 00123 VBUF
049265,000180:
049266,000181: 23,3467 77776 CDU*NBSM EXIT
049267,000182: 23,3470 03345 TC CDUTRIGS
049268,000183: 23,3471 13474 TCF C*MM*N3
049269,000184:
049270,000185: 23,3472 77776 TRG*NBSM EXIT
049271,000186: 23,3473 03353 TC CD*TR*GS
049272,000187: 23,3474 07504 C*MM*N3 TC MPACVBUF # FOR AX*SR*T
049273,000188: 23,3475 36221 CA THREE # SIGNAL FOR NB TO SM TRANSFORMATION
049274,000189: 23,3476 13463 TCF C*MM*N2
049275,000190:
049276,000191: # *NBSM* AND *SMNB* EXPECT TO SEE THE SINES AND COSINES (AT SINCDU
049277,000192: # AND COSCDU) RATHER THAN THE ANGLES THEMSELVES. OTHERWISE THEY ARE
049278,000193: # LIKE TRG*NBSM AND TRG*SMNB.
049279,000194:
049280,000195: # NOTE THAT JUST AS CD*TR*GS NEED BE CALLED ONLY ONCE FOR EACH SERIES
049281,000196: # OF TRANSFORMATIONS USING THE SAME ANGLES, SO TOO ONLY ONE OF TRG*NBSM
049282,000197: # AND TRG*SMNB NEED BE CALLED FOR EACH SERIES. FOR SUBSEQUENT TRANSFOR-
049283,000198: # MATIONS USE *NBSM* AND *SMNB*.
049284,000199:
049285,000200: 23,3477 77776 *SMNB* EXIT
049286,000201: 23,3500 13461 TCF C*MM*N1
049287,000202:
049288,000203: 23,3501 77776 *NBSM* EXIT
049289,000204: 23,3502 13474 TCF C*MM*N3
049290,000205:
049291,000206: # AX*SR*T COMBINES THE OLD SMNB AND NBSM. FOR THE NB TO SM
049292,000207: # TRANSFORMATION, ENTER WITH +3 IN A. FOR SM TO NB, ENTER WITH -3.
049293,000208: # THE VECTOR TO BE TRANSFORMED ARRIVES, AND IS RETURNED, IN VBUF.
049294,000209: # AX*SR*T EXPECTS TO FIND THE SINES AND COSINES OF THE ANGLES OF ROTATION
049295,000210: # AT SINCDU AND COSCDU, IN THE ORDER Y Z X. A CALL TO CD*TR*GS, WITH
049296,000211: # THE 2'S COMPLEMENT ANGLES (ORDER Y Z X) AT CDUSPOT, WILL TAKE CARE OF
049297,000212: # THIS. HERE IS A SAMPLE CALLING SEQUENCE:-
049298,000213: # TC CDUTRIGS
049299,000214: # CS THREE ("CA THREE" FOR NBSM)
049300,000215: # TC AX*SR*T
049301,000216: # THE CALL TO CD*TR*GS NEED NOT BE REPEATED, WHEN AX*SR*T IS CALLED MORE
049302,000217: # THAN ONCE, UNLESS THE ANGLES HAVE CHANGED.
049303,000218:
049304,000219: # AX*SR*T IS GUARANTEED SAFE ONLY FOR VECTORS OF MAGNITUDE LESS THAN
049305,000220: # UNITY. A LOOK AT THE CASE IN WHICH A VECTOR OF GREATER MAGNITUDE
049306,000221: # HAPPENS TO LIE ALONG AN AXIS OF THE SYSTEM TO WHICH IT IS TO BE TRANS-
049307,000222: # FORMED CONVINCES ONE THAT THIS IS A RESTRICTION WHICH MUST BE ACCEPTED.
049308,000223:
049309,000224: 23,3503 54142 AX*SR*T TS DEXDEX # WHERE IT BECOMES THE INDEX OF INDEXES
049310,000225: 23,3504 00006 EXTEND
049311,000226: 23,3505 22145 QXCH RTNSAVER
049312,000227:
049313,000228: 23,3506 10142 R*TL**P CCS DEXDEX # +3 --> 0 -3 --> 2
049314,000229: 23,3507 40142 CS DEXDEX # THUS: +2 --> 1 -2 --> 1
049315,000230: 23,3510 66221 AD THREE # +1 --> 2 -1 --> 0
049316,000231: 23,3511 00006 EXTEND
049317,000232: 23,3512 50000 INDEX A
049318,000233: 23,3513 33572 DCA INDEXI
049319,000234: 23,3514 52144 DXCH DEXI
049320,000235:
049321,000236: 23,3515 35026 CA ONE
049322,000237: 23,3516 54130 TS BUF
049323,000238: 23,3517 00006 EXTEND
049324,000239: 23,3520 50143 INDEX DEX1
049325,000240: 23,3521 40123 DCS VBUF
049326,000241: 23,3522 13524 TCF LOOP1 # REALLY BE A SUBTRACT, AND VICE VERSA
049327,000242:
049328,000243: 23,3523 52131 LOOP2 DXCH BUF # LOADING VECTOR COMPONENT, STORING INDEX
049329,000244: 23,3524 52155 LOOP1 DXCH MPAC
049330,000245: 23,3525 33570 CA SINESLOC
049331,000246: 23,3526 60143 AD DEX1
049332,000247: 23,3527 54116 TS ADDRWD
049333,000248:
049334,000249: 23,3530 07063 TC DMPSUB # MULTIPLY BY SIN(CDUANGLE)
049335,000250: 23,3531 10142 CCS DEXDEX
049336,000251: 23,3532 52155 DXCH MPAC # NBSM CASE
049337,000252: 23,3533 13536 TCF +3
049338,000253: 23,3534 00006 EXTEND # SMNB CASE
049339,000254: 23,3535 40155 DCS MPAC
049340,000255: 23,3536 52134 DXCH TERM1TMP
049341,000256:
049342,000257: 23,3537 36216 CA SIX # SINCDU AND COSCDU (EACH 6 WORDS) MUST
049343,000258: 23,3540 26116 ADS ADDRWD # BE CONSECUTIVE AND IN THAT ORDER
049344,000259:
049345,000260: 23,3541 00006 EXTEND
049346,000261: 23,3542 50130 INDEX BUF
049347,000262: 23,3543 50143 INDEX DEX1
049348,000263: 23,3544 30123 DCA VBUF
049349,000264: 23,3545 52155 DXCH MPAC
049350,000265: 23,3546 07063 TC DMPSUB # MULTIPLY BY COS(CDUANGLE)
049351,000266: 23,3547 52155 DXCH MPAC
049352,000267: 23,3550 20134 DAS TERM1TMP
049353,000268: 23,3551 52134 DXCH TERM1TMP
049354,000269: 23,3552 20001 DDOUBL
049355,000270: 23,3553 50130 INDEX BUF
049356,000271: 23,3554 50143 INDEX DEX1
049357,000272: 23,3555 52123 DXCH VBUF
049358,000273: 23,3556 52131 DXCH BUF # LOADING INDEX, STORING VECTOR COMPONENT
049359,000274:
049360,000275: 23,3557 10000 CCS A # 'CAUSE THAT'S WHERE THE INDEX NOW IS
049361,000276: 23,3560 13523 TCF LOOP2
049362,000277:
049363,000278: 23,3561 00006 EXTEND
049364,000279: 23,3562 26142 DIM DEXDEX # DECREMENT MAGNITUDE PRESERVING SIGN
049365,000280:
049366,000281: 23,3563 10142 TSTPOINT CCS DEXDEX # ONLY THE BRANCHING FUNCTION IS USED
049367,000282: 23,3564 13506 TCF R*TL**P
049368,000283: 23,3565 00145 TC RTNSAVER
049369,000284: 23,3566 13506 TCF R*TL**P
049370,000285: 23,3567 00145 TC RTNSAVER
049371,000286:
049372,000287: 23,3570 00736 SINESLOC ADRES SINCDU # FOR USE IN SETTING ADDRWD
049373,000288:
049374,000289: 23,3571 00004 INDEXI DEC 4 B-14 # ********** DON'T **********
049375,000290: 23,3572 00002 DEC 2 B-14 # ********** TOUCH **********
049376,000291: 23,3573 00000 DEC 0 B-14 # ********** THESE **********
049377,000292: 23,3574 00004 DEC 4 B-14 # ********** CONSTANTS **********
049378,000293:
049379,000294: # ****************************************************************************************************************
049380,000295: # THIS SUBROUTINE COMPUTES INCREMENTAL CHANGES IN CDU(GIMBAL) ANGLES FROM INCREMENTAL CHANGES ABOUT SM AXES. IT
049381,000296: # REQUIRES SM INCREMENTS AS A DP VECTOR SCALED AT ONE REVOLUTION(DTHETASM,+2,+4). SIN,COS(CDUY,Z,X) ARE IN
049382,000297: # SINCDU,+2,+4 AND COSCDU,+2,+4 RESPECTIVELY,SCALED TO ONE HALF. CDU INCREENTS ARE PLACED IN DCDU,+2,+4 SCALED TO
049383,000298: # ONE REVOLUTION.
049384,000299:
049385,000300: # * COS(IGA)SEC(MGA) 0 -SIN(IGA)SEC(MGA) *
049386,000301: # * *
049387,000302: # * -COS(IGA)TAN(MGA) 1 SIN(IGA)TAN(MGA) *
049388,000303: # * *
049389,000304: # * SIN(IGA) 0 COS(IGA) *
049390,000305:
049391,000306: 14,3375 BANK 14
049392,000307: 23,2000 SETLOC POWFLIT1
049393,000308: 23,2000 BANK
049394,000309: 23,3575 41345 SMCDURES DLOAD DMP
049395,000310: 23,3576 01267 DTHETASM
049396,000311: 23,3577 00745 COSCDUY
049397,000312:
049398,000313: 23,3600 41325 PDDL DMP
049399,000314: 23,3601 01273 DTHETASM +4
049400,000315: 23,3602 00737 SINCDUY
049401,000316:
049402,000317: 23,3603 77621 BDSU
049403,000318: 23,3604 77671 DDV
049404,000319: 23,3605 00747 COSCDUZ
049405,000320: 23,3606 03233 STORE DCDU
049406,000321:
049407,000322: 23,3607 72405 DMP SL1 # SCALE
049408,000323: 23,3610 00741 SINCDUZ
049409,000324: 23,3611 77621 BDSU
049410,000325:
049411,000326: 23,3612 01271 DTHETASM +2
049412,000327: 23,3613 17235 STODL DCDU +2
049413,000328: 23,3614 01267 DTHETASM
049414,000329:
049415,000330: 23,3615 65205 DMP PDDL
049416,000331: 23,3616 00737 SINCDUY
049417,000332: 23,3617 01273 DTHETASM +4
049418,000333:
049419,000334: 23,3620 43205 DMP DAD
049420,000335: 23,3621 00745 COSCDUY
049421,000336: 23,3622 77752 SL1
049422,000337: 23,3623 03237 STORE DCDU +4
049423,000338: 23,3624 77616 RVQ
049424,000339:
End of include-file POWERED_FLIGHT_SUBROUTINES.agc. Parent file is MAIN.agc