Source Code

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

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

027614,000002:                                                                                                  ## Copyright:   Public domain.
027615,000003:                                                                                                  ## Filename:    R30.agc
027616,000004:                                                                                                  ## Purpose:     A section of a reconstructed, mixed version of Sundance
027617,000005:                                                                                                  ##              It is part of the reconstructed source code for the Lunar
027618,000006:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
027619,000007:                                                                                                  ##              No original listings of this program are available;
027620,000008:                                                                                                  ##              instead, this file was created via disassembly of dumps
027621,000009:                                                                                                  ##              of various revisions of Sundance core rope modules.
027622,000010:                                                                                                  ## Assembler:   yaYUL
027623,000011:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
027624,000012:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
027625,000013:                                                                                                  ## Mod history: 2020-06-17 MAS  Created from Luminary 69.
027626,000014:                                                                                                  ##              2021-05-30 ABS  TICKTIFF -> TICKTFF
027627,000015: 
027628,000016:                                                                                                  ## Sundance 302
027629,000017: 
027630,000018:                                                                                                  #  SUBROUTINE NAME:  V82CALL
027631,000019:                                                                                                  #  MOD NO: 0                                                             DATE: 16 FEB 67
027632,000020:                                                                                                  #  MOD BY: RR BAIRNSFATHER                                               LOG SECTION:  R30
027633,000021:                                                                                                  #  MOD NO: 1     MOD BY:  RR BAIRNSFATHER        DATE: 11 APR 67         SR30.1 CHANGED TO ALLOW MONITOR OPERN
027634,000022:                                                                                                  #  MOD NO: 2     MOD BY  ALONSO                  DATE: 11 DEC 67         VB82 PROGRAM REWRITTEN
027635,000023:                                                                                                  #  MOD NO: 3     MOD BY  ALONSO                  DATE: 26 MAR 68         PROG MOD TO HANDLE DIF EARTH/MOON SCALE
027636,000024: 
027637,000025:                                                                                                  #  NEW FUNCTIONAL DESCRIPTION:   CALLED BY VERB 82 ENTER.  PRIORITY 10
027638,000026:                                                                                                  #  USED THROUGHOUT.              CALCULATE AND DISPLAY ORBITAL PARAMETERS
027639,000027: 
027640,000028:                                                                                                  #  1.    IF AVERAGE G IS OFF:
027641,000029:                                                                                                  #                FLASH DISPLAY V04N06.  R2 INDICATES WHICH SHIP'S STATE VECTOR IS
027642,000030:                                                                                                  #                        TO BE UPDATED.  INITIAL CHOICE IS THIS SHIP (R2=1).  ASTRONAUT
027643,000031:                                                                                                  #                        CAN CHANGE TO OTHER SHIP BY V22EXE, WHERE X NOT EQ 1.
027644,000032:                                                                                                  #                SELECTED STATE VECTOR UPDATED BY THISPREC (OTHPREC).
027645,000033:                                                                                                  #                CALLS SR30.1 (WHICH CALLS TFFCONMU + TFFRP/RA) TO CALCULATE
027646,000034:                                                                                                  #                        RPER (PERIGEE RADIUS), RAPO (APOGEE RADIUS), HPER (PERIGEE
027647,000035:                                                                                                  #                        HEIGHT ABOVE LAUNCH PAD OR LUNAR LANDING SITE), HAPO (APOGEE
027648,000036:                                                                                                  #                        HEIGHT AS ABOVE), TPER (TIME TO PERIGEE), TFF (TIME TO
027649,000037:                                                                                                  #                        INTERSECT 300 KFT ABOVE PAD OR 35KFT ABOVE LANDING SITE).
027650,000038:                                                                                                  #                FLASH MONITOR V16N44 (HAPO, HPER, TFF).  TFF IS -59M59S IF IT WAS
027651,000039:                                                                                                  #                        NOT COMPUTABLE, OTHERWISE IT INCREMENTS ONCE PER SECOND.
027652,000040:                                                                                                  #                        ASTRONAUT HAS OPTION TO MONITOR TPER BY KEYING IN N 32 E.
027653,000041:                                                                                                  #                        DISPLAY IS IN HMS, IS NEGATIVE (AS WAS TFF), AND INCREMENTS
027654,000042:                                                                                                  #                        ONCE PER SECOND ONLY IF TFF DISPLAY WAS -59M59S.
027655,000043:                                                                                                  #        2.      IF AVERAGE G IS ON:
027656,000044:                                                                                                  #                        CALLS SR30.1 APPROX EVERY TWO SECS.  STATE VECTOR IS ALWAYS
027657,000045:                                                                                                  #                                FOR THIS VEHICLE.  V82 DOES NOT DISTURB STATE VECTOR.  RESULTS
027658,000046:                                                                                                  #                                OF SR30.1 ARE RAPO, RPER, HAPO, HPER, TPER, TFF.
027659,000047:                                                                                                  #                        FLASH MONITOR V16N44 (HAPO, HPER, TFF).
027660,000048:                                                                                                  #        ADDENDUM:  HAPO AND HPER SHOULD BE CHANGED TO READ HAPOX AND HPERX IN THE
027661,000049:                                                                                                  #                ABOVE REMARKS.
027662,000050: 
027663,000051:                                                                                                  #  CALLING SEQUENCE: VERB 82 ENTER.
027664,000052: 
027665,000053:                                                                                                  #  SUBROUTINES CALLED:   SR30.1, GOXDSPF
027666,000054:                                                                                                  #                        MAYBE - THISPREC, OTHPREC, LOADTIME, DELRSPL
027667,000055: 
027668,000056:                                                                                                  #  NORMAL EXIT MODES:  TC ENDEXT
027669,000057: 
027670,000058:                                                                                                  #  ALARMS:  NONE
027671,000059: 
027672,000060:                                                                                                  #  OUTPUT:       HAPOX   (-29) M
027673,000061:                                                                                                  #                HPERX   (-29) M
027674,000062:                                                                                                  #                RAPO    (-29) M EARTH
027675,000063:                                                                                                  #                        (-27) M MOON
027676,000064:                                                                                                  #                RPER    (-29) M EARTH
027677,000065:                                                                                                  #                        (-27) M MOON
027678,000066:                                                                                                  #                TFF     (-28) CS        CONTAINS NEGATIVE QUANTITY
027679,000067:                                                                                                  #                -TPER   (-28) CS        CONTAINS NEGATIVE QUANTITY
027680,000068: 
027681,000069:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED:  STATE VECTOR.
027682,000070: 
027683,000071:                                                                                                  #  DEBRIS:       QPRET, RONE, VONE, TFF/RTMU, HPERMIN, RPADTEM, V82EMFLG.
027684,000072:                                                                                                  #                MAYBE:  TSTART82, V82FLAGS, TDEC1.
027685,000073: 
027686,000074: 13,2323  E4,1521                                  EBANK=   HAPOX                                 
027687,000075: 31,2000                                           BANK     31                                    
027688,000076: 22,2000                                           SETLOC   R30LOC                                
027689,000077: 22,2000                                           BANK                                           
027690,000078: 22,3236                                           COUNT*   $$/R30                                
027691,000079: 
027692,000080: 22,3236           06014        V82CALL            TC       INTPRET                               
027693,000081: 22,3237           52014                           BON      GOTO                                  
027694,000082: 22,3240           03712                                    AVEGFLAG                              
027695,000083: 22,3241           45472                                    V82GON                                #  IF AVERAGE G ON
027696,000084: 22,3242           45243                                    V82GOFF                               #  IF AVERAGE G OFF
027697,000085: 
027698,000086: 22,3243           77776        V82GOFF            EXIT                                           #  ALLOW ASTRONAUT TO SELECT VEHICLE
027699,000087: 22,3244           35025                           CAF      TWO                                   #  DESIRED FOR ORBITAL PARAMETERS
027700,000088: 22,3245           55155                           TS       OPTION1                               #  CALCULATION AND DISPLAY.
027701,000089: 22,3246           35026                           CAF      ONE                                   
027702,000090: 22,3247           55156                           TS       OPTION1    +1                         
027703,000091: 22,3250           33315                           CAF      OPTIONVN                              #  V 04 N 06
027704,000092: 22,3251           04655                           TC       BANKCALL                              
027705,000093: 22,3252           20226                           CADR     GOXDSPF                               
027706,000094: 22,3253           05561                           TC       ENDEXT                                #  TERMINATE
027707,000095: 22,3254           03256                           TC       +2                                    #  PROCEED
027708,000096: 22,3255           03250                           TC       -5                                    #  DATA IN.  OPTION1+1 = 1 FOR THIS VEHICLE.
027709,000097:                                                                                                  #                UNEQ 1 FOR OTHER VEHICLE.
027710,000098: 22,3256           00004                           INHINT                                         
027711,000099: 22,3257           35023                           CAF      BIT4                                  #  80 MS
027712,000100: 22,3260           05252                           TC       WAITLIST                              
027713,000101: 22,3261  E4,1542                                  EBANK=   TFF                                   
027714,000102: 22,3261           03435 44064                     2CADR    TICKTEST                              
027715,000103: 
027716,000104: 22,3263           00003                           RELINT                                         
027717,000105: 22,3264           33317        V82GOFLP           CAF      TFFBANK                               #  MAJOR RECYCLE LOOP ENTRY
027718,000106: 22,3265           54003                           TS       EBANK                                 
027719,000107: 22,3266           35030                           CAF      ZERO                                  
027720,000108: 22,3267           55541                           TS       V82FLAGS                              #  ZERO FLAGS FOR TICKTEST. INHIBITS
027721,000109:                                                                                                  #  DECREMENTING OF TFF AND -TPER.
027722,000110: 22,3270           00004                           INHINT                                         
027723,000111: 22,3271           35012                           CAF      PRIO10                                
027724,000112: 22,3272           05155                           TC       FINDVAC                               #  V82GOFF1 WILL EXECUTE STATE VECTOR
027725,000113: 22,3273  E4,1542                                  EBANK=   TFF                                   #  UPDATE AND ORBIT CALCULATIONS FOR
027726,000114: 22,3273           03320 44064                     2CADR    V82GOFF1                              #  SELECTED VEHICLE ABOUT PROPER BODY.
027727,000115: 
027728,000116: 22,3275           00003                           RELINT                                         
027729,000117: 22,3276           36221        V82STALL           CAF      THREE                                 #  STALL IN THIS LOOP AND WITHOLD V 16 N 44
027730,000118: 22,3277           71541                           MASK     V82FLAGS                              #  UNTIL STATE VECTOR UPDATE SETS ONE OF
027731,000119: 22,3300           10000                           CCS      A                                     #  OUR FLAG BITS.
027732,000120: 22,3301           03306                           TC       FLAGGON                               #  EXIT FROM STALL LOOP.
027733,000121: 22,3302           35047                           CAF      1SEC                                  
027734,000122: 22,3303           04655                           TC       BANKCALL                              
027735,000123: 22,3304           01730                           CADR     DELAYJOB                              
027736,000124: 22,3305           03276                           TC       V82STALL                              
027737,000125: 
027738,000126: 22,3306           06716        FLAGGON            TC       UNK7766                               
027739,000127: 22,3307           33316                           CAF      V16N44                                #  MONITOR HAPO,HPER,TFF.
027740,000128: 22,3310           04655                           TC       BANKCALL                              
027741,000129: 22,3311           20226                           CADR     GOXDSPF                               
027742,000130: 22,3312           05642                           TC       B5OFF                                 #  TERM  THIS TELLS TICKTEST TO KILL ITSELF
027743,000131: 22,3313           05642                           TC       B5OFF                                 #  PROCEED   DITTO
027744,000132: 22,3314           03264                           TC       V82GOFLP                              #  RECYCLE   RECOMPUTE STATE VECT + DISPLAY
027745,000133: 
027746,000134: 22,3315           01006        OPTIONVN           VN       406                                   
027747,000135: 22,3316           04054        V16N44             VN       1644                                  
027748,000136: 22,3317           02142        TFFBANK            ECADR    TFF                                   
027749,000137: 
027750,000138: 22,3320           06014        V82GOFF1           TC       INTPRET                               
027751,000139: 22,3321           77634                           RTB                                            
027752,000140: 22,3322           21454                                    LOADTIME                              
027753,000141: 22,3323           00041                           STORE    TDEC1                                 #  TIME FOR STATE VECTOR UPDATE.
027754,000142: 22,3324           02213                           STORE    TSTART82                              #  TIME FOR INTERNAL USE.
027755,000143: 22,3325           77776                           EXIT                                           
027756,000144: 22,3326           41156                           CS       OPTION1    +1                         #  1 FOR THIS VEHICLE, NOT 1 FOR OTHER.
027757,000145: 22,3327           65026                           AD       ONE                                   
027758,000146: 22,3330           00006                           EXTEND                                         
027759,000147: 22,3331           13357                           BZF      THISSHIP                              
027760,000148: 22,3332           06014        OTHSHIP            TC       INTPRET                               
027761,000149: 22,3333           77624                           CALL                                           #  CALL STATE VECTOR UPDATE FOR OTHER SHIP.
027762,000150: 22,3334           27014                                    OTHPREC                               
027763,000151: 22,3335           77775        BOTHSHIP           VLOAD                                          #  MOVE RESULTS INTO TFFCONIC STORAGE AREAS
027764,000152: 22,3336           00001                                    RATT                                  #  TO BE CALLED BY SR30.1.
027765,000153: 22,3337           02215                           STORE    RONE                                  #  RATT AT (-29)M FOR EARTH OR MOON
027766,000154: 22,3340           77656                           UNIT                                           
027767,000155: 22,3341           25760                           STOVL    UNITR                                 
027768,000156: 22,3342           00007                                    VATT                                  
027769,000157: 22,3343           02223                           STORE    VONE                                  #  VATT AT (-7)M/CS FOR EARTH OR MOON
027770,000158: 22,3344           77743                           DLOAD*                                         
027771,000159: 22,3345           72410                                    RTMUE,2                               #  X2 IS 0 FOR EARTH CENTERED STATE VEC
027772,000160: 22,3346           00037                           STORE    TFF/RTMU                              #  X2 IS 2 FOR MOON
027773,000161: 22,3347           77743                           DLOAD*                                         #  AS LEFT BY THISPREC OR OTHPREC.
027774,000162: 22,3350           72404                                    MINPERE,2                             
027775,000163: 22,3351           02207                           STORE    HPERMIN                               #  TFFRTMU, HPERMIN AND RPADTEM ARE ALL
027776,000164: 22,3352           46135                           SLOAD    BHIZ                                  #  EARTH/MOON PARAMETERS AS SET HERE.
027777,000165: 22,3353           00050                                    X2                                    
027778,000166: 22,3354           45374                                    EARTHPAD                              
027779,000167: 22,3355           77650                           GOTO                                           
027780,000168: 22,3356           45377                                    MOONPAD                               
027781,000169: 22,3357           06014        THISSHIP           TC       INTPRET                               
027782,000170: 22,3360           77624                           CALL                                           #  CALL STATE VECTOR UPDATE FOR THIS SHIP.
027783,000171: 22,3361           27030                                    THISPREC                              
027784,000172: 22,3362           77650                           GOTO                                           
027785,000173: 22,3363           45335                                    BOTHSHIP                              
027786,000174: 
027787,000175:                                                                                                  #  THE FOLLOWING CONSTANTS ARE PAIRWISE INDEXED.  DO NOT SEPARATE PAIRS.
027788,000176: 22,3364           02547 34337  RTMUM              2DEC*    2.21422176 E4         B-18*           
027789,000177: 22,3366           30276 04773  RTMUE              2DEC*    1.996504951 E5         B-18*           
027790,000178: 
027791,000179: 22,3370           00000 12326  MINPERM            2DEC     10668      B-29                       #  35 KFT MIN PERIGEE HEIGHT FOR MOON(-29)M
027792,000180: 
027793,000181: 22,3372           00002 31230  MINPERE            2DEC     91440      B-29                       #  300 KFT (-29)M FOR EARTH
027794,000182: 
027795,000183: 22,3374           52145        EARTHPAD           DLOAD    GOTO                                  #  PAD 37-B RADIUS.  SCALED AT (-29)M.
027796,000184: 22,3375           06105                                    RPAD                                  
027797,000185: 22,3376           45402                                    BOTHPAD                               
027798,000186: 
027799,000187: 22,3377           51575        MOONPAD            VLOAD    ABVAL                                 #  COMPUTE MOON PAD RADIUS FROM RLS VECTOR.
027800,000188: 22,3400           02025                                    RLS                                   #  SCALED AT (-27)M.
027801,000189: 22,3401           77722                           SR2R                                           
027802,000190: 22,3402           02211        BOTHPAD            STORE    RPADTEM                               
027803,000191: 22,3403           77624                           CALL                                           
027804,000192: 22,3404           45572                                    SR30.1                                #  CALCULATE ORBITAL PARAMETERS
027805,000193: 22,3405           77634                           RTB                                            
027806,000194: 22,3406           21454                                    LOADTIME                              
027807,000195: 22,3407           77625                           DSU                                            
027808,000196: 22,3410           02213                                    TSTART82                              #  PRESENT TIME - TIME V82GOFF1 BEGAN
027809,000197: 22,3411           02213                           STORE    TSTART82                              #                  SAVE IT
027810,000198: 22,3412           53145                           DLOAD    BZE                                   #  SR30.1 SETS -TPER=0 IF HPER L/
027811,000199: 22,3413           02145                                    -TPER                                 #  HPERMIN (300 OR 35) KFT.
027812,000200: 22,3414           45425                                    TICKTFF                               #  (-TPER = 0)
027813,000201: 22,3415           43345        TICKTPER           DLOAD    DAD                                   #  (-TPER NON ZERO) TFF WAS NOT COMPUTED,
027814,000202: 22,3416           02145                                    -TPER                                 #  BUT WAS SET TO 59M59S.  DONT TICK TFF, DO
027815,000203: 22,3417           02213                                    TSTART82                              #  TICK -TPER.  DISPLAY BOTH.
027816,000204: 22,3420           02145                           STORE    -TPER                                 #  -TPER CORRECTED FOR TIME SINCE V82GOFF1
027817,000205: 22,3421           77776                           EXIT                                           #  BEGAN.
027818,000206: 22,3422           35026                           CAF      BIT1                                  
027819,000207: 22,3423           55541                           TS       V82FLAGS                              #  INFORMS TICKTEST TO INCREMENT ONLY -TPER
027820,000208: 22,3424           05225                           TC       ENDOFJOB                              
027821,000209: 
027822,000210: 22,3425           43345        TICKTFF            DLOAD    DAD                                   #  (-TPER=0) TFF WAS COMPUTED.  TICK TFF.
027823,000211: 22,3426           02143                                    TFF                                   #  DO NOT TICK -TPER.  DISPLAY TFF, BUT NOT
027824,000212: 22,3427           02213                                    TSTART82                              #  -TPER.
027825,000213: 22,3430           02143                           STORE    TFF                                   #  TFF CORRECTED FOR TIME SINCE V82GOFF1
027826,000214: 22,3431           77776                           EXIT                                           #  BEGAN.
027827,000215: 22,3432           35025                           CAF      BIT2                                  
027828,000216: 22,3433           55541                           TS       V82FLAGS                              #  INFORMS TICKTEST TO INCREMENT ONLY TFF.
027829,000217: 22,3434           05225                           TC       ENDOFJOB                              
027830,000218: 
027831,000219: 22,3435           35022        TICKTEST           CAF      BIT5                                  #  THIS WAITLIST PROGRAM PERPETUATES ITSELF
027832,000220: 22,3436           71045                           MASK     EXTVBACT                              #  ONCE A SEC UNTIL BIT 5 OF EXTVBACT =0.
027833,000221: 22,3437           10000                           CCS      A                                     
027834,000222: 22,3440           03446                           TC       DOTICK                                
027835,000223: 22,3441           37665                           CAF      PRIO25                                
027836,000224: 22,3442           05142                           TC       NOVAC                                 #  TERMINATE V 82.  CANT CALL ENDEXT IN RUPT.
027837,000225: 22,3443     1045                                  EBANK=   EXTVBACT                              
027838,000226: 22,3443           05561 04062                     2CADR    ENDEXT                                
027839,000227: 
027840,000228: 22,3445           05321                           TC       TASKOVER                              
027841,000229: 22,3446           35047        DOTICK             CAF      1SEC                                  #  RE-REQUEST TICKTEST.
027842,000230: 22,3447           05252                           TC       WAITLIST                              
027843,000231: 22,3450  E4,1542                                  EBANK=   TFF                                   
027844,000232: 22,3450           03435 44064                     2CADR    TICKTEST                              
027845,000233: 
027846,000234: 22,3452           36221                           CAF      THREE                                 
027847,000235: 22,3453           71541                           MASK     V82FLAGS                              
027848,000236: 22,3454           50000                           INDEX    A                                     
027849,000237: 22,3455           03456                           TC       +1                                    
027850,000238: 22,3456           05321                           TC       TASKOVER                              #  IF NO FLAGBITS SET DONT CHANGE TFF OR
027851,000239:                                                                                                  #  -TPER, BUT CONTINUE LOOP.
027852,000240: 22,3457           03465                           TC       TPERTICK                              #  ONLY BIT 1 SET.  INCR -TPER BY 1 SEC.
027853,000241: 22,3460           35047        TFFTICK            CAF      1SEC                                  #  ONLY BIT 2 SET.  INCR TFF BY 1 SEC.
027854,000242: 22,3461           54001                           TS       L                                     
027855,000243: 22,3462           35030                           CAF      ZERO                                  
027856,000244: 22,3463           21543                           DAS      TFF                                   
027857,000245: 22,3464           05321                           TC       TASKOVER                              
027858,000246: 22,3465           35047        TPERTICK           CAF      1SEC                                  
027859,000247: 22,3466           54001                           TS       L                                     
027860,000248: 22,3467           35030                           CAF      ZERO                                  
027861,000249: 22,3470           21545                           DAS      -TPER                                 
027862,000250: 22,3471           05321                           TC       TASKOVER                              
027863,000251: 
027864,000252: 22,3472           77776        V82GON             EXIT                                           #  AVERAGE G ON.  USE CURRENT STATE VECTOR
027865,000253: 22,3473           00004                           INHINT                                         #  FOR ORBITAL PARAMETER CALCULATIONS.
027866,000254: 22,3474           35071                           CAF      PRIO7                                 #  LESS THAN LAMBERT
027867,000255: 22,3475           05155                           TC       FINDVAC                               #  V82GON1 WILL PERFORM ORBIT CALCULATIONS
027868,000256: 22,3476  E4,1542                                  EBANK=   TFF                                   #  ABOUT PROPER BODY APPROX ONCE PER SEC.
027869,000257: 22,3476           03513 44064                     2CADR    V82GON1                               
027870,000258: 
027871,000259: 22,3500           00003                           RELINT                                         
027872,000260: 22,3501           35047                           CAF      1SEC                                  #  WITHOLD V16 N44 UNTIL FIRST ORBIT CALC
027873,000261: 22,3502           04655                           TC       BANKCALL                              #  IS DONE.  NOTE:  V82GON1 (PRIO7, FINDVAC
027874,000262: 22,3503           01730                           CADR     DELAYJOB                              #  JOB) IS COMPLETED BEFORE V82GON (PRIO7,
027875,000263: 22,3504           06716                           TC       UNK7766                               #  NOVAC JOB).
027876,000264: 22,3505           33316        V82REDSP           CAF      V16N44                                #  MONITOR HAPO, HPER, TFF
027877,000265: 22,3506           04655                           TC       BANKCALL                              
027878,000266: 22,3507           20226                           CADR     GOXDSPF                               
027879,000267: 22,3510           05642                           TC       B5OFF                                 #  TERM THIS TELLS V82GON1 TO KILL ITSELF.
027880,000268: 22,3511           05642                           TC       B5OFF                                 #  PROC DITTO.
027881,000269: 22,3512           03505                           TC       V82REDSP                              #  RECYCLE
027882,000270: 
027883,000271: 22,3513           06014        V82GON1            TC       INTPRET                               #  THIS EXEC PROGRAM PERPETUATES ITSELF
027884,000272:                                                                                                  #  ONCE A SEC UNTIL BIT 5 OF EXTVBACT =0.
027885,000273: 22,3514           52175                           VLOAD    GOTO                                  #  HOLDS OFF CCS NEWJOB BETWEEN RN AND
027886,000274: 22,3515           01220                                    RN                                    #  VN FETCH SO RN, VN ARE FROM SAME
027887,000275: 22,3516           45517                                    NEXTLINE                              #  STATE VECTOR UPDATE.
027888,000276: 22,3517           26215        NEXTLINE           STOVL    RONE                                  #  RN AT (-29)M FOR EARTH OR MOON
027889,000277: 22,3520           01226                                    VN                                    
027890,000278: 22,3521           02223                           STORE    VONE                                  #  VN AT (-7)M/CS FOR EARTH OR MOON
027891,000279: 22,3522           52014                           BON      GOTO                                  
027892,000280: 22,3523           04304                                    MOONTHIS                              #  FLAG INDICATES BODY ABOUT WHICH ORBITAL
027893,000281: 22,3524           45526                                    MOONGON                               #  CALCULATIONS ARE TO BE PERFORMED.
027894,000282: 22,3525           45540                                    EARTHGON                              #  IF SET - MOON, IF RESET - EARTH.
027895,000283: 
027896,000284: 22,3526           77745        MOONGON            DLOAD                                          
027897,000285: 22,3527           05365                                    RTMUM                                 #  LUNAR PARAMETERS LOADED HERE FOR SR30.1
027898,000286: 22,3530           14037                           STODL    TFF/RTMU                              
027899,000287: 22,3531           05371                                    MINPERM                               
027900,000288: 22,3532           02207                           STORE    HPERMIN                               
027901,000289: 22,3533           51575                           VLOAD    ABVAL                                 
027902,000290: 22,3534           02025                                    RLS                                   #  SCALED AT (-27)M.
027903,000291: 22,3535           77722                           SR2R                                           
027904,000292: 22,3536           77650                           GOTO                                           
027905,000293: 22,3537           45546                                    V82GON2                               
027906,000294: 22,3540           77745        EARTHGON           DLOAD                                          
027907,000295: 22,3541           05367                                    RTMUE                                 #  EARTH PARAMETERS LOADED HERE FOR SR30.1
027908,000296: 22,3542           14037                           STODL    TFF/RTMU                              
027909,000297: 22,3543           05373                                    MINPERE                               
027910,000298: 22,3544           16207                           STODL    HPERMIN                               
027911,000299: 22,3545           06105                                    RPAD                                  
027912,000300: 22,3546           02211        V82GON2            STORE    RPADTEM                               #  COMMON CODE FOR EARTH & MOON.
027913,000301: 22,3547           77624                           CALL                                           
027914,000302: 22,3550           45572                                    SR30.1                                
027915,000303: 22,3551           77776                           EXIT                                           
027916,000304: 22,3552           05365                           TC       CHECKMM                               
027917,000305: 22,3553           00013                           DEC      11         B-14                       
027918,000306: 22,3554           03562                           TC       V82GON3                               
027919,000307: 22,3555           06014                           TC       INTPRET                               
027920,000308: 22,3556           45145                           DLOAD    CALL                                  
027921,000309: 22,3557           02143                                    TFF                                   
027922,000310: 22,3560           45561                                    V82GON3    -1                         
027923,000311: 22,3561           77776                           EXIT                                           
027924,000312: 22,3562           35022        V82GON3            CAF      BIT5                                  
027925,000313: 22,3563           71045                           MASK     EXTVBACT                              #  SEE IF ASTRONAUT HAS SIGNALLED TERMINATE
027926,000314: 22,3564           00006                           EXTEND                                         
027927,000315: 22,3565           15561                           BZF      ENDEXT                                #  YES, TERMINATE VB 82 LOOP
027928,000316: 22,3566           35047                           CAF      1SEC                                  
027929,000317: 22,3567           04655                           TC       BANKCALL                              #  WAIT ONE SECOND BEFORE REPEATING
027930,000318: 22,3570           01730                           CADR     DELAYJOB                              #  ORBITAL PARAMETER COMPUTATION.
027931,000319: 22,3571           03513                           TC       V82GON1                               
027932,000320: 
027933,000321: 22,3572  22,3562               SPLRET             =        V82GON3                               
027934,000322: 
027935,000323:                                                                                                  #  SUBROUTINE NAME: SR30.1
027936,000324:                                                                                                  #  MOD NO: 0                                                             DATE: 16 FEB 67
027937,000325:                                                                                                  #  MOD BY: RR BAIRNSFATHER                                               LOG SECTION: R32
027938,000326:                                                                                                  #  MOD NO: 1     MOD BY: RR BAIRNSFATHER         DATE: 11 APR 67         SR30.1 CHANGED TO ALLOW MONITOR OPERN
027939,000327:                                                                                                  #  MOD NO: 2     MOD BY: RR BAIRNSFATHER         DATE: 14 APR 67         ADD OVFL CK FOR RAPO
027940,000328:                                                                                                  #  MOD NO: 3     MOD BY ALONSO                   DATE: 11 DEC 67         SUBROUTINE REWRITTEN
027941,000329:                                                                                                  #  MOD NO: 4     MOD BY ALONSO                   DATE: 26 MAR 68         PROG MOD TO HANDLE DIF EARTH/MOON SCALE
027942,000330:                                                                                                  #  MOD NO: 5     MOD BY: RR BAIRNSFATHER         DATE: 6 AUG 68          OVFL CK FOR HAPO & HPER. VOIDS MOD #2.
027943,000331: 
027944,000332:                                                                                                  #  NEW FUNCTIONAL DESCRIPTION:  ORBITAL PARAMETERS DISPLAY FOR NOUNS 32 AND 44.
027945,000333:                                                                                                  #  SR30.1 CALLS TFFCONMU AND TFFRP/RA TO CALCULATE RPER (PERIGEE RADIUS),
027946,000334:                                                                                                  #  RAPO (APOGEE RADIUS), HPER (PERIGEE HEIGHT ABOVE LAUNCH PAD OR LUNAR
027947,000335:                                                                                                  #  LANDING SITE), HAPO (APOGEE HEIGHT AS ABOVE), TPER (TIME TO PERIGEE),
027948,000336:                                                                                                  #  TFF (TIME TO INTERSECT 300 KFT ABOVE PAD OR 35KFT ABOVE LANDING SITE).
027949,000337:                                                                                                  #  IF HPER IS GREATER THAN OR EQUAL TO HPERMIN, CALCULATES TPER AND STORES
027950,000338:                                                                                                  #  NEGATIVE IN -TPER.  OTHERWISE STORES +0 IN -TPER.  WHENEVER TPER IS
027951,000339:                                                                                                  #  CALCULATED, TFF IS NOT COMPUTABLE AND DEFAULTS TO -59MIN 59SEC.  IF HAPO
027952,000340:                                                                                                  #  WOULD EXCEED 9999.9 NM, IT IS LIMITED TO THAT VALUE FOR DISPLAY.
027953,000341: 
027954,000342:                                                                                                  #  ADDENDUM:     HAPO AND HPER SHOULD BE CHANGED TO READ HAPOX AND HPERX IN THE
027955,000343:                                                                                                  #                ABOVE REMARKS.
027956,000344: 
027957,000345:                                                                                                  #  CALLING SEQUENCE:     CALL
027958,000346:                                                                                                  #                                SR30.1
027959,000347: 
027960,000348:                                                                                                  #  SUBROUTINES CALLED:   TFFCONMU, TFFRP/RA, CALCTPER, CALCTFF
027961,000349: 
027962,000350:                                                                                                  #  NORMAL EXIT MODE:     CALLING LINE +1 (STILL IN INTERPRETIVE MODE)
027963,000351: 
027964,000352:                                                                                                  #  ALARMS:       NONE
027965,000353: 
027966,000354:                                                                                                  #  OUTPUT:       RAPO    (-29) M EARTH   APOGEE RADIUS   EARTH CENTERED COORD.
027967,000355:                                                                                                  #                        (-27) M MOON                    MOON CENTERED COORD.
027968,000356:                                                                                                  #                RPER    (-29) M EARTH   PERIGEE RADIUS  EARTH CENTERED COORD.
027969,000357:                                                                                                  #                        (-27) M MOON                    MOON CENTERED COORD.
027970,000358:                                                                                                  #                HAPOX   (-29) M         APOGEE ALTITUDE ABOVE PAD OR LAND. SITE MAX VALUE LIMITED TO 9999.9 NM.
027971,000359:                                                                                                  #                HPERX   (-29) M         PERIGEE ALT. ABOVE PAD OR LAND. SITE    MAX VALUE LIMITED TO 9999.9 NM.
027972,000360:                                                                                                  #                TFF     (-28) CS        TIME TO 300KFT OR 35KFT ALTITUDE
027973,000361:                                                                                                  #                -TPER   (-28) CS        TIME TO PERIGEE
027974,000362: 
027975,000363:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED -
027976,000364:                                                                                                  #        TFF/RTMU        (+17) EARTH     RECIPROCAL OF PROPER GRAV CONSTANT FOR
027977,000365:                                                                                                  #                        (+14) MOON      EARTH OR MOON = 1/SQRT(MU).
027978,000366:                                                                                                  #        RONE            (-29) M         STATE VECTOR
027979,000367:                                                                                                  #        VONE            (-7)  M/CS      STATE VECTOR
027980,000368:                                                                                                  #        RPADTEM         (-29) M EARTH   RADIUS OF LAUNCH PAD OR LUNAR LANDING
027981,000369:                                                                                                  #                        (-27) M MOON    SITE.
027982,000370:                                                                                                  #        HPERMIN         (-29) M EARTH   (300 OR 35) KFT MINIMUM PERIGEE ALTITUDE
027983,000371:                                                                                                  #                        (-27) M MOON    ABOVE LAUNCH PAD OR LUNAR LANDING SITE.
027984,000372:                                                                                                  #        V82EMFLG        (INT SW BIT)    RESET FOR EARTH, SET FOR MOON.
027985,000373: 
027986,000374:                                                                                                  #  DEBRIS:       QPRET, PDL, S2
027987,000375: 
027988,000376: 22,3572                                           COUNT*   $$/SR30S                              
027989,000377: 
027990,000378: 22,3572           44001        SR30.1             SETPD    STQ                                   #  INITIALIZE PUSHDOWN LIST.
027991,000379: 22,3573           00001                                    0                                     
027992,000380: 22,3574           00051                                    S2                                    
027993,000381:                                                                                                  #  SR30.1 INPUT: RONE AT (-29)M EARTH/MOON
027994,000382:                                                                                                  #                VONE AT (-7)M/CS
027995,000383:                                                                                                  #  TFFCONMU, TFFRP/RA, CALCTPER AND CALCTFF
027996,000384:                                                                                                  #  CALLS REQUIRE:
027997,000385:                                                                                                  #  EARTH CENTERED (NO RESCALING REQUIRED)
027998,000386:                                                                                                  #        RONE SCALED TO B-29 M
027999,000387:                                                                                                  #        VONE SCALED TO B-7  M/CS
028000,000388:                                                                                                  #  MOON CENTERED (RESCALING REQUIRED)
028001,000389:                                                                                                  #        RONE SCALED TO B-27 M
028002,000390:                                                                                                  #        VONE SCALED TO B-5  M/CS
028003,000391: 22,3575           77624                           CALL                                           
028004,000392: 22,3576           57314                                    TFFCONMU                              
028005,000393: 22,3577           77624                           CALL                                           #  TFFRP/RA COMPUTES RAPO,RPER.
028006,000394: 22,3600           57360                                    TFFRP/RA                              
028007,000395:                                                                                                  #  RETURNS WITH RAPO IN D(MPAC).
028008,000396: 22,3601           40015                           DAD      BOV                                   
028009,000397: 22,3602           14423                                    1BITDP                                
028010,000398: 22,3603           45637                                    MAXCHK                                
028011,000399: 22,3604           45345                           DLOAD    DSU                                   
028012,000400: 22,3605           00021                                    RAPO                                  
028013,000401: 22,3606           02211                                    RPADTEM                               
028014,000402: 22,3607           16122        STORHAPO           STODL    HAPOX                                 
028015,000403: 22,3610           00017                                    RPER                                  
028016,000404: 22,3611           77625                           DSU                                            
028017,000405: 22,3612           02211                                    RPADTEM                               #  GIVES HPER AT (-29)M EARTH, (-27)M MOON.
028018,000406: 22,3613           02124        STORHPER           STORE    HPERX                                 #  STORE (RPER - RPADTEM) INTO HPERX.
028019,000407: 22,3614           51025                           DSU      BPL                                   #  HPERMIN AT (-29)M FOR EARTH, (-27)M MOON
028020,000408: 22,3615           02207                                    HPERMIN                               #  IF HPER L/ HPERMIN (300 OR 35) KFT,
028021,000409: 22,3616           45622                                    DOTPER                                #  THEN ZERO INTO -TPER.
028022,000410: 22,3617           52145                           DLOAD    GOTO                                  #  OTHERWISE CALCULATE TPER.
028023,000411: 22,3620           06233                                    HI6ZEROS                              
028024,000412: 22,3621           45626                                    SKIPTPER                              
028025,000413: 22,3622           45145        DOTPER             DLOAD    CALL                                  
028026,000414: 22,3623           00017                                    RPER                                  
028027,000415: 22,3624           57412                                    CALCTPER                              
028028,000416: 22,3625           77676                           DCOMP                                          #  TPER IS PUT NEG INTO -TPER.
028029,000417: 22,3626           16145        SKIPTPER           STODL    -TPER                                 
028030,000418: 22,3627           02207                                    HPERMIN                               #  HPERMIN AT (-29)M FOR EARTH, (-27)M MOON
028031,000419: 22,3630           45015                           DAD      CALL                                  
028032,000420: 22,3631           02211                                    RPADTEM                               #  RPADTEM AT (-29)M FOR EARTH, (-27)M MOON
028033,000421: 22,3632           57415                                    CALCTFF                               #  GIVES 59M59S FOR TFF IF RPER G/
028034,000422: 22,3633           77676                           DCOMP                                          #  HPERMIN + RPADTEM.  (TPER WAS NON ZERO)
028035,000423: 22,3634           02143                           STORE    TFF                                   #  OTHERWISE COMPUTES TFF.       (GOTO)
028036,000424: 22,3635           77650                           GOTO                                           
028037,000425: 22,3636           00051                                    S2                                    
028038,000426: 
028039,000427: 22,3637           52145        MAXCHK             DLOAD    GOTO                                  #  IF C(MPAC) > 9999.9 NM, MPAC = 9999.9 NM
028040,000428: 22,3640           05643                                    MAXNM                                 
028041,000429: 22,3641           45607                                    STORHAPO                              
028042,000430: 
028043,000431: 22,3642           01065 05603  MAXNM              2OCT     01065      05603                      
028044,000432: 
028045,000433: 

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