Source Code

029632,000002: ## Copyright: Public domain. 029633,000003: ## Filename: AVERAGE_G_INTEGRATOR.agc 029634,000004: ## Purpose: Part of the source code for Solarium build 55. This 029635,000005: ## is for the Command Module's (CM) Apollo Guidance 029636,000006: ## Computer (AGC), for Apollo 6. 029637,000007: ## Assembler: yaYUL --block1 029638,000008: ## Contact: Jim Lawton <jim DOT lawton AT gmail DOT com> 029639,000009: ## Website: www.ibiblio.org/apollo/index.html 029640,000010: ## Page Scans: www.ibiblio.org/apollo/ScansForConversion/Solarium055/ 029641,000011: ## Mod history: 2009-10-01 JL Created. 029642,000012: ## 2016-08-19 RSB Added temporary "BANK 30" workaround. 029643,000013: ## 2016-08-20 RSB Typos. 029644,000014: ## 2016-12-28 RSB Proofed comment text using octopus/ProoferComments, 029645,000015: ## and fixed errors found. 029646,000016:

Page 746

029648,000018: 
029649,000019:                                                                                                  #        ROUTINE CALCRVG INTEGRATES THE EQUATIONS OF MOTION BY AVERAGING THE THRUST AND GRAVITATIONAL ACCELERA-
029650,000020:                                                                                                  #  TIONS OVER A TIME INTERVAL, DELTAT
029651,000021:                                                                                                  #        FOR THE EARTH-CENTERED GRAVITATIONAL FIELD THE PERTURBATION DUE TO OBLATENESS IS COMPUTED TO THE FIRST
029652,000022:                                                                                                  #  HARMONIC COEFFICIENT J
029653,000023:                                                                                                  #        ROUTINE NORMLISE MUST BE CALLED PRIOR TO THE FIRST ENTRY INTO CALCRVG. IT REQUIRES RN SCALED TO 2(+29)M
029654,000024:                                                                                                  #  IT LEAVES RN NORMALISED, SO THAT THE SCALED MAGNITUDE OF THE VECTOR CONTAINS ONE LEADING ZERO, BY SHIFTING THE
029655,000025:                                                                                                  #  VECTOR LEFT N BINARY PLACES
029656,000026:                                                                                                  #        ROUTINE CALCRVG REQUIRES
029657,000027:                                                                                                  #                1) THRUST ACCELERATION INCREMENTS IN DELV SCALED SAME AS PIPAX,Y,Z
029658,000028:                                                                                                  #                2) VN SCALED AT 2(+7) M/CS
029659,000029:                                                                                                  #                3) ADDRESS OF CALCGLUN OR CALCGEAR IN CALCG
029660,000030:                                                                                                  #                4) DELTAT SCALED AT 2(+9) CS
029661,000031:                                                                                                  #                5) PUSH-DOWN COUNTER SET TO ZERO
029662,000032:                                                                                                  #  IT LEAVES UPDATED RN, SCALED AT 2(29-N) M, VN, AND GRAVITY SCALED AT 2(-5) M/CS/CS
029663,000033: 
029664,000034: 
029665,000035:                                                                                                  #        CONTINUE ON IN BANK 30.

RSB — The original source code did not have the following BANK pseudo-op, but for some reason I haven't tracked down yet, yaYUL can't resolve the addresses without it. Perhaps a bug in yaYUL.

029669,000039: 30,7524                                           BANK     30                                    
029670,000040: 
029671,000041: 30,7524           71173        NORMLISE           ABVAL    3                                     #  COUNT NUMBER OF LEADING ZEROS IN
029672,000042: 30,7525           57715                           TSLC     INCR,1                                #  ABVAL (RN) AND STORE -N(=2-M) IN NSHIFT
029673,000043: 30,7526           67515                           SXA,1    INCR,1                                #  RN MUST BE SCALED AT 2(+29)M
029674,000044: 30,7527           67425                           SXA,1    ITA                                   
029675,000045: 30,7530           00766                                    RN                                    
029676,000046: 30,7531           00047                                    X1                                    
029677,000047: 30,7532           00003                                    2                                     
029678,000048: 30,7533           01041                                    NSHIFT                                #  SAVE C(X1)=-N
029679,000049: 30,7534           00017                                    14D                                   
029680,000050: 30,7535           01042                                    XSHIFT                                #  SAVE C(X1) =14-N
029681,000051: 30,7536           00052                                    S2                                    
029682,000052: 
029683,000053: 30,7537           75175                           VMOVE    1                                     
029684,000054: 30,7540           44376                           VSLT*                                          
029685,000055: 30,7541           00766                                    RN                                    
029686,000056: 30,7542           00035                                    14D,1                                 
029687,000057: 30,7543           32766                           STORE    RN                                    #  RN SCALED AT 2(29-N)METRES
029688,000058: 
029689,000059: 30,7544           76776                           ITC      0                                     
029690,000060: 30,7545           21645                                    CALCGRV1                              
029691,000061: 
029692,000062: 30,7546           44576                           ITCI     0                                     
029693,000063: 30,7547           00052                                    S2                                    
029694,000064: 

