Source Code

This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the third release of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 96 and 97. A bug (which had been around since at least Apollo 10, Luminary 69) was discovered in Rev 0 shortly before the Apollo 11 flight, resulting in a last minute revision into Rev 1, which is what actually flew rather than the Rev 0 presented here. A hardcopy of Rev 0 is known to exist — it belonged to AGC developer Allan Klumpp for many years — but unfortunately the Virtual AGC Project has not had access to that hardcopy. Thus the code you see here had been reconstructed (we believe accurately) rather than transcribed. The first step of the reconstruction of the Rev 0 source code was the transcription of the Rev 1 source code from a hardcopy in the MIT Museum collection. The process of reverting the active portion of the source code (i.e., other than program comments) from Rev 1 to Rev 0 was very minor, consisting only of moving the position of the STARTSB1 label in FRESH START AND RESTART. Allan had previously given us the checksums of the memory banks of Rev 0, and we have verified the program presented here has checksums identical to all banks of Allan's listing of Rev 0. The notations on Allan's Rev 0 program listing read, in part:

	GAP:  ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-051

A single program comment is known to differ between Rev 0 and Rev 1, but these are harder to reconstruct and verify than changes to the active portion of the code. Thus it is possible that there are additional differences between the program comments in Rev 0 and Rev 1 that are unknown to us, and therefore are not reflected in the code presented here.

020701,000002:                                                                                                  ## Copyright:   Public domain.
020702,000003:                                                                                                  ## Filename:    R60,R62.agc
020703,000004:                                                                                                  ## Purpose:     Part of the reconstructed source code for LMY99 Rev 0,
020704,000005:                                                                                                  ##              otherwise known as Luminary Rev 99, the third release
020705,000006:                                                                                                  ##              of the Apollo Guidance Computer (AGC) software for Apollo 11.
020706,000007:                                                                                                  ##              It differs from LMY99 Rev 1 (the flown version) only in the
020707,000008:                                                                                                  ##              placement of a single label. The corrections shown here have
020708,000009:                                                                                                  ##              been verified to have the same bank checksums as AGC developer
020709,000010:                                                                                                  ##              Allan Klumpp's copy of Luminary Rev 99, and so are believed
020710,000011:                                                                                                  ##              to be accurate. This file is intended to be a faithful 
020711,000012:                                                                                                  ##              recreation, except that the code format has been changed to 
020712,000013:                                                                                                  ##              conform to the requirements of the yaYUL assembler rather than 
020713,000014:                                                                                                  ##              the original YUL assembler.
020714,000015:                                                                                                  ##
020715,000016:                                                                                                  ## Assembler:   yaYUL
020716,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
020717,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo.
020718,000019:                                                                                                  ## Pages:       472-485
020719,000020:                                                                                                  ## Mod history: 2009-05-17 RSB  Adapted from the corresponding 
020720,000021:                                                                                                  ##                              Luminary131 file, using page 
020721,000022:                                                                                                  ##                              images from Luminary 1A.
020722,000023:                                                                                                  ##              2016-12-13 RSB  GOTOP00H -> GOTOPOOH
020723,000024:                                                                                                  ##              2016-12-14 RSB  Proofed text comments with octopus/ProoferComments
020724,000025:                                                                                                  ##                              and corrected the errors found.
020725,000026:                                                                                                  ##              2017-01-27 RSB  Back-ported a comment-text fix identified in Luminary 69.
020726,000027:                                                                                                  ##              2017-03-09 RSB  Comment text fixes noted in proofing Luminary 116.
020727,000028:                                                                                                  ##              2017-08-01 MAS  Created from LMY99 Rev 1.
020728,000029: 
020729,000030:                                                                                                  ## This source code has been transcribed or otherwise adapted from
020730,000031:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
020731,000032:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
020732,000033:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
020733,000034:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
020734,000035:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
020735,000036:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
020736,000037:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
020737,000038:                                                                                                  ## actually created.
020738,000039:                                                                                                  ##
020739,000040:                                                                                                  ## The code has been modified to match LMY99 Revision 0, otherwise
020740,000041:                                                                                                  ## known as Luminary Revision 99, the Apollo 11 software release preceeding
020741,000042:                                                                                                  ## the listing from which it was transcribed. It has been verified to
020742,000043:                                                                                                  ## contain the same bank checksums as AGC developer Allan Klumpp's listing
020743,000044:                                                                                                  ## of Luminary Revision 99 (for which we do not have scans).
020744,000045:                                                                                                  ##
020745,000046:                                                                                                  ## Notations on Allan Klumpp's listing read, in part:
020746,000047:                                                                                                  ##
020747,000048:                                                                                                  ##      ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
020748,000049: 

Page 472

