Source Code

These source-code files are part of a reconstructed copy of Luminary 163, the first (unflown) release of the Apollo 14 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction began with reconstructed source code for Luminary 173. Changes between revision 163 and 173 were backed out, as described by Luminary memos 157 and 158. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152N. Note that page numbers in the reconstructed code match those for the baseline log section mentioned in each file's changelog; the page numbers for a real Luminary 163 listing would be different.

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.

055174,000002:                                                                                                  ## Copyright:   Public domain.
055175,000003:                                                                                                  ## Filename:    RESTARTS_ROUTINE.agc
055176,000004:                                                                                                  ## Purpose:     A section of Luminary revision 163.
055177,000005:                                                                                                  ##              It is part of the reconstructed source code for the first
055178,000006:                                                                                                  ##              (unflown) release of the flight software for the Lunar
055179,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 14.
055180,000008:                                                                                                  ##              The code has been recreated from a reconstructed copy of
055181,000009:                                                                                                  ##              Luminary 173, as well as Luminary memos 157 amd 158.
055182,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
055183,000011:                                                                                                  ##              exactly match those specified for Luminary 163 in NASA
055184,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
055185,000013:                                                                                                  ##              that the reconstruction is correct.
055186,000014:                                                                                                  ## Reference:   pp. 1292-1297
055187,000015:                                                                                                  ## Assembler:   yaYUL
055188,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
055189,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
055190,000018:                                                                                                  ## Mod history: 2019-08-21 MAS  Created from Luminary 173.
055191,000019: 

Page 1292

055193,000021: 01,3530                                           BANK     01                                    
055194,000022: 01,2000                                           SETLOC   RESTART                               
055195,000023: 01,2000                                           BANK                                           
055196,000024: 
055197,000025: 01,3530  E3,1436                                  EBANK=   PHSNAME1                              #  GOPROG MUST SWITCH TO THIS EBANK
055198,000026: 
055199,000027: 01,3530                                           COUNT*   $$/RSROU                              
055200,000028: 01,3530           30161        RESTARTS           CA       MPAC       +5                         #  GET GROUP NUMBER -1
055201,000029: 01,3531           60000                           DOUBLE                                         #  SAVE FOR INDEXING
055202,000030: 01,3532           54155                           TS       TEMP2G                                
055203,000031: 
055204,000032: 01,3533           33772                           CA       PHS2CADR                              #  SET UP EXIT IN CASE IT IS AN EVEN
055205,000033: 01,3534           54157                           TS       TEMPSWCH                              #  TABLE PHASE
055206,000034: 
055207,000035: 01,3535           33567                           CA       RTRNCADR                              #  TO SAVE TIME ASSUME IT WILL GET NEXT
055208,000036: 01,3536           54707                           TS       GOLOC      +2                         #  GROUP AFTER THIS
055209,000037: 
055210,000038: 01,3537           30154                           CA       TEMPPHS                               
055211,000039: 01,3540           75007                           MASK     OCT1400                               
055212,000040: 01,3541           10000                           CCS      A                                     #  IS IT A VARIABLE OR TABLE RESTART
055213,000041: 01,3542           13553                           TCF      ITSAVAR                               #  IT:S A VARIABLE RESTART
055214,000042: 
055215,000043: 01,3543           10154        GETPART2           CCS      TEMPPHS                               #  IS IT AN X.1 RESTART
055216,000044: 01,3544           10000                           CCS      A                                     
055217,000045: 01,3545           13653                           TCF      ITSATBL                               #  NO, ITS A TABLE RESTART
055218,000046: 
055219,000047: 01,3546           35024                           CA       PRIO14                                #  IT IS AN X.1 RESTART, THEREFORE START
055220,000048: 01,3547           05105                           TC       FINDVAC                               #  THE DISPLAY RESTART JOB
055221,000049: 01,3550  E3,1400                                  EBANK=   LST1                                  
055222,000050: 01,3550           03040 20103                     2CADR    INITDSP                               
055223,000051: 
055224,000052: 01,3552           03567                           TC       RTRNCADR                              #  FINISHED WITH THIS GROUP, GET NEXT ONE
055225,000053: 
055226,000054: 01,3553           75007        ITSAVAR            MASK     OCT1400                               #  IS IT TYPE B ?
055227,000055: 01,3554           10000                           CCS      A                                     
055228,000056: 01,3555           13624                           TCF      ITSLIKEB                              #  YES,IT IS TYPE B
055229,000057: 
055230,000058: 01,3556           00006                           EXTEND                                         #  STORE THE JOB (OR TASK) 2CADR FOR EXIT
055231,000059: 01,3557           50155                           NDX      TEMP2G                                
055232,000060: 01,3560           31437                           DCA      PHSNAME1                              
055233,000061: 01,3561           52706                           DXCH     GOLOC                                 
055234,000062: 
055235,000063: 01,3562           30154                           CA       TEMPPHS                               #  SEE IF THIS IS A JOB, TASK, OR A LONGCAL
055236,000064: 01,3563           74757                           MASK     OCT7                                  
055237,000065: 01,3564           67751                           AD       MINUS2                                
055238,000066: 01,3565           10000                           CCS      A                                     
055239,000067: 01,3566           13736                           TCF      ITSLNGCL                              #  ITS A LONGCALL
055240,000068: 
055241,000069: 01,3567           04631        RTRNCADR           TC       SWRETURN                              #  CANT GET HERE
055242,000070: 

