Source Code

These source-code files are part of a reconstructed copy of Luminary 98, a development version of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction began with source code of Luminary 99 revision 1 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes described in original Luminary memo 85, using asterisks indicating changed lines in the listing as a guide. While no listing of this version is known to exist, nor are the memory-bank checksums available, the reconstruction is believed to be correct because it was an an intermediate step in reconstructing Luminary 97 whose reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152G. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 98 listing.

Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

054592,000002:                                                                                                  ## Copyright:   Public domain.
054593,000003:                                                                                                  ## Filename:    RESTARTS_ROUTINE.agc
054594,000004:                                                                                                  ## Purpose:     A section of Luminary revision 98.
054595,000005:                                                                                                  ##              It is part of the reconstructed source code for the a
054596,000006:                                                                                                  ##              development version of the flight software for the Lunar 
054597,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
054598,000008:                                                                                                  ##              The code has been recreated from a copy of Luminary 99
054599,000009:                                                                                                  ##              revision 001, using asterisks indicating changed lines in
054600,000010:                                                                                                  ##              the listing and Luminary Memo #85, which lists changes between
054601,000011:                                                                                                  ##              Luminary 98 and 99.
054602,000012:                                                                                                  ## Reference:   pp. 1303-1308
054603,000013:                                                                                                  ## Assembler:   yaYUL
054604,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
054605,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
054606,000016:                                                                                                  ## Mod history: 2019-07-28 MAS  Created from Luminary 99.
054607,000017: 

Page 1303

054609,000019: 01,3526                                           BANK     01                                    
054610,000020: 01,2000                                           SETLOC   RESTART                               
054611,000021: 01,2000                                           BANK                                           
054612,000022: 
054613,000023: 01,3526  E3,1436                                  EBANK=   PHSNAME1                              #  GOPROG MUST SWITCH TO THIS EBANK
054614,000024: 
054615,000025: 01,3526                                           COUNT*   $$/RSROU                              
054616,000026: 01,3526           30161        RESTARTS           CA       MPAC       +5                         #  GET GROUP NUMBER -1
054617,000027: 01,3527           60000                           DOUBLE                                         #  SAVE FOR INDEXING
054618,000028: 01,3530           54155                           TS       TEMP2G                                
054619,000029: 
054620,000030: 01,3531           33770                           CA       PHS2CADR                              #  SET UP EXIT IN CASE IT IS AN EVEN
054621,000031: 01,3532           54157                           TS       TEMPSWCH                              #  TABLE PHASE
054622,000032: 
054623,000033: 01,3533           33565                           CA       RTRNCADR                              #  TO SAVE TIME ASSUME IT WILL GET NEXT
054624,000034: 01,3534           54707                           TS       GOLOC      +2                         #  GROUP AFTER THIS
054625,000035: 
054626,000036: 01,3535           30154                           CA       TEMPPHS                               
054627,000037: 01,3536           75007                           MASK     OCT1400                               
054628,000038: 01,3537           10000                           CCS      A                                     #  IS IT A VARIABLE OR TABLE RESTART
054629,000039: 01,3540           13551                           TCF      ITSAVAR                               #  IT:S A VARIABLE RESTART
054630,000040: 
054631,000041: 01,3541           10154        GETPART2           CCS      TEMPPHS                               #  IS IT AN X.1 RESTART
054632,000042: 01,3542           10000                           CCS      A                                     
054633,000043: 01,3543           13651                           TCF      ITSATBL                               #  NO, ITS A TABLE RESTART
054634,000044: 
054635,000045: 01,3544           35024                           CA       PRIO14                                #  IT IS AN X.1 RESTART, THEREFORE START
054636,000046: 01,3545           05105                           TC       FINDVAC                               #  THE DISPLAY RESTART JOB
054637,000047: 01,3546  E3,1400                                  EBANK=   LST1                                  
054638,000048: 01,3546           03037 20103                     2CADR    INITDSP                               
054639,000049: 
054640,000050: 01,3550           03565                           TC       RTRNCADR                              #  FINISHED WITH THIS GROUP, GET NEXT ONE
054641,000051: 
054642,000052: 01,3551           75007        ITSAVAR            MASK     OCT1400                               #  IS IT TYPE B ?
054643,000053: 01,3552           10000                           CCS      A                                     
054644,000054: 01,3553           13622                           TCF      ITSLIKEB                              #  YES, IT IS TYPE B
054645,000055: 
054646,000056: 01,3554           00006                           EXTEND                                         #  STORE THE JOB (OR TASK) 2CADR FOR EXIT
054647,000057: 01,3555           50155                           NDX      TEMP2G                                
054648,000058: 01,3556           31437                           DCA      PHSNAME1                              
054649,000059: 01,3557           52706                           DXCH     GOLOC                                 
054650,000060: 
054651,000061: 01,3560           30154                           CA       TEMPPHS                               #  SEE IF THIS IS A JOB, TASK, OR A LONGCAL
054652,000062: 01,3561           74757                           MASK     OCT7                                  
054653,000063: 01,3562           67746                           AD       MINUS2                                
054654,000064: 01,3563           10000                           CCS      A                                     
054655,000065: 01,3564           13734                           TCF      ITSLNGCL                              #  ITS A LONGCALL
054656,000066: 
054657,000067: 01,3565           04631        RTRNCADR           TC       SWRETURN                              #  CANT GET HERE