Page 747

029696,000066: 
029697,000067: 30,7550           75776        CALCRVG            VXSC     0                                     
029698,000068: 30,7551           01002                                    DELV                                  
029699,000069: 30,7552           21742                                    KPIP                                  #  DV TO PD SCALED AT 2(+4)M/CS
029700,000070: 
029701,000071: 30,7553           75775                           VXSC     1                                     
029702,000072: 30,7554           73432                           LXA,1    BVSU                                  
029703,000073: 30,7555           01010                                    GRAVITY                               
029704,000074: 30,7556           01030                                    DELTAT                                
029705,000075: 30,7557           01042                                    XSHIFT                                
029706,000076: 30,7560           00001                                    0                                     #  (DV-(OLD GDT))/2 TO PD SCALED 2(+3)M/CS
029707,000077: 
029708,000078: 30,7561           47573                           NOLOD    3                                     
029709,000079: 30,7562           45642                           VSRT     VAD                                   
029710,000080: 30,7563           75620                           VXSC     VSLT*                                 
029711,000081: 30,7564           50625                           VAD      ITA                                   
029712,000082: 30,7565           00005                                    4                                     
029713,000083: 30,7566           00774                                    VN                                    
029714,000084: 30,7567           01030                                    DELTAT                                
029715,000085: 30,7570           00001                                    0,1                                   
029716,000086: 30,7571           00766                                    RN                                    
029717,000087: 30,7572           00052                                    S2                                    
029718,000088: 30,7573           33300                           STORE    RN1                                   #  SCALED AT 2(29-N) METERS
029719,000089: 
029720,000090: 30,7574           76776                           ITC      0                                     
029721,000091: 30,7575           21645                                    CALCGRV1                              
029722,000092: 
029723,000093: 30,7576           47573                           NOLOD    3                                     
029724,000094: 30,7577           75632                           VXSC     BVSU                                  
029725,000095: 30,7600           50626                           VAD      VSRT                                  
029726,000096: 30,7601           50776                           VAD                                            
029727,000097: 30,7602           01030                                    DELTAT                                
029728,000098: 30,7603           77777                                    -                                     #  (DV-(OLD GDT))/2
029729,000099: 30,7604           77777                                    -                                     #  DV/2
029730,000100: 30,7605           00005                                    4                                     
029731,000101: 30,7606           00774                                    VN                                    
029732,000102: 30,7607           33306                           STORE    VN1                                   #  SCALED AT 2(+7) MET/CS
029733,000103: 
029734,000104:                                                                                                  #   IN AVERAGE G, UP THE PHASE BITS BY 2 OF ACTIVE PROG BEFORE COPY CYCLE.
029735,000105: 
029736,000106: 30,7610           77576                           EXIT     0                                     
029737,000107: 
029738,000108: 30,7611           20067                           INDEX    FIXLOC                                
029739,000109: 30,7612           40051                           CS       S2                                    #  SAVE NEG RETURN ADDRESS IN NON-VAC AREA.
029740,000110: 30,7613           51313        CALCRVG2           TS       AVGRETRN                              #  SAVE NEGATIVE OF RETURN ADDRESS.
029741,000111: 
029742,000112: 30,7614           40662                           CS       -PHASE1    +4                         #  PICK UP PHASES.
029743,000113: 30,7615           64516                           AD       ONE                                   #  INCREMENT BY 1.
029744,000114: 30,7616           02312                           TC       NEWPHASE                              #  AND CALL ROUTINE TO CHANGE PHASE.
029745,000115: 30,7617           00005                           OCT      00005                                 

Page 748

