Source Code

These source code files are an attempted reconstruction of Sundance revision 306, the Apollo 9 LM (Lunar Module) AGC (Apollo Guidance Computer) flight software, created from binary dumps of original core rope program modules, as follows:
  • B1 — Revision 292
  • B2 — Revision 302
  • B3 — Revision 302
  • B4 — Revision 302
  • B5 — Revision 292
  • B6 — Revision 306
These dumps were then modified using memos, checklists, observed address changes, and the Sundance GSOPs to get the entire program to match Sundance revision 306 as closely as possible. Without more information, it is not possible to say how close it actually is; however, this code should be quite close. It is capable of flying the whole Apollo 9 mission using the original checklists and padload. 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.

057905,000002:                                                                                                  ## Copyright:   Public domain.
057906,000003:                                                                                                  ## Filename:    TJET_LAW.agc
057907,000004:                                                                                                  ## Purpose:     A section of an attempt to reconstruct Sundance revision 306
057908,000005:                                                                                                  ##              as closely as possible with available information. Sundance
057909,000006:                                                                                                  ##              306 is the source code for the Lunar Module's (LM) Apollo
057910,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 9. This program was created
057911,000008:                                                                                                  ##              using the mixed-revision SundanceXXX as a starting point, and
057912,000009:                                                                                                  ##              pulling back features from Luminary 69 believed to have been
057913,000010:                                                                                                  ##              added based on memos, checklists, observed address changes,
057914,000011:                                                                                                  ##              or the Sundance GSOPs.
057915,000012:                                                                                                  ## Assembler:   yaYUL
057916,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
057917,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
057918,000015:                                                                                                  ## Mod history: 2020-07-24 MAS  Created from SundanceXXX.
057919,000016: 
057920,000017: 
057921,000018: 
057922,000019:                                                                                                  #  PROGRAM DESCRIPTION
057923,000020:                                                                                                  #  DESIGNED BY:  R. D. GOSS AND P. S. WEISSMAN
057924,000021:                                                                                                  #  CODED BY:  P. S. WEISSMAN 28 FEBRUARY 1968
057925,000022: 
057926,000023:                                                                                                  #  TJETLAW IS CALLED AS A SUBROUTINE WHEN THE LEM IS NOT DOCKED AND THE AUTOPILOT IS IN THE AUTOMATIC OR
057927,000024:                                                                                                  #  ATTITUDE-HOLD MODE TO CALCULATE THE JET-FIRING-TIME (TJET) REQUIRED FOR THE AXIS INDICATED BY AXISCTR:
057928,000025:                                                                                                  #        -1      INDICATES THE P-AXIS
057929,000026:                                                                                                  #        +0      INDICATES THE U-AXIS
057930,000027:                                                                                                  #        +1      INDICATES THE V-AXIS.
057931,000028:                                                                                                  #  THE REGISTERS E AND EDOT CONTAIN THE APPROPRIATE ATTITUDE ERROR AND ERROR RATE AND SENSETYP SHOWS WHETHER
057932,000029:                                                                                                  #  UNBALANCED COUPLES ARE PREFERRED.  TJETLAW ALSO USES VARIOUS FUNCTIONS OF ACCELERATION AND DEADBAND WHICH ARE
057933,000030:                                                                                                  #  COMPUTED IN THE 1/ACCONT SECTION OF 1/ACCS AND ARE STORED IN SUCH AN ORDER THAT THEY CAN BE CONVENIENTLY
057934,000031:                                                                                                  #  ACCESSED BY INDEXING.
057935,000032: 
057936,000033:                                                                                                  #  THE SIGN OF THE REQUIRED ROTATION IS CARRIED THROUGH TJETLAW AS ROTSENSE AND IS FINALLY APPLIED TO TJET JUST
057937,000034:                                                                                                  #  PREVIOUS TO ITS STORAGE IN THE LOCATION CORRESPONDING TO THE AXIS (TJP, TJU OR TJV).  THE NUMBER OF JETS THAT
057938,000035:                                                                                                  #  TJETLAW ASSUMES WILL BE USED IS INDICATED BY THE SETTING OF NUMBERT FOR THE U- OR V-AXIS.  TWO JETS ARE ALWAYS
057939,000036:                                                                                                  #  ASSUMED FOR THE P-AXIS  ALTHOUGH FOUR JETS WILL BE FIRED WHEN FIREFCT IS MORE NEGATIVE THAN -4.0 DEGREES
057940,000037:                                                                                                  #  (FIREFCT IS THE DISTANCE TO A SWITCH CURVE IN THE PHASE PLANE) AND A LONG FIRING IS CALLED FOR.
057941,000038: 
057942,000039:                                                                                                  #  IN ORDER TO AVOID SCALING DIFFICULTIES, SIMPLE ALGORITHMS TAGGED RUFLAW1, -2 AND -3 ARE RESORTED TO WHEN THE
057943,000040:                                                                                                  #  ERROR AND/OR ERROR RATE ARE LARGE.
057944,000041: 
057945,000042:                                                                                                  #  CALLING SEQUENCE:
057946,000043:                                                                                                  #                TC      TJETLAW         (MUST BE IN JASK)
057947,000044:                                                                                                  #        OR
057948,000045:                                                                                                  #                INHINT                  (MUST BE IN JASK)
057949,000046:                                                                                                  #                TC      IBNKCALL
057950,000047:                                                                                                  #                CADR    TJETLAW
057951,000048:                                                                                                  #                RELINT
057952,000049: 
057953,000050:                                                                                                  #  EXIT:         RETURN TO Q.
057954,000051: 
057955,000052:                                                                                                  #  INPUT:
057956,000053:                                                                                                  #        FROM THE CALLER:  E, EDOT, AXISCTR, SENSETYP, TJP,-U,-V.
057957,000054:                                                                                                  #        FROM 1/ACCONT:  48 ERASABLES BEGINNING AT BLOCKTOP (INCLUDING FLAT, ZONE3LIM AND ACCSWU,-V).
057958,000055: 
057959,000056:                                                                                                  #  OUTPUT:
057960,000057:                                                                                                  #        TJP,-U OR -V, NUMBERT (DAPTEMP5), FIREFCT (DAPTEMP3).
057961,000058: 
057962,000059:                                                                                                  #  DEBRIS:
057963,000060:                                                                                                  #        A, L, Q, E, EDOT, DAPTEMP1-6, DAPTREG1-4.
057964,000061: 
057965,000062:                                                                                                  #  ALARM:  NONE
057966,000063: 
057967,000064: 17,3035                                           BANK     17                                    
057968,000065: 17,2000                                           SETLOC   DAPS2                                 
057969,000066: 17,2000                                           BANK                                           
057970,000067: 17,3035  E6,1516                                  EBANK=   TJP                                   
057971,000068: 17,3035                                           COUNT*   $$/DAPTJ                              
057972,000069: 
057973,000070: 17,3035           00006        TJETLAW            EXTEND                                         #  SAVE Q FOR RETURN.
057974,000071: 17,3036           23742                           QXCH     HOLDQ                                 
057975,000072: 
057976,000073:                                                                                                  #  SET INDEXERS TO CORRESPOND TO THE AXIS AND TO THE SIGN OF EDOT
057977,000074: 
057978,000075: 17,3037           51471                           INDEX    AXISCTR                               #  AXISDIFF(-1)=NO OF LOCATIONS BER P AND U
057979,000076: 17,3040           33505                           CAF      AXISDIFF                              #  AXISDIFF(0) = 0
057980,000077: 17,3041           55743                           TS       ADRSDIF1                              #  AXISDIFF(+1)=NO OF LOCATIONS BET V AND U
057981,000078: 
057982,000079: 17,3042           31543                           CAE      EDOT                                  #  IF EDOT NEGATIVE, PICK UP SET OF VALUES
057983,000080: 17,3043           00006                           EXTEND                                         #        THAT ALLOW USE OF SAME CODING AS FOR
057984,000081: 17,3044           63051                           BZMF     NEGEDOT                               #        POSITIVE EDOT.
057985,000082: 17,3045           31743                           CAE      ADRSDIF1                              #  SET A SECOND INDEXER WHICH MAY BE
057986,000083: 17,3046           55741                           TS       ADRSDIF2                              #        MODIFIED BY A DECISION FOR MAX JETS.
057987,000084: 17,3047           33507                           CAF      SENSOR                                #  FOR POSITIVE EDOT, ROTSENSE IS
057988,000085: 17,3050           13061                           TCF      SETSENSE                              #        INITIALIZED POSITIVE.
057989,000086: 
057990,000087: 17,3051           41542        NEGEDOT            CS       E                                     #  IN ORDER FOR NEG EDOT CASE TO USE CODING
057991,000088: 17,3052           55542                           TS       E                                     #        OF POS EDOT, MUST MODIFY AS FOLLOWS:
057992,000089: 17,3053           41543                           CS       EDOT                                  #        1. COMPLEMENT E AND EDOT.
057993,000090: 17,3054           55543                           TS       EDOT                                  #        2. SET SENSE OF ROTATION TO NEGATIVE
057994,000091: 17,3055           35026                           CAF      BIT1                                  #           (REVERSED LATER IF NECESSARY).
057995,000092: 17,3056           27743                           ADS      ADRSDIF1                              #        3. INCREMENT INDEXERS BY ONE SO THAT
057996,000093: 17,3057           55741                           TS       ADRSDIF2                              #           THE PROPER PARAMETERS ARE ACCESSED.
057997,000094: 17,3060           43507                           CS       SENSOR                                
057998,000095: 17,3061           55735        SETSENSE           TS       ROTSENSE                              
057999,000096: 
058000,000097:                                                                                                  #  TEST MAGNITUDE OF E (ATTITUDE ERROR, SINGLE-PRECISION, SCALED AT PI RADIANS):
058001,000098:                                                                                                  #        IF GREATER THAN (OR EQUAL TO) PI/16 RADIANS, GO TO THE SIMPLIFIED TJET ROUTINE.
058002,000099:                                                                                                  #        IF LESS THAN PI/16 RADIANS, RESCALE TO PI/4.
058003,000100: 
058004,000101: 17,3062           31542                           CAE      E                                     #  PICK UP ATTITUDE ERROR FOR THIS AXIS
058005,000102: 17,3063           00006                           EXTEND                                         
058006,000103: 17,3064           75022                           MP       BIT5                                  #  SHIFT RIGHT TEN BITS:  IF A-REGISTER IS
058007,000104: 17,3065           10000                           CCS      A                                     #        ZERO, RESCALE AND TEST EDOT.
058008,000105: 17,3066           13447                           TCF      RUFLAW2                               
058009,000106: 17,3067           13071                           TCF      SCALEE                                
058010,000107: 17,3070           13413                           TCF      RUFLAW1                               
058011,000108: 17,3071           35012        SCALEE             CAF      BIT13                                 #  ERROR IS IN L SCALED AT PI/16.  RESCALE
058012,000109: 17,3072           00006                           EXTEND                                         #        IT TO PI/4 AND SAVE IT.
058013,000110: 17,3073           70001                           MP       L                                     
058014,000111: 17,3074           55542                           TS       E                                     
058015,000112: 
058016,000113:                                                                                                  #  TEST MAGNITUDE OF EDOT (ERROR RATE SCALED AT PI/4 RADIANS/SECOND)
058017,000114:                                                                                                  #        IF GREATER THAN (OR EQUAL TO) PI/32 RADIANS/SECOND, GO TO THE SIMPLIFIED TJET ROUTINE.
058018,000115:                                                                                                  #        IF LESS THAN PI/32 RADIANS/SECOND, THEN RESCALE TO PI/32 RADIANS/SECOND.
058019,000116: 
058020,000117: 17,3075           31543                           CAE      EDOT                                  #  PICK UP SINGLE-PRECISION ERROR-RATE
058021,000118: 17,3076           00006                           EXTEND                                         #  FOR THIS AXIS=
058022,000119: 17,3077           75023                           MP       BIT4                                  #  SHIFT RIGHT ELEVEN BITS, IF THE A-REG IS
058023,000120: 17,3100           00006                           EXTEND                                         #  ZERO, THEN RESCALE AND USE FINELAW.
058024,000121: 17,3101           13103                           BZF      SCALEDOT                              
058025,000122: 17,3102           13455                           TCF      RUFLAW3                               
058026,000123: 
058027,000124:                                                                                                  #  *** FINELAW STARTS HERE ***
058028,000125: 
058029,000126: 17,3103           23543        SCALEDOT           LXCH     EDOT                                  #  EDOT IS SCALED AT PI/32 RADIANS/SECOND.
058030,000127: 
058031,000128: 17,3104           31543                           CAE      EDOT                                  #  COMPUTE (EDOT)(EDOT)
058032,000129: 17,3105           00006                           EXTEND                                         
058033,000130: 17,3106           70000                           SQUARE                                         #  PRODUCT SCALED AT PI(2)/2(10) RAD/SEC.
058034,000131: 17,3107           00006                           EXTEND                                         
058035,000132: 17,3110           75012                           MP       BIT13                                 #  SHIFT RIGHT TWO BITS TO RESCALE EDOTSQ
058036,000133: 17,3111           55734                           TS       EDOTSQ                                #        TO PI(2)/2(8) RAD(2)/SEC(2).
058037,000134: 
058038,000135: 17,3112           11542        ERRTEST            CCS      E                                     #  DOES BIG ERROR (TWO DEGREES BEYOND THE
058039,000136: 17,3113           63510                           AD       -2DEG                                 #  DEADBAND) REQUIRE MAXIMUM JETS?
058040,000137: 17,3114           13116                           TCF      +2                                    
058041,000138: 17,3115           63510                           AD       -2DEG                                 
058042,000139: 17,3116           00006                           EXTEND                                         
058043,000140: 17,3117           51743                           INDEX    ADRSDIF1                              
058044,000141: 17,3120           61576                           SU       FIREDB                                
058045,000142: 17,3121           00006                           EXTEND                                         
058046,000143: 17,3122           63127                           BZMF     SENSTEST                              #  IF NOT:  ARE UNBALANCED JETS PREFERRED|
058047,000144: 17,3123           35025        MAXJETS            CAF      TWO                                   #  IF YES:  INCREMENT ADDRESS LOCATOR AND
058048,000145: 17,3124           27741                           ADS      ADRSDIF2                              #           SET SWITCH FOR JET SELECT LOGIC TO 4.
058049,000146: 17,3125           35024                           CAF      FOUR                                  #           (ALWAYS DO THIS FOR P-AXIS)
058050,000147: 17,3126           13132                           TCF      TJCALC                                
058051,000148: 17,3127           11472        SENSTEST           CCS      SENSETYP                              #  DOES TRANSLATION PREFER MIN JETS.
058052,000149: 17,3130           13132                           TCF      TJCALC                                #  YES.  USE MIN-JET PARAMETERS.
058053,000150: 17,3131           13123                           TCF      MAXJETS                               #  NO.  GET MAX-JET PARAMETERS.
058054,000151: 17,3132           55740        TJCALC             TS       NUMBERT                               #  SET TO +0,1,4 FOR (U,V-AXES) JET SELECT.
058055,000152: 
058056,000153:                                                                                                  #  BEGINNING OF TJET CALCULATIONS:
058057,000154: 
058058,000155: 17,3133           41734                           CS       EDOTSQ                                #  SCALED AT PI(2)/2(8).
058059,000156: 17,3134           00006                           EXTEND                                         
058060,000157: 17,3135           51741                           INDEX    ADRSDIF2                              
058061,000158: 17,3136           71564                           MP       1/ANET1                               #  .5/ACC SCALED AT 2(6)/PI SEC(2)/RADIAN.
058062,000159: 17,3137           51743                           INDEX    ADRSDIF1                              
058063,000160: 17,3140           61576                           AD       FIREDB                                #  DEADBAND SCALED AT PI/4 RADIAN.
058064,000161: 17,3141           00006                           EXTEND                                         
058065,000162: 17,3142           61542                           SU       E                                     #  ATTITUDE ERROR SCALED AT PI/4 RADIAN.
058066,000163: 17,3143           55736                           TS       FIREFCT                               #  -E-.5(EDOTSQ)/ACC-DB AT PI/4 RADIAN.
058067,000164: 17,3144           00006                           EXTEND                                         
058068,000165: 17,3145           63325                           BZMF     ZON1,2,3                              
058069,000166: 
058070,000167: 17,3146           51743        ZONE4,5            INDEX    ADRSDIF1                              
058071,000168: 17,3147           31570                           CAE      1/ACOAST                              #  .5/ACC SCALED AT 2(6)/PI WHERE
058072,000169: 17,3150           00006                           EXTEND                                         #  ACC = MAX(AMIN, AOS-).
058073,000170: 17,3151           71734                           MP       EDOTSQ                                #  SCALED AT PI/2(8).
058074,000171: 17,3152           61542                           AD       E                                     #  SCALED AT PI/4
058075,000172: 17,3153           51743                           INDEX    ADRSDIF1                              
058076,000173: 17,3154           61600                           AD       COASTDB                               #  SCALED AT PI/4 POS. FOR NEG. INTERCEPT.
058077,000174: 17,3155           00006                           EXTEND                                         #  TEST E+.5(EDOTSQ)/ACC+DB AT PI/4 RADIAN.
058078,000175: 17,3156           63211                           BZMF     ZONE5                                 #  IF FUNCTION NEGATIVE, FIND TJET.
058079,000176:                                                                                                  #  IF FUNCTION POSITIVE, IN ZONE 4.
058080,000177: 
058081,000178:                                                                                                  #  ZONE 4 IS THE COAST REGION.  HOWEVER, IF THE JETS ARE ON AND DRIVING TOWARD
058082,000179:                                                                                                  #        A. THE AXIS WITHIN + OR - (DB + FLAT) FOR DRIFTING FLIGHT, OR
058083,000180:                                                                                                  #        B. THE USUAL TARGET PARABOLA FOR POWERED FLIGHT
058084,000181:                                                                                                  #  THEN THE THRUSTERS ARE KEPT ON.
058085,000182: 
058086,000183: 17,3157           51471        ZONE4              INDEX    AXISCTR                               #  IS THE CURRENT VALUE IN TJET NON-ZERO
058087,000184: 17,3160           41517                           CS       TJETU                                 #        WITH SENSE OPPOSITE TO EDOT,
058088,000185: 17,3161           00006                           EXTEND                                         #        (I.E., ARE JETS ON AND FIRING TOWARD
058089,000186: 17,3162           71735                           MP       ROTSENSE                              #        THE DESIRABLE STATE).
058090,000187: 17,3163           00006                           EXTEND                                         
058091,000188: 17,3164           63205                           BZMF     COASTTJ                               #  NO.  COAST.
058092,000189: 
058093,000190: 17,3165           11552        JETSON             CCS      FLAT                                  #  YES.  IS THIS DRIFTING OR POWERED FLIGHT|
058094,000191: 17,3166           13177                           TCF      DRIFT/ON                              #  DRIFTING.  GO MAKE FURTHER TEST.
058095,000192: 
058096,000193: 17,3167           41736                           CS       FIREFCT                               #  POWERED (OR ULLAGE).  CAN TARGET PARABOLA
058097,000194: 17,3170           51743                           INDEX    ADRSDIF1                              #        BE REACHED FROM THIS POINT IN THE
058098,000195: 17,3171           61602                           AD       AXISDIST                              #        PHASE PLANE|
058099,000196: 17,3172           00006                           EXTEND                                         
058100,000197: 17,3173           63205                           BZMF     COASTTJ                               #  NO. SET TJET = 0.
058101,000198: 17,3174           03311                           TC       Z123COMP                              #  YES.  CALCULATE TJET AS THOUGH IN ZONE 1
058102,000199: 17,3175           31736                           CAE      FIREFCT                               #        AFTER COMPUTING THE REQUIRED
058103,000200: 17,3176           13345                           TCF      ZONE1                                 #        PARAMETERS.
058104,000201: 
058105,000202: 17,3177           51743        DRIFT/ON           INDEX    ADRSDIF1                              #  CAN TARGET STRIP OF AXIS BE REACHED FROM
058106,000203: 17,3200           41576                           CS       FIREDB                                #        THIS POINT IN THE PHASE PLANE|
058107,000204: 17,3201           60000                           DOUBLE                                         
058108,000205: 17,3202           61736                           AD       FIREFCT                               
058109,000206: 17,3203           00006                           EXTEND                                         
058110,000207: 17,3204           63207                           BZMF     +3                                    
058111,000208: 17,3205           35030        COASTTJ            CAF      ZERO                                  #  NO.  SET TJET = 0.
058112,000209: 17,3206           13251                           TCF      RETURNTJ                              
058113,000210: 
058114,000211: 17,3207           03311                           TC       Z123COMP                              #  YES. CALCULATE TJET AS THOUGH IN ZONE 2
058115,000212: 17,3210           13332                           TCF      ZONE2,3                               #        OR 3 AFTER COMPUTING REQUIRED VALUES.
058116,000213: 
058117,000214: 17,3211           54001        ZONE5              TS       L                                     #  TEMPORARILY STORE FUNCTION IN L.
058118,000215: 17,3212           11735                           CCS      ROTSENSE                              #  MODIFY ADRSDIF2 FOR ACCESSING 1/ANET2
058119,000216: 17,3213           13217                           TCF      +4                                    #  AND ACCFCTZ5, WHICH MUST BE PICKED UP
058120,000217: 17,3214           05726                           TC       CCSHOLE                               #  FROM THE NEXT LOWER REGISTER IF THE
058121,000218: 17,3215           45025                           CS       TWO                                   #  (ACTUAL) ERROR RATE IS NEGATIVE.
058122,000219: 17,3216           27741                           ADS      ADRSDIF2                              
058123,000220: 
058124,000221: 17,3217           30001                 +4        CAE      L                                     
058125,000222: 17,3220           00006                           EXTEND                                         
058126,000223: 17,3221           51741                           INDEX    ADRSDIF2                              #  TTOAXIS AND HH ARE THE PARAMETERS UPON
058127,000224: 17,3222           71573                           MP       ACCFCTZ5                              #        WHICH THE APPROXIMATIONS TO TJET ARE
058128,000225: 17,3223           20001                           DDOUBL                                         #        BASED.
058129,000226: 17,3224           20001                           DDOUBL                                         
058130,000227: 17,3225           53745                           DXCH     HH                                    #  DOUBLE PRECISION H SCALED AT 8 SEC(2).
058131,000228: 17,3226           51741                           INDEX    ADRSDIF2                              
058132,000229: 17,3227           31565                           CAE      1/ANET2                               #  SCALED AT 2(7)/PI SEC(2)/RAD.
058133,000230: 17,3230           00006                           EXTEND                                         
058134,000231: 17,3231           71543                           MP       EDOT                                  #  SCALED AT PI/2(5)
058135,000232: 17,3232           55737                           TS       TTOAXIS                               #  SCALED AT 4 SEC.
058136,000233: 
058137,000234:                                                                                                  #  TEST WHETHER TJET GREATER THAN 50 MSEC.
058138,000235: 
058139,000236: 17,3233           00006                           EXTEND                                         
058140,000237: 17,3234           73517                           MP       -.05AT2                               #  H - .05 TTOAXIS - .00125 G.T. ZERO
058141,000238: 17,3235           61744                           AD       HH                                    #        (SCALED AT 8 SEC(2) ).
058142,000239: 17,3236           67720                           AD       NEG2                                  
058143,000240: 17,3237           00006                           EXTEND                                         
058144,000241: 17,3240           63266                           BZMF     FORMULA1                              
058145,000242: 
058146,000243:                                                                                                  #  TEST WHETHER TJET GREATER THAN 150 MSEC.
058147,000244: 
058148,000245: 17,3241           31737                           CAE      TTOAXIS                               
058149,000246: 17,3242           00006                           EXTEND                                         
058150,000247: 17,3243           73520                           MP       -.15AT2                               #  H - .15 TTOAXIS - .01125 G.T. ZERO
058151,000248: 17,3244           61744                           AD       HH                                    #        (SCALED AT 8 SEC(2) )
058152,000249: 17,3245           63511                           AD       -.0112A8                              
058153,000250: 17,3246           00006                           EXTEND                                         
058154,000251: 17,3247           63276                           BZMF     FORMULA2                              
058155,000252: 
058156,000253:                                                                                                  #  IF TJET GREATER THAN 150 MSEC, ASSIGN IT VALUE OF 250 MSEC, SINCE THIS
058157,000254:                                                                                                  #  IS ENOUGH TO ASSURE NO SKIP NEXT CSP (100 MSEC).
058158,000255: 
058159,000256: 17,3250           35014        FULLTIME           CAF      BIT11                                 #  250 MSEC SCALED AT 4 SEC.
058160,000257: 
058161,000258:                                                                                                  #  RETURN TO CALLING PROGRAM WITH JET TIME SCALED AS TIME6 AND SIGNED.
058162,000259: 
058163,000260: 17,3251           00006        RETURNTJ           EXTEND                                         #  ALL BRANCHES TERMINATE HERE WITH TJET
058164,000261: 17,3252           71735                           MP       ROTSENSE                              #        (SCALED AT 4 SEC) IN THE ACCUMULATOR.
058165,000262: 17,3253           51471                           INDEX    AXISCTR                               #  ROTSENSE APPLIES SIGN AND CHANGES SCALE.
058166,000263: 17,3254           55517                           TS       TJETU                                 
058167,000264: 17,3255           00006                           EXTEND                                         
058168,000265: 17,3256           51471                           INDEX    AXISCTR                               
058169,000266: 17,3257           71544                           MP       ACCSWU                                #  SET SWITCH FOR JET SELECT IF ROTATION IS
058170,000267: 17,3260           30001                           CAE      L                                     
058171,000268: 17,3261           00006                           EXTEND                                         #        IN A SENSE FOR WHICH 1/ACCS HAS FORCED
058172,000269: 17,3262           63265                           BZMF     +3                                    #        A MAX-JET CALCULATION.
058173,000270: 17,3263           35024                           CAF      FOUR                                  
058174,000271: 17,3264           55740                           TS       NUMBERT                               
058175,000272: 17,3265           01742                           TC       HOLDQ                                 #  RETURN VIA SAVED Q.
058176,000273: 
058177,000274:                                                                                                  #  TJET = H/(.025 + TTOAXIS)     FOR TJET LESS THAN 50 MSEC.
058178,000275: 
058179,000276: 17,3266           43516        FORMULA1           CS       -.025AT4                              #  .025 SEC SCALED AT 4.
058180,000277: 17,3267           61737                           AD       TTOAXIS                               #  SCALED AT 4 SECONDS.
058181,000278: 17,3270           53745                           DXCH     HH                                    #  STORE DENOMINATOR IN FIRST WORD OF H,
058182,000279: 17,3271           00006                           EXTEND                                         #        WHICH NEED NOT BE PRESERVED.  PICK UP
058183,000280: 17,3272           11744                           DV       HH                                    #        DP H AND DIVIDE BY DENOMINATOR.
058184,000281: 17,3273           00006                           EXTEND                                         
058185,000282: 17,3274           75011                           MP       BIT14                                 #  RESCALE TJET FROM 2 TO USUAL 4 SEC.
058186,000283: 17,3275           13406                           TCF      CHKMINTJ                              #  CHECK THAT TJET IS NOT LESS THAN MINIMUM
058187,000284: 
058188,000285:                                                                                                  #  TJET = (H + .00375)/(0.1 + TTOAXIS)   FOR TJET GREATER THAN 50 MSEC.
058189,000286: 
058190,000287: 17,3276           00006        FORMULA2           EXTEND                                         
058191,000288: 17,3277           33522                           DCA      .00375A8                              #  .00375 SEC(2) SCALED AT 8.
058192,000289: 17,3300           21745                           DAS      HH                                    #  STORE NUMERATOR IN DP H, WHICH NEED NOT
058193,000290:                                                                                                  #        BE PRESERVED.
058194,000291: 17,3301           31737                           CAE      TTOAXIS                               #  SCALED AT 4 SEC.
058195,000292: 17,3302           63512                           AD       .1AT4                                 #  0.1 SEC SCALED AT 4.
058196,000293: 17,3303           53745                           DXCH     HH                                    #  STORE DENOMINATOR IN FIRST WORD OF H,
058197,000294: 17,3304           00006                           EXTEND                                         #        WHICH NEED NOT BE PRESERVED.  PICK UP
058198,000295: 17,3305           11744                           DV       HH                                    #        DP NUMERATOR AND DIVIDE BY DENOMINATOR
058199,000296: 17,3306           00006                           EXTEND                                         
058200,000297: 17,3307           75011                           MP       BIT14                                 #  RESCALE TJET FROM 2 TO USUAL 4 SEC.
058201,000298: 17,3310           13251                           TCF      RETURNTJ                              #  END SUBROUTINE.
058202,000299: 
058203,000300:                                                                                                  #  SUBROUTINIZED COMPUTATIONS REQUIRED FOR ALL ENTRIES INTO CODING FOR ZONES 1, 2, AND 3.
058204,000301:                                                                                                  #  REACHED BY TC FROM 3 POINTS IN TJETLAW.
058205,000302: 
058206,000303: 17,3311           41735        Z123COMP           CS       ROTSENSE                              #  USED IN RETURNTJ SECTION TO RESCALE TJET
058207,000304: 17,3312           55735                           TS       ROTSENSE                              #        AS TIME6 AND GIVE IT PROPER SIGN.
058208,000305: 17,3313           31543                           CAE      EDOT                                  #  SCALED AT PI/2(5) RAD/SEC.
058209,000306: 17,3314           00006                           EXTEND                                         
058210,000307: 17,3315           51741                           INDEX    ADRSDIF2                              
058211,000308: 17,3316           71564                           MP       1/ANET1                               #  SCALED AT 2(7)/PI SEC(2)/RAD.
058212,000309: 17,3317           55737                           TS       TTOAXIS                               #  STORE TIME-TO-AXIS SCALED AT 4 SECONDS.
058213,000310: 17,3320           63523                           AD       -TJMAX                                
058214,000311: 17,3321           00006                           EXTEND                                         #  IS TIME TO AXIS LESS THAN 150 MSEC.
058215,000312: 17,3322           63324                           BZMF     +2                                    
058216,000313: 17,3323           13250                           TCF      FULLTIME                              #  NO. FIRE JETS, DO NOT CALCULATE TJET.
058217,000314: 17,3324           00002                           RETURN                                         #  YES.  GO ON TO FIND TJET
058218,000315: 
058219,000316: 17,3325           03311        ZON1,2,3           TC       Z123COMP                              #  SUBROUTINIZED PREPARATION FOR ZONE1,2,3.
058220,000317: 
058221,000318:                                                                                                  #  IF THE (NEG) DISTANCE BEYOND PARABOLA IS LESS THAN FLAT, USE SPECIAL
058222,000319:                                                                                                  #  LOGIC TO ACQUIRE MINIMUM IMPULSE LIMIT CYCLE.  DURING POWERED FLIGHT
058223,000320:                                                                                                  #  OR ULLAGE, FLAT = 0
058224,000321: 
058225,000322: 17,3326           31736                           CAE      FIREFCT                               #  SCALED AT PI/4 RAD.
058226,000323: 17,3327           61552                           AD       FLAT                                  
058227,000324: 17,3330           00006                           EXTEND                                         
058228,000325: 17,3331           63345                           BZMF     ZONE1                                 #  NOT IN SPECIAL ZONES.
058229,000326: 
058230,000327:                                                                                                  #  FIRE FOR AXIS OR, IF CLOSE, FIRE MINIMUM IMPULSE.  IF ON AXIS, COAST.
058231,000328: 
058232,000329: 17,3332           41553        ZONE2,3            CS       ZONE3LIM                              #  HEIGHT OF MIN-IMPULSE ZONE SET BY 1/ACCS
058233,000330: 17,3333           61737                           AD       TTOAXIS                               #        35 MSEC IN DRIFTING FLIGHT
058234,000331: 17,3334           00006                           EXTEND                                         #        ZERO WHEN TRYING TO ENTER GTS CONTROL.
058235,000332: 17,3335           63340                           BZMF     ZONE3                                 
058236,000333: 17,3336           31737        ZONE2              CAE      TTOAXIS                               #  FIRE TO AXIS.
058237,000334: 17,3337           13251                           TCF      RETURNTJ                              
058238,000335: 17,3340           11543        ZONE3              CCS      EDOT                                  #  CHECK IF EDOT IS ZERO.
058239,000336: 17,3341           35021                           CAF      BIT6                                  #  FIRE A ONE-JET MINIMUM IMPULSE.
058240,000337: 17,3342           13251                           TCF      RETURNTJ                              #  TJET = +0.
058241,000338: 17,3343           05726                           TC       CCSHOLE                               #  CANNOT BE BECAUSE NEG EDOT COMPLEMENTED.
058242,000339: 17,3344           13251                           TCF      RETURNTJ                              #  TJET = +0.
058243,000340: 
058244,000341: 17,3345           00006        ZONE1              EXTEND                                         
058245,000342: 17,3346           51743                           INDEX    ADRSDIF1                              
058246,000343: 17,3347           61602                           SU       AXISDIST                              #  SCALED AT PI/4 RAD.
058247,000344: 17,3350           00006                           EXTEND                                         
058248,000345: 17,3351           51741                           INDEX    ADRSDIF2                              
058249,000346: 17,3352           71572                           MP       ACCFCTZ1                              #  SCALED AT 2(7)/PI SEC(2)/RAD.
058250,000347: 17,3353           20001                           DDOUBL                                         
058251,000348: 17,3354           20001                           DDOUBL                                         
058252,000349: 17,3355           53745                           DXCH     HH                                    #  DOUBLE PRECISION H SCALED AT 8 SEC(2).
058253,000350: 
058254,000351:                                                                                                  #  TEST WHETHER TOTAL TIME REQUIRED GREATER THAN 150 MSEC:
058255,000352:                                                                                                  #                             2                                   2
058256,000353:                                                                                                  #        IS .5(.150 - TTOAXIS)  - H  NEGATIVE (SCALED AT 8 SECONDS )
058257,000354: 
058258,000355: 17,3356           31737                           CAE      TTOAXIS                               #  TTOAXIS SCALED AT 4 SECONDS.
058259,000356: 17,3357           63523                           AD       -TJMAX                                #  -.150 SECOND SCALED AT 4.
058260,000357: 17,3360           00006                           EXTEND                                         
058261,000358: 17,3361           70000                           SQUARE                                         
058262,000359: 17,3362           00006                           EXTEND                                         
058263,000360: 17,3363           61744                           SU       HH                                    #  HIGH WORD OF H SCALED AT 8 SEC(2).
058264,000361: 17,3364           00006                           EXTEND                                         
058265,000362: 17,3365           63250                           BZMF     FULLTIME                              #  YES.  NEED NOT CALCULATE TJET.
058266,000363: 
058267,000364:                                                                                                  #  TEST WHETHER TIME BEYOND AXIS GREATER THAN 50 MSEC TO DETERMINE WHICH APPROXIMATION TO USE.
058268,000365: 
058269,000366: 17,3366           31744                           CAE      HH                                    
058270,000367: 17,3367           67720                           AD       NEG2                                  
058271,000368: 17,3370           00006                           EXTEND                                         
058272,000369: 17,3371           63401                           BZMF     FORMULA3                              
058273,000370: 
058274,000371:                                                                                                  #  TJET = H/0.1 + TTOAXIS + .0375        FOR APPROXIMATION OVER MORE THAN 50 MSEC.
058275,000372: 
058276,000373: 17,3372           33513                           CAF      .1AT2                                 #  STORE .1 SEC SCALED AT 2 FOR DIVISION.
058277,000374: 17,3373           53745                           DXCH     HH                                    #  DP H SCALED AT 8 SEC(2) NEED NOT BE
058278,000375: 17,3374           00006                           EXTEND                                         #        PRESERVED.
058279,000376: 17,3375           11744                           DV       HH                                    #  QUOTIENT SCALED AT 4 SECONDS.
058280,000377: 17,3376           61737                           AD       TTOAXIS                               #  SCALED AT 4 SEC.
058281,000378: 17,3377           63514                           AD       .0375AT4                              #  .0375 SEC SCALED AT 4.
058282,000379: 17,3400           13251                           TCF      RETURNTJ                              #  END COMPUTATION.
058283,000380: 
058284,000381:                                                                                                  #  TJET = H/.O25 + TTOAXIS       FOR APPROXIMATION OVER LESS THAN 50 MSEC.
058285,000382: 
058286,000383: 17,3401           43515        FORMULA3           CS       -.025AT2                              #  STORE +.025 SEC SCALED AT 2 FOR DIVISION
058287,000384: 17,3402           53745                           DXCH     HH                                    #  PICK UP DP H AT 8, WHICH NEED NOT BE
058288,000385: 17,3403           00006                           EXTEND                                         #        PRESERVED.
058289,000386: 17,3404           11744                           DV       HH                                    #  QUOTIENT SCALED AT 4 SECONDS.
058290,000387: 17,3405           61737                           AD       TTOAXIS                               #  SCALED AT 4 SEC.
058291,000388: 
058292,000389:                                                                                                  #  IF COMPUTED JET TIME IS LESS THAN TJMIN, TJET IS SET TO ZERO.
058293,000390:                                                                                                  #  MINIMUM IMPULSES REQUIRED IN ZONE 3 ARE NOT SUBJECT TO THIS CONSTRAINT, NATURALLY.
058294,000391: 
058295,000392: 17,3406           63525        CHKMINTJ           AD       -TJMIN                                #  IS COMPUTED TIME LESS THAN THE MINIMUM.
058296,000393: 17,3407           00006                           EXTEND                                         
058297,000394: 17,3410           63205                           BZMF     COASTTJ                               #  YES, SET TIME TO ZERO.
058298,000395: 17,3411           63524                           AD       TJMIN                                 #  NO, RESTORE COMPUTED TIME.
058299,000396: 17,3412           13251                           TCF      RETURNTJ                              #  END COMPUTATION.
058300,000397: 
058301,000398:                                                                                                  #  *** ROUGHLAW ***
058302,000399: 
058303,000400:                                                                                                  #  BEFORE ENTRY TO RUFLAW:
058304,000401:                                                                                                  #        1. INDEXERS ADRSDIF1 AND ADRSDIF2 ARE SET ON BASIS OF AXIS, AND SIGN OF EDOT.
058305,000402:                                                                                                  #        2. IF EDOT WAS NEGATIVE, E AND EDOT ARE ROTATED INTO UPPER HALF-PLANE AND ROTSENSE IS MADE NEGATIVE.
058306,000403:                                                                                                  #        3. E IS SCALED AT PI RADIANS AND EDOT AT PI/4 RAD/SEC.
058307,000404:                                                                                                  #           (EXCEPT THE RUFLAW3 ENTRY WHEN E IS AT PI/4)
058308,000405: 
058309,000406:                                                                                                  #  RUFLAW1:      ERROR MORE NEGATIVE THAN PI/16 RAD.  FIRE TO A RATE OF PI/32 RAD/SEC (IF JET TIME EXCEEDS 20 MSEC.).
058310,000407:                                                                                                  #  RUFLAW2:      ERROR MORE POSITIVE THAN PI/16 RAD.  FIRE TO OPPOSING RATE OF PI/32 RAD/SEC.
058311,000408:                                                                                                  #  RUFLAW3:      ERROR RATE GREATER THAN PI/32 RAD/SEC AND ERROR WITHIN BOUNDS.  COAST IF BELOW FIREFCT, FIRE IF ABOVE
058312,000409: 
058313,000410: 17,3413           45013        RUFLAW1            CS       BIT12                                 #  DECREMENT EDOT BY PI/32 RAD/SEC, WHICH
058314,000411: 17,3414           27543                           ADS      EDOT                                  #        IS THE TARGET RATE.
058315,000412: 17,3415           00006                           EXTEND                                         
058316,000413: 17,3416           63437                           BZMF     SMALRATE                              #  BRANCH IF RATE LESS THAN TARGET.
058317,000414: 17,3417           03475                           TC       RUFSETUP                              #  REVERSE ROTSENSE AND INDICATE MAX JETS.
058318,000415: 17,3420           31543                           CAE      EDOT                                  #  PICK UP DESIRED RATE CHANGE.
058319,000416: 
058320,000417: 17,3421           00006        RUFLAW12           EXTEND                                         #  COMPUTE TJET
058321,000418: 17,3422           51741                           INDEX    ADRSDIF2                              #        = (DESIRED RATE CHANGE)/(2-JET ACCEL.)
058322,000419: 17,3423           71566                           MP       1/ANET1    +2                         
058323,000420: 17,3424           67712                           AD       -1/8                                  #  IF TJET, SCALED AT 32 SEC, EXCEEDS
058324,000421: 17,3425           00006                           EXTEND                                         #        4 SECONDS, SET TJET TO TJMAX.
058325,000422: 17,3426           63430                           BZMF     +2                                    
058326,000423: 17,3427           13250                           TCF      FULLTIME                              
058327,000424: 17,3430           00006                           EXTEND                                         
058328,000425: 17,3431           13250                           BZF      FULLTIME                              
058329,000426: 17,3432           65013                           AD       BIT12                                 #  RESTORE COMPUTED TJET TO ACCUMULATOR.
058330,000427: 17,3433           20001                           DAS      A                                     
058331,000428: 17,3434           20001                           DAS      A                                     
058332,000429: 17,3435           20001                           DAS      A                                     #  RESCALED TJET AT 4 SECONDS.
058333,000430: 17,3436           13406                           TCF      CHKMINTJ                              #  RETURN AS FROM FINELAW.
058334,000431: 
058335,000432: 17,3437           03477        SMALRATE           TC       RUFSETUP   +2                         #  SET NUMBERT AND FIREFCT FOR MAXIMUM JETS
058336,000433: 17,3440           11735                           CCS      ROTSENSE                              
058337,000434: 17,3441           35026                           CAF      ONE                                   #  MODIFY INDEXER TO POINT TO 1/ANET
058338,000435: 17,3442           13444                           TCF      +2                                    #        CORRESPONDING TO THE PROPER SENSE.
058339,000436: 17,3443           37721                           CAF      NEGONE                                
058340,000437: 17,3444           27741                           ADS      ADRSDIF2                              
058341,000438: 
058342,000439: 17,3445           41543                           CS       EDOT                                  #  PICK UP (PI/32-EDOT)=DESIRED CHANGE.
058343,000440: 17,3446           13421                           TCF      RUFLAW12                              
058344,000441: 
058345,000442: 17,3447           03475        RUFLAW2            TC       RUFSETUP                              #  REVERSE ROTSENSE AND INDICATE MAX JETS.
058346,000443: 17,3450           35013                           CAF      BIT12                                 
058347,000444: 17,3451           61543                           AD       EDOT                                  #  PICK UP(PI/32+EDOT) = DESIRED RATE CHANGE
058348,000445: 17,3452           54000                           TS       A                                     #  IF OVERFLOW SKIP, FIRE FOR FULL TIME.
058349,000446: 
058350,000447: 17,3453           13421                           TCF      RUFLAW12                              #  OTHERWISE, COMPUTE JET TIME.
058351,000448: 17,3454           13250                           TCF      FULLTIME                              
058352,000449: 
058353,000450: 17,3455           03475        RUFLAW3            TC       RUFSETUP                              #  EXECUTE COMMON RUFLAW SUBROUTINE.
058354,000451: 17,3456           51743                           INDEX    ADRSDIF1                              
058355,000452: 17,3457           41576                           CS       FIREDB                                #  CALCULATE DISTANCE FROM SWITCH CURVE
058356,000453: 17,3460           61542                           AD       E                                     #        1/ANET1*EDOT*EDOT +E - FIREDB = 0
058357,000454: 17,3461           00006                           EXTEND                                         #                SCALED AT 4 PI RADIANS
058358,000455: 17,3462           75014                           MP       BIT11                                 
058359,000456: 17,3463           57543                           XCH      EDOT                                  
058360,000457: 17,3464           00006                           EXTEND                                         
058361,000458: 17,3465           70000                           SQUARE                                         
058362,000459: 17,3466           00006                           EXTEND                                         
058363,000460: 17,3467           51743                           INDEX    ADRSDIF1                              
058364,000461: 17,3470           71566                           MP       1/ANET1    +2                         
058365,000462: 17,3471           61543                           AD       EDOT                                  
058366,000463: 17,3472           00006                           EXTEND                                         
058367,000464: 17,3473           63205                           BZMF     COASTTJ                               #  COAST IF BELOW IT.
058368,000465: 17,3474           13250                           TCF      FULLTIME                              #  FIRE FOR FULL PERIOD IF ABOVE IT.
058369,000466: 
058370,000467:                                                                                                  #  SUBROUTINE USED IN ALL ENTRIES TO ROUGHLAW.
058371,000468: 
058372,000469: 17,3475           41735        RUFSETUP           CS       ROTSENSE                              #  REVERSE ROTSENSE WHEN ENTER HERE.
058373,000470: 17,3476           55735                           TS       ROTSENSE                              
058374,000471: 17,3477           35024                 +2        CAF      FOUR                                  #  REQUIRE MAXIMUM (2) JETS IN U,V-AXES.
058375,000472: 17,3500           55740                           TS       NUMBERT                               
058376,000473: 17,3501           35010                           CAF      NEGMAX                                #  SUGGEST MAXIMUM (4) JETS IN P-AXIS.
058377,000474: 17,3502           55736                           TS       FIREFCT                               
058378,000475: 17,3503           00002                           TC       Q                                     
058379,000476: 
058380,000477:                                                                                                  #  CONSTANTS FOR TJETLAW
058381,000478: 
058382,000479: 17,3504           77757                           DEC      -16        B-14                       #  AXISDIFF(INDEX) = NUMBER OF REGISTERS
058383,000480: 17,3505           00000        AXISDIFF           DEC      +0         B-14                       #        BETWEEN STORED 1/ACCS PARAMETERS FOR
058384,000481: 17,3506           00020                           DEC      16         B-14                       #        THE INDEXED AXIS AND THE U-AXIS.
058385,000482: 17,3507           14400        SENSOR             OCT      14400                                 #  RATIO OF TJET SCALING WITHIN TJETLAW
058386,000483:                                                                                                  #        (4 SEC) TO SCALING FOR T6 (10.24 SEC).
058387,000484: 17,3510           76447        -2DEG              DEC      -.04444                               #  -2.0 DEGREES SCALED AT 45.
058388,000485: 17,3511           77750        -.0112A8           DEC      -.00141                               #  -.01125 SEC(2) SCALED AT 8.
058389,000486: 17,3512           00632        .1AT4              DEC      .025                                  #  0.1 SECOND SCALED AT 4.
058390,000487: 17,3513           01463        .1AT2              DEC      .05                                   #  0.1 SEC SCALED AT 2.
058391,000488: 17,3514           00232        .0375AT4           DEC      .00938                                #  .0375 SEC SCALED AT 4.
058392,000489: 17,3515           77462        -.025AT2           DEC      -.0125                                #  -.025 SEC SCALED AT 2.
058393,000490: 17,3516           77631        -.025AT4           DEC      -.00625                               
058394,000491: 17,3517           77145        -.05AT2            DEC      -.025                                 
058395,000492: 17,3520           75462        -.15AT2            DEC      -.075                                 
058396,000493: 17,3521           00007 25605  .00375A8           2DEC     .00375     B-3                        
058397,000494: 
058398,000495: 17,3523           76631        -TJMAX             DEC      -.0375                                #  LARGEST CALCULATED TIME.  .150 SEC AT 4.
058399,000496: 17,3524           00122        TJMIN              DEC      .005                                  #  SMALLEST ALLOWABLE TIME.  .020 SEC AT 4.
058400,000497: 17,3525           77655        -TJMIN             DEC      -.005                                 

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