020750,000051:                                                                                                  #  MOD NO: 0                             DATE: 1 MAY 1968
020751,000052:                                                                                                  #  MOD BY: DIGITAL DEVEL GROUP           LOG SECTION R60,R62
020752,000053: 
020753,000054:                                                                                                  #  FUNCTIONAL DESCRIPTION:
020754,000055: 
020755,000056:                                                                                                  #  CALLED AS A GENERAL SUBROUTINE TO MANEUVER THE LM TO A SPECIFIED
020756,000057:                                                                                                  #  ATTITUDE.
020757,000058: 
020758,000059:                                                                                                  #  1. IF THE 3-AXIS FLAG IS NOT SET THE FINAL CDU ANGLES ARE
020759,000060:                                                                                                  #  CALCULATED (VECPOINT).
020760,000061: 
020761,000062:                                                                                                  #  2. THE FDAI BALL ANGLES (NOUN 18) ARE CALCULATED (BALLANGS).
020762,000063: 
020763,000064:                                                                                                  #  3. REQUEST FLASHING DISPLAY V50 N18 PLEASE PERFORM AUTO MANEUVER.
020764,000065: 
020765,000066:                                                                                                  #  4. IF PRIORITY DISPLAY FLAG IS SET DO A PHASECHANGE.  THEN AWAIT
020766,000067:                                                                                                  #  ASTRONAUT RESPONSE.
020767,000068: 
020768,000069:                                                                                                  #  5. DISPLAY RESPONSE RETURNS:
020769,000070: 
020770,000071:                                                                                                  #        A.      ENTER - RESET 3-AXIS FLAG AND RETURN TO CLIENT.
020771,000072: 
020772,000073:                                                                                                  #        B.      TERMINATE - IF IN P00 GO TO STEP 5A.  OTHERWISE CHECK IF R61 IS
020773,000074:                                                                                                  #                THE CALLING PROGRAM.  IF IN R61 AN EXIT IS MADE TO GOTOV56.  IF
020774,000075:                                                                                                  #                NOT IN R61 AN EXIT IS DONE VIA GOTOP00H.
020775,000076: 
020776,000077:                                                                                                  #        C.      PROCEED - CONTINUE WITH PROGRAM AT STEP 6.
020777,000078: 
020778,000079:                                                                                                  #  6. IF THE 3-AXISFLAG IS NOT SET, THE FINAL CDU ANGLES ARE CALCULATED
020779,000080:                                                                                                  #  (VECPOINT).
020780,000081: 
020781,000082:                                                                                                  #  7. THE FDAI BALL ANGLES (NOUN 18) ARE CALCULATED (BALLANGS).
020782,000083: 
020783,000084:                                                                                                  #  8. IF THE G+N SWITCH IS NOT SET GO BACK TO STEP 3.
020784,000085:                                                                                                  #  
020785,000086:                                                                                                  #  9. IF THE AUTO SWITCH IS NOT SET GO BACK TO STEP 3.
020786,000087: 
020787,000088:                                                                                                  #  10. NONFLASHING DISPLAY V06N18 (FDAI ANGLES).
020788,000089: 
020789,000090:                                                                                                  #  11. DO A PHASECHANGE.
020790,000091: 
020791,000092:                                                                                                  #  12. DO A MANEUVER CALCULATION AND ICDU DRIVE ROUTINE TO ACHIEVE FINAL
020792,000093:                                                                                                  #  GIMBAL ANGLES (GOMANUR).
020793,000094: 
020794,000095:                                                                                                  #  13. AT END OF MANEUVER GO TO STEP 3.
020795,000096: 
020796,000097:                                                                                                  #        IF SATISFACTORY MANEUVER STEP 5A EXITS R60.
020797,000098:                                                                                                  #        FOR FURTHER ADJUSTMENT OF THE VEHICLE ATTITUDE ABOUT THE
020798,000099:                                                                                                  #        DESIRED VECTOR, THE ROUTINE MAY BE PERFORMED AGAIN STARTING AT

Page 473

020800,000101:                                                                                                  #        STEP 5C.
020801,000102: 
020802,000103:                                                                                                  #  CALLING SEQUENCE:     TC      BANKCALL
020803,000104:                                                                                                  #                        CADR    R60LEM
020804,000105: 
020805,000106:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED:     SCAXIS, POINTVSM (FOR VECPOINT)
020806,000107:                                                                                                  #                                        3AXISFLG.
020807,000108: 
020808,000109:                                                                                                  #  SUBROUTINES CALLED:   VECPOINT, BALLANGS, GOPERF2R, LINUS, GODSPER,
020809,000110:                                                                                                  #                        GOMANUR, DOWNFLAG, PHASCHNG, UPFLAG
020810,000111: 
020811,000112:                                                                                                  #  NORMAL EXIT MODES:    CAE     TEMPR60         (CALLERS RETURN ADDRESS)
020812,000113:                                                                                                  #                        TC      BANKJUMP
020813,000114: 
020814,000115:                                                                                                  #  ALARMS: NONE
020815,000116: 
020816,000117:                                                                                                  #  OUTPUT: NONE
020817,000118: 
020818,000119:                                                                                                  #  DEBRIS: CPHI, CTHETA, CPSI, 3AXISFLG, TBASE2
020819,000120: 
020820,000121: 34,2000                                           BANK     34                                    
020821,000122: 26,2000                                           SETLOC   MANUVER                               
020822,000123: 26,2000                                           BANK                                           
020823,000124: 
020824,000125: 26,2123     1164                                  EBANK=   TEMPR60                               
020825,000126: 
020826,000127: 26,2123                                           COUNT*   $$/R06                                
020827,000128: 26,2123           04645        R60LEM             TC       MAKECADR                              
020828,000129: 26,2124           55164                           TS       TEMPR60                               
020829,000130: 
020830,000131: 26,2125           34746        REDOMANN           CAF      3AXISBIT                              
020831,000132: 26,2126           70101                           MASK     FLAGWRD5                              #  IS 3-AXIS FLAG SET
020832,000133: 26,2127           10000                           CCS      A                                     
020833,000134: 26,2130           12136                           TCF      TOBALL                                #  YES
020834,000135: 26,2131           06037                           TC       INTPRET                               
020835,000136: 26,2132           77624                           CALL                                           
020836,000137: 26,2133           56040                                    VECPOINT                              #  TO COMPUTE FINAL ANGLES
020837,000138: 26,2134           00322                           STORE    CPHI                                  #  STORE FINAL ANGLES - CPHI, CTHETA, CPSI
020838,000139: 26,2135           77776                           EXIT                                           
020839,000140: 
020840,000141: 26,2136           04616        TOBALL             TC       BANKCALL                              
020841,000142: 26,2137           54266                           CADR     BALLANGS                              #  TO CONVERT ANGLES TO FDAI
020842,000143: 26,2140           32254        TOBALLA            CAF      V06N18                                
020843,000144: 26,2141           04616                           TC       BANKCALL                              
020844,000145: 26,2142           20710                           CADR     GOPERF2R                              #  DISPLAY PLEASE PERFORM AUTO MANEUVER
020845,000146: 26,2143           02242                           TC       R61TEST                               
020846,000147: 26,2144           02150                           TC       REDOMANC                              #  PROCEED
020847,000148: 26,2145           02175                           TC       ENDMANU1                              #  ENTER I.E. FINISHED WITH R60

Page 474

