Source Code

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

The reconstruction began with reconstructed source code for Luminary 97. Changes between revisions 96 and 97 were backed out, as described by anomal report LNY-59. transcribed from a digitized copy of that program. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152D. 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 96 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.

054710,000002:                                                                                                  ## Copyright:   Public domain.
054711,000003:                                                                                                  ## Filename:    RESTARTS_ROUTINE.agc
054712,000004:                                                                                                  ## Purpose:     A section of Luminary revision 96.
054713,000005:                                                                                                  ##              It is part of the reconstructed source code for the
054714,000006:                                                                                                  ##              original release of the flight software for the Lunar 
054715,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
054716,000008:                                                                                                  ##              The code has been recreated from a previously reconstructed
054717,000009:                                                                                                  ##              copy of Luminary 97 by undoing changes described in anomaly
054718,000010:                                                                                                  ##              report LNY-59. The code has been adapted such that the
054719,000011:                                                                                                  ##              resulting bugger words exactly match those specified for
054720,000012:                                                                                                  ##              Luminary 96 in NASA drawing 2021152D, which gives relatively
054721,000013:                                                                                                  ##              high confidence that the reconstruction is correct.
054722,000014:                                                                                                  ## Reference:   pp. 1303-1308
054723,000015:                                                                                                  ## Assembler:   yaYUL
054724,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
054725,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
054726,000018:                                                                                                  ## Mod history: 2019-08-04 MAS  Created from Luminary 97.
054727,000019: 

Page 1303

054729,000021: 01,3526                                           BANK     01                                    
054730,000022: 01,2000                                           SETLOC   RESTART                               
054731,000023: 01,2000                                           BANK                                           
054732,000024: 
054733,000025: 01,3526  E3,1436                                  EBANK=   PHSNAME1                              #  GOPROG MUST SWITCH TO THIS EBANK
054734,000026: 
054735,000027: 01,3526                                           COUNT*   $$/RSROU                              
054736,000028: 01,3526           30161        RESTARTS           CA       MPAC       +5                         #  GET GROUP NUMBER -1
054737,000029: 01,3527           60000                           DOUBLE                                         #  SAVE FOR INDEXING
054738,000030: 01,3530           54155                           TS       TEMP2G                                
054739,000031: 
054740,000032: 01,3531           33770                           CA       PHS2CADR                              #  SET UP EXIT IN CASE IT IS AN EVEN
054741,000033: 01,3532           54157                           TS       TEMPSWCH                              #  TABLE PHASE
054742,000034: 
054743,000035: 01,3533           33565                           CA       RTRNCADR                              #  TO SAVE TIME ASSUME IT WILL GET NEXT
054744,000036: 01,3534           54707                           TS       GOLOC      +2                         #  GROUP AFTER THIS
054745,000037: 
054746,000038: 01,3535           30154                           CA       TEMPPHS                               
054747,000039: 01,3536           75007                           MASK     OCT1400                               
054748,000040: 01,3537           10000                           CCS      A                                     #  IS IT A VARIABLE OR TABLE RESTART
054749,000041: 01,3540           13551                           TCF      ITSAVAR                               #  IT:S A VARIABLE RESTART
054750,000042: 
054751,000043: 01,3541           10154        GETPART2           CCS      TEMPPHS                               #  IS IT AN X.1 RESTART
054752,000044: 01,3542           10000                           CCS      A                                     
054753,000045: 01,3543           13651                           TCF      ITSATBL                               #  NO, ITS A TABLE RESTART
054754,000046: 
054755,000047: 01,3544           35024                           CA       PRIO14                                #  IT IS AN X.1 RESTART, THEREFORE START
054756,000048: 01,3545           05105                           TC       FINDVAC                               #  THE DISPLAY RESTART JOB
054757,000049: 01,3546  E3,1400                                  EBANK=   LST1                                  
054758,000050: 01,3546           03037 20103                     2CADR    INITDSP                               
054759,000051: 
054760,000052: 01,3550           03565                           TC       RTRNCADR                              #  FINISHED WITH THIS GROUP, GET NEXT ONE
054761,000053: 
054762,000054: 01,3551           75007        ITSAVAR            MASK     OCT1400                               #  IS IT TYPE B ?
054763,000055: 01,3552           10000                           CCS      A                                     
054764,000056: 01,3553           13622                           TCF      ITSLIKEB                              #  YES, IT IS TYPE B
054765,000057: 
054766,000058: 01,3554           00006                           EXTEND                                         #  STORE THE JOB (OR TASK) 2CADR FOR EXIT
054767,000059: 01,3555           50155                           NDX      TEMP2G                                
054768,000060: 01,3556           31437                           DCA      PHSNAME1                              
054769,000061: 01,3557           52706                           DXCH     GOLOC                                 
054770,000062: 
054771,000063: 01,3560           30154                           CA       TEMPPHS                               #  SEE IF THIS IS A JOB, TASK, OR A LONGCAL
054772,000064: 01,3561           74757                           MASK     OCT7                                  
054773,000065: 01,3562           67746                           AD       MINUS2                                
054774,000066: 01,3563           10000                           CCS      A                                     
054775,000067: 01,3564           13734                           TCF      ITSLNGCL                              #  ITS A LONGCALL
054776,000068: 
054777,000069: 01,3565           04631        RTRNCADR           TC       SWRETURN                              #  CANT GET HERE

