Source Code

This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the second release of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 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.

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

Page 472

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

Page 473

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

Page 474

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

Page 475

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

Page 476

020947,000253: 26,2262           00006        ISITAUTO           EXTEND                                         #  CHECK FOR AUTO MODE
020948,000254: 26,2263           00031                           READ     CHAN31                                
020949,000255: 26,2264           74736                           MASK     BIT14                                 
020950,000256: 26,2265           00002                           TC       Q                                     #  (+) = NOT IN AUTO, (+0) = AOK
020951,000257: 

Page 477

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

Page 478

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

Page 479

021062,000368: 26,2347           04640                           TC       BANKJUMP                              
021063,000369: 

Page 480

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

Page 481

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

Page 482

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

Page 483

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

Page 484

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

Page 485

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

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