Page 1304

054659,000069: 01,3566           13570                           TCF      ITSAWAIT                              
054660,000070: 
054661,000071: 01,3567           13635                           TCF      ITSAJOB                               #  ITS A JOB
054662,000072: 
054663,000073: 01,3570           33774        ITSAWAIT           CA       WTLTCADR                              #  SET UP WAITLIST CALL
054664,000074: 01,3571           54704                           TS       GOLOC      -1                         
054665,000075: 
054666,000076: 01,3572           50155                           NDX      TEMP2G                                #  DIRECTLY STORED
054667,000077: 01,3573           31054                           CA       PHSPRDT1                              
054668,000078: 01,3574           10000        TIMETEST           CCS      A                                     #  IS IT AN IMMEDIATE RESTART
054669,000079: 01,3575           24000                           INCR     A                                     #  NO,
054670,000080: 01,3576           13601                           TCF      FINDTIME                              #  FIND OUT WHEN IT SHOULD BEGIN
054671,000081: 
054672,000082: 01,3577           15436                           TCF      ITSINDIR                              #  STORED INDIRECTLY
054673,000083: 
054674,000084: 01,3600           13620                           TCF      IMEDIATE                              #  IT WANTS AN IMMEDIATE RESTART
054675,000085: 
054676,000086:                                                                                                  #  ***** THIS MUST BE IN FIXED FIXED *****
054677,000087: 
054678,000088:    5436                                           BLOCK    02                                    
054679,000089:    4000                                           SETLOC   FFTAG2                                
054680,000090:    4000                                           BANK                                           
054681,000091: 
054682,000092:    5436                                           COUNT*   $$/RSROU                              
054683,000093:    5436           22706        ITSINDIR           LXCH     GOLOC      +1                         #  GET THE CORRECT E BANK IN CASE THIS IS
054684,000094:    5437           22006                           LXCH     BB                                    #  SWITCHED ERRASIBLE
054685,000095: 
054686,000096:    5440           50000                           NDX      A                                     #  GET THE TIME INDIRECTLY
054687,000097:    5441           30001                           CA       1                                     
054688,000098: 
054689,000099:    5442           22006                           LXCH     BB                                    #  RESTORE THE BB AND GOLOC
054690,000100:    5443           22706                           LXCH     GOLOC      +1                         
054691,000101: 
054692,000102:    5444           13601                           TCF      FINDTIME                              #  FIND OUT WHEN IT SHOULD BEGIN
054693,000103: 
054694,000104:                                                                                                  #  ***** YOU MAY RETURN TO SWITCHED FIXED *****
054695,000105: 
054696,000106: 01,3601                                           BANK     01                                    
054697,000107: 01,2000                                           SETLOC   RESTART                               
054698,000108: 01,2000                                           BANK                                           
054699,000109: 
054700,000110: 01,3601                                           COUNT*   $$/RSROU                              
054701,000111: 01,3601           40000        FINDTIME           COM                                            #  MAKE NEGITIVE SINCE IT WILL BE SUBTRACTD
054702,000112: 01,3602           54001                           TS       L                                     #  AND SAVE
054703,000113: 01,3603           50155                           NDX      TEMP2G                                
054704,000114: 01,3604           41053                           CS       TBASE1                                
054705,000115: 01,3605           00006                           EXTEND                                         
054706,000116: 01,3606           60025                           SU       TIME1                                 
054707,000117: 01,3607           10000                           CCS      A                                     
054708,000118: 01,3610           40000                           COM                                            