Page 1304

054779,000071: 01,3566           13570                           TCF      ITSAWAIT                              
054780,000072: 
054781,000073: 01,3567           13635                           TCF      ITSAJOB                               #  ITS A JOB
054782,000074: 
054783,000075: 01,3570           33774        ITSAWAIT           CA       WTLTCADR                              #  SET UP WAITLIST CALL
054784,000076: 01,3571           54704                           TS       GOLOC      -1                         
054785,000077: 
054786,000078: 01,3572           50155                           NDX      TEMP2G                                #  DIRECTLY STORED
054787,000079: 01,3573           31054                           CA       PHSPRDT1                              
054788,000080: 01,3574           10000        TIMETEST           CCS      A                                     #  IS IT AN IMMEDIATE RESTART
054789,000081: 01,3575           24000                           INCR     A                                     #  NO,
054790,000082: 01,3576           13601                           TCF      FINDTIME                              #  FIND OUT WHEN IT SHOULD BEGIN
054791,000083: 
054792,000084: 01,3577           15436                           TCF      ITSINDIR                              #  STORED INDIRECTLY
054793,000085: 
054794,000086: 01,3600           13620                           TCF      IMEDIATE                              #  IT WANTS AN IMMEDIATE RESTART
054795,000087: 
054796,000088:                                                                                                  #  ***** THIS MUST BE IN FIXED FIXED *****
054797,000089: 
054798,000090:    5436                                           BLOCK    02                                    
054799,000091:    4000                                           SETLOC   FFTAG2                                
054800,000092:    4000                                           BANK                                           
054801,000093: 
054802,000094:    5436                                           COUNT*   $$/RSROU                              
054803,000095:    5436           22706        ITSINDIR           LXCH     GOLOC      +1                         #  GET THE CORRECT E BANK IN CASE THIS IS
054804,000096:    5437           22006                           LXCH     BB                                    #  SWITCHED ERRASIBLE
054805,000097: 
054806,000098:    5440           50000                           NDX      A                                     #  GET THE TIME INDIRECTLY
054807,000099:    5441           30001                           CA       1                                     
054808,000100: 
054809,000101:    5442           22006                           LXCH     BB                                    #  RESTORE THE BB AND GOLOC
054810,000102:    5443           22706                           LXCH     GOLOC      +1                         
054811,000103: 
054812,000104:    5444           13601                           TCF      FINDTIME                              #  FIND OUT WHEN IT SHOULD BEGIN
054813,000105: 
054814,000106:                                                                                                  #  ***** YOU MAY RETURN TO SWITCHED FIXED *****
054815,000107: 
054816,000108: 01,3601                                           BANK     01                                    
054817,000109: 01,2000                                           SETLOC   RESTART                               
054818,000110: 01,2000                                           BANK                                           
054819,000111: 
054820,000112: 01,3601                                           COUNT*   $$/RSROU                              
054821,000113: 01,3601           40000        FINDTIME           COM                                            #  MAKE NEGITIVE SINCE IT WILL BE SUBTRACTD
054822,000114: 01,3602           54001                           TS       L                                     #  AND SAVE
054823,000115: 01,3603           50155                           NDX      TEMP2G                                
054824,000116: 01,3604           41053                           CS       TBASE1                                
054825,000117: 01,3605           00006                           EXTEND                                         
054826,000118: 01,3606           60025                           SU       TIME1                                 
054827,000119: 01,3607           10000                           CCS      A                                     
054828,000120: 01,3610           40000                           COM                                            