Page 1293

055244,000072: 01,3570           13572                           TCF      ITSAWAIT                              
055245,000073: 
055246,000074: 01,3571           13637                           TCF      ITSAJOB                               #  ITS A JOB
055247,000075: 
055248,000076: 01,3572           34352        ITSAWAIT           CA       WTLTCADR                              #  SET UP WAITLIST CALL
055249,000077: 01,3573           54704                           TS       GOLOC      -1                         
055250,000078: 
055251,000079: 01,3574           50155                           NDX      TEMP2G                                #  DIRECTLY STORED
055252,000080: 01,3575           31053                           CA       PHSPRDT1                              
055253,000081: 01,3576           10000        TIMETEST           CCS      A                                     #  IS IT AN IMMEDIATE RESTART
055254,000082: 01,3577           24000                           INCR     A                                     #  NO,
055255,000083: 01,3600           13603                           TCF      FINDTIME                              #  FIND OUT WHEN IT SHOULD BEGIN
055256,000084: 
055257,000085: 01,3601           15447                           TCF      ITSINDIR                              #  STORED INDIRECTLY
055258,000086: 
055259,000087: 01,3602           13622                           TCF      IMEDIATE                              #  IT WANTS AN IMMEDIATE RESTART
055260,000088: 
055261,000089:                                                                                                  #  ***** THIS MUST BE IN FIXED FIXED *****
055262,000090: 
055263,000091:    5447                                           BLOCK    02                                    
055264,000092:    4000                                           SETLOC   FFTAG2                                
055265,000093:    4000                                           BANK                                           
055266,000094: 
055267,000095:    5447                                           COUNT*   $$/RSROU                              
055268,000096:    5447           22706        ITSINDIR           LXCH     GOLOC      +1                         #  GET THE CORRECT E BANK IN CASE THIS IS
055269,000097:    5450           22006                           LXCH     BB                                    #  SWITCHED ERRASIBLE
055270,000098: 
055271,000099:    5451           50000                           NDX      A                                     #  GET THE TIME INDIRECTLY
055272,000100:    5452           30001                           CA       1                                     
055273,000101: 
055274,000102:    5453           22006                           LXCH     BB                                    #  RESTORE THE BB AND GOLOC
055275,000103:    5454           22706                           LXCH     GOLOC      +1                         
055276,000104: 
055277,000105:    5455           13603                           TCF      FINDTIME                              #  FIND OUT WHEN IT SHOULD BEGIN
055278,000106: 
055279,000107:                                                                                                  #  ***** YOU  MAY RETURN TO  SWITCHED FIXED *****
055280,000108: 
055281,000109: 01,3603                                           BANK     01                                    
055282,000110: 01,2000                                           SETLOC   RESTART                               
055283,000111: 01,2000                                           BANK                                           
055284,000112: 
055285,000113: 01,3603                                           COUNT*   $$/RSROU                              
055286,000114: 01,3603           40000        FINDTIME           COM                                            #  MAKE NEGITIVE SINCE IT WILL BE SUBTRACTD
055287,000115: 01,3604           54001                           TS       L                                     #  AND SAVE
055288,000116: 01,3605           50155                           NDX      TEMP2G                                
055289,000117: 01,3606           41052                           CS       TBASE1                                
055290,000118: 01,3607           00006                           EXTEND                                         
055291,000119: 01,3610           60025                           SU       TIME1                                 
055292,000120: 01,3611           10000                           CCS      A                                     
055293,000121: 01,3612           40000                           COM                                            
055294,000122: 