Page 1305

054710,000120: 01,3611           67731                           AD       OCT37776                              
054711,000121: 01,3612           64753                           AD       ONE                                   
054712,000122: 01,3613           60001                           AD       L                                     
054713,000123: 01,3614           10000                           CCS      A                                     
054714,000124: 01,3615           34755                           CA       ZERO                                  
054715,000125: 01,3616           13620                           TCF      +2                                    
054716,000126: 01,3617           13620                           TCF      +1                                    
054717,000127: 01,3620           64753        IMEDIATE           AD       ONE                                   
054718,000128: 01,3621           00704                           TC       GOLOC      -1                         
054719,000129: 01,3622           33565        ITSLIKEB           CA       RTRNCADR                              #  TYPE B, SO STORE RETURN IN
054720,000130: 01,3623           54157                           TS       TEMPSWCH                              #  TEMPSWCH IN CASE OF AN EVEN PHASE
054721,000131: 
054722,000132: 01,3624           33771                           CA       PRT2CADR                              #  SET UP EXIT TO GET TABLE PART OF THIS
054723,000133: 01,3625           54707                           TS       GOLOC      +2                         #  VARIABLE TYPE OF PHASE
054724,000134: 
054725,000135: 01,3626           30154                           CA       TEMPPHS                               #  MAKE THE PHASE LOOK RIGHT FOR THE TABLE
054726,000136: 01,3627           76074                           MASK     OCT177                                #  PART OF THIS VARIABLE PHASE
054727,000137: 01,3630           54154                           TS       TEMPPHS                               
054728,000138: 
054729,000139: 01,3631           00006                           EXTEND                                         
054730,000140: 01,3632           50155                           NDX      TEMP2G                                #  OBTAIN THE JOB:S 2CADR
054731,000141: 01,3633           31437                           DCA      PHSNAME1                              
054732,000142: 01,3634           52706                           DXCH     GOLOC                                 
054733,000143: 
054734,000144: 01,3635           50155        ITSAJOB            NDX      TEMP2G                                #  NOW ADD THE PRIORITY AND LET:S GO
054735,000145: 01,3636           31054                           CA       PHSPRDT1                              
054736,000146: 01,3637           54704        CHKNOVAC           TS       GOLOC      -1                         #  SAVE PRIO UNTIL WE SEE IF ITS
054737,000147: 01,3640           00006                           EXTEND                                         #  A FINDVAC OR A NOVAC
054738,000148: 01,3641           63645                           BZMF     ITSNOVAC                              
054739,000149: 
054740,000150: 01,3642           33773                           CAF      FVACCADR                              #  POSITIVE, SET UP FINDVAC CALL.
054741,000151: 01,3643           56704                           XCH      GOLOC      -1                         #  PICK UP PRIO,
054742,000152: 01,3644           00704                           TC       GOLOC      -1                         #  AND GO
054743,000153: 
054744,000154: 01,3645           33775        ITSNOVAC           CAF      NOVACADR                              #  NEGATIVE,
054745,000155: 01,3646           56704                           XCH      GOLOC      -1                         #  SET UP NOVAC CALL,
054746,000156: 01,3647           40000                           COM                                            #  CORRECT PRIO,
054747,000157: 01,3650           00704                           TC       GOLOC      -1                         #  AND GO
054748,000158: 
054749,000159: 01,3651           54020        ITSATBL            TS       CYR                                   #  FIND OUT IF THE PHASE IS ODD OR EVEN
054750,000160: 01,3652           10020                           CCS      CYR                                   
054751,000161: 01,3653           13654                           TCF      +1                                    #  IT:S EVEN
054752,000162: 01,3654           13752                           TCF      ITSEVEN                               
054753,000163: 
054754,000164: 01,3655           33565                           CA       RTRNCADR                              #  IN CASE THIS IS THE SECOND PART OF A
054755,000165: 01,3656           54707                           TS       GOLOC      +2                         #  TYPE B RESTART, WE NEED PROPER EXIT
054756,000166: 
054757,000167: 01,3657           30154                           CA       TEMPPHS                               #  SET UP POINTER FOR FINDING OUR PLACE IN
054758,000168: 01,3660           54021                           TS       SR                                    #  THE RESTART TABLES
054759,000169: 01,3661           60021                           AD       SR                                    