Page 1305

054830,000122: 01,3611           67731                           AD       OCT37776                              
054831,000123: 01,3612           64753                           AD       ONE                                   
054832,000124: 01,3613           60001                           AD       L                                     
054833,000125: 01,3614           10000                           CCS      A                                     
054834,000126: 01,3615           34755                           CA       ZERO                                  
054835,000127: 01,3616           13620                           TCF      +2                                    
054836,000128: 01,3617           13620                           TCF      +1                                    
054837,000129: 01,3620           64753        IMEDIATE           AD       ONE                                   
054838,000130: 01,3621           00704                           TC       GOLOC      -1                         
054839,000131: 01,3622           33565        ITSLIKEB           CA       RTRNCADR                              #  TYPE B, SO STORE RETURN IN
054840,000132: 01,3623           54157                           TS       TEMPSWCH                              #  TEMPSWCH IN CASE OF AN EVEN PHASE
054841,000133: 
054842,000134: 01,3624           33771                           CA       PRT2CADR                              #  SET UP EXIT TO GET TABLE PART OF THIS
054843,000135: 01,3625           54707                           TS       GOLOC      +2                         #  VARIABLE TYPE OF PHASE
054844,000136: 
054845,000137: 01,3626           30154                           CA       TEMPPHS                               #  MAKE THE PHASE LOOK RIGHT FOR THE TABLE
054846,000138: 01,3627           76074                           MASK     OCT177                                #  PART OF THIS VARIABLE PHASE
054847,000139: 01,3630           54154                           TS       TEMPPHS                               
054848,000140: 
054849,000141: 01,3631           00006                           EXTEND                                         
054850,000142: 01,3632           50155                           NDX      TEMP2G                                #  OBTAIN THE JOB:S 2CADR
054851,000143: 01,3633           31437                           DCA      PHSNAME1                              
054852,000144: 01,3634           52706                           DXCH     GOLOC                                 
054853,000145: 
054854,000146: 01,3635           50155        ITSAJOB            NDX      TEMP2G                                #  NOW ADD THE PRIORITY AND LET:S GO
054855,000147: 01,3636           31054                           CA       PHSPRDT1                              
054856,000148: 01,3637           54704        CHKNOVAC           TS       GOLOC      -1                         #  SAVE PRIO UNTIL WE SEE IF ITS
054857,000149: 01,3640           00006                           EXTEND                                         #  A FINDVAC OR A NOVAC
054858,000150: 01,3641           63645                           BZMF     ITSNOVAC                              
054859,000151: 
054860,000152: 01,3642           33773                           CAF      FVACCADR                              #  POSITIVE, SET UP FINDVAC CALL.
054861,000153: 01,3643           56704                           XCH      GOLOC      -1                         #  PICK UP PRIO,
054862,000154: 01,3644           00704                           TC       GOLOC      -1                         #  AND GO
054863,000155: 
054864,000156: 01,3645           33775        ITSNOVAC           CAF      NOVACADR                              #  NEGATIVE,
054865,000157: 01,3646           56704                           XCH      GOLOC      -1                         #  SET UP NOVAC CALL,
054866,000158: 01,3647           40000                           COM                                            #  CORRECT PRIO,
054867,000159: 01,3650           00704                           TC       GOLOC      -1                         #  AND GO
054868,000160: 
054869,000161: 01,3651           54020        ITSATBL            TS       CYR                                   #  FIND OUT IF THE PHASE IS ODD OR EVEN
054870,000162: 01,3652           10020                           CCS      CYR                                   
054871,000163: 01,3653           13654                           TCF      +1                                    #  IT:S EVEN
054872,000164: 01,3654           13752                           TCF      ITSEVEN                               
054873,000165: 
054874,000166: 01,3655           33565                           CA       RTRNCADR                              #  IN CASE THIS IS THE SECOND PART OF A
054875,000167: 01,3656           54707                           TS       GOLOC      +2                         #  TYPE B RESTART, WE NEED PROPER EXIT
054876,000168: 
054877,000169: 01,3657           30154                           CA       TEMPPHS                               #  SET UP POINTER FOR FINDING OUR PLACE IN
054878,000170: 01,3660           54021                           TS       SR                                    #  THE RESTART TABLES
054879,000171: 01,3661           60021                           AD       SR                                    