Page 1294

055296,000124: 01,3613           67734                           AD       OCT37776                              
055297,000125: 01,3614           64753                           AD       ONE                                   
055298,000126: 01,3615           60001                           AD       L                                     
055299,000127: 01,3616           10000                           CCS      A                                     
055300,000128: 01,3617           34755                           CA       ZERO                                  
055301,000129: 01,3620           13622                           TCF      +2                                    
055302,000130: 01,3621           13622                           TCF      +1                                    
055303,000131: 01,3622           64753        IMEDIATE           AD       ONE                                   
055304,000132: 01,3623           00704                           TC       GOLOC      -1                         
055305,000133: 01,3624           33567        ITSLIKEB           CA       RTRNCADR                              #  TYPE B,             SO STORE RETURN IN
055306,000134: 01,3625           54157                           TS       TEMPSWCH                              #  TEMPSWCH IN CASE OF AN EVEN PHASE
055307,000135: 
055308,000136: 01,3626           33773                           CA       PRT2CADR                              #  SET UP EXIT TO GET TABLE PART OF THIS
055309,000137: 01,3627           54707                           TS       GOLOC      +2                         #  VARIABLE TYPE OF PHASE
055310,000138: 
055311,000139: 01,3630           30154                           CA       TEMPPHS                               #  MAKE THE PHASE LOOK RIGHT FOR THE TABLE
055312,000140: 01,3631           76077                           MASK     OCT177                                #  PART OF THIS VARIABLE PHASE
055313,000141: 01,3632           54154                           TS       TEMPPHS                               
055314,000142: 
055315,000143: 01,3633           00006                           EXTEND                                         
055316,000144: 01,3634           50155                           NDX      TEMP2G                                #  OBTAIN THE JOB:S 2CADR
055317,000145: 01,3635           31437                           DCA      PHSNAME1                              
055318,000146: 01,3636           52706                           DXCH     GOLOC                                 
055319,000147: 
055320,000148: 01,3637           50155        ITSAJOB            NDX      TEMP2G                                #  NOW ADD THE PRIORITY AND LET:S GO
055321,000149: 01,3640           31053                           CA       PHSPRDT1                              
055322,000150: 01,3641           54704        CHKNOVAC           TS       GOLOC      -1                         #  SAVE PRIO UNTIL WE SEE IF ITS
055323,000151: 01,3642           00006                           EXTEND                                         #  A FINDVAC OR A NOVAC
055324,000152: 01,3643           63647                           BZMF     ITSNOVAC                              
055325,000153: 
055326,000154: 01,3644           34354                           CAF      FVACCADR                              #  POSITIVE, SET UP FINDVAC CALL.
055327,000155: 01,3645           56704                           XCH      GOLOC      -1                         #  PICK UP PRIO,
055328,000156: 01,3646           00704                           TC       GOLOC      -1                         #  AND GO
055329,000157: 
055330,000158: 01,3647           34351        ITSNOVAC           CAF      NOVACADR                              #  NEGATIVE,
055331,000159: 01,3650           56704                           XCH      GOLOC      -1                         #  SET UP NOVAC CALL,
055332,000160: 01,3651           40000                           COM                                            #  CORRECT PRIO,
055333,000161: 01,3652           00704                           TC       GOLOC      -1                         #  AND GO
055334,000162: 
055335,000163: 01,3653           54020        ITSATBL            TS       CYR                                   #  FIND OUT IF THE PHASE IS ODD OR EVEN
055336,000164: 01,3654           10020                           CCS      CYR                                   
055337,000165: 01,3655           13656                           TCF      +1                                    #  IT:S EVEN
055338,000166: 01,3656           13754                           TCF      ITSEVEN                               
055339,000167: 
055340,000168: 01,3657           33567                           CA       RTRNCADR                              #  IN CASE THIS IS THE SECOND PART OF A
055341,000169: 01,3660           54707                           TS       GOLOC      +2                         #  TYPE B RESTART, WE NEED PROPER EXIT
055342,000170: 
055343,000171: 01,3661           30154                           CA       TEMPPHS                               #  SET UP POINTER FOR FINDING OUR PLACE IN
055344,000172: 01,3662           54021                           TS       SR                                    #  THE RESTART TABLES
055345,000173: 01,3663           60021                           AD       SR                                    
055346,000174: 

