Source Code

These source-code files derive from a printout of Luminary 210 (Apollo 15-17 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Jim Lawton, and transcribed to source code by a team of volunteers. This colorized, syntax-highlighted form was created by assembling that transcribed source code. Note that the full page images are available on the Virtual AGC project page at archive.org, while reduced-size images are presented at the VirtualAGC project website. Report or fix any transcription errors at the Virtual AGC project code repository.

Notations on the program listing read, in part:

	GAP: ASSEMBLE REVISION 210 OF AGC PROGRAM LUMINARY 
	BY NASA 2021112-161 17:11 MAR. 19,1971
Note that the date is the date of the printout, not the date of the program revision.

021523,000002:                                                                                                  ## Copyright:   Public domain.
021524,000003:                                                                                                  ## Filename:    R60,R62.agc
021525,000004:                                                                                                  ## Purpose:     A section of Luminary revision 210.
021526,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
021527,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 15-17.
021528,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
021529,000008:                                                                                                  ##              that the code format has been changed to conform to the
021530,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
021531,000010:                                                                                                  ##              original YUL assembler.
021532,000011:                                                                                                  ## Reference:   pp. 487-500
021533,000012:                                                                                                  ## Assembler:   yaYUL
021534,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
021535,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
021536,000015:                                                                                                  ## Mod history: 2016-11-17 JL   Created from Luminary131 version.
021537,000016:                                                                                                  ##              2016-11-27 HG   Transcribed
021538,000017:                                                                                                  ##              2016-12-07 HG   Fix P00 -> POO
021539,000018:                                                                                                  ##                              Change POO -> P00 in some comments
021540,000019:                                                                                                  ##              2016-12-23 RSB  Proofed comment text with octopus/ProoferComments
021541,000020:                                                                                                  ##                              and fixed all errors found.
021542,000021:                                                                                                  ##              2017-03-09 RSB  Comment text fixes noted in proofing Luminary 116.
021543,000022:                                                                                                  ##              2017-03-16 RSB  Comment-text fixes identified in 5-way
021544,000023:                                                                                                  ##                              side-by-side diff of Luminary 69/99/116/131/210.
021545,000024: 

Page 487

021547,000026:                                                                                                  #  MOD NO: 0                             DATE: 1 MAY 1968
021548,000027:                                                                                                  #  MOD BY: DIGITAL DEVEL GROUP           LOG SECTION R60,R62
021549,000028: 
021550,000029:                                                                                                  #  FUNCTIONAL DESCRIPTION:
021551,000030: 
021552,000031:                                                                                                  #  CALLED AS A GENERAL SUBROUTINE TO MANEUVER THE LM TO A SPECIFIED
021553,000032:                                                                                                  #  ATTITUDE.
021554,000033: 
021555,000034:                                                                                                  #  1. IF THE 3-AXIS FLAG IS NOT SET THE FINAL CDU ANGLES ARE
021556,000035:                                                                                                  #  CALCULATED (VECPOINT).
021557,000036: 
021558,000037:                                                                                                  #  2. THE FDAI BALL ANGLES (NOUN 18) ARE CALCULATED (BALLANGS).
021559,000038: 
021560,000039:                                                                                                  #  3. REQUEST FLASHING DISPLAY V50 N18 PLEASE PERFORM AUTO MANEUVER.
021561,000040: 
021562,000041:                                                                                                  #  4. IF PRIORITY DISPLAY FLAG IS SET DO A PHASECHANGE. THEN AWAIT
021563,000042:                                                                                                  #  ASTRONAUT RESPONSE.
021564,000043: 
021565,000044:                                                                                                  #  5. DISPLAY RESPONSE RETURNS:
021566,000045: 
021567,000046:                                                                                                  #      A. ENTER - RESET 3-AXIS FLAG AND RETURN TO CLIENT.
021568,000047: 
021569,000048:                                                                                                  #      B. TERMINATE - IF IN P00 GO TO STEP 5A. OTHERWISE CHECK IF R61 IS
021570,000049:                                                                                                  #         THE CALLING PROGRAM. IF IN R61 AN EXIT IS MADE TO GOTOV56. IF
021571,000050:                                                                                                  #         NOT IN R61 AN EXIT IS DONE VIA GOTOP00H.
021572,000051: 
021573,000052:                                                                                                  #      C. PROCEED - CONTINUE WITH PROGRAM AT STEP 6.
021574,000053: 
021575,000054:                                                                                                  #  6. IF THE 3-AXISFLAG IS NOT SET, THE FINAL CDU ANGLES ARE CALCULATED
021576,000055:                                                                                                  #     (VECPOINT).
021577,000056: 
021578,000057:                                                                                                  #  7. THE FDAI BALL ANGLES (NOUN 18) ARE CALCULATED (BALLANGS).
021579,000058: 
021580,000059:                                                                                                  #  8. IF THE G+N SWITCH IS NOT SET GO BACK TO STEP 3.
021581,000060: 
021582,000061:                                                                                                  #  9. IF THE AUTO SWITCH IS NOT SET GO BACK TO STEP 3.
021583,000062: 
021584,000063:                                                                                                  #  10. NONFLASHING DISPLAY V06N18 (FDAI ANGLES).
021585,000064: 
021586,000065:                                                                                                  #  11. DO A PHASECHANGE.
021587,000066: 
021588,000067:                                                                                                  #  12. DO A MANEUVER CALCULATION AND ICDU DRIVE ROUTINE TO ACHIEVE FINAL
021589,000068: 
021590,000069:                                                                                                  #      GIMBAL ANGLES (GOMANUR).
021591,000070:                                                                                                  #  13. AT END OF MANEUVER GO TO STEP 3.
021592,000071: 
021593,000072:                                                                                                  #           IF SATISFACTORY MANEUVER STEP 5A EXITS R60.
021594,000073:                                                                                                  #           FOR FURTHER ADJUSTMENT OF THE VEHICLE ATTITUDE ABOUT THE
021595,000074:                                                                                                  #           DESIRED VECTOR, THE ROUTINE MAY BE PERFORMED AGAIN STARTING AT
021596,000075: 

Page 488

021598,000077:                                                                                                  #           STEP 5C.
021599,000078: 
021600,000079:                                                                                                  #  CALLING SEQUENCE:  TC BANKCALL
021601,000080:                                                                                                  #                     CADR R60LEM
021602,000081: 
021603,000082:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED : SCAXIS, POINTVSM (FOR VECPOINT)
021604,000083:                                                                                                  #                                     3AXISFLG.
021605,000084: 
021606,000085:                                                                                                  #  SUBROUTINES CALLED: VECPOINT, BALLANGS, GOPERF2R, LINUS, GODSPER,
021607,000086:                                                                                                  #                     GOMANUR, DOWNFLAG, PHASCHNG, UPFLAG
021608,000087: 
021609,000088:                                                                                                  #  NORMAL EXIT MODES: CAE TEMPR60   (CALLERS RETURN ADDRESS)
021610,000089:                                                                                                  #                     TC  BANKJUMP
021611,000090: 
021612,000091:                                                                                                  #  ALARMS: NONE
021613,000092: 
021614,000093:                                                                                                  #  OUTPUT: NONE
021615,000094: 
021616,000095:                                                                                                  #  DEBRIS: CPHI, CTHETA, CPSI, 3AXISFLG, TBASE2
021617,000096: 
021618,000097: 
021619,000098: 34,2000                                           BANK     34                                    
021620,000099: 26,2000                                           SETLOC   MANUVER                               
021621,000100: 26,2000                                           BANK                                           
021622,000101: 
021623,000102: 26,2125     1163                                  EBANK=   TEMPR60                               
021624,000103: 
021625,000104: 26,2125                                           COUNT*   $$/R06                                
021626,000105: 26,2125           04636        R60LEM             TC       MAKECADR                              
021627,000106: 26,2126           55163                           TS       TEMPR60                               
021628,000107: 
021629,000108: 26,2127           34737        REDOMANN           CAF      3AXISBIT                              
021630,000109: 26,2130           70101                           MASK     FLAGWRD5                              #  IS 3-AXIS FLAG SET
021631,000110: 26,2131           10000                           CCS      A                                     
021632,000111: 26,2132           12140                           TCF      TOBALL                                #  YES
021633,000112: 26,2133           06060                           TC       INTPRET                               
021634,000113: 26,2134           77624                           CALL                                           
021635,000114: 26,2135           56040                                    VECPOINT                              #  TO COMPUTE FINAL ANGLES
021636,000115: 26,2136           00322                           STORE    CPHI                                  #  STORE FINAL ANGLES - CPHI,CTHETA,CPSI
021637,000116: 26,2137           77776                           EXIT                                           
021638,000117: 
021639,000118: 26,2140           05506        TOBALL             TC       UPFLAG                                #  INSURE THAT TOTAL ATTITUDE ERRORS ARE
021640,000119: 26,2141           00013                           ADRES    NEEDLFLG                              #  DISPLAYED ON FDAI ERROR NEEDLES
021641,000120: 26,2142           05520                           TC       DOWNFLAG                              
021642,000121: 26,2143           00000                           ADRES    NEED2FLG                              
021643,000122: 26,2144           04607                           TC       BANKCALL                              
021644,000123: 26,2145           54300                           CADR     BALLANGS                              #  TO CONVERT ANGLES TO FDAI
021645,000124: 26,2146           32266        TOBALLA            CAF      V06N18                                
021646,000125: 26,2147           04607                           TC       BANKCALL                              
021647,000126: 

Page 489

021649,000128: 26,2150           20722                           CADR     GOPERF2R                              #  DISPLAY PLEASE PERFORM AUTO MANEUVER
021650,000129: 26,2151           02254                           TC       R61TEST                               
021651,000130: 26,2152           02162                           TC       REDOMANC                              #  PROCEED
021652,000131: 26,2153           02207                           TC       ENDMANU1                              #  ENTER I.E. FINISHED WITH R60
021653,000132: 26,2154           02214                           TC       CHKLINUS                              #  TO CHECK FOR PRIORITY DISPLAYS
021654,000133: 26,2155           05146                           TC       ENDOFJOB                              
021655,000134: 
021656,000135: 26,2156           46266                           CS       THREE                                 #  SET UP RESTART POINT AT BEGINNING OF
021657,000136: 26,2157           60133                           AD       BUF2                                  #    DISPLAY IF PRIORITY DISP FLAG SET
021658,000137: 26,2160           02221                           TC       CHKLINS1                              
021659,000138: 26,2161           05146                           TC       ENDOFJOB                              
021660,000139: 
021661,000140: 26,2162           34737        REDOMANC           CAF      3AXISBIT                              
021662,000141: 26,2163           70101                           MASK     FLAGWRD5                              #  IS 3-AXIS FLAG SET
021663,000142: 26,2164           10000                           CCS      A                                     
021664,000143: 26,2165           12173                           TCF      TOBALLC                               #  YES
021665,000144: 26,2166           06060                           TC       INTPRET                               
021666,000145: 26,2167           77624                           CALL                                           
021667,000146: 26,2170           56040                                    VECPOINT                              #  TO COMPUTE FINAL ANGLES
021668,000147: 26,2171           00322                           STORE    CPHI                                  #  STORE ANGLES
021669,000148: 26,2172           77776                           EXIT                                           
021670,000149: 
021671,000150: 26,2173           04607        TOBALLC            TC       BANKCALL                              
021672,000151: 26,2174           54300                           CADR     BALLANGS                              #  TO CONVERT ANGLES TO FDAI
021673,000152: 26,2175           02267                           TC       G+N,AUTO                              #  CHECK AUTO MODE
021674,000153: 26,2176           10000                           CCS      A                                     
021675,000154: 26,2177           12146                           TCF      TOBALLA                               #  NOT AUTO, GO REREQUEST AUTO MANEUVER.
021676,000155: 
021677,000156: 26,2200           02214        AUTOMANV           TC       CHKLINUS                              
021678,000157: 26,2201           12204                           TCF      STARTMNV                              
021679,000158: 26,2202           32213                           CAF      STARTMNAD                             #  RESTART AT STARTMNV IF PRIORITY
021680,000159: 26,2203           55054                           TS       TBASE2                                #     DISPLAY FLAG SET
021681,000160: 
021682,000161: 26,2204           04607        STARTMNV           TC       BANKCALL                              #  PERFORM MANEUVER VIA KALCMANU
021683,000162: 26,2205           42764                           CADR     GOMANUR                               
021684,000163: 
021685,000164: 26,2206           12146        ENDMANUV           TCF      TOBALLA                               #  FINISHED MANEUVER.
021686,000165: 26,2207           05520        ENDMANU1           TC       DOWNFLAG                              #  RESET 3-AXIS FLAG
021687,000166: 26,2210           00124                           ADRES    3AXISFLG                              
021688,000167: 26,2211           31163                           CAE      TEMPR60                               #                                        -
021689,000168: 26,2212           04631                           TC       BANKJUMP                              #                                        -
021690,000169: 
021691,000170: 26,2213           02204        STARTMNAD           ADRES    STARTMNV                              
021692,000171: 
021693,000172: 26,2214           40101        CHKLINUS           CS       FLAGWRD5                              
021694,000173: 26,2215           74727                           MASK     PDSPFBIT                              #  IS PRIORITY DISPLAY FLAG SET?
021695,000174: 26,2216           10000                           CCS      A                                     #                                        -
021696,000175: 26,2217           00002                           TC       Q                                     #  NO - EXIT
021697,000176: 26,2220           16760                           TCF      Q+1                                   #  GO BACK AND SET UP CORRECT RESTART ADDR.
021698,000177: 

Page 490

021700,000179: 26,2221           55054        CHKLINS1           TS       TBASE2                                
021701,000180: 26,2222           30002                           CA       Q                                     
021702,000181: 26,2223           54156                           TS       MPAC       +2                         
021703,000182: 
021704,000183: 26,2224           05355                           TC       PHASCHNG                              
021705,000184: 26,2225           00132                           OCT      00132                                 
021706,000185: 
021707,000186: 26,2226           34736                           CAF      BIT7                                  
021708,000187: 26,2227           05466                           TC       LINUS                                 #  GO SET BITS FOR PRIORITY DISPLAY    -
021709,000188: 26,2230           00156                           TC       MPAC       +2                         
021710,000189: 
021711,000190: 26,2231           37735        RELINUS            CAF      PRIO26                                #  RESTORE ORIGINAL PRIORITY
021712,000191: 26,2232           05137                           TC       PRIOCHNG                              
021713,000192: 
021714,000193: 26,2233           34740                           CAF      TRACKBIT                              #  DON'T CONTINUE R60 UNLESS TRACKFLAG ON.
021715,000194: 26,2234           70075                           MASK     FLAGWRD1                              
021716,000195: 26,2235           10000                           CCS      A                                     
021717,000196: 26,2236           12251                           TCF      RER60                                 
021718,000197: 
021719,000198: 26,2237           34736                           CAF      RNDVZBIT                              #  IS IT P20?
021720,000199: 26,2240           70074                           MASK     FLAGWRD0                              
021721,000200: 26,2241           10000                           CCS      A                                     
021722,000201: 26,2242           02246                           TC       +4                                    #  YES
021723,000202: 26,2243           05355                           TC       PHASCHNG                              #  NO, MUST BE P25, SET 2.11 SPOT
021724,000203: 26,2244           40112                           OCT      40112                                 
021725,000204: 
021726,000205: 26,2245           05146                           TC       ENDOFJOB                              
021727,000206: 
021728,000207: 26,2246           05355                           TC       PHASCHNG                              #  SET 2.7 SPOT FOR P20
021729,000208: 26,2247           40072                           OCT      40072                                 
021730,000209: 
021731,000210: 26,2250           05146                           TC       ENDOFJOB                              
021732,000211: 
021733,000212: 26,2251           05506        RER60              TC       UPFLAG                                #  SET PRIO DISPLAY FLAG AFTER RESTART
021734,000213: 26,2252           00114                           ADRES    PDSPFLAG                              
021735,000214: 
021736,000215: 26,2253           01054                           TC       TBASE2                                
021737,000216: 
021738,000217: 26,2254           31010        R61TEST            CA       MODREG                                #  IF WE ARE IN P00 IT MUST BE V49 OR V89
021739,000218: 26,2255           00006                           EXTEND                                         
021740,000219: 26,2256           12207                           BZF      ENDMANU1                              #  THUS WE GO TO ENDEXT VIA USER
021741,000220: 
021742,000221: 26,2257           30101                           CA       FLAGWRD5                              
021743,000222: 26,2260           74727                           MASK     PDSPFBIT                              
021744,000223: 26,2261           00006                           EXTEND                                         
021745,000224: 26,2262           16001                           BZF      GOTOPOOH                              #  NO
021746,000225: 26,2263           06043                           TC       GOTOV56                               #  YES
021747,000226: 
021748,000227: 26,2264           20100        BIT14+7            OCT      20100                                 #                                        -
021749,000228: 26,2265           00203        OCT203             OCT      203                                   
021750,000229: 

Page 491

021752,000231: 26,2266           01422        V06N18             VN       0618                                  
021753,000232:                                                                                                  #           SUBROUTINE TO CHECK FOR G+N CONTROL, AUTO STABILIZATION
021754,000233: 
021755,000234:                                                                                                  #           RETURNS WITH C(A) = +  IF NOT SET FOR G+N, AUTO
021756,000235:                                                                                                  #           RETURNS WITH C(A) = +0 IF SWITCHES ARE SET
021757,000236: 
021758,000237: 26,2267           00006        G+N,AUTO           EXTEND                                         
021759,000238: 26,2270           00030                           READ     CHAN30                                
021760,000239: 26,2271           74733                           MASK     BIT10                                 
021761,000240: 26,2272           10000                           CCS      A                                     
021762,000241: 26,2273           00002                           TC       Q                                     #  NOT IN G+N  C(A) = +
021763,000242: 26,2274           00006        ISITAUTO           EXTEND                                         #  CHECK FOR AUTO MODE
021764,000243: 26,2275           00031                           READ     CHAN31                                
021765,000244: 26,2276           74727                           MASK     BIT14                                 
021766,000245: 26,2277           00002                           TC       Q                                     #  (+) = NOT IN AUTO, (+0) = AOK
021767,000246: 

Page 492

021769,000248:                                                                                                  #  PROGRAM DESCRIPTION BALLANGS
021770,000249:                                                                                                  #  MOD NO.         LOG SECTION R60,R62
021771,000250: 
021772,000251:                                                                                                  #  WRITTEN BY RAMA M.AIYAWAR
021773,000252:                                                                                                  #  FUNCTIONAL DESCRIPTION
021774,000253: 
021775,000254:                                                                                                  #  COMPUTES LM FDAI BALL DISPLAY ANGLES
021776,000255:                                                                                                  #  CALLING SEQUENCE
021777,000256: 
021778,000257:                                                                                                  #           TC      BALLANGS
021779,000258:                                                                                                  #  NORMAL EXIT MODE
021780,000259: 
021781,000260:                                                                                                  #           TC      BALLEXIT        (SAVED Q)
021782,000261: 
021783,000262:                                                                                                  #  ALARM OR EXIT MODE   NIL
021784,000263:                                                                                                  #  SUBROUTINES CALLED
021785,000264:                                                                                                  #           CD*TR*G
021786,000265:                                                                                                  #           ARCTAN
021787,000266: 
021788,000267:                                                                                                  #  INPUT
021789,000268: 
021790,000269:                                                                                                  #  CPHI,CTHETA,CPSI  ARE  THE ANGLES CORRESPONDING TO AOG,AIG,AMG.  THEY ARE
021791,000270:                                                                                                  #  SP,2S COMPLIMENT SCALED TO HALF REVOLUTION.
021792,000271:                                                                                                  #  OUTPUT
021793,000272: 
021794,000273:                                                                                                  #  FDAIX,FDAIY,FDAIZ ARE THE REQUIRED BALL ANGLES SCALED TO HALF REVOLUTION
021795,000274:                                                                                                  #  SP,2S COMPLIMENT.
021796,000275:                                                                                                  #  THESE ANGLES WILL BE DISPLAYED AS DEGREES AND HUNDREDTHS, IN THE ORDER ROLL, PITCH, YAW, USING NOUNS 18 & 19.
021797,000276: 
021798,000277:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
021799,000278: 
021800,000279:                                                                                                  #  CPHI,CTHETA,CPSI EACH A SP REGISTER
021801,000280:                                                                                                  #  DEBRIS
021802,000281: 
021803,000282:                                                                                                  #  A,L,Q,MPAC,SINCDU,COSCDU,PUSHLIST,BALLEXIT
021804,000283: 
021805,000284: 
021806,000285:                                                                                                  #  NOMENCLATURE:  CPHI, CTHETA, & CPSI REPRESENT THE OUTER, INNER, & MIDDLE GIMBAL ANGLES, RESPECTIVELY; OR
021807,000286:                                                                                                  #  EQUIVALENTLY, CDUX, CDUY, & CDUZ.
021808,000287: 
021809,000288:                                                                                                  #  NOTE:  ARCTAN CHECKS FOR OVERFLOW AND SHOULD BE ABLE TO HANDLE ANY SINGULARITIES.
021810,000289: 
021811,000290: 26,2000                                           SETLOC   BAWLANGS                              
021812,000291: 26,2000                                           BANK                                           
021813,000292: 
021814,000293: 26,2300                                           COUNT*   $$/BALL                               
021815,000294: 26,2300           04636        BALLANGS           TC       MAKECADR                              
021816,000295: 26,2301           55337                           TS       BALLEXIT                              
021817,000296: 26,2302           30321                           CA       CPHI                                  
021818,000297: 

Page 493

021820,000299: 26,2303           54771                           TS       CDUSPOT    +4                         
021821,000300: 26,2304           30322                           CA       CTHETA                                
021822,000301: 26,2305           54765                           TS       CDUSPOT                               
021823,000302: 26,2306           30323                           CA       CPSI                                  
021824,000303: 26,2307           54767                           TS       CDUSPOT    +2                         
021825,000304: 
021826,000305: 26,2310           06060                           TC       INTPRET                               
021827,000306: 26,2311           45001                           SETPD    CALL                                  
021828,000307: 26,2312           00001                                    0D                                    
021829,000308: 26,2313           47526                                    CD*TR*G                               
021830,000309: 
021831,000310: 26,2314           41345                           DLOAD    DMP                                   
021832,000311: 26,2315           00742                                    SINCDUX                               #  SIN (OGA)
021833,000312: 26,2316           00746                                    COSCDUZ                               #  COS (MGA)
021834,000313: 
021835,000314: 26,2317           57552                           SL1      DCOMP                                 #  SCALE
021836,000315: 26,2320           65336                           ARCSIN   PDDL                                  #  YAW = ARCSIN(-SXCZ) INTO 0 PD
021837,000316: 26,2321           00740                                    SINCDUZ                               
021838,000317: 26,2322           14023                           STODL    SINTH                                 #  (SINTH = 18D IN PD)
021839,000318: 26,2323           00746                                    COSCDUZ                               
021840,000319: 26,2324           72405                           DMP      SL1                                   #  RESCALE
021841,000320: 26,2325           00750                                    COSCDUX                               
021842,000321: 26,2326           34021                           STCALL   COSTH                                 #  (COSTH = 16D IN PD)
021843,000322: 26,2327           26545                                    ARCTAN                                
021844,000323: 26,2330           41325                           PDDL     DMP                                   #  ROLL = ARCTAN(SZ/CZCX) INTO 2 PD
021845,000324: 26,2331           00740                                    SINCDUZ                               
021846,000325: 26,2332           00742                                    SINCDUX                               
021847,000326: 26,2333           41512                           SL2      PUSH                                  #  SXSZ INTO 4 PD
021848,000327: 26,2334           65205                           DMP      PDDL                                  #  SXSZCY INTO 4 PD
021849,000328: 26,2335           00744                                    COSCDUY                               
021850,000329: 26,2336           65205                           DMP      PDDL                                  #  SXSZSY INTO 6 PD
021851,000330: 26,2337           00736                                    SINCDUY                               
021852,000331: 26,2340           00750                                    COSCDUX                               
021853,000332: 26,2341           72405                           DMP      SL1                                   #  CXCY
021854,000333: 26,2342           00744                                    COSCDUY                               
021855,000334: 26,2343           45425                           DSU      STADR                                 #  PULL UP FROM 6 PD
021856,000335: 26,2344           63756                           STODL    COSTH                                 #  COSTH = CXCY - SXSZSY
021857,000336: 26,2345           00736                                    SINCDUY                               
021858,000337: 26,2346           72405                           DMP      SL1                                   
021859,000338: 26,2347           00750                                    COSCDUX                               #  CXSY
021860,000339: 26,2350           45415                           DAD      STADR                                 #  PULL UP FROM 4 PD
021861,000340: 26,2351           43754                           STCALL   SINTH                                 #  SINTH = CXSY + SXSZCY
021862,000341: 26,2352           26545                                    ARCTAN                                #  RETURNS WITH D(MPAC) = PITCH
021863,000342: 26,2353           55525                           PDDL     VDEF                                  #  PITCH INTO 2 PD, ROLL INTO MPAC FROM 2PD
021864,000343: 26,2354           77634                           RTB                                            #  VDEF MAKES V(MPAC) = ROLL, PITCH, YAW
021865,000344: 26,2355           21630                                    V1STO2S                               
021866,000345: 26,2356           02336                           STORE    FDAIX                                 #  MODE IS TP
021867,000346: 26,2357           77776                           EXIT                                           
021868,000347: 
021869,000348: 26,2360           31337        ENDBALL            CA       BALLEXIT                              
021870,000349: 

Page 494

021872,000351: 26,2361           04631                           TC       BANKJUMP                              
021873,000352: 

Page 495

021875,000354:                                                                                                  #  PROGRAM DESCRIPTION - VECPOINT
021876,000355: 
021877,000356: 
021878,000357:                                                                                                  #           THIS INTERPRETIVE SUBROUTINE MAY BE USED TO POINT A SPACECRAFT AXIS IN A DESIRED DIRECTION.  THE AXIS
021879,000358:                                                                                                  #  TO BE POINTED MUST APPEAR AS A HALF UNIT DOUBLE PRECISION VECTOR IN SUCCESSIVE LOCATIONS OF ERASABLE MEMORY
021880,000359:                                                                                                  #  BEGINNING WITH THE LOCATION CALLED SCAXIS.  THE COMPONENTS OF THIS VECTOR ARE GIVEN IN SPACECRAFT COORDINATES.
021881,000360:                                                                                                  #  THE DIRECTION IN WHICH THIS AXIS IS TO BE POINTED MUST APPEAR AS A HALF UNIT DOUBLE PRECISION VECTOR IN
021882,000361:                                                                                                  #  SUCCESSIVE LOCATIONS OF ERASABLE MEMORY BEGINNING WITH THE ADDRESS CALLED POINTVSM.  THE COMPONENTS OF THIS
021883,000362:                                                                                                  #  VECTOR ARE GIVEN IN STABLE MEMBER COORDINATES.  WITH THIS INFORMATION VECPOINT COMPUTES A SET OF THREE GIMBAL
021884,000363:                                                                                                  #  ANGLES (2S COMPLEMENT) CORESPONDING TO THE CROSS-PRODUCT ROTATION BETWE EN SCAXIS AND POINTVSM AND STORES THEM
021885,000364:                                                                                                  #  IN T(MPAC) BEFORE RETURNING TO THE CALLER.
021886,000365:                                                                                                  #           THIS ROTATION, HOWEVER, MAY BRING THE S/C INTO GIMBAL LOCK.  WHEN POINTING A VECTOR IN THE Y-Z PLANE,
021887,000366:                                                                                                  #  THE TRANSPONDER AXIS, OR THE AOT FOR THE LEM, THE PROGRAM WILL CORRECT THIS PROBLEM BY ROTATING THE CROSS-
021888,000367:                                                                                                  #  PRODUCT ATTITUDE ABOUT POINTVSM BY A FIXED AMOUNT SUFFICIENT TO ROTATE THE DESIRED S/C ATTITUDE OUT OF GIMBAL
021889,000368:                                                                                                  #  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,
021890,000369:                                                                                                  #  THE ADDITIONAL ROTATION TO AVOID GIMAL LOCK IS 35 DEGREES.  IF THE AXIS IS MORE THAN 60.5 DEGEES FROM +X (OR -X)
021891,000370:                                                                                                  #  THE ADDITIONAL ROTATION IS 35 DEGREES.  THE GIMBAL ANGLES CORRESPONDING TO THIS ATTITUDE ARE THEN COMPUTED AND
021892,000371:                                                                                                  #  STORED AS 2S COMPLIMENT ANGLES IN T(MPAC) BEFORE RETURNING TO THE CALLER.
021893,000372:                                                                                                  #           WHEN POINTING THE X-AXIS, OR THE THRUST VECTOR, OR ANY VECTOR WITHIN 40.6 DEG OF THE X-AXIS, VECPOINT
021894,000373:                                                                                                  #  CANNOT CORRECT FOR A CROSS-PRODUCT ROTATION INTO GIMBAL LOCK.  IN THIS CASE A PLATFORM REALIGNMENT WOULD BE
021895,000374:                                                                                                  #  REQUIRED TO POINT THE VECTOR IN THE DESIRED DIRECTION.  AT PRESENT NO INDICATION IS GIVEN FOR THIS SITUATION
021896,000375:                                                                                                  #  EXCEPT THAT THE FINAL MIDDLE GIMBAL ANGLE IN MPAC +2 IS GREATER THAN 59 DEGREES.
021897,000376: 
021898,000377:                                                                                                  #           CALLING SEQUENCE -
021899,000378:                                                                                                  #               1) LOAD SCAXIS, POINTVSM
021900,000379:                                                                                                  #               2) CALL
021901,000380:                                                                                                  #                        VECPOINT
021902,000381: 
021903,000382:                                                                                                  #           RETURNS WITH
021904,000383: 
021905,000384:                                                                                                  #               1) DESIRED OUTER  GIMBAL ANGLE IN MPAC
021906,000385:                                                                                                  #               2) DESIRED INNER  GIMBAL ANGLE IN MPAC +1
021907,000386:                                                                                                  #               3) DESIRED MIDDLE GIMBAL ANGLE IN MPAC +2
021908,000387: 
021909,000388: 
021910,000389:                                                                                                  #           ERASABLES USED -
021911,000390: 
021912,000391:                                                                                                  #               1) SCAXIS           6
021913,000392:                                                                                                  #               2) POINTVSM         6
021914,000393:                                                                                                  #               3) MIS             18
021915,000394:                                                                                                  #               4) DEL             18
021916,000395:                                                                                                  #               5) COF              6
021917,000396:                                                                                                  #               6) VECQTEMP         1
021918,000397:                                                                                                  #               7) ALL OF VAC AREA 43
021919,000398: 
021920,000399:                                                                                                  #                        TOTAL     99
021921,000400: 
021922,000401: 27,2000                                           SETLOC   VECPT                                 
021923,000402: 27,2000                                           BANK                                           
021924,000403: 

Page 496

021926,000405: 27,2032                                           COUNT*   $$/VECPT                              
021927,000406: 
021928,000407: 27,2032  E6,1675                                  EBANK=   BCDU                                  
021929,000408: 
021930,000409: 27,2032           40020        VECPNT1            STQ      BOV                                   #  THIS ENTRY USES DESIRED CDUS
021931,000410: 27,2033           03324                                    VECQTEMP                              #  NOT PRESENT-ENTER WITH CDUD'S IN MPAC
021932,000411: 27,2034           56035                                    VECPNT2                               
021933,000412: 27,2035           52164        VECPNT2            AXC,2    GOTO                                  
021934,000413: 27,2036           03245                                    MIS                                   
021935,000414: 27,2037           56046                                    STORANG                               
021936,000415: 27,2040           40020        VECPOINT           STQ      BOV                                   #  SAVE RETURN ADDRESS
021937,000416: 27,2041           03324                                    VECQTEMP                              
021938,000417: 27,2042           56043                                    VECLEAR                               #  AND CLEAR OVFIND
021939,000418: 27,2043           47164        VECLEAR            AXC,2    RTB                                   
021940,000419: 27,2044           03245                                    MIS                                   #  READ THE PRESENT CDU ANGLES AND
021941,000420: 27,2045           44403                                    READCDUK                              #  STORE THEM IN PD25, 26, 27
021942,000421: 27,2046           34032        STORANG            STCALL   25D                                   
021943,000422: 27,2047           44410                                    CDUTODCM                              #  S/C AXES TO STABLE MEMBER AXES (MIS)
021944,000423: 27,2050           61375                           VLOAD    VXM                                   
021945,000424: 27,2051           03773                                    POINTVSM                              #  RESOLVE THE POINTING DIRECTION VF INTO
021946,000425: 27,2052           03246                                    MIS                                   #  INITIAL S/C AXES (VF = POINTVSM)
021947,000426: 27,2053           77656                           UNIT                                           
021948,000427: 27,2054           00035                           STORE    28D                                   
021949,000428:                                                                                                  #  PD 28 29 30 31 32 33
021950,000429: 27,2055           53435                           VXV      UNIT                                  #  TAKE THE CROSS PRODUCT VF X VI
021951,000430: 27,2056           03765                                    SCAXIS                                #  WHERE VI = SCAXIS
021952,000431: 27,2057           57400                           BOV      VCOMP                                 
021953,000432: 27,2060           56170                                    PICKAXIS                              
021954,000433: 27,2061           17270                           STODL    COF                                   #  CHECK MAGNITUDE
021955,000434: 27,2062           00045                                    36D                                   #  OF CROSS PRODUCT
021956,000435: 27,2063           50025                           DSU      BMN                                   #  VECTOR, IF LESS
021957,000436: 27,2064           14423                                    DPB-14                                #  THAN B-14 ASSUME
021958,000437: 27,2065           56170                                    PICKAXIS                              #  UNIT OPERATION
021959,000438: 27,2066           50375                           VLOAD    DOT                                   #           INVALID.
021960,000439: 27,2067           03765                                    SCAXIS                                
021961,000440: 27,2070           00035                                    28D                                   
021962,000441: 27,2071           65552                           SL1      ARCCOS                                
021963,000442: 27,2072           77624        COMPMATX           CALL                                           #  NOW COMPUTE THE TRANSFORMATION FROM
021964,000443: 27,2073           44527                                    DELCOMP                               #  FINAL S/C AXES TO INITIAL S/C AXES MFI
021965,000444: 27,2074           75160                           AXC,1    AXC,2                                 
021966,000445: 27,2075           03245                                    MIS                                   #  COMPUTE THE TRANSFORMATION FROM FINAL
021967,000446: 27,2076           02221                                    KEL                                   #  S/C AXES TO STABLE MEMBER AXES
021968,000447: 27,2077           77624                           CALL                                           #  MFS = MIS MFI
021969,000448: 27,2100           44312                                    MXM3                                  #  (IN PD LIST)
021970,000449: 
021971,000450: 27,2101           51545                           DLOAD    ABS                                   
021972,000451: 27,2102           00007                                    6                                     #  MFS6 = SIN(CPSI)                    $2
021973,000452: 27,2103           50025                           DSU      BMN                                   
021974,000453: 27,2104           14410                                    SINGIMLC                              #  = SIN(59 DEGS)                      $2
021975,000454: 27,2105           56160                                    FINDGIMB                              #  /CPSI/ LESS THAN 59 DEGS
021976,000455: 

Page 497

021978,000457:                                                                                                  #  I.E. DESIRED ATTITUDE NOT IN GIMBAL LOCK
021979,000458: 
021980,000459: 27,2106           51545                           DLOAD    ABS                                   #  CHECK TO SEE IF WE ARE POINTING
021981,000460: 27,2107           03765                                    SCAXIS                                #  THE THRUST AXIS
021982,000461: 27,2110           51025                           DSU      BPL                                   
021983,000462: 27,2111           14412                                    SINVEC1                               #  SIN 49.4 DEGS                        $2
021984,000463: 27,2112           56160                                    FINDGIMB                              #  IF SO, WE ARE TRYING TO POINT IT INTO
021985,000464: 27,2113           77775                           VLOAD                                          #  GIMBAL LOCK, ABORT COULD GO HERE
021986,000465: 27,2114           77626                           STADR                                          
021987,000466: 27,2115           50515                           STOVL    MIS        +12D                       
021988,000467: 27,2116           77626                           STADR                                          #  STORE MFS (IN PD LIST) IN MIS
021989,000468: 27,2117           50523                           STOVL    MIS        +6                         
021990,000469: 27,2120           77626                           STADR                                          
021991,000470: 27,2121           50531                           STOVL    MIS                                   
021992,000471: 27,2122           03254                                    MIS        +6                         #  INNER GIMBAL AXIS IN FINAL S/C AXES
021993,000472: 27,2123           57444                           BPL      VCOMP                                 #  LOCATE THE IG AXIS DIRECTION CLOSEST TO
021994,000473: 27,2124           56125                                    IGSAMEX                               #  FINAL X S/C AXIS
021995,000474: 
021996,000475: 27,2125           50035        IGSAMEX            VXV      BMN                                   #  FIND THE SHORTEST WAY OF ROTATING THE
021997,000476: 27,2126           03765                                    SCAXIS                                #  S/C OUT OF GIMBAL LOCK BY A ROTATION
021998,000477: 27,2127           56134                                    U=SCAXIS                              #  ABOUT +- SCAXIS, I.E. IF  (IG (SGN MFS3)
021999,000478:                                                                                                  #  X SCAXIS . XF) LESS THAN 0, U = SCAXIS
022000,000479:                                                                                                  #  OTHERWISE U = -SCAXIS
022001,000480: 
022002,000481: 27,2130           57575                           VLOAD    VCOMP                                 
022003,000482: 27,2131           03765                                    SCAXIS                                
022004,000483: 27,2132           37270                           STCALL   COF                                   #  ROTATE ABOUT -SCAXIS
022005,000484: 27,2133           56137                                    CHEKAXIS                              
022006,000485: 27,2134           77775        U=SCAXIS           VLOAD                                          
022007,000486: 27,2135           03765                                    SCAXIS                                
022008,000487: 27,2136           03270                           STORE    COF                                   #  ROTATE ABOUT + SCAXIS
022009,000488: 27,2137           51545        CHEKAXIS           DLOAD    ABS                                   
022010,000489: 27,2140           03765                                    SCAXIS                                #  SEE IF WE ARE POINTING THE AOT
022011,000490: 27,2141           51025                           DSU      BPL                                   
022012,000491: 27,2142           14414                                    SINVEC2                               #  SIN 29.5 DEGS                        $2
022013,000492: 27,2143           56147                                    PICKANG1                              #  IF SO, ROTATE 50 DEGS ABOUT +- SCAXIS
022014,000493: 27,2144           52145                           DLOAD    GOTO                                  #  IF NOT, MUST BE POINTING THE TRANSPONDER
022015,000494: 27,2145           14420                                    VECANG2                               #  OR SOME VECTOR IN THE Y, OR Z PLANE
022016,000495: 27,2146           56151                                    COMPMFSN                              #  IN THIS CASE ROTATE 35 DEGS TO GET OUT
022017,000496:                                                                                                  #  OF GIMBAL LOCK (VECANG2 $360)
022018,000497: 27,2147           77745        PICKANG1           DLOAD                                          
022019,000498: 27,2150           14416                                    VECANG1                               #  = 50 DEGS                          $ 360
022020,000499: 27,2151           77624        COMPMFSN           CALL                                           
022021,000500: 27,2152           44527                                    DELCOMP                               #  COMPUTE THE ROTATION ABOUT SCAXIS TO
022022,000501: 27,2153           75160                           AXC,1    AXC,2                                 #  BRING MFS OUT OF GIMBAL LOCK
022023,000502: 27,2154           03245                                    MIS                                   
022024,000503: 27,2155           02221                                    KEL                                   
022025,000504: 27,2156           77624                           CALL                                           #  COMPUTE THE NEW TRANSFORMATION FROM
022026,000505: 27,2157           44312                                    MXM3                                  #  DESIRED S/C AXES TO STABLE MEMBER AXES
022027,000506:                                                                                                  #  WHICH WILL ALIGN VI WITH VF AND AVOID
022028,000507: 

Page 498

022030,000509:                                                                                                  #  GIMBAL LOCK
022031,000510: 27,2160           45160        FINDGIMB           AXC,1    CALL                                  
022032,000511: 27,2161           00000                                    0                                     #  EXTRACT THE COMMANDED CDU ANGLES FROM
022033,000512: 27,2162           44654                                    DCMTOCDU                              #  THIS MATRIX
022034,000513: 27,2163           40234                           RTB      SETPD                                 
022035,000514: 27,2164           21630                                    V1STO2S                               #  CONVERT TO 2:S COMPLEMENT
022036,000515: 27,2165           00001                                    0                                     
022037,000516: 27,2166           77650                           GOTO                                           
022038,000517: 27,2167           03324                                    VECQTEMP                              #  RETURN TO CALLER
022039,000518: 
022040,000519: 27,2170           50375        PICKAXIS           VLOAD    DOT                                   #  IF VF X VI = 0, FIND VF . VI
022041,000520: 27,2171           00035                                    28D                                   
022042,000521: 27,2172           03765                                    SCAXIS                                
022043,000522: 27,2173           72240                           BMN      TLOAD                                 
022044,000523: 27,2174           54362                                    ROT180                                
022045,000524: 27,2175           00032                                    25D                                   
022046,000525: 27,2176           77650                           GOTO                                           #  IF VF = VI, CDU DESIRED = PRESENT CDU
022047,000526: 27,2177           03324                                    VECQTEMP                              #  PRESENT CDU ANGLES
022048,000527: 
022049,000528: 35,2000                                           BANK     35                                    
022050,000529: 26,2000                                           SETLOC   MANUVER1                              
022051,000530: 26,2000                                           BANK                                           
022052,000531: 26,2362           47375        ROT180             VLOAD    VXV                                   #  IF VF, VI ANTIPARALLEL, 108 DEG ROTATION
022053,000532: 26,2363           03254                                    MIS        +6                         #  IS REQUIRED. Y STABLE MEMBER AXIS IN
022054,000533: 26,2364           06503                                    HIDPHALF                              #  INITIAL S/C AXES.
022055,000534: 26,2365           47256                           UNIT     VXV                                   #  FIND Y(SM) X X(I)
022056,000535: 26,2366           03765                                    SCAXIS                                #  FIND UNIT(VI X UNIT(Y(SM) X X(I)))
022057,000536: 26,2367           40056                           UNIT     BOV                                   #  I.E. PICK A VECTOR IN THE PLANE OF X(I),
022058,000537: 26,2370           54404                                    PICKX                                 #  Y(SM) PERPENDICULAR TO VI
022059,000538: 26,2371           17270                           STODL    COF                                   
022060,000539: 26,2372           00045                                    36D                                   #  CHECK MAGNITUDE
022061,000540: 26,2373           50025                           DSU      BMN                                   #  OF THIS VECTOR.
022062,000541: 26,2374           14423                                    DPB-14                                #  IF LESS THAN B-14,
022063,000542: 26,2375           54404                                    PICKX                                 #  PICK X-AXIS.
022064,000543: 26,2376           77775                           VLOAD                                          
022065,000544: 26,2377           03270                                    COF                                   
022066,000545: 26,2400           17270        XROT               STODL    COF                                   
022067,000546: 26,2401           06503                                    HIDPHALF                              
022068,000547: 26,2402           77650                           GOTO                                           
022069,000548: 26,2403           56072                                    COMPMATX                              
022070,000549: 26,2404           52175        PICKX              VLOAD    GOTO                                  #  PICK THE XAXIS IN THIS CASE
022071,000550: 26,2405           06503                                    HIDPHALF                              
022072,000551: 26,2406           54400                                    XROT                                  
022073,000552: 26,2407           15555 35172  SINGIMLC           2DEC     .4285836003                            #  =SIN(59)                $2
022074,000553: 26,2411           14113 36326  SINVEC1            2DEC     .3796356537                            #  =SIN(49.4)              $2
022075,000554: 26,2413           07701 35703  SINVEC2            2DEC     .2462117800                            #  =SIN(29.5)              $2
022076,000555: 26,2415           04343 21616  VECANG1            2DEC     .1388888889                            #  = 50 DEGREES                       $360
022077,000556: 

Page 499

022079,000558: 26,2417           03070 34344  VECANG2            2DEC     .09722222222                            #  = 35 DEGREES                       $360
022080,000559: 26,2421           00000        1BITDP             OCT      0                                     #  KEEP THIS BEFORE DPB(-14)     *********
022081,000560: 26,2422           00001        DPB-14             OCT      00001                                 
022082,000561: 26,2423           00000                           OCT      00000                                 
022083,000562: 

Page 500

022085,000564:                                                                                                  #  ROUTINE FOR INITIATING AUTOMATIC MANEUVER VIA KEYBOARD (V49)
022086,000565: 
022087,000566: 
022088,000567: 34,2000                                           BANK     34                                    
022089,000568: 23,2000                                           SETLOC   R62                                   
022090,000569: 23,2000                                           BANK                                           
022091,000570: 23,2103  E6,1675                                  EBANK=   BCDU                                  
022092,000571: 
022093,000572: 23,2103                                           COUNT*   $$/R62                                
022094,000573: 
022095,000574: 23,2103  23,2103               R62DISP            EQUALS   R62FLASH                              
022096,000575: 
022097,000576: 23,2103           35001        R62FLASH           CAF      V06N22                                #  FLASH V06N22 AND
022098,000577: 23,2104           04607                           TC       BANKCALL                              #  ICDU ANGLES
022099,000578: 23,2105           20471                           CADR     GOFLASH                               
022100,000579: 23,2106           15474                           TCF      ENDEXT                                #  TERMINATE
022101,000580: 23,2107           12111                           TCF      GOMOVE                                #  PROCEED
022102,000581: 23,2110           12103                           TCF      R62FLASH                              #  ENTER
022103,000582: 
022104,000583:                                                                                                  #  ASTRONAUT MAY LOAD NEW ICDUS AT THIS
022105,000584:                                                                                                  #  POINT
022106,000585: 23,2111           05506        GOMOVE             TC       UPFLAG                                #  SET FOR 3-AXIS MANEUVER
022107,000586: 23,2112           00124                           ADRES    3AXISFLG                              
022108,000587: 
022109,000588: 23,2113           04607                           TC       BANKCALL                              
022110,000589: 23,2114           54125                           CADR     R60LEM                                
022111,000590: 23,2115           15474                           TCF      ENDEXT                                #  END R62
022112,000591: 

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