020849,000150: 26,2146           02201                           TC       CHKLINUS                              #  TO CHECK FOR PRIORITY DISPLAYS
020850,000151: 26,2147           05155                           TC       ENDOFJOB                              
020851,000152: 
020852,000153: 26,2150           34746        REDOMANC           CAF      3AXISBIT                              
020853,000154: 26,2151           70101                           MASK     FLAGWRD5                              #  IS 3-AXIS FLAG SET
020854,000155: 26,2152           10000                           CCS      A                                     
020855,000156: 26,2153           12161                           TCF      TOBALLC                               #  YES
020856,000157: 26,2154           06037                           TC       INTPRET                               
020857,000158: 26,2155           77624                           CALL                                           
020858,000159: 26,2156           56040                                    VECPOINT                              #  TO COMPUTE FINAL ANGLES
020859,000160: 26,2157           00322                           STORE    CPHI                                  #  STORE ANGLES
020860,000161: 26,2160           77776                           EXIT                                           
020861,000162: 
020862,000163: 26,2161           04616        TOBALLC            TC       BANKCALL                              
020863,000164: 26,2162           54266                           CADR     BALLANGS                              #  TO CONVERT ANGLES TO FDAI
020864,000165: 26,2163           02255                           TC       G+N,AUTO                              #  CHECK AUTO MODE
020865,000166: 26,2164           10000                           CCS      A                                     
020866,000167: 26,2165           12140                           TCF      TOBALLA                               #  NOT AUTO, GO REREQUEST AUTO MANEUVER.
020867,000168: 
020868,000169: 26,2166           32254        AUTOMANV           CAF      V06N18                                #  STATIC DISPLAY DURING AUTO MANEUVER
020869,000170: 26,2167           04616                           TC       BANKCALL                              #                                        -
020870,000171: 26,2170           20451                           CADR     GODSPR                                #                                        -
020871,000172: 26,2171           02201                           TC       CHKLINUS                              #  TO CHECK FOR PRIORITY DISPLAYS
020872,000173: 
020873,000174: 26,2172           04616        STARTMNV           TC       BANKCALL                              #  PERFORM MANEUVER VIA KALCMANU
020874,000175: 26,2173           17750                           CADR     GOMANUR                               
020875,000176: 
020876,000177: 26,2174           12140        ENDMANUV           TCF      TOBALLA                               #  FINISHED MANEUVER.
020877,000178: 26,2175           05516        ENDMANU1           TC       DOWNFLAG                              #  RESET 3-AXIS FLAG
020878,000179: 26,2176           00124                           ADRES    3AXISFLG                              
020879,000180: 26,2177           31164                           CAE      TEMPR60                               #                                        -
020880,000181: 26,2200           04640                           TC       BANKJUMP                              #                                        -
020881,000182: 
020882,000183: 26,2201           40100        CHKLINUS           CS       FLAGWRD4                              
020883,000184: 26,2202           74740                           MASK     PDSPFBIT                              #  IS PRIORITY DISPLAY FLAG SET?
020884,000185: 26,2203           10000                           CCS      A                                     #                                        -
020885,000186: 26,2204           00002                           TC       Q                                     #  NO - EXIT
020886,000187: 26,2205           30002                           CA       Q                                     
020887,000188: 26,2206           54156                           TS       MPAC       +2                         #  SAVE RETURN
020888,000189: 26,2207           46245                           CS       THREE                                 #  OBTAIN LOCATION FOR RESTART
020889,000190: 26,2210           60133                           AD       BUF2                                  #  HOLDS Q OF LAST DISPLAY
020890,000191: 26,2211           55055                           TS       TBASE2                                
020891,000192: 
020892,000193: 26,2212           05353                           TC       PHASCHNG                              
020893,000194: 26,2213           00132                           OCT      00132                                 
020894,000195: 
020895,000196: 26,2214           34745                           CAF      BIT7                                  
020896,000197: 26,2215           05464                           TC       LINUS                                 #  GO SET BITS FOR PRIORITY DISPLAY      -
020897,000198: 26,2216           00156                           TC       MPAC       +2                         
020898,000199: 

Page 475

020900,000201: 26,2217           37714        RELINUS            CAF      PRIO26                                #  RESTORE ORIGINAL PRIORITY
020901,000202: 26,2220           05146                           TC       PRIOCHNG                              
020902,000203: 
020903,000204: 26,2221           34747                           CAF      TRACKBIT                              #  DON'T CONTINUE R60 UNLESS TRACKFLAG ON.
020904,000205: 26,2222           70075                           MASK     FLAGWRD1                              
020905,000206: 26,2223           10000                           CCS      A                                     
020906,000207: 26,2224           12237                           TCF      RER60                                 
020907,000208: 
020908,000209: 26,2225           34745                           CAF      RNDVZBIT                              #  IS IT P20?
020909,000210: 26,2226           70074                           MASK     FLAGWRD0                              
020910,000211: 26,2227           10000                           CCS      A                                     
020911,000212: 26,2230           02234                           TC       +4                                    #  YES
020912,000213: 26,2231           05353                           TC       PHASCHNG                              #  NO, MUST BE P25, SET 2.11 SPOT
020913,000214: 26,2232           40112                           OCT      40112                                 
020914,000215: 
020915,000216: 26,2233           05155                           TC       ENDOFJOB                              
020916,000217: 
020917,000218: 26,2234           05353                           TC       PHASCHNG                              #  SET 2.7 SPOT FOR P20
020918,000219: 26,2235           40072                           OCT      40072                                 
020919,000220: 
020920,000221: 26,2236           05155                           TC       ENDOFJOB                              
020921,000222: 
020922,000223: 26,2237           05504        RER60              TC       UPFLAG                                #  SET PRIO DISPLAY FLAG AFTER RESTART
020923,000224: 26,2240           00077                           ADRES    PDSPFLAG                              
020924,000225: 
020925,000226: 26,2241           01055                           TC       TBASE2                                
020926,000227: 
020927,000228: 26,2242           31011        R61TEST            CA       MODREG                                #  IF WE ARE IN P00 IT MUST BE V49 OR V89
020928,000229: 26,2243           00006                           EXTEND                                         
020929,000230: 26,2244           12175                           BZF      ENDMANU1                              #  THUS WE GO TO ENDEXT VIA USER
020930,000231: 
020931,000232: 26,2245           30100                           CA       FLAGWRD4                              #  ARE WE IN R61 (P20 OR P25)
020932,000233: 26,2246           74740                           MASK     PDSPFBIT                              
020933,000234: 26,2247           00006                           EXTEND                                         
020934,000235: 26,2250           16001                           BZF      GOTOPOOH                              #  NO
020935,000236: 26,2251           06022                           TC       GOTOV56                               #  YES
020936,000237: 
020937,000238: 26,2252           20100        BIT14+7            OCT      20100                                 #                                        -
020938,000239: 26,2253           00203        OCT203             OCT      203                                   
020939,000240: 26,2254           01422        V06N18             VN       0618                                  
020940,000241: 
020941,000242:                                                                                                  #  SUBROUTINE TO CHECK FOR G+N CONTROL, AUTO STABILIZATION
020942,000243: 
020943,000244:                                                                                                  #  RETURNS WITH C(A) = +         IF NOT SET FOR G+N, AUTO
020944,000245:                                                                                                  #  RETURNS WITH C(A) = +0        IF SWITCHES ARE SET
020945,000246: 
020946,000247: 26,2255           00006        G+N,AUTO           EXTEND                                         
020947,000248: 26,2256           00030                           READ     CHAN30                                
020948,000249: 26,2257           74742                           MASK     BIT10                                 
020949,000250: 26,2260           10000                           CCS      A                                     
020950,000251: 26,2261           00002                           TC       Q                                     #  NOT IN G+N    C(A) = +