029747,000117: 30,7620           20017        REFAZE6            INHINT                                         
029748,000118: 30,7621           37641                           CAF      ELEVEND                               
029749,000119: 30,7622           50115                           TS       MPAC                                  #  USE MPAC FOR LOOP COUNTER.
029750,000120: 30,7623           20115                           INDEX    MPAC                                  
029751,000121: 30,7624           41277                           CS       RN1                                   #  RN1 AND VN1 MUST BE IN ORDER.
029752,000122: 30,7625           40000                           COM                                            #  LEAVE RN1 ALONE  IN CASE OF RESTARTS.
029753,000123: 30,7626           20115                           INDEX    MPAC                                  #  SELECT THE RIGHT TERM.
029754,000124: 30,7627           50765                           TS       RN                                    #  ...AND GO THRU COPY CYCLE.
029755,000125: 
029756,000126: 30,7630           10115                           CCS      MPAC                                  #  ARE WE DONE..
029757,000127: 30,7631           07622                           TC       REFAZE6    +2                         #  NO, NOT YET.
029758,000128: 30,7632           44515                           CS       BIT2                                  #  YES, MPAC = 0.
029759,000129: 30,7633           70675                           MASK     TMMARKER                              
029760,000130: 30,7634           64515                           AD       BIT2                                  #  SET BIT 2 TO ONE IN TMMARKER.
029761,000131: 30,7635           50675                           TS       TMMARKER                              
029762,000132:                                                                                                  #  WHAT ABOUT GRAVITY FOR RESTART..
029763,000133: 30,7636           20016                           RELINT                                         
029764,000134: 30,7637           41313                           CS       AVGRETRN                              #  NEG OF ADDRESS WAS STORED.
029765,000135: 30,7640           05723                           TC       BANKJUMP                              
029766,000136: 
029767,000137: 
029768,000138: 
029769,000139: 30,7641           00013        ELEVEND            DEC      11         B-14                       #  11D  (ELEVEN DECIMAL, OF COURSE.)
029770,000140: 
029771,000141: 
029772,000142: 
029773,000143: 30,7642           73576        CALCGRAV           LXA,1    0                                     
029774,000144: 30,7643           01042                                    XSHIFT                                
029775,000145: 
029776,000146: 30,7644           47575        CALCGRV1           NOLOD    1                                     
029777,000147: 30,7645           73176                           UNIT                                           
029778,000148: 30,7646           33016                           STORE    UNITR                                 
029779,000149: 
029780,000150: 30,7647           45175                           DMOVE    1                                     
029781,000151: 30,7650           63776                           TSLT                                           
029782,000152: 30,7651           00037                                    30D                                   
029783,000153: 30,7652           00002                                    1                                     
029784,000154: 30,7653           33024                           STORE    RMAG                                  #  SCALED AT 2(30-N)M
029785,000155: 
029786,000156: 30,7654           63776                           TSLT     0                                     
029787,000157: 30,7655           00035                                    28D                                   
029788,000158: 30,7656           00003                                    2                                     
029789,000159: 30,7657           33026                           STORE    RMAGSQ                                #  SCALED AT 2(+50)M(+2)
029790,000160: 
029791,000161: 30,7660           45575                           ITA      1                                     
029792,000162: 30,7661           61576                           XAD,1                                          
029793,000163: 30,7662           00034                                    27D                                   
029794,000164: 30,7663           01041                                    NSHIFT                                

Page 749