Page 1306

054881,000173: 01,3662           50155                           NDX      TEMP2G                                
054882,000174: 01,3663           62003                           AD       SIZETAB    +1                         
054883,000175: 01,3664           54156                           TS       POINTER                               
054884,000176: 
054885,000177: 01,3665           00006        CONTBL2            EXTEND                                         #  FIND OUT WHAT:S IN THE TABLE
054886,000178: 01,3666           50156                           NDX      POINTER                               
054887,000179: 01,3667           32002                           DCA      CADRTAB                               #  GET THE 2CADR
054888,000180: 
054889,000181: 01,3670           22706                           LXCH     GOLOC      +1                         #  STORE THE BB INFORMATION
054890,000182: 
054891,000183: 01,3671           10000                           CCS      A                                     #  IS IT A JOB OR IS IT TIMED
054892,000184: 01,3672           24000                           INCR     A                                     #  POSITIVE, MUST BE A JOB
054893,000185: 01,3673           13746                           TCF      ITSAJOB2                              
054894,000186: 
054895,000187: 01,3674           24000                           INCR     A                                     #  MUST BE EITHER A WAITLIST OR LONGCALL
054896,000188: 01,3675           54705                           TS       GOLOC                                 #  LET-S STORE THE CORRECT CADR
054897,000189: 
054898,000190: 01,3676           33774                           CA       WTLTCADR                              #  SET UP OUR EXIT TO WAITLIST
054899,000191: 01,3677           54704                           TS       GOLOC      -1                         
054900,000192: 
054901,000193: 01,3700           30706                           CA       GOLOC      +1                         #  NOW FIND OUT IF IT IS A WAITLIST CALL
054902,000194: 01,3701           74742                           MASK     BIT10                                 #  THIS SHOULD BE ONE IF WE HAVE -BB
054903,000195: 01,3702           10000                           CCS      A                                     #  FOR THAT MATTER SO SHOULD BE BITS 9,8,7,
054904,000196:                                                                                                  #  6,5, AND LAST BUT NOT LEAST (PERHAPS NOT
054905,000197:                                                                                                  #  IN IMPORTANCE ANYWAY.  BIT 4
054906,000198: 01,3703           13741                           TCF      ITSWTLST                              #  IT IS A WAITLIST CALL
054907,000199: 
054908,000200: 01,3704           50156                           NDX      POINTER                               #  OBTAIN THE ORIGINAL DELTA T
054909,000201: 01,3705           32000                           CA       PRDTTAB                               #  ADDRESS FOR THIS LONGCALL
054910,000202: 
054911,000203: 01,3706           15445                           TCF      ITSLGCL1                              #  NOW GO GET THE DELTA TIME
054912,000204: 
054913,000205:                                                                                                  #  ***** THIS MUST BE IN FIXED FIXED *****
054914,000206: 
054915,000207:    5445                                           BLOCK    02                                    
054916,000208:    4000                                           SETLOC   FFTAG2                                
054917,000209:    4000                                           BANK                                           
054918,000210: 
054919,000211:    5445                                           COUNT*   $$/RSROU                              
054920,000212:    5445           22706        ITSLGCL1           LXCH     GOLOC      +1                         #  OBTAIN THE CORRECT E BANK
054921,000213:    5446           22006                           LXCH     BB                                    
054922,000214:    5447           22706                           LXCH     GOLOC      +1                         #  AND PRESERVE OUR E AND F BANKS
054923,000215: 
054924,000216:    5450           00006                           EXTEND                                         #  GET THE DELTA TIME
054925,000217:    5451           50000                           NDX      A                                     
054926,000218:    5452           30001                           DCA      0                                     
054927,000219: 
054928,000220:    5453           22706                           LXCH     GOLOC      +1                         #  RESTORE OUR E AND F BANK
054929,000221:    5454           22006                           LXCH     BB                                    #  RESTORE THE TASKS E AND F BANKS
054930,000222:    5455           22706                           LXCH     GOLOC      +1                         #  AND PRESERVE OUR L