Page 476

020952,000253: 26,2262           00006        ISITAUTO           EXTEND                                         #  CHECK FOR AUTO MODE
020953,000254: 26,2263           00031                           READ     CHAN31                                
020954,000255: 26,2264           74736                           MASK     BIT14                                 
020955,000256: 26,2265           00002                           TC       Q                                     #  (+) = NOT IN AUTO, (+0) = AOK
020956,000257: 

Page 477

020958,000259:                                                                                                  #  PROGRAM DESCRIPTION BALLANGS
020959,000260:                                                                                                  #  MOD NO.                               LOG SECTION R60,R62
020960,000261: 
020961,000262:                                                                                                  #  WRITTEN BY RAMA M. AIYAWAR
020962,000263: 
020963,000264:                                                                                                  #  FUNCTIONAL DESCRIPTION
020964,000265: 
020965,000266:                                                                                                  #        COMPUTES LM FDAI BALL DISPLAY ANGLES
020966,000267: 
020967,000268:                                                                                                  #  CALLING SEQUENCE
020968,000269: 
020969,000270:                                                                                                  #        TC      BALLANGS
020970,000271: 
020971,000272:                                                                                                  #  NORMAL EXIT MODE
020972,000273: 
020973,000274:                                                                                                  #        TC      BALLEXIT        (SAVED Q)
020974,000275: 
020975,000276:                                                                                                  #  ALARM OR EXIT MODE    NIL
020976,000277: 
020977,000278:                                                                                                  #  SUBROUTINES CALLED
020978,000279: 
020979,000280:                                                                                                  #        CD*TR*G
020980,000281:                                                                                                  #        ARCTAN
020981,000282: 
020982,000283:                                                                                                  #  INPUT
020983,000284: 
020984,000285:                                                                                                  #        CPHI,CTHETA,CPSI ARE THE ANGLES CORRESPONDING TO AOG, AIG, AMG.  THEY ARE
020985,000286:                                                                                                  #        SP,2S COMPLIMENT SCALED TO HALF REVOLUTION.
020986,000287: 
020987,000288:                                                                                                  #  OUTPUT
020988,000289: 
020989,000290:                                                                                                  #        FDAIX, FDAIY, FDAIZ ARE THE REQUIRED BALL ANGLES SCALED TO HALF REVOLUTION
020990,000291:                                                                                                  #        SP,2S COMPLIMENT.
020991,000292: 
020992,000293:                                                                                                  #        THESE ANGLES WILL BE DISPLAYED AS DEGREES AND HUNDREDTHS, IN THE ORDER ROLL, PITCH, YAW, USING NOUNS 18 & 19.
020993,000294: 
020994,000295:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
020995,000296: 
020996,000297:                                                                                                  #        CPHI, CTHETA, CPSI      EACH A SP REGISTER
020997,000298: 
020998,000299:                                                                                                  #  DEBRIS
020999,000300: 
021000,000301:                                                                                                  #        A,L,Q,MPAC,SINCDU,COSCDU,PUSHLIST,BALLEXIT
021001,000302: 
021002,000303:                                                                                                  #  NOMENCLATURE: CPHI, CTHETA, & CPSI REPRESENT THE OUTER, INNER, & MIDDLE GIMBAL ANGLES, RESPECTIVELY; OR
021003,000304:                                                                                                  #                EQUIVALENTLY, CDUX, CDUY, & CDUZ.
021004,000305: 
021005,000306:                                                                                                  #  NOTE:  ARCTAN CHECKS FOR OVERFLOW AND SHOULD BE ABLE TO HANDLE ANY SINGULARITIES.
021006,000307: 
021007,000308: 26,2000                                           SETLOC   BAWLANGS                              
021008,000309: 26,2000                                           BANK                                           
021009,000310: 
021010,000311: 26,2266                                           COUNT*   $$/BALL                               
021011,000312: 26,2266           04645        BALLANGS           TC       MAKECADR                              
021012,000313: 26,2267           55342                           TS       BALLEXIT                              
021013,000314: 26,2270           30321                           CA       CPHI                                  

Page 478