Page 1295

055348,000176: 01,3664           50155                           NDX      TEMP2G                                
055349,000177: 01,3665           62003                           AD       SIZETAB    +1                         
055350,000178: 01,3666           54156                           TS       POINTER                               
055351,000179: 
055352,000180: 01,3667           00006        CONTBL2            EXTEND                                         #  FIND OUT WHAT:S IN THE TABLE
055353,000181: 01,3670           50156                           NDX      POINTER                               
055354,000182: 01,3671           32002                           DCA      CADRTAB                               #  GET THE 2CADR
055355,000183: 
055356,000184: 01,3672           22706                           LXCH     GOLOC      +1                         #  STORE THE BB INFORMATION
055357,000185: 
055358,000186: 01,3673           10000                           CCS      A                                     #  IS IT A JOB OR IS IT  TIMED
055359,000187: 01,3674           24000                           INCR     A                                     #  POSITIVE, MUST BE A JOB
055360,000188: 01,3675           13750                           TCF      ITSAJOB2                              
055361,000189: 
055362,000190: 01,3676           24000                           INCR     A                                     #  MUST BE EITHER A WAITLIST OR LONGCALL
055363,000191: 01,3677           54705                           TS       GOLOC                                 #  LET-S STORE THE CORRECT CADR
055364,000192: 
055365,000193: 01,3700           34352                           CA       WTLTCADR                              #  SET UP OUR EXIT TO WAITLIST
055366,000194: 01,3701           54704                           TS       GOLOC      -1                         
055367,000195: 
055368,000196: 01,3702           30706                           CA       GOLOC      +1                         #  NOW FIND OUT IF IT IS A WAITLIST CALL
055369,000197: 01,3703           74742                           MASK     BIT10                                 #  THIS SHOULD BE ONE IF WE HAVE -BB
055370,000198: 01,3704           10000                           CCS      A                                     #  FOR THAT MATTER SO SHOULD BE BITS 9,8,7,
055371,000199:                                                                                                  #  6,5, AND LAST BUT NOT LEAST (PERHAPS NOT
055372,000200:                                                                                                  #  IN IMPORTANCE ANYWAY. BIT 4
055373,000201: 01,3705           13743                           TCF      ITSWTLST                              #  IT IS A WAITLIST CALL
055374,000202: 
055375,000203: 01,3706           50156                           NDX      POINTER                               #  OBTAIN THE ORIGINAL DELTA T
055376,000204: 01,3707           32000                           CA       PRDTTAB                               #  ADDRESS FOR THIS LONGCALL
055377,000205: 
055378,000206: 01,3710           15456                           TCF      ITSLGCL1                              #  NOW GO GET THE DELTA TIME
055379,000207: 
055380,000208:                                                                                                  #  ***** THIS MUST BE IN FIXED FIXED *****
055381,000209: 
055382,000210:    5456                                           BLOCK    02                                    
055383,000211:    4000                                           SETLOC   FFTAG2                                
055384,000212:    4000                                           BANK                                           
055385,000213: 
055386,000214:    5456                                           COUNT*   $$/RSROU                              
055387,000215:    5456           22706        ITSLGCL1           LXCH     GOLOC      +1                         #  OBTAIN THE CORRECT E BANK
055388,000216:    5457           22006                           LXCH     BB                                    
055389,000217:    5460           22706                           LXCH     GOLOC      +1                         #  AND PRESERVE OUR E AND F BANKS
055390,000218: 
055391,000219:    5461           00006                           EXTEND                                         #  GET THE DELTA TIME
055392,000220:    5462           50000                           NDX      A                                     
055393,000221:    5463           30001                           DCA      0                                     
055394,000222: 
055395,000223:    5464           22706                           LXCH     GOLOC      +1                         #  RESTORE OUR E AND F BANK
055396,000224:    5465           22006                           LXCH     BB                                    #  RESTORE THE TASKS E AND F BANKS
055397,000225:    5466           22706                           LXCH     GOLOC      +1                         #  AND PRESERVE OUR L
055398,000226: 