029796,000166: 
029797,000167: 30,7664           42776        CALCGEAR           DOT      0                                     
029798,000168: 30,7665           01016                                    UNITR                                 
029799,000169: 30,7666           01044                                    UNITW                                 
029800,000170: 30,7667           32032                           STORE    25D                                   
029801,000171: 
029802,000172: 30,7670           47574                           NOLOD    2                                     
029803,000173: 30,7671           51122                           DSQ      DMP                                   
029804,000174: 30,7672           63726                           TSLT     BDSU                                  
029805,000175: 30,7673           21746                                    DP(5/8)                               
029806,000176: 30,7674           00005                                    4                                     
029807,000177: 30,7675           21744                                    DP2(-3)                               
029808,000178: 
029809,000179: 30,7676           62775                           DDV      1                                     
029810,000180: 30,7677           63376                           TSLT*                                          
029811,000181: 30,7700           21754                                    J(RE)SQ                               #  SCALED AT 2(+40) M(+2)
029812,000182: 30,7701           01026                                    RMAGSQ                                
029813,000183: 30,7702           00001                                    0,1                                   
029814,000184: 30,7703           32030                           STORE    23D                                   #  J(RE/RN) SQ SCALED AT 2(-3)
029815,000185: 
029816,000186: 30,7704           47574                           NOLOD    2                                     
029817,000187: 30,7705           64766                           DMP      VXSC                                  
029818,000188: 30,7706           50776                           VAD                                            
029819,000189: 30,7707           77777                                    -                                     
029820,000190: 30,7710           01016                                    UNITR                                 
029821,000191: 30,7711           01016                                    UNITR                                 
029822,000192: 
029823,000193: 30,7712           64775                           DMP      1                                     
029824,000194: 30,7713           75642                           VXSC     VAD                                   
029825,000195: 30,7714           00030                                    23D                                   
029826,000196: 30,7715           00032                                    25D                                   
029827,000197: 30,7716           01044                                    UNITW                                 
029828,000198: 
029829,000199: 30,7717           45175                           DMOVE    1                                     
029830,000200: 30,7720           76776                           ITC                                            
029831,000201: 30,7721           21750                                    MUEARTH                               
029832,000202: 30,7722           21732                                    MU/RSQ                                
029833,000203: 
029834,000204: 30,7723           75176        CALCGLUN           VMOVE    0                                     
029835,000205: 30,7724           01016                                    UNITR                                 
029836,000206: 
029837,000207: 30,7725           45175                           DMOVE    1                                     
029838,000208: 30,7726           63576                           INCR,1                                         
029839,000209: 30,7727           21752                                    MUMOON                                
029840,000210: 30,7730           00007                                    6                                     
029841,000211: 
029842,000212: 30,7731           47574        MU/RSQ             NOLOD    2                                     
029843,000213: 30,7732           62714                           DDV      TSLT*                                 
029844,000214: 30,7733           75776                           VXSC                                           
029845,000215: 30,7734           01026                                    RMAGSQ                                #  C(X1)=14-2N  (EARTH)
029846,000216: 30,7735           00013                                    5,1                                   #       =20-2N  (MOON)

Page 750

029848,000218: 30,7736           33010                           STORE    GRAVITY                               #  SCALED AT 2(-5) M/CS/CS
029849,000219: 
029850,000220: 30,7737           44576                           ITCI     0                                     
029851,000221: 30,7740           00034                                    27D                                   
029852,000222: 
029853,000223: 30,7741           23126 25370  KPIP               2DEC     0.59904                               
029854,000224: 30,7743           04000 00000  DP2(-3)            2DEC     0.125                                 
029855,000225: 30,7745           24000 00000  DP(5/8)            2DEC     0.625                                 
029856,000226: 30,7747           00022 21756  MUEARTH            2DEC     .009063188 B-3                        #  SCALED AT 2(+45)M(+3)/CS(+2)
029857,000227: 30,7751           00164 34414  MUMOON             2DEC     0.007134481                            #  4.90277800 E12        2(+36)M(+3)/CS(+2)
029858,000228: 30,7753           00173 00416  J(RE)SQ            2DEC     .06006663  B-3                        #  SCALED AT 2(+43)M(+2)
029859,000229: 

Page 751