021015,000316: 26,2271           54772                           TS       CDUSPOT    +4                         
021016,000317: 26,2272           30322                           CA       CTHETA                                
021017,000318: 26,2273           54766                           TS       CDUSPOT                               
021018,000319: 26,2274           30323                           CA       CPSI                                  
021019,000320: 26,2275           54770                           TS       CDUSPOT    +2                         
021020,000321: 
021021,000322: 26,2276           06037                           TC       INTPRET                               
021022,000323: 26,2277           45001                           SETPD    CALL                                  
021023,000324: 26,2300           00001                                    0D                                    
021024,000325: 26,2301           47543                                    CD*TR*G                               
021025,000326: 
021026,000327: 26,2302           41345                           DLOAD    DMP                                   
021027,000328: 26,2303           00743                                    SINCDUX                               #  SIN (OGA)
021028,000329: 26,2304           00747                                    COSCDUZ                               #  COS (MGA)
021029,000330: 
021030,000331: 26,2305           57552                           SL1      DCOMP                                 #  SCALE
021031,000332: 26,2306           65336                           ARCSIN   PDDL                                  #  YAW = ARCSIN(-SXCZ) INTO 0 PD
021032,000333: 26,2307           00741                                    SINCDUZ                               
021033,000334: 26,2310           14023                           STODL    SINTH                                 #  (SINTH = 18D IN PD)
021034,000335: 26,2311           00747                                    COSCDUZ                               
021035,000336: 26,2312           72405                           DMP      SL1                                   #  RESCALE
021036,000337: 26,2313           00751                                    COSCDUX                               
021037,000338: 26,2314           34021                           STCALL   COSTH                                 #  (COSTH = 16D IN PD)
021038,000339: 26,2315           26510                                    ARCTAN                                
021039,000340: 26,2316           41325                           PDDL     DMP                                   #  ROLL = ARCTAN(SZ/CZCX) INTO 2 PD
021040,000341: 26,2317           00741                                    SINCDUZ                               
021041,000342: 26,2320           00743                                    SINCDUX                               
021042,000343: 26,2321           41512                           SL2      PUSH                                  #  SXSZ INTO 4 PD
021043,000344: 26,2322           65205                           DMP      PDDL                                  #  SXSZCY INTO 4 PD
021044,000345: 26,2323           00745                                    COSCDUY                               
021045,000346: 26,2324           65205                           DMP      PDDL                                  #  SXSZSY INTO 6 PD
021046,000347: 26,2325           00737                                    SINCDUY                               
021047,000348: 26,2326           00751                                    COSCDUX                               
021048,000349: 26,2327           72405                           DMP      SL1                                   #  CXCY
021049,000350: 26,2330           00745                                    COSCDUY                               
021050,000351: 26,2331           45425                           DSU      STADR                                 #  PULL UP FROM 6 PD
021051,000352: 26,2332           63756                           STODL    COSTH                                 #  COSTH = CXCY - SXSZSY
021052,000353: 26,2333           00737                                    SINCDUY                               
021053,000354: 26,2334           72405                           DMP      SL1                                   
021054,000355: 26,2335           00751                                    COSCDUX                               #  CXSY
021055,000356: 26,2336           45415                           DAD      STADR                                 #  PULL UP FROM 4 PD
021056,000357: 26,2337           43754                           STCALL   SINTH                                 #  SINTH = CXSY + SXSZCY
021057,000358: 26,2340           26510                                    ARCTAN                                #  RETURNS WITH D(MPAC) = PITCH
021058,000359: 26,2341           55525                           PDDL     VDEF                                  #  PITCH INTO 2 PD, ROLL INTO MPAC FROM 2 PD
021059,000360: 26,2342           77634                           RTB                                            #  VDEF MAKES V(MPAC) = ROLL, PITCH, YAW
021060,000361: 26,2343           21620                                    V1STO2S                               
021061,000362: 26,2344           02345                           STORE    FDAIX                                 #  MODE IS TP
021062,000363: 26,2345           77776                           EXIT                                           
021063,000364: 
021064,000365: 26,2346           31342        ENDBALL            CA       BALLEXIT                              
021065,000366: 

Page 479

021067,000368: 26,2347           04640                           TC       BANKJUMP                              
021068,000369: 

Page 480

021070,000371:                                                                                                  #  PROGRAM DESCRIPTION - VECPOINT
021071,000372: 
021072,000373:                                                                                                  #  THIS INTERPRETIVE SUBROUTINE MAY BE USED TO POINT A SPACECRAFT AXIS IN A DESIRED DIRECTION.  THE AXIS
021073,000374:                                                                                                  #  TO BE POINTED MUST APPEAR AS A HALF UNIT DOUBLE PRECISION VECTOR IN SUCCESSIVE LOCATIONS OF ERASABLE MEMORY
021074,000375:                                                                                                  #  BEGINNING WITH THE LOCATION CALLED SCAXIS.  THE COMPONENTS OF THIS VECTOR ARE GIVEN IN SPACECRAFT COORDINATES.
021075,000376:                                                                                                  #  THE DIRECTION IN WHICH THIS AXIS IS TO BE POINTED MUST APPEAR AS A HALF UNIT DOUBLE PRECISION VECTOR IN
021076,000377:                                                                                                  #  SUCCESSIVE LOCATIONS OF ERASABLE MEMORY BEGINNING WITH THE ADDRESS CALLED POINTVSM.  THE COMPONENTS OF THIS
021077,000378:                                                                                                  #  VECTOR ARE GIVEN IN STABLE MEMBER COORDINATES.  WITH THIS INFORMATION VECPOINT COMPUTES A SET OF THREE GIMBAL
021078,000379:                                                                                                  #  ANGLES (2S COMPLEMENT) CORESPONDING TO THE CROSS-PRODUCT ROTATION BETWEEN SCAXIS AND POINTVSM AND STORES THEM
021079,000380:                                                                                                  #  IN T(MPAC) BEFORE RETURNING TO THE CALLER.
021080,000381: 
021081,000382:                                                                                                  #  THIS ROTATION, HOWEVER, MAY BRING THE S/C INTO GIMBAL LOCK.  WHEN POINTING A VECTOR IN THE Y-Z PLANE,
021082,000383:                                                                                                  #  THE TRANSPONDER AXIS, OR THE AOT FOR THE LEM, THE PROGRAM WILL CORRECT THIS PROBLEM BY ROTATING THE CROSS-
021083,000384:                                                                                                  #  PRODUCT ATTITUDE ABOUT POINTVSM BY A FIXED AMOUNT SUFFICIENT TO ROTATE THE DESIRED S/C ATTITUDE OUT OF GIMBAL
021084,000385:                                                                                                  #  LOCK.  IF THE AXIS TO BE POINTED IS MORE THAN 40.6 DEGREES BUT LESS THAN 60.5 DEG FROM THE +X (OR -X) AXIS,
021085,000386:                                                                                                  #  THE ADDITIONAL ROTATION TO AVOID GIMAL LOCK IS 35 DEGREES.  IF THE AXIS IS MORE THAN 60.5 DEGEES FROM +X (OR -X)
021086,000387:                                                                                                  #  THE ADDITIONAL ROTATION IS 35 DEGREES.  THE GIMBAL ANGLES CORRESPONDING TO THIS ATTITUDE ARE THEN COMPUTED AND
021087,000388:                                                                                                  #  STORED AS 2S COMPLIMENT ANGLES IN T(MPAC) BEFORE RETURNING TO THE CALLER.
021088,000389: 
021089,000390:                                                                                                  #  WHEN POINTING THE X-AXIS, OR THE THRUST VECTOR, OR ANY VECTOR WITHIN 40.6 DEG OF THE X-AXIS, VECPOINT
021090,000391:                                                                                                  #  CANNOT CORRECT FOR A CROSS-PRODUCT ROTATION INTO GIMBAL LOCK.  IN THIS CASE A PLATFORM REALIGNMENT WOULD BE
021091,000392:                                                                                                  #  REQUIRED TO POINT THE VECTOR IN THE DESIRED DIRECTION.  AT PRESENT NO INDICATION IS GIVEN FOR THIS SITUATION
021092,000393:                                                                                                  #  EXCEPT THAT THE FINAL MIDDLE GIMBAL ANGLE IN MPAC +2 IS GREATER THAN 59 DEGREES.
021093,000394: 
021094,000395:                                                                                                  #  CALLING SEQUENCE -
021095,000396: 
021096,000397:                                                                                                  #        1)      LOAD SCAXIS, POINTVSM
021097,000398:                                                                                                  #        2)      CALL
021098,000399:                                                                                                  #                        VECPOINT
021099,000400: 
021100,000401:                                                                                                  #  RETURNS WITH
021101,000402: 
021102,000403:                                                                                                  #        1)      DESIRED OUTER GIMBAL ANGLE IN MPAC
021103,000404:                                                                                                  #        2)      DESIRED INNER GIMBAL ANGLE IN MPAC +1
021104,000405:                                                                                                  #        3)      DESIRED MIDDLE GIMBAL ANGLE IN MPAC +2
021105,000406: 
021106,000407:                                                                                                  #  ERASABLES USED -
021107,000408: 
021108,000409:                                                                                                  #        1)      SCAXIS          6
021109,000410:                                                                                                  #        2)      POINTVSM        6
021110,000411:                                                                                                  #        3)      MIS             18
021111,000412:                                                                                                  #        4)      DEL             18
021112,000413:                                                                                                  #        5)      COF             6
021113,000414:                                                                                                  #        6)      VECQTEMP        1
021114,000415:                                                                                                  #        7)      ALL OF VAC AREA 43
021115,000416: 
021116,000417:                                                                                                  #                        TOTAL   99
021117,000418: 
021118,000419: 27,2000                                           SETLOC   VECPT                                 
021119,000420: 27,2000                                           BANK                                           