Page 1307

054932,000224:    5456           13707                           TCF      ITSLGCL2                              #  NOW LET:S PROCESS THIS LONGCALL
054933,000225: 
054934,000226:                                                                                                  #  ***** YOU MAY RETURN TO SWITCHED FIXED *****
054935,000227: 
054936,000228: 01,3707                                           BANK     01                                    
054937,000229: 01,2000                                           SETLOC   RESTART                               
054938,000230: 01,2000                                           BANK                                           
054939,000231: 
054940,000232: 01,3707                                           COUNT*   $$/RSROU                              
054941,000233: 01,3707           53154        ITSLGCL2           DXCH     LONGTIME                              
054942,000234: 
054943,000235: 01,3710           00006                           EXTEND                                         #  CALCULATE TIME LEFT
054944,000236: 01,3711           40025                           DCS      TIME2                                 
054945,000237: 01,3712           21154                           DAS      LONGTIME                              
054946,000238: 01,3713           00006                           EXTEND                                         
054947,000239: 01,3714           31152                           DCA      LONGBASE                              
054948,000240: 01,3715           21154                           DAS      LONGTIME                              
054949,000241: 
054950,000242: 01,3716           11153                           CCS      LONGTIME                              #  FIND OUT HOW THIS SHOULD BE RESTARTED
054951,000243: 01,3717           13727                           TCF      LONGCLCL                              
054952,000244: 01,3720           13722                           TCF      +2                                    
054953,000245: 01,3721           13615                           TCF      IMEDIATE   -3                         
054954,000246: 01,3722           11154                           CCS      LONGTIME   +1                         
054955,000247: 01,3723           13727                           TCF      LONGCLCL                              
054956,000248: 01,3724           13725                           NOOP                                           #  CAN:T GET HERE *********
054957,000249: 01,3725           13615                           TCF      IMEDIATE   -3                         
054958,000250: 01,3726           13620                           TCF      IMEDIATE                              
054959,000251: 
054960,000252: 01,3727           33772        LONGCLCL           CA       LGCLCADR                              #  WE WILL GO TO LONGCALL
054961,000253: 01,3730           54704                           TS       GOLOC      -1                         
054962,000254: 
054963,000255: 01,3731           00006                           EXTEND                                         #  PREPARE OUR ENTRY TO LONGCALL
054964,000256: 01,3732           31154                           DCA      LONGTIME                              
054965,000257: 01,3733           00704                           TC       GOLOC      -1                         
054966,000258: 
054967,000259: 01,3734           33774        ITSLNGCL           CA       WTLTCADR                              #  ASSUME IT WILL GO TO WAITLIST
054968,000260: 01,3735           54704                           TS       GOLOC      -1                         
054969,000261: 
054970,000262: 01,3736           50155                           NDX      TEMP2G                                
054971,000263: 01,3737           41054                           CS       PHSPRDT1                              #  GET THE DELTA T ADDRESS
054972,000264: 
054973,000265: 01,3740           15445                           TCF      ITSLGCL1                              #  NOW GET THE DELTA TIME
054974,000266: 
054975,000267: 01,3741           40706        ITSWTLST           CS       GOLOC      +1                         #  CORRECT THE BBCON INFORMATION
054976,000268: 01,3742           54706                           TS       GOLOC      +1                         
054977,000269: 
054978,000270: 01,3743           50156                           NDX      POINTER                               #  GET THE DT AND FIND OUT IF IT WAS STORED
054979,000271: 01,3744           32000                           CA       PRDTTAB                               #  DIRECTLY OR INDIRECTLY
054980,000272: 
054981,000273: 01,3745           13574                           TCF      TIMETEST                              #  FIND OUT HOW THE TIME IS STORED
054982,000274: 