Page 1306

054761,000171: 01,3662           50155                           NDX      TEMP2G                                
054762,000172: 01,3663           62003                           AD       SIZETAB    +1                         
054763,000173: 01,3664           54156                           TS       POINTER                               
054764,000174: 
054765,000175: 01,3665           00006        CONTBL2            EXTEND                                         #  FIND OUT WHAT:S IN THE TABLE
054766,000176: 01,3666           50156                           NDX      POINTER                               
054767,000177: 01,3667           32002                           DCA      CADRTAB                               #  GET THE 2CADR
054768,000178: 
054769,000179: 01,3670           22706                           LXCH     GOLOC      +1                         #  STORE THE BB INFORMATION
054770,000180: 
054771,000181: 01,3671           10000                           CCS      A                                     #  IS IT A JOB OR IS IT TIMED
054772,000182: 01,3672           24000                           INCR     A                                     #  POSITIVE, MUST BE A JOB
054773,000183: 01,3673           13746                           TCF      ITSAJOB2                              
054774,000184: 
054775,000185: 01,3674           24000                           INCR     A                                     #  MUST BE EITHER A WAITLIST OR LONGCALL
054776,000186: 01,3675           54705                           TS       GOLOC                                 #  LET-S STORE THE CORRECT CADR
054777,000187: 
054778,000188: 01,3676           33774                           CA       WTLTCADR                              #  SET UP OUR EXIT TO WAITLIST
054779,000189: 01,3677           54704                           TS       GOLOC      -1                         
054780,000190: 
054781,000191: 01,3700           30706                           CA       GOLOC      +1                         #  NOW FIND OUT IF IT IS A WAITLIST CALL
054782,000192: 01,3701           74742                           MASK     BIT10                                 #  THIS SHOULD BE ONE IF WE HAVE -BB
054783,000193: 01,3702           10000                           CCS      A                                     #  FOR THAT MATTER SO SHOULD BE BITS 9,8,7,
054784,000194:                                                                                                  #  6,5, AND LAST BUT NOT LEAST (PERHAPS NOT
054785,000195:                                                                                                  #  IN IMPORTANCE ANYWAY.  BIT 4
054786,000196: 01,3703           13741                           TCF      ITSWTLST                              #  IT IS A WAITLIST CALL
054787,000197: 
054788,000198: 01,3704           50156                           NDX      POINTER                               #  OBTAIN THE ORIGINAL DELTA T
054789,000199: 01,3705           32000                           CA       PRDTTAB                               #  ADDRESS FOR THIS LONGCALL
054790,000200: 
054791,000201: 01,3706           15445                           TCF      ITSLGCL1                              #  NOW GO GET THE DELTA TIME
054792,000202: 
054793,000203:                                                                                                  #  ***** THIS MUST BE IN FIXED FIXED *****
054794,000204: 
054795,000205:    5445                                           BLOCK    02                                    
054796,000206:    4000                                           SETLOC   FFTAG2                                
054797,000207:    4000                                           BANK                                           
054798,000208: 
054799,000209:    5445                                           COUNT*   $$/RSROU                              
054800,000210:    5445           22706        ITSLGCL1           LXCH     GOLOC      +1                         #  OBTAIN THE CORRECT E BANK
054801,000211:    5446           22006                           LXCH     BB                                    
054802,000212:    5447           22706                           LXCH     GOLOC      +1                         #  AND PRESERVE OUR E AND F BANKS
054803,000213: 
054804,000214:    5450           00006                           EXTEND                                         #  GET THE DELTA TIME
054805,000215:    5451           50000                           NDX      A                                     
054806,000216:    5452           30001                           DCA      0                                     
054807,000217: 
054808,000218:    5453           22706                           LXCH     GOLOC      +1                         #  RESTORE OUR E AND F BANK
054809,000219:    5454           22006                           LXCH     BB                                    #  RESTORE THE TASKS E AND F BANKS
054810,000220:    5455           22706                           LXCH     GOLOC      +1                         #  AND PRESERVE OUR L