Page 481

021121,000422: 27,2032                                           COUNT*   $$/VECPT                              
021122,000423: 
021123,000424: 27,2032  E6,1676                                  EBANK=   BCDU                                  
021124,000425: 
021125,000426: 27,2032           40020        VECPNT1            STQ      BOV                                   #  THIS ENTRY USES DESIRED CDUS
021126,000427: 27,2033           03325                                    VECQTEMP                              #  NOT PRESENT - ENTER WITH CDUD'S IN MPAC
021127,000428: 27,2034           56035                                    VECPNT2                               
021128,000429: 27,2035           52164        VECPNT2            AXC,2    GOTO                                  
021129,000430: 27,2036           03246                                    MIS                                   
021130,000431: 27,2037           56046                                    STORANG                               
021131,000432: 27,2040           40020        VECPOINT           STQ      BOV                                   #  SAVE RETURN ADDRESS
021132,000433: 27,2041           03325                                    VECQTEMP                              
021133,000434: 27,2042           56043                                    VECLEAR                               #  AND CLEAR OVFIND
021134,000435: 27,2043           47164        VECLEAR            AXC,2    RTB                                   
021135,000436: 27,2044           03246                                    MIS                                   #  READ THE PRESENT CDU ANGLES AND
021136,000437: 27,2045           44403                                    READCDUK                              #  STORE THEM IN PD25, 26, 27
021137,000438: 27,2046           34032        STORANG            STCALL   25D                                   
021138,000439: 27,2047           44410                                    CDUTODCM                              #  S/C AXES TO STABLE MEMBER AXES (MIS)
021139,000440: 27,2050           61375                           VLOAD    VXM                                   
021140,000441: 27,2051           03773                                    POINTVSM                              #  RESOLVE THE POINTING DIRECTION VF INTO
021141,000442: 27,2052           03247                                    MIS                                   #  INITIAL S/C AXES (VF = POINTVSM)
021142,000443: 27,2053           77656                           UNIT                                           
021143,000444: 27,2054           00035                           STORE    28D                                   
021144,000445:                                                                                                  #  PD 28 29 30 31 32 33
021145,000446: 27,2055           53435                           VXV      UNIT                                  #  TAKE THE CROSS PRODUCT VF X VI
021146,000447: 27,2056           03765                                    SCAXIS                                #  WHERE VI = SCAXIS
021147,000448: 27,2057           57400                           BOV      VCOMP                                 
021148,000449: 27,2060           56170                                    PICKAXIS                              
021149,000450: 27,2061           17271                           STODL    COF                                   #  CHECK MAGNITUDE
021150,000451: 27,2062           00045                                    36D                                   #  OF CROSS PRODUCT
021151,000452: 27,2063           50025                           DSU      BMN                                   #  VECTOR, IF LESS
021152,000453: 27,2064           14411                                    DPB-14                                #  THAN B-14 ASSUME
021153,000454: 27,2065           56170                                    PICKAXIS                              #  UNIT OPERATION
021154,000455: 27,2066           50375                           VLOAD    DOT                                   #  INVALID.
021155,000456: 27,2067           03765                                    SCAXIS                                
021156,000457: 27,2070           00035                                    28D                                   
021157,000458: 27,2071           65552                           SL1      ARCCOS                                
021158,000459: 27,2072           77624        COMPMATX           CALL                                           #  NOW COMPUTE THE TRANSFORMATION FROM
021159,000460: 27,2073           44527                                    DELCOMP                               #  FINAL S/C AXES TO INITIAL S/C AXES MFI
021160,000461: 27,2074           75160                           AXC,1    AXC,2                                 
021161,000462: 27,2075           03246                                    MIS                                   #  COMPUTE THE TRANSFORMATION FROM FINAL
021162,000463: 27,2076           02230                                    KEL                                   #  S/C AXES TO STABLE MEMBER AXES
021163,000464: 27,2077           77624                           CALL                                           #  MFS = MIS MFI
021164,000465: 27,2100           44312                                    MXM3                                  #  (IN PD LIST)
021165,000466: 
021166,000467: 27,2101           51545                           DLOAD    ABS                                   
021167,000468: 27,2102           00007                                    6                                     #  MFS6 = SIN(CPSI)                      $2
021168,000469: 27,2103           50025                           DSU      BMN                                   
021169,000470: 27,2104           14376                                    SINGIMLC                              #  = SIN(59 DEGS)                        $2
021170,000471: 27,2105           56160                                    FINDGIMB                              #  /CPSI/ LESS THAN 59 DEGS