Page 1308

054984,000276: 01,3746           56705        ITSAJOB2           XCH      GOLOC                                 #  STORE THE CADR
054985,000277: 
054986,000278: 01,3747           50156                           NDX      POINTER                               #  ADD THE PRIORITY AND LET:S GO
054987,000279: 01,3750           32000                           CA       PRDTTAB                               
054988,000280: 
054989,000281: 01,3751           13637                           TCF      CHKNOVAC                              
054990,000282: 
054991,000283: 01,3752           30157        ITSEVEN            CA       TEMPSWCH                              #  SET UP FOR EITHER THE SECOND PART OF THE
054992,000284: 01,3753           54707                           TS       GOLOC      +2                         #  TABLE, OR A RETURN FOR THE NEXT GROUP
054993,000285: 
054994,000286: 01,3754           50155                           NDX      TEMP2G                                #  SET UP POINTER FOR OUR LOCATION WITHIN
054995,000287: 01,3755           32002                           CA       SIZETAB                               #  THE TABLE
054996,000288: 01,3756           60154                           AD       TEMPPHS                               #  THIS MAY LOOK BAD BUT LET:S SEE YOU DO
054997,000289: 01,3757           60154                           AD       TEMPPHS                               #  BETTER IN TIME OR NUMBERR OF LOCATIONS
054998,000290: 01,3760           60154                           AD       TEMPPHS                               
054999,000291: 01,3761           54156                           TS       POINTER                               
055000,000292: 
055001,000293: 01,3762           13665                           TCF      CONTBL2                               #  NOW PROCESS WHAT IS IN THE TABLE
055002,000294: 
055003,000295: 01,3763           36245        PHSPART2           CA       THREE                                 #  SET THE POINTER FOR THE SECOND HALF OF
055004,000296: 01,3764           26156                           ADS      POINTER                               #  THE TABLE
055005,000297: 
055006,000298: 01,3765           33565                           CA       RTRNCADR                              #  THIS WILL BE OUR LAST TIME THROUGH THE
055007,000299: 01,3766           54707                           TS       GOLOC      +2                         #  EVEN TABLE, SO AFTER IT GET THE NEXT
055008,000300:                                                                                                  #  GROUP
055009,000301: 01,3767           13665                           TCF      CONTBL2                               #  SO LET:S GET THE SECOND ENTRY IN THE TBL
055010,000302: 
055011,000303: 01,3770     0154               TEMPPHS            EQUALS   MPAC                                  
055012,000304: 01,3770     0155               TEMP2G             EQUALS   MPAC       +1                         
055013,000305: 01,3770     0156               POINTER            EQUALS   MPAC       +2                         
055014,000306: 01,3770     0157               TEMPSWCH           EQUALS   MPAC       +3                         
055015,000307: 01,3770     0705               GOLOC              EQUALS   VAC5       +20D                       
055016,000308: 01,3770     7746               MINUS2             EQUALS   NEG2                                  
055017,000309: 01,3770     6074               OCT177             EQUALS   LOW7                                  
055018,000310: 
055019,000311: 01,3770           03763        PHS2CADR           GENADR   PHSPART2                              
055020,000312: 01,3771           03541        PRT2CADR           GENADR   GETPART2                              
055021,000313: 01,3772           05277        LGCLCADR           GENADR   LONGCALL                              
055022,000314: 01,3773           05105        FVACCADR           GENADR   FINDVAC                               
055023,000315: 01,3774           05203        WTLTCADR           GENADR   WAITLIST                              
055024,000316: 01,3775           05072        NOVACADR           GENADR   NOVAC                                 
055025,000317: 
055026,000318: 

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