Source Code

These source code files are a reconstruction of Sundance, the Apollo 9 LM (Lunar Module) AGC (Apollo Guidance Computer) flight software, created from binary dumps of original core rope program modules, as follows:
  • B1 — Revision 292
  • B2 — Revision 302
  • B3 — Revision 302
  • B4 — Revision 302
  • B5 — Revision 292
  • B6 — Revision 306
This means that source code does not represent a specific historical revision of Sundance, but rather a mixture of the three released versions. Nonetheless, it is capable of flying the whole Apollo 9 mission. This source code matches the binary dumps, as closely as feasible, but 100% match is not possible, due mostly to changes in memory addresses at which code and variables were allocated in different revisions of Sundance. Refer to this list of explanations for each binary mismatch.

Since only binary dumps (rather than listings) of Sundance are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing.

057639,000002:                                                                                                  ## Copyright:   Public domain.
057640,000003:                                                                                                  ## Filename:    TJET_LAW.agc
057641,000004:                                                                                                  ## Purpose:     A section of a reconstructed, mixed version of Sundance
057642,000005:                                                                                                  ##              It is part of the reconstructed source code for the Lunar
057643,000006:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
057644,000007:                                                                                                  ##              No original listings of this program are available;
057645,000008:                                                                                                  ##              instead, this file was created via disassembly of dumps
057646,000009:                                                                                                  ##              of various revisions of Sundance core rope modules.
057647,000010:                                                                                                  ## Assembler:   yaYUL
057648,000011:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
057649,000012:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
057650,000013:                                                                                                  ## Mod history: 2020-06-17 MAS  Created from Luminary 69.
057651,000014: 
057652,000015:                                                                                                  ## Sundance 302
057653,000016: 
057654,000017:                                                                                                  #  PROGRAM DESCRIPTION
057655,000018:                                                                                                  #  DESIGNED BY:  R. D. GOSS AND P. S. WEISSMAN
057656,000019:                                                                                                  #  CODED BY:  P. S. WEISSMAN 28 FEBRUARY 1968
057657,000020: 
057658,000021:                                                                                                  #  TJETLAW IS CALLED AS A SUBROUTINE WHEN THE LEM IS NOT DOCKED AND THE AUTOPILOT IS IN THE AUTOMATIC OR
057659,000022:                                                                                                  #  ATTITUDE-HOLD MODE TO CALCULATE THE JET-FIRING-TIME (TJET) REQUIRED FOR THE AXIS INDICATED BY AXISCTR:
057660,000023:                                                                                                  #        -1      INDICATES THE P-AXIS
057661,000024:                                                                                                  #        +0      INDICATES THE U-AXIS
057662,000025:                                                                                                  #        +1      INDICATES THE V-AXIS.
057663,000026:                                                                                                  #  THE REGISTERS E AND EDOT CONTAIN THE APPROPRIATE ATTITUDE ERROR AND ERROR RATE AND SENSETYP SHOWS WHETHER
057664,000027:                                                                                                  #  UNBALANCED COUPLES ARE PREFERRED.  TJETLAW ALSO USES VARIOUS FUNCTIONS OF ACCELERATION AND DEADBAND WHICH ARE
057665,000028:                                                                                                  #  COMPUTED IN THE 1/ACCONT SECTION OF 1/ACCS AND ARE STORED IN SUCH AN ORDER THAT THEY CAN BE CONVENIENTLY
057666,000029:                                                                                                  #  ACCESSED BY INDEXING.
057667,000030: 
057668,000031:                                                                                                  #  THE SIGN OF THE REQUIRED ROTATION IS CARRIED THROUGH TJETLAW AS ROTSENSE AND IS FINALLY APPLIED TO TJET JUST
057669,000032:                                                                                                  #  PREVIOUS TO ITS STORAGE IN THE LOCATION CORRESPONDING TO THE AXIS (TJP, TJU OR TJV).  THE NUMBER OF JETS THAT
057670,000033:                                                                                                  #  TJETLAW ASSUMES WILL BE USED IS INDICATED BY THE SETTING OF NUMBERT FOR THE U- OR V-AXIS.  TWO JETS ARE ALWAYS
057671,000034:                                                                                                  #  ASSUMED FOR THE P-AXIS  ALTHOUGH FOUR JETS WILL BE FIRED WHEN FIREFCT IS MORE NEGATIVE THAN -4.0 DEGREES
057672,000035:                                                                                                  #  (FIREFCT IS THE DISTANCE TO A SWITCH CURVE IN THE PHASE PLANE) AND A LONG FIRING IS CALLED FOR.
057673,000036: 
057674,000037:                                                                                                  #  IN ORDER TO AVOID SCALING DIFFICULTIES, SIMPLE ALGORITHMS TAGGED RUFLAW1, -2 AND -3 ARE RESORTED TO WHEN THE
057675,000038:                                                                                                  #  ERROR AND/OR ERROR RATE ARE LARGE.
057676,000039: 
057677,000040:                                                                                                  #  CALLING SEQUENCE:
057678,000041:                                                                                                  #                TC      TJETLAW         (MUST BE IN JASK)
057679,000042:                                                                                                  #        OR
057680,000043:                                                                                                  #                INHINT                  (MUST BE IN JASK)
057681,000044:                                                                                                  #                TC      IBNKCALL
057682,000045:                                                                                                  #                CADR    TJETLAW
057683,000046:                                                                                                  #                RELINT
057684,000047: 
057685,000048:                                                                                                  #  EXIT:         RETURN TO Q.
057686,000049: 
057687,000050:                                                                                                  #  INPUT:
057688,000051:                                                                                                  #        FROM THE CALLER:  E, EDOT, AXISCTR, SENSETYP, TJP,-U,-V.
057689,000052:                                                                                                  #        FROM 1/ACCONT:  48 ERASABLES BEGINNING AT BLOCKTOP (INCLUDING FLAT, ZONE3LIM AND ACCSWU,-V).
057690,000053: 
057691,000054:                                                                                                  #  OUTPUT:
057692,000055:                                                                                                  #        TJP,-U OR -V, NUMBERT (DAPTEMP5), FIREFCT (DAPTEMP3).
057693,000056: 
057694,000057:                                                                                                  #  DEBRIS:
057695,000058:                                                                                                  #        A, L, Q, E, EDOT, DAPTEMP1-6, DAPTREG1-4.
057696,000059: 
057697,000060:                                                                                                  #  ALARM:  NONE
057698,000061: 
057699,000062: 17,3035                                           BANK     17                                    
057700,000063: 17,2000                                           SETLOC   DAPS2                                 
057701,000064: 17,2000                                           BANK                                           
057702,000065: 17,3035  E6,1516                                  EBANK=   TJP                                   
057703,000066: 17,3035                                           COUNT*   $$/DAPTJ                              
057704,000067: 
057705,000068: 17,3035           00006        TJETLAW            EXTEND                                         #  SAVE Q FOR RETURN.
057706,000069: 17,3036           23742                           QXCH     HOLDQ                                 
057707,000070: 
057708,000071:                                                                                                  #  SET INDEXERS TO CORRESPOND TO THE AXIS AND TO THE SIGN OF EDOT
057709,000072: 
057710,000073: 17,3037           51471                           INDEX    AXISCTR                               #  AXISDIFF(-1)=NO OF LOCATIONS BER P AND U
057711,000074: 17,3040           33505                           CAF      AXISDIFF                              #  AXISDIFF(0) = 0
057712,000075: 17,3041           55743                           TS       ADRSDIF1                              #  AXISDIFF(+1)=NO OF LOCATIONS BET V AND U
057713,000076: 
057714,000077: 17,3042           31543                           CAE      EDOT                                  #  IF EDOT NEGATIVE, PICK UP SET OF VALUES
057715,000078: 17,3043           00006                           EXTEND                                         #        THAT ALLOW USE OF SAME CODING AS FOR
057716,000079: 17,3044           63051                           BZMF     NEGEDOT                               #        POSITIVE EDOT.
057717,000080: 17,3045           31743                           CAE      ADRSDIF1                              #  SET A SECOND INDEXER WHICH MAY BE
057718,000081: 17,3046           55741                           TS       ADRSDIF2                              #        MODIFIED BY A DECISION FOR MAX JETS.
057719,000082: 17,3047           33507                           CAF      SENSOR                                #  FOR POSITIVE EDOT, ROTSENSE IS
057720,000083: 17,3050           13061                           TCF      SETSENSE                              #        INITIALIZED POSITIVE.
057721,000084: 
057722,000085: 17,3051           41542        NEGEDOT            CS       E                                     #  IN ORDER FOR NEG EDOT CASE TO USE CODING
057723,000086: 17,3052           55542                           TS       E                                     #        OF POS EDOT, MUST MODIFY AS FOLLOWS:
057724,000087: 17,3053           41543                           CS       EDOT                                  #        1. COMPLEMENT E AND EDOT.
057725,000088: 17,3054           55543                           TS       EDOT                                  #        2. SET SENSE OF ROTATION TO NEGATIVE
057726,000089: 17,3055           35026                           CAF      BIT1                                  #           (REVERSED LATER IF NECESSARY).
057727,000090: 17,3056           27743                           ADS      ADRSDIF1                              #        3. INCREMENT INDEXERS BY ONE SO THAT
057728,000091: 17,3057           55741                           TS       ADRSDIF2                              #           THE PROPER PARAMETERS ARE ACCESSED.
057729,000092: 17,3060           43507                           CS       SENSOR                                
057730,000093: 17,3061           55735        SETSENSE           TS       ROTSENSE                              
057731,000094: 
057732,000095:                                                                                                  #  TEST MAGNITUDE OF E (ATTITUDE ERROR, SINGLE-PRECISION, SCALED AT PI RADIANS):
057733,000096:                                                                                                  #        IF GREATER THAN (OR EQUAL TO) PI/16 RADIANS, GO TO THE SIMPLIFIED TJET ROUTINE.
057734,000097:                                                                                                  #        IF LESS THAN PI/16 RADIANS, RESCALE TO PI/4.
057735,000098: 
057736,000099: 17,3062           31542                           CAE      E                                     #  PICK UP ATTITUDE ERROR FOR THIS AXIS
057737,000100: 17,3063           00006                           EXTEND                                         
057738,000101: 17,3064           75022                           MP       BIT5                                  #  SHIFT RIGHT TEN BITS:  IF A-REGISTER IS
057739,000102: 17,3065           10000                           CCS      A                                     #        ZERO, RESCALE AND TEST EDOT.
057740,000103: 17,3066           13447                           TCF      RUFLAW2                               
057741,000104: 17,3067           13071                           TCF      SCALEE                                
057742,000105: 17,3070           13413                           TCF      RUFLAW1                               
057743,000106: 17,3071           35012        SCALEE             CAF      BIT13                                 #  ERROR IS IN L SCALED AT PI/16.  RESCALE
057744,000107: 17,3072           00006                           EXTEND                                         #        IT TO PI/4 AND SAVE IT.
057745,000108: 17,3073           70001                           MP       L                                     
057746,000109: 17,3074           55542                           TS       E                                     
057747,000110: 
057748,000111:                                                                                                  #  TEST MAGNITUDE OF EDOT (ERROR RATE SCALED AT PI/4 RADIANS/SECOND)
057749,000112:                                                                                                  #        IF GREATER THAN (OR EQUAL TO) PI/32 RADIANS/SECOND, GO TO THE SIMPLIFIED TJET ROUTINE.
057750,000113:                                                                                                  #        IF LESS THAN PI/32 RADIANS/SECOND, THEN RESCALE TO PI/32 RADIANS/SECOND.
057751,000114: 
057752,000115: 17,3075           31543                           CAE      EDOT                                  #  PICK UP SINGLE-PRECISION ERROR-RATE
057753,000116: 17,3076           00006                           EXTEND                                         #  FOR THIS AXIS=
057754,000117: 17,3077           75023                           MP       BIT4                                  #  SHIFT RIGHT ELEVEN BITS, IF THE A-REG IS
057755,000118: 17,3100           00006                           EXTEND                                         #  ZERO, THEN RESCALE AND USE FINELAW.
057756,000119: 17,3101           13103                           BZF      SCALEDOT                              
057757,000120: 17,3102           13455                           TCF      RUFLAW3                               
057758,000121: 
057759,000122:                                                                                                  #  *** FINELAW STARTS HERE ***
057760,000123: 
057761,000124: 17,3103           23543        SCALEDOT           LXCH     EDOT                                  #  EDOT IS SCALED AT PI/32 RADIANS/SECOND.
057762,000125: 
057763,000126: 17,3104           31543                           CAE      EDOT                                  #  COMPUTE (EDOT)(EDOT)
057764,000127: 17,3105           00006                           EXTEND                                         
057765,000128: 17,3106           70000                           SQUARE                                         #  PRODUCT SCALED AT PI(2)/2(10) RAD/SEC.
057766,000129: 17,3107           00006                           EXTEND                                         
057767,000130: 17,3110           75012                           MP       BIT13                                 #  SHIFT RIGHT TWO BITS TO RESCALE EDOTSQ
057768,000131: 17,3111           55734                           TS       EDOTSQ                                #        TO PI(2)/2(8) RAD(2)/SEC(2).
057769,000132: 
057770,000133: 17,3112           11542        ERRTEST            CCS      E                                     #  DOES BIG ERROR (TWO DEGREES BEYOND THE
057771,000134: 17,3113           63510                           AD       -2DEG                                 #  DEADBAND) REQUIRE MAXIMUM JETS?
057772,000135: 17,3114           13116                           TCF      +2                                    
057773,000136: 17,3115           63510                           AD       -2DEG                                 
057774,000137: 17,3116           00006                           EXTEND                                         
057775,000138: 17,3117           51743                           INDEX    ADRSDIF1                              
057776,000139: 17,3120           61576                           SU       FIREDB                                
057777,000140: 17,3121           00006                           EXTEND                                         
057778,000141: 17,3122           63127                           BZMF     SENSTEST                              #  IF NOT:  ARE UNBALANCED JETS PREFERRED|
057779,000142: 17,3123           35025        MAXJETS            CAF      TWO                                   #  IF YES:  INCREMENT ADDRESS LOCATOR AND
057780,000143: 17,3124           27741                           ADS      ADRSDIF2                              #           SET SWITCH FOR JET SELECT LOGIC TO 4.
057781,000144: 17,3125           35024                           CAF      FOUR                                  #           (ALWAYS DO THIS FOR P-AXIS)
057782,000145: 17,3126           13132                           TCF      TJCALC                                
057783,000146: 17,3127           11472        SENSTEST           CCS      SENSETYP                              #  DOES TRANSLATION PREFER MIN JETS.
057784,000147: 17,3130           13132                           TCF      TJCALC                                #  YES.  USE MIN-JET PARAMETERS.
057785,000148: 17,3131           13123                           TCF      MAXJETS                               #  NO.  GET MAX-JET PARAMETERS.
057786,000149: 17,3132           55740        TJCALC             TS       NUMBERT                               #  SET TO +0,1,4 FOR (U,V-AXES) JET SELECT.
057787,000150: 
057788,000151:                                                                                                  #  BEGINNING OF TJET CALCULATIONS:
057789,000152: 
057790,000153: 17,3133           41734                           CS       EDOTSQ                                #  SCALED AT PI(2)/2(8).
057791,000154: 17,3134           00006                           EXTEND                                         
057792,000155: 17,3135           51741                           INDEX    ADRSDIF2                              
057793,000156: 17,3136           71564                           MP       1/ANET1                               #  .5/ACC SCALED AT 2(6)/PI SEC(2)/RADIAN.
057794,000157: 17,3137           51743                           INDEX    ADRSDIF1                              
057795,000158: 17,3140           61576                           AD       FIREDB                                #  DEADBAND SCALED AT PI/4 RADIAN.
057796,000159: 17,3141           00006                           EXTEND                                         
057797,000160: 17,3142           61542                           SU       E                                     #  ATTITUDE ERROR SCALED AT PI/4 RADIAN.
057798,000161: 17,3143           55736                           TS       FIREFCT                               #  -E-.5(EDOTSQ)/ACC-DB AT PI/4 RADIAN.
057799,000162: 17,3144           00006                           EXTEND                                         
057800,000163: 17,3145           63325                           BZMF     ZON1,2,3                              
057801,000164: 
057802,000165: 17,3146           51743        ZONE4,5            INDEX    ADRSDIF1                              
057803,000166: 17,3147           31570                           CAE      1/ACOAST                              #  .5/ACC SCALED AT 2(6)/PI WHERE
057804,000167: 17,3150           00006                           EXTEND                                         #  ACC = MAX(AMIN, AOS-).
057805,000168: 17,3151           71734                           MP       EDOTSQ                                #  SCALED AT PI/2(8).
057806,000169: 17,3152           61542                           AD       E                                     #  SCALED AT PI/4
057807,000170: 17,3153           51743                           INDEX    ADRSDIF1                              
057808,000171: 17,3154           61600                           AD       COASTDB                               #  SCALED AT PI/4 POS. FOR NEG. INTERCEPT.
057809,000172: 17,3155           00006                           EXTEND                                         #  TEST E+.5(EDOTSQ)/ACC+DB AT PI/4 RADIAN.
057810,000173: 17,3156           63211                           BZMF     ZONE5                                 #  IF FUNCTION NEGATIVE, FIND TJET.
057811,000174:                                                                                                  #  IF FUNCTION POSITIVE, IN ZONE 4.
057812,000175: 
057813,000176:                                                                                                  #  ZONE 4 IS THE COAST REGION.  HOWEVER, IF THE JETS ARE ON AND DRIVING TOWARD
057814,000177:                                                                                                  #        A. THE AXIS WITHIN + OR - (DB + FLAT) FOR DRIFTING FLIGHT, OR
057815,000178:                                                                                                  #        B. THE USUAL TARGET PARABOLA FOR POWERED FLIGHT
057816,000179:                                                                                                  #  THEN THE THRUSTERS ARE KEPT ON.
057817,000180: 
057818,000181: 17,3157           51471        ZONE4              INDEX    AXISCTR                               #  IS THE CURRENT VALUE IN TJET NON-ZERO
057819,000182: 17,3160           41517                           CS       TJETU                                 #        WITH SENSE OPPOSITE TO EDOT,
057820,000183: 17,3161           00006                           EXTEND                                         #        (I.E., ARE JETS ON AND FIRING TOWARD
057821,000184: 17,3162           71735                           MP       ROTSENSE                              #        THE DESIRABLE STATE).
057822,000185: 17,3163           00006                           EXTEND                                         
057823,000186: 17,3164           63205                           BZMF     COASTTJ                               #  NO.  COAST.
057824,000187: 
057825,000188: 17,3165           11552        JETSON             CCS      FLAT                                  #  YES.  IS THIS DRIFTING OR POWERED FLIGHT|
057826,000189: 17,3166           13177                           TCF      DRIFT/ON                              #  DRIFTING.  GO MAKE FURTHER TEST.
057827,000190: 
057828,000191: 17,3167           41736                           CS       FIREFCT                               #  POWERED (OR ULLAGE).  CAN TARGET PARABOLA
057829,000192: 17,3170           51743                           INDEX    ADRSDIF1                              #        BE REACHED FROM THIS POINT IN THE
057830,000193: 17,3171           61602                           AD       AXISDIST                              #        PHASE PLANE|
057831,000194: 17,3172           00006                           EXTEND                                         
057832,000195: 17,3173           63205                           BZMF     COASTTJ                               #  NO. SET TJET = 0.
057833,000196: 17,3174           03311                           TC       Z123COMP                              #  YES.  CALCULATE TJET AS THOUGH IN ZONE 1
057834,000197: 17,3175           31736                           CAE      FIREFCT                               #        AFTER COMPUTING THE REQUIRED
057835,000198: 17,3176           13345                           TCF      ZONE1                                 #        PARAMETERS.
057836,000199: 
057837,000200: 17,3177           51743        DRIFT/ON           INDEX    ADRSDIF1                              #  CAN TARGET STRIP OF AXIS BE REACHED FROM
057838,000201: 17,3200           41576                           CS       FIREDB                                #        THIS POINT IN THE PHASE PLANE|
057839,000202: 17,3201           60000                           DOUBLE                                         
057840,000203: 17,3202           61736                           AD       FIREFCT                               
057841,000204: 17,3203           00006                           EXTEND                                         
057842,000205: 17,3204           63207                           BZMF     +3                                    
057843,000206: 17,3205           35030        COASTTJ            CAF      ZERO                                  #  NO.  SET TJET = 0.
057844,000207: 17,3206           13251                           TCF      RETURNTJ                              
057845,000208: 
057846,000209: 17,3207           03311                           TC       Z123COMP                              #  YES. CALCULATE TJET AS THOUGH IN ZONE 2
057847,000210: 17,3210           13332                           TCF      ZONE2,3                               #        OR 3 AFTER COMPUTING REQUIRED VALUES.
057848,000211: 
057849,000212: 17,3211           54001        ZONE5              TS       L                                     #  TEMPORARILY STORE FUNCTION IN L.
057850,000213: 17,3212           11735                           CCS      ROTSENSE                              #  MODIFY ADRSDIF2 FOR ACCESSING 1/ANET2
057851,000214: 17,3213           13217                           TCF      +4                                    #  AND ACCFCTZ5, WHICH MUST BE PICKED UP
057852,000215: 17,3214           05723                           TC       CCSHOLE                               #  FROM THE NEXT LOWER REGISTER IF THE
057853,000216: 17,3215           45025                           CS       TWO                                   #  (ACTUAL) ERROR RATE IS NEGATIVE.
057854,000217: 17,3216           27741                           ADS      ADRSDIF2                              
057855,000218: 
057856,000219: 17,3217           30001                 +4        CAE      L                                     
057857,000220: 17,3220           00006                           EXTEND                                         
057858,000221: 17,3221           51741                           INDEX    ADRSDIF2                              #  TTOAXIS AND HH ARE THE PARAMETERS UPON
057859,000222: 17,3222           71573                           MP       ACCFCTZ5                              #        WHICH THE APPROXIMATIONS TO TJET ARE
057860,000223: 17,3223           20001                           DDOUBL                                         #        BASED.
057861,000224: 17,3224           20001                           DDOUBL                                         
057862,000225: 17,3225           53745                           DXCH     HH                                    #  DOUBLE PRECISION H SCALED AT 8 SEC(2).
057863,000226: 17,3226           51741                           INDEX    ADRSDIF2                              
057864,000227: 17,3227           31565                           CAE      1/ANET2                               #  SCALED AT 2(7)/PI SEC(2)/RAD.
057865,000228: 17,3230           00006                           EXTEND                                         
057866,000229: 17,3231           71543                           MP       EDOT                                  #  SCALED AT PI/2(5)
057867,000230: 17,3232           55737                           TS       TTOAXIS                               #  SCALED AT 4 SEC.
057868,000231: 
057869,000232:                                                                                                  #  TEST WHETHER TJET GREATER THAN 50 MSEC.
057870,000233: 
057871,000234: 17,3233           00006                           EXTEND                                         
057872,000235: 17,3234           73517                           MP       -.05AT2                               #  H - .05 TTOAXIS - .00125 G.T. ZERO
057873,000236: 17,3235           61744                           AD       HH                                    #        (SCALED AT 8 SEC(2) ).
057874,000237: 17,3236           67720                           AD       NEG2                                  
057875,000238: 17,3237           00006                           EXTEND                                         
057876,000239: 17,3240           63266                           BZMF     FORMULA1                              
057877,000240: 
057878,000241:                                                                                                  #  TEST WHETHER TJET GREATER THAN 150 MSEC.
057879,000242: 
057880,000243: 17,3241           31737                           CAE      TTOAXIS                               
057881,000244: 17,3242           00006                           EXTEND                                         
057882,000245: 17,3243           73520                           MP       -.15AT2                               #  H - .15 TTOAXIS - .01125 G.T. ZERO
057883,000246: 17,3244           61744                           AD       HH                                    #        (SCALED AT 8 SEC(2) )
057884,000247: 17,3245           63511                           AD       -.0112A8                              
057885,000248: 17,3246           00006                           EXTEND                                         
057886,000249: 17,3247           63276                           BZMF     FORMULA2                              
057887,000250: 
057888,000251:                                                                                                  #  IF TJET GREATER THAN 150 MSEC, ASSIGN IT VALUE OF 250 MSEC, SINCE THIS
057889,000252:                                                                                                  #  IS ENOUGH TO ASSURE NO SKIP NEXT CSP (100 MSEC).
057890,000253: 
057891,000254: 17,3250           35014        FULLTIME           CAF      BIT11                                 #  250 MSEC SCALED AT 4 SEC.
057892,000255: 
057893,000256:                                                                                                  #  RETURN TO CALLING PROGRAM WITH JET TIME SCALED AS TIME6 AND SIGNED.
057894,000257: 
057895,000258: 17,3251           00006        RETURNTJ           EXTEND                                         #  ALL BRANCHES TERMINATE HERE WITH TJET
057896,000259: 17,3252           71735                           MP       ROTSENSE                              #        (SCALED AT 4 SEC) IN THE ACCUMULATOR.
057897,000260: 17,3253           51471                           INDEX    AXISCTR                               #  ROTSENSE APPLIES SIGN AND CHANGES SCALE.
057898,000261: 17,3254           55517                           TS       TJETU                                 
057899,000262: 17,3255           00006                           EXTEND                                         
057900,000263: 17,3256           51471                           INDEX    AXISCTR                               
057901,000264: 17,3257           71544                           MP       ACCSWU                                #  SET SWITCH FOR JET SELECT IF ROTATION IS
057902,000265: 17,3260           30001                           CAE      L                                     
057903,000266: 17,3261           00006                           EXTEND                                         #        IN A SENSE FOR WHICH 1/ACCS HAS FORCED
057904,000267: 17,3262           63265                           BZMF     +3                                    #        A MAX-JET CALCULATION.
057905,000268: 17,3263           35024                           CAF      FOUR                                  
057906,000269: 17,3264           55740                           TS       NUMBERT                               
057907,000270: 17,3265           01742                           TC       HOLDQ                                 #  RETURN VIA SAVED Q.
057908,000271: 
057909,000272:                                                                                                  #  TJET = H/(.025 + TTOAXIS)     FOR TJET LESS THAN 50 MSEC.
057910,000273: 
057911,000274: 17,3266           43516        FORMULA1           CS       -.025AT4                              #  .025 SEC SCALED AT 4.
057912,000275: 17,3267           61737                           AD       TTOAXIS                               #  SCALED AT 4 SECONDS.
057913,000276: 17,3270           53745                           DXCH     HH                                    #  STORE DENOMINATOR IN FIRST WORD OF H,
057914,000277: 17,3271           00006                           EXTEND                                         #        WHICH NEED NOT BE PRESERVED.  PICK UP
057915,000278: 17,3272           11744                           DV       HH                                    #        DP H AND DIVIDE BY DENOMINATOR.
057916,000279: 17,3273           00006                           EXTEND                                         
057917,000280: 17,3274           75011                           MP       BIT14                                 #  RESCALE TJET FROM 2 TO USUAL 4 SEC.
057918,000281: 17,3275           13406                           TCF      CHKMINTJ                              #  CHECK THAT TJET IS NOT LESS THAN MINIMUM
057919,000282: 
057920,000283:                                                                                                  #  TJET = (H + .00375)/(0.1 + TTOAXIS)   FOR TJET GREATER THAN 50 MSEC.
057921,000284: 
057922,000285: 17,3276           00006        FORMULA2           EXTEND                                         
057923,000286: 17,3277           33522                           DCA      .00375A8                              #  .00375 SEC(2) SCALED AT 8.
057924,000287: 17,3300           21745                           DAS      HH                                    #  STORE NUMERATOR IN DP H, WHICH NEED NOT
057925,000288:                                                                                                  #        BE PRESERVED.
057926,000289: 17,3301           31737                           CAE      TTOAXIS                               #  SCALED AT 4 SEC.
057927,000290: 17,3302           63512                           AD       .1AT4                                 #  0.1 SEC SCALED AT 4.
057928,000291: 17,3303           53745                           DXCH     HH                                    #  STORE DENOMINATOR IN FIRST WORD OF H,
057929,000292: 17,3304           00006                           EXTEND                                         #        WHICH NEED NOT BE PRESERVED.  PICK UP
057930,000293: 17,3305           11744                           DV       HH                                    #        DP NUMERATOR AND DIVIDE BY DENOMINATOR
057931,000294: 17,3306           00006                           EXTEND                                         
057932,000295: 17,3307           75011                           MP       BIT14                                 #  RESCALE TJET FROM 2 TO USUAL 4 SEC.
057933,000296: 17,3310           13251                           TCF      RETURNTJ                              #  END SUBROUTINE.
057934,000297: 
057935,000298:                                                                                                  #  SUBROUTINIZED COMPUTATIONS REQUIRED FOR ALL ENTRIES INTO CODING FOR ZONES 1, 2, AND 3.
057936,000299:                                                                                                  #  REACHED BY TC FROM 3 POINTS IN TJETLAW.
057937,000300: 
057938,000301: 17,3311           41735        Z123COMP           CS       ROTSENSE                              #  USED IN RETURNTJ SECTION TO RESCALE TJET
057939,000302: 17,3312           55735                           TS       ROTSENSE                              #        AS TIME6 AND GIVE IT PROPER SIGN.
057940,000303: 17,3313           31543                           CAE      EDOT                                  #  SCALED AT PI/2(5) RAD/SEC.
057941,000304: 17,3314           00006                           EXTEND                                         
057942,000305: 17,3315           51741                           INDEX    ADRSDIF2                              
057943,000306: 17,3316           71564                           MP       1/ANET1                               #  SCALED AT 2(7)/PI SEC(2)/RAD.
057944,000307: 17,3317           55737                           TS       TTOAXIS                               #  STORE TIME-TO-AXIS SCALED AT 4 SECONDS.
057945,000308: 17,3320           63523                           AD       -TJMAX                                
057946,000309: 17,3321           00006                           EXTEND                                         #  IS TIME TO AXIS LESS THAN 150 MSEC.
057947,000310: 17,3322           63324                           BZMF     +2                                    
057948,000311: 17,3323           13250                           TCF      FULLTIME                              #  NO. FIRE JETS, DO NOT CALCULATE TJET.
057949,000312: 17,3324           00002                           RETURN                                         #  YES.  GO ON TO FIND TJET
057950,000313: 
057951,000314: 17,3325           03311        ZON1,2,3           TC       Z123COMP                              #  SUBROUTINIZED PREPARATION FOR ZONE1,2,3.
057952,000315: 
057953,000316:                                                                                                  #  IF THE (NEG) DISTANCE BEYOND PARABOLA IS LESS THAN FLAT, USE SPECIAL
057954,000317:                                                                                                  #  LOGIC TO ACQUIRE MINIMUM IMPULSE LIMIT CYCLE.  DURING POWERED FLIGHT
057955,000318:                                                                                                  #  OR ULLAGE, FLAT = 0
057956,000319: 
057957,000320: 17,3326           31736                           CAE      FIREFCT                               #  SCALED AT PI/4 RAD.
057958,000321: 17,3327           61552                           AD       FLAT                                  
057959,000322: 17,3330           00006                           EXTEND                                         
057960,000323: 17,3331           63345                           BZMF     ZONE1                                 #  NOT IN SPECIAL ZONES.
057961,000324: 
057962,000325:                                                                                                  #  FIRE FOR AXIS OR, IF CLOSE, FIRE MINIMUM IMPULSE.  IF ON AXIS, COAST.
057963,000326: 
057964,000327: 17,3332           41553        ZONE2,3            CS       ZONE3LIM                              #  HEIGHT OF MIN-IMPULSE ZONE SET BY 1/ACCS
057965,000328: 17,3333           61737                           AD       TTOAXIS                               #        35 MSEC IN DRIFTING FLIGHT
057966,000329: 17,3334           00006                           EXTEND                                         #        ZERO WHEN TRYING TO ENTER GTS CONTROL.
057967,000330: 17,3335           63340                           BZMF     ZONE3                                 
057968,000331: 17,3336           31737        ZONE2              CAE      TTOAXIS                               #  FIRE TO AXIS.
057969,000332: 17,3337           13251                           TCF      RETURNTJ                              
057970,000333: 17,3340           11543        ZONE3              CCS      EDOT                                  #  CHECK IF EDOT IS ZERO.
057971,000334: 17,3341           35021                           CAF      BIT6                                  #  FIRE A ONE-JET MINIMUM IMPULSE.
057972,000335: 17,3342           13251                           TCF      RETURNTJ                              #  TJET = +0.
057973,000336: 17,3343           05723                           TC       CCSHOLE                               #  CANNOT BE BECAUSE NEG EDOT COMPLEMENTED.
057974,000337: 17,3344           13251                           TCF      RETURNTJ                              #  TJET = +0.
057975,000338: 
057976,000339: 17,3345           00006        ZONE1              EXTEND                                         
057977,000340: 17,3346           51743                           INDEX    ADRSDIF1                              
057978,000341: 17,3347           61602                           SU       AXISDIST                              #  SCALED AT PI/4 RAD.
057979,000342: 17,3350           00006                           EXTEND                                         
057980,000343: 17,3351           51741                           INDEX    ADRSDIF2                              
057981,000344: 17,3352           71572                           MP       ACCFCTZ1                              #  SCALED AT 2(7)/PI SEC(2)/RAD.
057982,000345: 17,3353           20001                           DDOUBL                                         
057983,000346: 17,3354           20001                           DDOUBL                                         
057984,000347: 17,3355           53745                           DXCH     HH                                    #  DOUBLE PRECISION H SCALED AT 8 SEC(2).
057985,000348: 
057986,000349:                                                                                                  #  TEST WHETHER TOTAL TIME REQUIRED GREATER THAN 150 MSEC:
057987,000350:                                                                                                  #                             2                                   2
057988,000351:                                                                                                  #        IS .5(.150 - TTOAXIS)  - H  NEGATIVE (SCALED AT 8 SECONDS )
057989,000352: 
057990,000353: 17,3356           31737                           CAE      TTOAXIS                               #  TTOAXIS SCALED AT 4 SECONDS.
057991,000354: 17,3357           63523                           AD       -TJMAX                                #  -.150 SECOND SCALED AT 4.
057992,000355: 17,3360           00006                           EXTEND                                         
057993,000356: 17,3361           70000                           SQUARE                                         
057994,000357: 17,3362           00006                           EXTEND                                         
057995,000358: 17,3363           61744                           SU       HH                                    #  HIGH WORD OF H SCALED AT 8 SEC(2).
057996,000359: 17,3364           00006                           EXTEND                                         
057997,000360: 17,3365           63250                           BZMF     FULLTIME                              #  YES.  NEED NOT CALCULATE TJET.
057998,000361: 
057999,000362:                                                                                                  #  TEST WHETHER TIME BEYOND AXIS GREATER THAN 50 MSEC TO DETERMINE WHICH APPROXIMATION TO USE.
058000,000363: 
058001,000364: 17,3366           31744                           CAE      HH                                    
058002,000365: 17,3367           67720                           AD       NEG2                                  
058003,000366: 17,3370           00006                           EXTEND                                         
058004,000367: 17,3371           63401                           BZMF     FORMULA3                              
058005,000368: 
058006,000369:                                                                                                  #  TJET = H/0.1 + TTOAXIS + .0375        FOR APPROXIMATION OVER MORE THAN 50 MSEC.
058007,000370: 
058008,000371: 17,3372           33513                           CAF      .1AT2                                 #  STORE .1 SEC SCALED AT 2 FOR DIVISION.
058009,000372: 17,3373           53745                           DXCH     HH                                    #  DP H SCALED AT 8 SEC(2) NEED NOT BE
058010,000373: 17,3374           00006                           EXTEND                                         #        PRESERVED.
058011,000374: 17,3375           11744                           DV       HH                                    #  QUOTIENT SCALED AT 4 SECONDS.
058012,000375: 17,3376           61737                           AD       TTOAXIS                               #  SCALED AT 4 SEC.
058013,000376: 17,3377           63514                           AD       .0375AT4                              #  .0375 SEC SCALED AT 4.
058014,000377: 17,3400           13251                           TCF      RETURNTJ                              #  END COMPUTATION.
058015,000378: 
058016,000379:                                                                                                  #  TJET = H/.O25 + TTOAXIS       FOR APPROXIMATION OVER LESS THAN 50 MSEC.
058017,000380: 
058018,000381: 17,3401           43515        FORMULA3           CS       -.025AT2                              #  STORE +.025 SEC SCALED AT 2 FOR DIVISION
058019,000382: 17,3402           53745                           DXCH     HH                                    #  PICK UP DP H AT 8, WHICH NEED NOT BE
058020,000383: 17,3403           00006                           EXTEND                                         #        PRESERVED.
058021,000384: 17,3404           11744                           DV       HH                                    #  QUOTIENT SCALED AT 4 SECONDS.
058022,000385: 17,3405           61737                           AD       TTOAXIS                               #  SCALED AT 4 SEC.
058023,000386: 
058024,000387:                                                                                                  #  IF COMPUTED JET TIME IS LESS THAN TJMIN, TJET IS SET TO ZERO.
058025,000388:                                                                                                  #  MINIMUM IMPULSES REQUIRED IN ZONE 3 ARE NOT SUBJECT TO THIS CONSTRAINT, NATURALLY.
058026,000389: 
058027,000390: 17,3406           63525        CHKMINTJ           AD       -TJMIN                                #  IS COMPUTED TIME LESS THAN THE MINIMUM.
058028,000391: 17,3407           00006                           EXTEND                                         
058029,000392: 17,3410           63205                           BZMF     COASTTJ                               #  YES, SET TIME TO ZERO.
058030,000393: 17,3411           63524                           AD       TJMIN                                 #  NO, RESTORE COMPUTED TIME.
058031,000394: 17,3412           13251                           TCF      RETURNTJ                              #  END COMPUTATION.
058032,000395: 
058033,000396:                                                                                                  #  *** ROUGHLAW ***
058034,000397: 
058035,000398:                                                                                                  #  BEFORE ENTRY TO RUFLAW:
058036,000399:                                                                                                  #        1. INDEXERS ADRSDIF1 AND ADRSDIF2 ARE SET ON BASIS OF AXIS, AND SIGN OF EDOT.
058037,000400:                                                                                                  #        2. IF EDOT WAS NEGATIVE, E AND EDOT ARE ROTATED INTO UPPER HALF-PLANE AND ROTSENSE IS MADE NEGATIVE.
058038,000401:                                                                                                  #        3. E IS SCALED AT PI RADIANS AND EDOT AT PI/4 RAD/SEC.
058039,000402:                                                                                                  #           (EXCEPT THE RUFLAW3 ENTRY WHEN E IS AT PI/4)
058040,000403: 
058041,000404:                                                                                                  #  RUFLAW1:      ERROR MORE NEGATIVE THAN PI/16 RAD.  FIRE TO A RATE OF PI/32 RAD/SEC (IF JET TIME EXCEEDS 20 MSEC.).
058042,000405:                                                                                                  #  RUFLAW2:      ERROR MORE POSITIVE THAN PI/16 RAD.  FIRE TO OPPOSING RATE OF PI/32 RAD/SEC.
058043,000406:                                                                                                  #  RUFLAW3:      ERROR RATE GREATER THAN PI/32 RAD/SEC AND ERROR WITHIN BOUNDS.  COAST IF BELOW FIREFCT, FIRE IF ABOVE
058044,000407: 
058045,000408: 17,3413           45013        RUFLAW1            CS       BIT12                                 #  DECREMENT EDOT BY PI/32 RAD/SEC, WHICH
058046,000409: 17,3414           27543                           ADS      EDOT                                  #        IS THE TARGET RATE.
058047,000410: 17,3415           00006                           EXTEND                                         
058048,000411: 17,3416           63437                           BZMF     SMALRATE                              #  BRANCH IF RATE LESS THAN TARGET.
058049,000412: 17,3417           03475                           TC       RUFSETUP                              #  REVERSE ROTSENSE AND INDICATE MAX JETS.
058050,000413: 17,3420           31543                           CAE      EDOT                                  #  PICK UP DESIRED RATE CHANGE.
058051,000414: 
058052,000415: 17,3421           00006        RUFLAW12           EXTEND                                         #  COMPUTE TJET
058053,000416: 17,3422           51741                           INDEX    ADRSDIF2                              #        = (DESIRED RATE CHANGE)/(2-JET ACCEL.)
058054,000417: 17,3423           71566                           MP       1/ANET1    +2                         
058055,000418: 17,3424           67712                           AD       -1/8                                  #  IF TJET, SCALED AT 32 SEC, EXCEEDS
058056,000419: 17,3425           00006                           EXTEND                                         #        4 SECONDS, SET TJET TO TJMAX.
058057,000420: 17,3426           63430                           BZMF     +2                                    
058058,000421: 17,3427           13250                           TCF      FULLTIME                              
058059,000422: 17,3430           00006                           EXTEND                                         
058060,000423: 17,3431           13250                           BZF      FULLTIME                              
058061,000424: 17,3432           65013                           AD       BIT12                                 #  RESTORE COMPUTED TJET TO ACCUMULATOR.
058062,000425: 17,3433           20001                           DAS      A                                     
058063,000426: 17,3434           20001                           DAS      A                                     
058064,000427: 17,3435           20001                           DAS      A                                     #  RESCALED TJET AT 4 SECONDS.
058065,000428: 17,3436           13406                           TCF      CHKMINTJ                              #  RETURN AS FROM FINELAW.
058066,000429: 
058067,000430: 17,3437           03477        SMALRATE           TC       RUFSETUP   +2                         #  SET NUMBERT AND FIREFCT FOR MAXIMUM JETS
058068,000431: 17,3440           11735                           CCS      ROTSENSE                              
058069,000432: 17,3441           35026                           CAF      ONE                                   #  MODIFY INDEXER TO POINT TO 1/ANET
058070,000433: 17,3442           13444                           TCF      +2                                    #        CORRESPONDING TO THE PROPER SENSE.
058071,000434: 17,3443           37721                           CAF      NEGONE                                
058072,000435: 17,3444           27741                           ADS      ADRSDIF2                              
058073,000436: 
058074,000437: 17,3445           41543                           CS       EDOT                                  #  PICK UP (PI/32-EDOT)=DESIRED CHANGE.
058075,000438: 17,3446           13421                           TCF      RUFLAW12                              
058076,000439: 
058077,000440: 17,3447           03475        RUFLAW2            TC       RUFSETUP                              #  REVERSE ROTSENSE AND INDICATE MAX JETS.
058078,000441: 17,3450           35013                           CAF      BIT12                                 
058079,000442: 17,3451           61543                           AD       EDOT                                  #  PICK UP(PI/32+EDOT) = DESIRED RATE CHANGE
058080,000443: 17,3452           54000                           TS       A                                     #  IF OVERFLOW SKIP, FIRE FOR FULL TIME.
058081,000444: 
058082,000445: 17,3453           13421                           TCF      RUFLAW12                              #  OTHERWISE, COMPUTE JET TIME.
058083,000446: 17,3454           13250                           TCF      FULLTIME                              
058084,000447: 
058085,000448: 17,3455           03475        RUFLAW3            TC       RUFSETUP                              #  EXECUTE COMMON RUFLAW SUBROUTINE.
058086,000449: 17,3456           51743                           INDEX    ADRSDIF1                              
058087,000450: 17,3457           41576                           CS       FIREDB                                #  CALCULATE DISTANCE FROM SWITCH CURVE
058088,000451: 17,3460           61542                           AD       E                                     #        1/ANET1*EDOT*EDOT +E - FIREDB = 0
058089,000452: 17,3461           00006                           EXTEND                                         #                SCALED AT 4 PI RADIANS
058090,000453: 17,3462           75014                           MP       BIT11                                 
058091,000454: 17,3463           57543                           XCH      EDOT                                  
058092,000455: 17,3464           00006                           EXTEND                                         
058093,000456: 17,3465           70000                           SQUARE                                         
058094,000457: 17,3466           00006                           EXTEND                                         
058095,000458: 17,3467           51743                           INDEX    ADRSDIF1                              
058096,000459: 17,3470           71566                           MP       1/ANET1    +2                         
058097,000460: 17,3471           61543                           AD       EDOT                                  
058098,000461: 17,3472           00006                           EXTEND                                         
058099,000462: 17,3473           63205                           BZMF     COASTTJ                               #  COAST IF BELOW IT.
058100,000463: 17,3474           13250                           TCF      FULLTIME                              #  FIRE FOR FULL PERIOD IF ABOVE IT.
058101,000464: 
058102,000465:                                                                                                  #  SUBROUTINE USED IN ALL ENTRIES TO ROUGHLAW.
058103,000466: 
058104,000467: 17,3475           41735        RUFSETUP           CS       ROTSENSE                              #  REVERSE ROTSENSE WHEN ENTER HERE.
058105,000468: 17,3476           55735                           TS       ROTSENSE                              
058106,000469: 17,3477           35024                 +2        CAF      FOUR                                  #  REQUIRE MAXIMUM (2) JETS IN U,V-AXES.
058107,000470: 17,3500           55740                           TS       NUMBERT                               
058108,000471: 17,3501           35010                           CAF      NEGMAX                                #  SUGGEST MAXIMUM (4) JETS IN P-AXIS.
058109,000472: 17,3502           55736                           TS       FIREFCT                               
058110,000473: 17,3503           00002                           TC       Q                                     
058111,000474: 
058112,000475:                                                                                                  #  CONSTANTS FOR TJETLAW
058113,000476: 
058114,000477: 17,3504           77757                           DEC      -16        B-14                       #  AXISDIFF(INDEX) = NUMBER OF REGISTERS
058115,000478: 17,3505           00000        AXISDIFF           DEC      +0         B-14                       #        BETWEEN STORED 1/ACCS PARAMETERS FOR
058116,000479: 17,3506           00020                           DEC      16         B-14                       #        THE INDEXED AXIS AND THE U-AXIS.
058117,000480: 17,3507           14400        SENSOR             OCT      14400                                 #  RATIO OF TJET SCALING WITHIN TJETLAW
058118,000481:                                                                                                  #        (4 SEC) TO SCALING FOR T6 (10.24 SEC).
058119,000482: 17,3510           76447        -2DEG              DEC      -.04444                               #  -2.0 DEGREES SCALED AT 45.
058120,000483: 17,3511           77750        -.0112A8           DEC      -.00141                               #  -.01125 SEC(2) SCALED AT 8.
058121,000484: 17,3512           00632        .1AT4              DEC      .025                                  #  0.1 SECOND SCALED AT 4.
058122,000485: 17,3513           01463        .1AT2              DEC      .05                                   #  0.1 SEC SCALED AT 2.
058123,000486: 17,3514           00232        .0375AT4           DEC      .00938                                #  .0375 SEC SCALED AT 4.
058124,000487: 17,3515           77462        -.025AT2           DEC      -.0125                                #  -.025 SEC SCALED AT 2.
058125,000488: 17,3516           77631        -.025AT4           DEC      -.00625                               
058126,000489: 17,3517           77145        -.05AT2            DEC      -.025                                 
058127,000490: 17,3520           75462        -.15AT2            DEC      -.075                                 
058128,000491: 17,3521           00007 25605  .00375A8           2DEC     .00375     B-3                        
058129,000492: 
058130,000493: 17,3523           76631        -TJMAX             DEC      -.0375                                #  LARGEST CALCULATED TIME.  .150 SEC AT 4.
058131,000494: 17,3524           00122        TJMIN              DEC      .005                                  #  SMALLEST ALLOWABLE TIME.  .020 SEC AT 4.
058132,000495: 17,3525           77655        -TJMIN             DEC      -.005                                 

End of include-file TJET_LAW.agc.  Parent file is MAIN.agc