Page 482

021172,000473:                                                                                                  #  I.E. DESIRED ATTITUDE NOT IN GIMBAL LOCK
021173,000474: 
021174,000475: 27,2106           51545                           DLOAD    ABS                                   #  CHECK TO SEE IF WE ARE POINTING
021175,000476: 27,2107           03765                                    SCAXIS                                #  THE THRUST AXIS
021176,000477: 27,2110           51025                           DSU      BPL                                   
021177,000478: 27,2111           14400                                    SINVEC1                               #  SIN 49.4 DEGS                         $2
021178,000479: 27,2112           56160                                    FINDGIMB                              #  IF SO, WE ARE TRYING TO POINT IT INTO
021179,000480: 27,2113           77775                           VLOAD                                          #  GIMBAL LOCK, ABORT COULD GO HERE
021180,000481: 27,2114           77626                           STADR                                          
021181,000482: 27,2115           50514                           STOVL    MIS        +12D                       
021182,000483: 27,2116           77626                           STADR                                          #  STORE MFS (IN PD LIST) IN MIS
021183,000484: 27,2117           50522                           STOVL    MIS        +6                         
021184,000485: 27,2120           77626                           STADR                                          
021185,000486: 27,2121           50530                           STOVL    MIS                                   
021186,000487: 27,2122           03255                                    MIS        +6                         #  INNER GIMBAL AXIS IN FINAL S/C AXES
021187,000488: 27,2123           57444                           BPL      VCOMP                                 #  LOCATE THE IG AXIS DIRECTION CLOSEST TO
021188,000489: 27,2124           56125                                    IGSAMEX                               #  FINAL X S/C AXIS
021189,000490: 
021190,000491: 27,2125           50035        IGSAMEX            VXV      BMN                                   #  FIND THE SHORTEST WAY OF ROTATING THE 
021191,000492: 27,2126           03765                                    SCAXIS                                #  S/C OUT OF GIMBAL LOCK BY A ROTATION 
021192,000493: 27,2127           56134                                    U=SCAXIS                              #  ABOUT +- SCAXIS, I.E. IF  (IG (SGN MFS3)
021193,000494:                                                                                                  #  X SCAXIS . XF) LESS THAN 0, U = SCAXIS
021194,000495:                                                                                                  #  OTHERWISE U = -SCAXIS
021195,000496: 
021196,000497: 27,2130           57575                           VLOAD    VCOMP                                 
021197,000498: 27,2131           03765                                    SCAXIS                                
021198,000499: 27,2132           37271                           STCALL   COF                                   #  ROTATE ABOUT -SCAXIS
021199,000500: 27,2133           56137                                    CHEKAXIS                              
021200,000501: 27,2134           77775        U=SCAXIS           VLOAD                                          
021201,000502: 27,2135           03765                                    SCAXIS                                
021202,000503: 27,2136           03271                           STORE    COF                                   #  ROTATE ABOUT + SCAXIS
021203,000504: 27,2137           51545        CHEKAXIS           DLOAD    ABS                                   
021204,000505: 27,2140           03765                                    SCAXIS                                #  SEE IF WE ARE POINTING THE AOT
021205,000506: 27,2141           51025                           DSU      BPL                                   
021206,000507: 27,2142           14402                                    SINVEC2                               #  SIN 29.5 DEGS                         $2
021207,000508: 27,2143           56147                                    PICKANG1                              #  IF SO, ROTATE 50 DEGS ABOUT +- SCAXIS
021208,000509: 27,2144           52145                           DLOAD    GOTO                                  #  IF NOT, MUST BE POINTING THE TRANSPONDER
021209,000510: 27,2145           14406                                    VECANG2                               #  OR SOME VECTOR IN THE Y, OR Z PLANE
021210,000511: 27,2146           56151                                    COMPMFSN                              #  IN THIS CASE ROTATE 35 DEGS TO GET OUT
021211,000512:                                                                                                  #  OF GIMBAL LOCK (VECANG2  $360)
021212,000513: 27,2147           77745        PICKANG1           DLOAD                                          
021213,000514: 27,2150           14404                                    VECANG1                               #  = 50 DEGS                             $360
021214,000515: 27,2151           77624        COMPMFSN           CALL                                           
021215,000516: 27,2152           44527                                    DELCOMP                               #  COMPUTE THE ROTATION ABOUT SCAXIS TO
021216,000517: 27,2153           75160                           AXC,1    AXC,2                                 #  BRING MFS OUT OF GIMBAL LOCK
021217,000518: 27,2154           03246                                    MIS                                   
021218,000519: 27,2155           02230                                    KEL                                   
021219,000520: 27,2156           77624                           CALL                                           #  COMPUTE THE NEW TRANSFORMATION FROM
021220,000521: 27,2157           44312                                    MXM3                                  #  DESIRED S/C AXES TO STABLE MEMBER AXES
021221,000522:                                                                                                  #  WHICH WILL ALIGN VI WITH VF AND AVOID

Page 483