Page 1296

055400,000228:    5467           13711                           TCF      ITSLGCL2                              #  NOW LET:S PROCESS THIS LONGCALL
055401,000229: 
055402,000230:                                                                                                  #  ***** YOU  MAY RETURN  TO SWITCHED FIXED *****
055403,000231: 
055404,000232: 01,3711                                           BANK     01                                    
055405,000233: 01,2000                                           SETLOC   RESTART                               
055406,000234: 01,2000                                           BANK                                           
055407,000235: 
055408,000236: 01,3711                                           COUNT*   $$/RSROU                              
055409,000237: 01,3711           53153        ITSLGCL2           DXCH     LONGTIME                              
055410,000238: 
055411,000239: 01,3712           00006                           EXTEND                                         #  CALCULATE TIME LEFT
055412,000240: 01,3713           40025                           DCS      TIME2                                 
055413,000241: 01,3714           21153                           DAS      LONGTIME                              
055414,000242: 01,3715           00006                           EXTEND                                         
055415,000243: 01,3716           31151                           DCA      LONGBASE                              
055416,000244: 01,3717           21153                           DAS      LONGTIME                              
055417,000245: 
055418,000246: 01,3720           11152                           CCS      LONGTIME                              #  FIND OUT HOW THIS SHOULD BE RESTARTED
055419,000247: 01,3721           13731                           TCF      LONGCLCL                              
055420,000248: 01,3722           13724                           TCF      +2                                    
055421,000249: 01,3723           13617                           TCF      IMEDIATE   -3                         
055422,000250: 01,3724           11153                           CCS      LONGTIME   +1                         
055423,000251: 01,3725           13731                           TCF      LONGCLCL                              
055424,000252: 01,3726           13727                           NOOP                                           #  CAN:T GET HERE    *********
055425,000253: 01,3727           13617                           TCF      IMEDIATE   -3                         
055426,000254: 01,3730           13622                           TCF      IMEDIATE                              
055427,000255: 
055428,000256: 01,3731           33774        LONGCLCL           CA       LGCLCADR                              #  WE WILL GO TO LONGCALL
055429,000257: 01,3732           54704                           TS       GOLOC      -1                         
055430,000258: 
055431,000259: 01,3733           00006                           EXTEND                                         #  PREPARE OUR ENTRY TO LONGCALL
055432,000260: 01,3734           31153                           DCA      LONGTIME                              
055433,000261: 01,3735           00704                           TC       GOLOC      -1                         
055434,000262: 
055435,000263: 01,3736           34352        ITSLNGCL           CA       WTLTCADR                              #  ASSUME IT WILL GO TO WAITLIST
055436,000264: 01,3737           54704                           TS       GOLOC      -1                         
055437,000265: 
055438,000266: 01,3740           50155                           NDX      TEMP2G                                
055439,000267: 01,3741           41053                           CS       PHSPRDT1                              #  GET THE DELTA T ADDRESS
055440,000268: 
055441,000269: 01,3742           15456                           TCF      ITSLGCL1                              #  NOW GET THE DELTA TIME
055442,000270: 
055443,000271: 01,3743           40706        ITSWTLST           CS       GOLOC      +1                         #  CORRECT THE BBCON INFORMATION
055444,000272: 01,3744           54706                           TS       GOLOC      +1                         
055445,000273: 
055446,000274: 01,3745           50156                           NDX      POINTER                               #  GET THE DT AND FIND OUT IF IT WAS STORED
055447,000275: 01,3746           32000                           CA       PRDTTAB                               #  DIRECTLY OR INDIRECTLY
055448,000276: 
055449,000277: 01,3747           13576                           TCF      TIMETEST                              #  FIND OUT HOW THE TIME IS STORED
055450,000278: 