Page 1307

054812,000222:    5456           13707                           TCF      ITSLGCL2                              #  NOW LET:S PROCESS THIS LONGCALL
054813,000223: 
054814,000224:                                                                                                  #  ***** YOU MAY RETURN TO SWITCHED FIXED *****
054815,000225: 
054816,000226: 01,3707                                           BANK     01                                    
054817,000227: 01,2000                                           SETLOC   RESTART                               
054818,000228: 01,2000                                           BANK                                           
054819,000229: 
054820,000230: 01,3707                                           COUNT*   $$/RSROU                              
054821,000231: 01,3707           53154        ITSLGCL2           DXCH     LONGTIME                              
054822,000232: 
054823,000233: 01,3710           00006                           EXTEND                                         #  CALCULATE TIME LEFT
054824,000234: 01,3711           40025                           DCS      TIME2                                 
054825,000235: 01,3712           21154                           DAS      LONGTIME                              
054826,000236: 01,3713           00006                           EXTEND                                         
054827,000237: 01,3714           31152                           DCA      LONGBASE                              
054828,000238: 01,3715           21154                           DAS      LONGTIME                              
054829,000239: 
054830,000240: 01,3716           11153                           CCS      LONGTIME                              #  FIND OUT HOW THIS SHOULD BE RESTARTED
054831,000241: 01,3717           13727                           TCF      LONGCLCL                              
054832,000242: 01,3720           13722                           TCF      +2                                    
054833,000243: 01,3721           13615                           TCF      IMEDIATE   -3                         
054834,000244: 01,3722           11154                           CCS      LONGTIME   +1                         
054835,000245: 01,3723           13727                           TCF      LONGCLCL                              
054836,000246: 01,3724           13725                           NOOP                                           #  CAN:T GET HERE *********
054837,000247: 01,3725           13615                           TCF      IMEDIATE   -3                         
054838,000248: 01,3726           13620                           TCF      IMEDIATE                              
054839,000249: 
054840,000250: 01,3727           33772        LONGCLCL           CA       LGCLCADR                              #  WE WILL GO TO LONGCALL
054841,000251: 01,3730           54704                           TS       GOLOC      -1                         
054842,000252: 
054843,000253: 01,3731           00006                           EXTEND                                         #  PREPARE OUR ENTRY TO LONGCALL
054844,000254: 01,3732           31154                           DCA      LONGTIME                              
054845,000255: 01,3733           00704                           TC       GOLOC      -1                         
054846,000256: 
054847,000257: 01,3734           33774        ITSLNGCL           CA       WTLTCADR                              #  ASSUME IT WILL GO TO WAITLIST
054848,000258: 01,3735           54704                           TS       GOLOC      -1                         
054849,000259: 
054850,000260: 01,3736           50155                           NDX      TEMP2G                                
054851,000261: 01,3737           41054                           CS       PHSPRDT1                              #  GET THE DELTA T ADDRESS
054852,000262: 
054853,000263: 01,3740           15445                           TCF      ITSLGCL1                              #  NOW GET THE DELTA TIME
054854,000264: 
054855,000265: 01,3741           40706        ITSWTLST           CS       GOLOC      +1                         #  CORRECT THE BBCON INFORMATION
054856,000266: 01,3742           54706                           TS       GOLOC      +1                         
054857,000267: 
054858,000268: 01,3743           50156                           NDX      POINTER                               #  GET THE DT AND FIND OUT IF IT WAS STORED
054859,000269: 01,3744           32000                           CA       PRDTTAB                               #  DIRECTLY OR INDIRECTLY
054860,000270: 
054861,000271: 01,3745           13574                           TCF      TIMETEST                              #  FIND OUT HOW THE TIME IS STORED
054862,000272: 