021223,000524:                                                                                                  #  GIMBAL LOCK
021224,000525: 27,2160           45160        FINDGIMB           AXC,1    CALL                                  
021225,000526: 27,2161           00000                                    0                                     #  EXTRACT THE COMMANDED CDU ANGLES FROM
021226,000527: 27,2162           44654                                    DCMTOCDU                              #  THIS MATRIX
021227,000528: 27,2163           40234                           RTB      SETPD                                 
021228,000529: 27,2164           21620                                    V1STO2S                               #  CONVERT TO 2:S COMPLEMENT
021229,000530: 27,2165           00001                                    0                                     
021230,000531: 27,2166           77650                           GOTO                                           
021231,000532: 27,2167           03325                                    VECQTEMP                              #  RETURN TO CALLER
021232,000533: 
021233,000534: 27,2170           50375        PICKAXIS           VLOAD    DOT                                   #  IF VF X VI = 0, FIND VF . VI
021234,000535: 27,2171           00035                                    28D                                   
021235,000536: 27,2172           03765                                    SCAXIS                                
021236,000537: 27,2173           72240                           BMN      TLOAD                                 
021237,000538: 27,2174           54350                                    ROT180                                
021238,000539: 27,2175           00032                                    25D                                   
021239,000540: 27,2176           77650                           GOTO                                           #  IF VF = VI, CDU DESIRED = PRESENT CDU
021240,000541: 27,2177           03325                                    VECQTEMP                              #  PRESENT CDU ANGLES
021241,000542: 
021242,000543: 35,2000                                           BANK     35                                    
021243,000544: 26,2000                                           SETLOC   MANUVER1                              
021244,000545: 26,2000                                           BANK                                           
021245,000546: 26,2350           47375        ROT180             VLOAD    VXV                                   #  IF VF, VI ANTIPARALLEL, 108 DEG ROTATION
021246,000547: 26,2351           03255                                    MIS        +6                         #  IS REQUIRED.  Y STABLE MEMBER AXIS IN
021247,000548: 26,2352           06520                                    HIDPHALF                              #  INITIAL S/C AXES.
021248,000549: 26,2353           47256                           UNIT     VXV                                   #  FIND Y(SM) X X(I)
021249,000550: 26,2354           03765                                    SCAXIS                                #  FIND UNIT(VI X UNIT(Y(SM) X X(I)))
021250,000551: 26,2355           40056                           UNIT     BOV                                   #  I.E. PICK A VECTOR IN THE PLANE OF X(I),
021251,000552: 26,2356           54372                                    PICKX                                 #  Y(SM) PERPENDICULAR TO VI
021252,000553: 26,2357           17271                           STODL    COF                                   
021253,000554: 26,2360           00045                                    36D                                   #  CHECK MAGNITUDE
021254,000555: 26,2361           50025                           DSU      BMN                                   #  OF THIS VECTOR.
021255,000556: 26,2362           14411                                    DPB-14                                #  IF LESS THAN B-14,
021256,000557: 26,2363           54372                                    PICKX                                 #  PICK X-AXIS.
021257,000558: 26,2364           77775                           VLOAD                                          
021258,000559: 26,2365           03271                                    COF                                   
021259,000560: 26,2366           17271        XROT               STODL    COF                                   
021260,000561: 26,2367           06520                                    HIDPHALF                              
021261,000562: 26,2370           77650                           GOTO                                           
021262,000563: 26,2371           56072                                    COMPMATX                              
021263,000564: 26,2372           52175        PICKX              VLOAD    GOTO                                  #  PICK THE XAXIS IN THIS CASE
021264,000565: 26,2373           06520                                    HIDPHALF                              
021265,000566: 26,2374           54366                                    XROT                                  
021266,000567: 26,2375           15555 35172  SINGIMLC           2DEC     .4285836003                            #  = SIN(59)                             $2
021267,000568: 
021268,000569: 26,2377           14113 36326  SINVEC1            2DEC     .3796356537                            #  = SIN(49.4)                           $2
021269,000570: 
021270,000571: 26,2401           07701 35703  SINVEC2            2DEC     .2462117800                            #  = SIN(29.5)                           $2
021271,000572: 
021272,000573: 26,2403           04343 21616  VECANG1            2DEC     .1388888889                            #  = 50 DEGREES                          $360

Page 484

021274,000575: 26,2405           03070 34344  VECANG2            2DEC     .09722222222                            #  = 35 DEGREES                          $360
021275,000576: 
021276,000577: 26,2407           00000        1BITDP             OCT      0                                     #  KEEP THIS BEFORE DPB(-14)        *********
021277,000578: 26,2410           00001        DPB-14             OCT      00001                                 
021278,000579: 26,2411           00000                           OCT      00000                                 
021279,000580: 

Page 485

021281,000582:                                                                                                  #  ROUTINE FOR INITIATING AUTOMATIC MANEUVER VIA KEYBOARD (V49)
021282,000583: 
021283,000584: 34,2000                                           BANK     34                                    
021284,000585: 23,2000                                           SETLOC   R62                                   
021285,000586: 23,2000                                           BANK                                           
021286,000587: 23,2103  E6,1676                                  EBANK=   BCDU                                  
021287,000588: 
021288,000589: 23,2103                                           COUNT*   $$/R62                                
021289,000590: 
021290,000591: 23,2103  23,2103               R62DISP            EQUALS   R62FLASH                              
021291,000592: 
021292,000593: 23,2103           35010        R62FLASH           CAF      V06N22                                #  FLASH V06N22 AND
021293,000594: 23,2104           04616                           TC       BANKCALL                              #  ICDU ANGLES
021294,000595: 23,2105           20476                           CADR     GOFLASH                               
021295,000596: 23,2106           15472                           TCF      ENDEXT                                #  TERMINATE
021296,000597: 23,2107           12111                           TCF      GOMOVE                                #  PROCEED
021297,000598: 23,2110           12103                           TCF      R62FLASH                              #  ENTER
021298,000599: 
021299,000600:                                                                                                  #  ASTRONAUT MAY LOAD NEW ICDUS AT THIS
021300,000601:                                                                                                  #  POINT
021301,000602: 23,2111           05504        GOMOVE             TC       UPFLAG                                #  SET FOR 3-AXIS MANEUVER
021302,000603: 23,2112           00124                           ADRES    3AXISFLG                              
021303,000604: 
021304,000605: 23,2113           04616                           TC       BANKCALL                              
021305,000606: 23,2114           54123                           CADR     R60LEM                                
021306,000607: 23,2115           15472                           TCF      ENDEXT                                #  END R62
021307,000608: 

End of include-file R60,R62.agc.  Parent file is MAIN.agc