Page 1297

055452,000280: 01,3750           56705        ITSAJOB2           XCH      GOLOC                                 #  STORE THE CADR
055453,000281: 
055454,000282: 01,3751           50156                           NDX      POINTER                               #  ADD THE PRIORITY AND LET:S GO
055455,000283: 01,3752           32000                           CA       PRDTTAB                               
055456,000284: 
055457,000285: 01,3753           13641                           TCF      CHKNOVAC                              
055458,000286: 
055459,000287: 01,3754           30157        ITSEVEN            CA       TEMPSWCH                              #  SET UP FOR EITHER THE SECOND PART OF THE
055460,000288: 01,3755           54707                           TS       GOLOC      +2                         #  TABLE, OR A RETURN FOR THE NEXT GROUP
055461,000289: 
055462,000290: 01,3756           50155                           NDX      TEMP2G                                #  SET UP POINTER FOR OUR LOCATION WITHIN
055463,000291: 01,3757           32002                           CA       SIZETAB                               #  THE TABLE
055464,000292: 01,3760           60154                           AD       TEMPPHS                               #  THIS MAY LOOK BAD BUT LET:S SEE YOU DO
055465,000293: 01,3761           60154                           AD       TEMPPHS                               #  BETTER IN TIME OR NUMBERR OF LOCATIONS
055466,000294: 01,3762           60154                           AD       TEMPPHS                               
055467,000295: 01,3763           54156                           TS       POINTER                               
055468,000296: 
055469,000297: 01,3764           13667                           TCF      CONTBL2                               #  NOW PROCESS WHAT IS IN THE TABLE
055470,000298: 
055471,000299: 01,3765           36250        PHSPART2           CA       THREE                                 #  SET THE POINTER FOR THE SECOND HALF OF
055472,000300: 01,3766           26156                           ADS      POINTER                               #  THE TABLE
055473,000301: 
055474,000302: 01,3767           33567                           CA       RTRNCADR                              #  THIS WILL BE OUR LAST TIME THROUGH THE
055475,000303: 01,3770           54707                           TS       GOLOC      +2                         #  EVEN TABLE , SO AFTER IT  GET THE NEXT
055476,000304:                                                                                                  #  GROUP
055477,000305: 01,3771           13667                           TCF      CONTBL2                               #  SO LET:S GET THE SECOND ENTRY IN THE TBL
055478,000306: 
055479,000307: 01,3772     0154               TEMPPHS            EQUALS   MPAC                                  
055480,000308: 01,3772     0155               TEMP2G             EQUALS   MPAC       +1                         
055481,000309: 01,3772     0156               POINTER            EQUALS   MPAC       +2                         
055482,000310: 01,3772     0157               TEMPSWCH           EQUALS   MPAC       +3                         
055483,000311: 01,3772     0705               GOLOC              EQUALS   VAC5       +20D                       
055484,000312: 01,3772     7751               MINUS2             EQUALS   NEG2                                  
055485,000313: 01,3772     6077               OCT177             EQUALS   LOW7                                  
055486,000314: 
055487,000315: 01,3772           03765        PHS2CADR           GENADR   PHSPART2                              
055488,000316: 01,3773           03543        PRT2CADR           GENADR   GETPART2                              
055489,000317: 01,3774           05310        LGCLCADR           GENADR   LONGCALL                              
055490,000318: 01,3775     4354               FVACCADR           =        TCFINDVC                              
055491,000319: 01,3775     4352               WTLTCADR           =        TCWAIT                                
055492,000320: 01,3775     4351               NOVACADR           =        TCNOVAC                               
055493,000321: 
055494,000322: 

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