Page 1308

054864,000274: 01,3746           56705        ITSAJOB2           XCH      GOLOC                                 #  STORE THE CADR
054865,000275: 
054866,000276: 01,3747           50156                           NDX      POINTER                               #  ADD THE PRIORITY AND LET:S GO
054867,000277: 01,3750           32000                           CA       PRDTTAB                               
054868,000278: 
054869,000279: 01,3751           13637                           TCF      CHKNOVAC                              
054870,000280: 
054871,000281: 01,3752           30157        ITSEVEN            CA       TEMPSWCH                              #  SET UP FOR EITHER THE SECOND PART OF THE
054872,000282: 01,3753           54707                           TS       GOLOC      +2                         #  TABLE, OR A RETURN FOR THE NEXT GROUP
054873,000283: 
054874,000284: 01,3754           50155                           NDX      TEMP2G                                #  SET UP POINTER FOR OUR LOCATION WITHIN
054875,000285: 01,3755           32002                           CA       SIZETAB                               #  THE TABLE
054876,000286: 01,3756           60154                           AD       TEMPPHS                               #  THIS MAY LOOK BAD BUT LET:S SEE YOU DO
054877,000287: 01,3757           60154                           AD       TEMPPHS                               #  BETTER IN TIME OR NUMBERR OF LOCATIONS
054878,000288: 01,3760           60154                           AD       TEMPPHS                               
054879,000289: 01,3761           54156                           TS       POINTER                               
054880,000290: 
054881,000291: 01,3762           13665                           TCF      CONTBL2                               #  NOW PROCESS WHAT IS IN THE TABLE
054882,000292: 
054883,000293: 01,3763           36245        PHSPART2           CA       THREE                                 #  SET THE POINTER FOR THE SECOND HALF OF
054884,000294: 01,3764           26156                           ADS      POINTER                               #  THE TABLE
054885,000295: 
054886,000296: 01,3765           33565                           CA       RTRNCADR                              #  THIS WILL BE OUR LAST TIME THROUGH THE
054887,000297: 01,3766           54707                           TS       GOLOC      +2                         #  EVEN TABLE, SO AFTER IT GET THE NEXT
054888,000298:                                                                                                  #  GROUP
054889,000299: 01,3767           13665                           TCF      CONTBL2                               #  SO LET:S GET THE SECOND ENTRY IN THE TBL
054890,000300: 
054891,000301: 01,3770     0154               TEMPPHS            EQUALS   MPAC                                  
054892,000302: 01,3770     0155               TEMP2G             EQUALS   MPAC       +1                         
054893,000303: 01,3770     0156               POINTER            EQUALS   MPAC       +2                         
054894,000304: 01,3770     0157               TEMPSWCH           EQUALS   MPAC       +3                         
054895,000305: 01,3770     0705               GOLOC              EQUALS   VAC5       +20D                       
054896,000306: 01,3770     7746               MINUS2             EQUALS   NEG2                                  
054897,000307: 01,3770     6074               OCT177             EQUALS   LOW7                                  
054898,000308: 
054899,000309: 01,3770           03763        PHS2CADR           GENADR   PHSPART2                              
054900,000310: 01,3771           03541        PRT2CADR           GENADR   GETPART2                              
054901,000311: 01,3772           05277        LGCLCADR           GENADR   LONGCALL                              
054902,000312: 01,3773           05105        FVACCADR           GENADR   FINDVAC                               
054903,000313: 01,3774           05203        WTLTCADR           GENADR   WAITLIST                              
054904,000314: 01,3775           05072        NOVACADR           GENADR   NOVAC                                 
054905,000315: 
054906,000316: 

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