029861,000231: 
029862,000232:                                                                                                  #        ROUTINE FOR FLIGHTS 501 &2 TO INCORPORATE STATE VECTOR UPDATE DURING AVERAGE G. EACH PASS THROUGH
029863,000233:                                                                                                  #  SERVICER COMES HERE TO SEE IF AN UPDATE IS READY.
029864,000234: 
029865,000235: 26,7711                                           BANK     26                                    
029866,000236: 
029867,000237: 26,7711           66774        501UPCHK           DSU      2                                     #  IF PIPTIME IS GREATER THAN OR EQUAL TO
029868,000238: 26,7712           73615                           BMN      TEST                                  #    UPTIME, AND UPTIME IS NOT TOO OLD, AND
029869,000239: 26,7713           66616                           DSU      BPL                                   #    UPDATFLG IS SET, DO THE UPDATE. UPTIME
029870,000240: 26,7714           01465                                    PIPTIME                               #    IS NORMALLY SET TO POSMAX
029871,000241: 26,7715           01672                                    UPTIME                                #  POSMAX.
029872,000242: 26,7716           25302                                    REGSTEP                               
029873,000243: 26,7717           00023                                    UPDATFLG                              
029874,000244: 26,7720           25302                                    REGSTEP                               
029875,000245: 
029876,000246: 26,7721           15770                                    2.5SEC26                              
029877,000247: 26,7722           15755                                    BADUPTIM                              
029878,000248: 26,7723           52775                           MXV      1                                     #  TRANSFORM DATA IN STBUFF TO SM COORDS.
029879,000249: 26,7724           44776                           VSLT                                           
029880,000250: 26,7725           01107                                    STBUFF     +6                         
029881,000251: 26,7726           01052                                    REFSMMAT                              
029882,000252: 26,7727           00002                                    1                                     #  THIS ASSUMES THAT UPDATE SCALED 2(7)M/CS
029883,000253: 26,7730           33306                           STORE    VN1                                   
029884,000254: 
029885,000255: 26,7731           52775                           MXV      1                                     
029886,000256: 26,7732           44776                           VSLT                                           
029887,000257: 26,7733           01101                                    STBUFF                                
029888,000258: 26,7734           01052                                    REFSMMAT                              
029889,000259: 26,7735           00003                                    2                                     #  THIS ASSUMES THAT UPDATE SCALED 2(26)M
029890,000260: 26,7736           33300                           STORE    RN1                                   
029891,000261: 
029892,000262: 26,7737           76776                           ITC      0                                     #  CALCULATE THE ASSOCIATED GRAVITY VECTOR
029893,000263: 26,7740           21643                                    CALCGRAV                              #  FOR THE NEXT TIME STEP.
029894,000264: 
029895,000265: 26,7741           77576                           EXIT     0                                     
029896,000266: 
029897,000267: 26,7742           02276                           TC       PHASCHNG                              #  UPDATE RESTART POINT BEFORE SETTING
029898,000268: 26,7743           03005                           OCT      03005                                 #  UPTIME TO SHOW THATTHE DATA HAS BEEN
029899,000269: 
029900,000270: 26,7744           03430        REDO5.24           TC       FLAG1DWN                              #  INCORPORATED. ALSO, INDICATE THIS TO THE
029901,000271: 26,7745           20000                           OCT      20000                                 #  GROUND BY RESETTING UPDATFLG.
029902,000272: 
029903,000273: 26,7746           34476                           CAF      POSMAX                                
029904,000274: 26,7747           51671                           TS       UPTIME                                
029905,000275: 26,7750           51672                           TS       UPTIME     +1                         
029906,000276: 
029907,000277: 26,7751           47771                           CS       501AVEX                               #  SET UP FOR AVERAGE G TO RETURN TO USUAL
029908,000278: 26,7752           05720                           TC       POSTJUMP                              #  POINT IN SERVICER
029909,000279: 26,7753           61613                           CADR     CALCRVG2                              
029910,000280: 
029911,000281: 26,7754           77576        BADUPTIM           EXIT     0                                     #  COME HERE IF UPTIME REPRESENTS PAST TIME

Page 752

029913,000283: 26,7755           03007                           TC       ALARM                                 
029914,000284: 26,7756           01411                           OCT      01411                                 
029915,000285: 
029916,000286: 26,7757           34476                           CAF      POSMAX                                
029917,000287: 26,7760           51671                           TS       UPTIME                                
029918,000288: 26,7761           51672                           TS       UPTIME     +1                         
029919,000289: 
029920,000290: 26,7762           03430                           TC       FLAG1DWN                              #  RESET UPDAT FLAG
029921,000291: 26,7763           20000                           OCT      20000                                 
029922,000292: 
029923,000293: 26,7764           04000                           TC       INTPRET                               
029924,000294: 
029925,000295: 26,7765           76776                           ITC      0                                     
029926,000296: 26,7766           25302                                    REGSTEP                               
029927,000297: 
029928,000298: 26,7767           00000 00372  2.5SEC26           2DEC     250        B-28                       
029929,000299: 26,7771           65303        501AVEX            CADR     AVGRET                                
029930,000300: 

Page 753

029932,000302: 
029933,000303:                                                                                                  #  SIM FLIGHT SPECIAL
029934,000304: 
029935,000305: 
029936,000306: 
029937,000307: 31,7520                                           BANK     31                                    
029938,000308: 
029939,000309: 31,7520           04000        MALSJOB            TC       INTPRET                               
029940,000310: 
029941,000311: 31,7521           51776                           VXM      0                                     
029942,000312: 31,7522           01101                                    STBUFF                                
029943,000313: 31,7523           01052                                    REFSMMAT                              
029944,000314: 31,7524           33101                           STORE    STBUFF                                
029945,000315: 
029946,000316: 31,7525           51775                           VXM      1                                     
029947,000317: 31,7526           44776                           VSLT                                           
029948,000318: 31,7527           01107                                    STBUFF     +6                         
029949,000319: 31,7530           01052                                    REFSMMAT                              
029950,000320: 31,7531           00002                                    1                                     
029951,000321: 31,7532           33107                           STORE    STBUFF     +6                         
029952,000322: 
029953,000323: 31,7533           77576                           EXIT     0                                     
029954,000324: 
029955,000325: 31,7534           02124                           TC       ENDOFJOB                              
029956,000326: 

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