Source Code

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

The reconstruction began with reconstructed source code for Luminary 178. Changes between revision 173 and 178 were backed out, as described by Luminary memo 167 (revision 1). 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 173 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.

055242,000002:                                                                                                  ## Copyright:   Public domain.
055243,000003:                                                                                                  ## Filename:    RESTARTS_ROUTINE.agc
055244,000004:                                                                                                  ## Purpose:     A section of Luminary revision 173.
055245,000005:                                                                                                  ##              It is part of the reconstructed source code for the second
055246,000006:                                                                                                  ##              (unflown) release of the flight software for the Lunar
055247,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 14.
055248,000008:                                                                                                  ##              The code has been recreated from a reconstructed copy of
055249,000009:                                                                                                  ##              Luminary 178, as well as Luminary memo 167 (revision 1).
055250,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
055251,000011:                                                                                                  ##              exactly match those specified for Luminary 173 in NASA
055252,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
055253,000013:                                                                                                  ##              that the reconstruction is correct.
055254,000014:                                                                                                  ## Reference:   pp. 1292-1297
055255,000015:                                                                                                  ## Assembler:   yaYUL
055256,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
055257,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
055258,000018:                                                                                                  ## Mod history: 2019-09-18 MAS  Created from Luminary 178.
055259,000019: 

Page 1292

055261,000021: 01,3530                                           BANK     01                                    
055262,000022: 01,2000                                           SETLOC   RESTART                               
055263,000023: 01,2000                                           BANK                                           
055264,000024: 
055265,000025: 01,3530  E3,1436                                  EBANK=   PHSNAME1                              #  GOPROG MUST SWITCH TO THIS EBANK
055266,000026: 
055267,000027: 01,3530                                           COUNT*   $$/RSROU                              
055268,000028: 01,3530           30161        RESTARTS           CA       MPAC       +5                         #  GET GROUP NUMBER -1
055269,000029: 01,3531           60000                           DOUBLE                                         #  SAVE FOR INDEXING
055270,000030: 01,3532           54155                           TS       TEMP2G                                
055271,000031: 
055272,000032: 01,3533           33772                           CA       PHS2CADR                              #  SET UP EXIT IN CASE IT IS AN EVEN
055273,000033: 01,3534           54157                           TS       TEMPSWCH                              #  TABLE PHASE
055274,000034: 
055275,000035: 01,3535           33567                           CA       RTRNCADR                              #  TO SAVE TIME ASSUME IT WILL GET NEXT
055276,000036: 01,3536           54707                           TS       GOLOC      +2                         #  GROUP AFTER THIS
055277,000037: 
055278,000038: 01,3537           30154                           CA       TEMPPHS                               
055279,000039: 01,3540           75007                           MASK     OCT1400                               
055280,000040: 01,3541           10000                           CCS      A                                     #  IS IT A VARIABLE OR TABLE RESTART
055281,000041: 01,3542           13553                           TCF      ITSAVAR                               #  IT:S A VARIABLE RESTART
055282,000042: 
055283,000043: 01,3543           10154        GETPART2           CCS      TEMPPHS                               #  IS IT AN X.1 RESTART
055284,000044: 01,3544           10000                           CCS      A                                     
055285,000045: 01,3545           13653                           TCF      ITSATBL                               #  NO, ITS A TABLE RESTART
055286,000046: 
055287,000047: 01,3546           35024                           CA       PRIO14                                #  IT IS AN X.1 RESTART, THEREFORE START
055288,000048: 01,3547           05105                           TC       FINDVAC                               #  THE DISPLAY RESTART JOB
055289,000049: 01,3550  E3,1400                                  EBANK=   LST1                                  
055290,000050: 01,3550           03040 20103                     2CADR    INITDSP                               
055291,000051: 
055292,000052: 01,3552           03567                           TC       RTRNCADR                              #  FINISHED WITH THIS GROUP, GET NEXT ONE
055293,000053: 
055294,000054: 01,3553           75007        ITSAVAR            MASK     OCT1400                               #  IS IT TYPE B ?
055295,000055: 01,3554           10000                           CCS      A                                     
055296,000056: 01,3555           13624                           TCF      ITSLIKEB                              #  YES,IT IS TYPE B
055297,000057: 
055298,000058: 01,3556           00006                           EXTEND                                         #  STORE THE JOB (OR TASK) 2CADR FOR EXIT
055299,000059: 01,3557           50155                           NDX      TEMP2G                                
055300,000060: 01,3560           31437                           DCA      PHSNAME1                              
055301,000061: 01,3561           52706                           DXCH     GOLOC                                 
055302,000062: 
055303,000063: 01,3562           30154                           CA       TEMPPHS                               #  SEE IF THIS IS A JOB, TASK, OR A LONGCAL
055304,000064: 01,3563           74757                           MASK     OCT7                                  
055305,000065: 01,3564           67751                           AD       MINUS2                                
055306,000066: 01,3565           10000                           CCS      A                                     
055307,000067: 01,3566           13736                           TCF      ITSLNGCL                              #  ITS A LONGCALL
055308,000068: 
055309,000069: 01,3567           04631        RTRNCADR           TC       SWRETURN                              #  CANT GET HERE
055310,000070: 

Page 1293

055312,000072: 01,3570           13572                           TCF      ITSAWAIT                              
055313,000073: 
055314,000074: 01,3571           13637                           TCF      ITSAJOB                               #  ITS A JOB
055315,000075: 
055316,000076: 01,3572           34352        ITSAWAIT           CA       WTLTCADR                              #  SET UP WAITLIST CALL
055317,000077: 01,3573           54704                           TS       GOLOC      -1                         
055318,000078: 
055319,000079: 01,3574           50155                           NDX      TEMP2G                                #  DIRECTLY STORED
055320,000080: 01,3575           31053                           CA       PHSPRDT1                              
055321,000081: 01,3576           10000        TIMETEST           CCS      A                                     #  IS IT AN IMMEDIATE RESTART
055322,000082: 01,3577           24000                           INCR     A                                     #  NO,
055323,000083: 01,3600           13603                           TCF      FINDTIME                              #  FIND OUT WHEN IT SHOULD BEGIN
055324,000084: 
055325,000085: 01,3601           15447                           TCF      ITSINDIR                              #  STORED INDIRECTLY
055326,000086: 
055327,000087: 01,3602           13622                           TCF      IMEDIATE                              #  IT WANTS AN IMMEDIATE RESTART
055328,000088: 
055329,000089:                                                                                                  #  ***** THIS MUST BE IN FIXED FIXED *****
055330,000090: 
055331,000091:    5447                                           BLOCK    02                                    
055332,000092:    4000                                           SETLOC   FFTAG2                                
055333,000093:    4000                                           BANK                                           
055334,000094: 
055335,000095:    5447                                           COUNT*   $$/RSROU                              
055336,000096:    5447           22706        ITSINDIR           LXCH     GOLOC      +1                         #  GET THE CORRECT E BANK IN CASE THIS IS
055337,000097:    5450           22006                           LXCH     BB                                    #  SWITCHED ERRASIBLE
055338,000098: 
055339,000099:    5451           50000                           NDX      A                                     #  GET THE TIME INDIRECTLY
055340,000100:    5452           30001                           CA       1                                     
055341,000101: 
055342,000102:    5453           22006                           LXCH     BB                                    #  RESTORE THE BB AND GOLOC
055343,000103:    5454           22706                           LXCH     GOLOC      +1                         
055344,000104: 
055345,000105:    5455           13603                           TCF      FINDTIME                              #  FIND OUT WHEN IT SHOULD BEGIN
055346,000106: 
055347,000107:                                                                                                  #  ***** YOU  MAY RETURN TO  SWITCHED FIXED *****
055348,000108: 
055349,000109: 01,3603                                           BANK     01                                    
055350,000110: 01,2000                                           SETLOC   RESTART                               
055351,000111: 01,2000                                           BANK                                           
055352,000112: 
055353,000113: 01,3603                                           COUNT*   $$/RSROU                              
055354,000114: 01,3603           40000        FINDTIME           COM                                            #  MAKE NEGITIVE SINCE IT WILL BE SUBTRACTD
055355,000115: 01,3604           54001                           TS       L                                     #  AND SAVE
055356,000116: 01,3605           50155                           NDX      TEMP2G                                
055357,000117: 01,3606           41052                           CS       TBASE1                                
055358,000118: 01,3607           00006                           EXTEND                                         
055359,000119: 01,3610           60025                           SU       TIME1                                 
055360,000120: 01,3611           10000                           CCS      A                                     
055361,000121: 01,3612           40000                           COM                                            
055362,000122: 

Page 1294

055364,000124: 01,3613           67734                           AD       OCT37776                              
055365,000125: 01,3614           64753                           AD       ONE                                   
055366,000126: 01,3615           60001                           AD       L                                     
055367,000127: 01,3616           10000                           CCS      A                                     
055368,000128: 01,3617           34755                           CA       ZERO                                  
055369,000129: 01,3620           13622                           TCF      +2                                    
055370,000130: 01,3621           13622                           TCF      +1                                    
055371,000131: 01,3622           64753        IMEDIATE           AD       ONE                                   
055372,000132: 01,3623           00704                           TC       GOLOC      -1                         
055373,000133: 01,3624           33567        ITSLIKEB           CA       RTRNCADR                              #  TYPE B,             SO STORE RETURN IN
055374,000134: 01,3625           54157                           TS       TEMPSWCH                              #  TEMPSWCH IN CASE OF AN EVEN PHASE
055375,000135: 
055376,000136: 01,3626           33773                           CA       PRT2CADR                              #  SET UP EXIT TO GET TABLE PART OF THIS
055377,000137: 01,3627           54707                           TS       GOLOC      +2                         #  VARIABLE TYPE OF PHASE
055378,000138: 
055379,000139: 01,3630           30154                           CA       TEMPPHS                               #  MAKE THE PHASE LOOK RIGHT FOR THE TABLE
055380,000140: 01,3631           76077                           MASK     OCT177                                #  PART OF THIS VARIABLE PHASE
055381,000141: 01,3632           54154                           TS       TEMPPHS                               
055382,000142: 
055383,000143: 01,3633           00006                           EXTEND                                         
055384,000144: 01,3634           50155                           NDX      TEMP2G                                #  OBTAIN THE JOB:S 2CADR
055385,000145: 01,3635           31437                           DCA      PHSNAME1                              
055386,000146: 01,3636           52706                           DXCH     GOLOC                                 
055387,000147: 
055388,000148: 01,3637           50155        ITSAJOB            NDX      TEMP2G                                #  NOW ADD THE PRIORITY AND LET:S GO
055389,000149: 01,3640           31053                           CA       PHSPRDT1                              
055390,000150: 01,3641           54704        CHKNOVAC           TS       GOLOC      -1                         #  SAVE PRIO UNTIL WE SEE IF ITS
055391,000151: 01,3642           00006                           EXTEND                                         #  A FINDVAC OR A NOVAC
055392,000152: 01,3643           63647                           BZMF     ITSNOVAC                              
055393,000153: 
055394,000154: 01,3644           34354                           CAF      FVACCADR                              #  POSITIVE, SET UP FINDVAC CALL.
055395,000155: 01,3645           56704                           XCH      GOLOC      -1                         #  PICK UP PRIO,
055396,000156: 01,3646           00704                           TC       GOLOC      -1                         #  AND GO
055397,000157: 
055398,000158: 01,3647           34351        ITSNOVAC           CAF      NOVACADR                              #  NEGATIVE,
055399,000159: 01,3650           56704                           XCH      GOLOC      -1                         #  SET UP NOVAC CALL,
055400,000160: 01,3651           40000                           COM                                            #  CORRECT PRIO,
055401,000161: 01,3652           00704                           TC       GOLOC      -1                         #  AND GO
055402,000162: 
055403,000163: 01,3653           54020        ITSATBL            TS       CYR                                   #  FIND OUT IF THE PHASE IS ODD OR EVEN
055404,000164: 01,3654           10020                           CCS      CYR                                   
055405,000165: 01,3655           13656                           TCF      +1                                    #  IT:S EVEN
055406,000166: 01,3656           13754                           TCF      ITSEVEN                               
055407,000167: 
055408,000168: 01,3657           33567                           CA       RTRNCADR                              #  IN CASE THIS IS THE SECOND PART OF A
055409,000169: 01,3660           54707                           TS       GOLOC      +2                         #  TYPE B RESTART, WE NEED PROPER EXIT
055410,000170: 
055411,000171: 01,3661           30154                           CA       TEMPPHS                               #  SET UP POINTER FOR FINDING OUR PLACE IN
055412,000172: 01,3662           54021                           TS       SR                                    #  THE RESTART TABLES
055413,000173: 01,3663           60021                           AD       SR                                    
055414,000174: 

Page 1295

055416,000176: 01,3664           50155                           NDX      TEMP2G                                
055417,000177: 01,3665           62003                           AD       SIZETAB    +1                         
055418,000178: 01,3666           54156                           TS       POINTER                               
055419,000179: 
055420,000180: 01,3667           00006        CONTBL2            EXTEND                                         #  FIND OUT WHAT:S IN THE TABLE
055421,000181: 01,3670           50156                           NDX      POINTER                               
055422,000182: 01,3671           32002                           DCA      CADRTAB                               #  GET THE 2CADR
055423,000183: 
055424,000184: 01,3672           22706                           LXCH     GOLOC      +1                         #  STORE THE BB INFORMATION
055425,000185: 
055426,000186: 01,3673           10000                           CCS      A                                     #  IS IT A JOB OR IS IT  TIMED
055427,000187: 01,3674           24000                           INCR     A                                     #  POSITIVE, MUST BE A JOB
055428,000188: 01,3675           13750                           TCF      ITSAJOB2                              
055429,000189: 
055430,000190: 01,3676           24000                           INCR     A                                     #  MUST BE EITHER A WAITLIST OR LONGCALL
055431,000191: 01,3677           54705                           TS       GOLOC                                 #  LET-S STORE THE CORRECT CADR
055432,000192: 
055433,000193: 01,3700           34352                           CA       WTLTCADR                              #  SET UP OUR EXIT TO WAITLIST
055434,000194: 01,3701           54704                           TS       GOLOC      -1                         
055435,000195: 
055436,000196: 01,3702           30706                           CA       GOLOC      +1                         #  NOW FIND OUT IF IT IS A WAITLIST CALL
055437,000197: 01,3703           74742                           MASK     BIT10                                 #  THIS SHOULD BE ONE IF WE HAVE -BB
055438,000198: 01,3704           10000                           CCS      A                                     #  FOR THAT MATTER SO SHOULD BE BITS 9,8,7,
055439,000199:                                                                                                  #  6,5, AND LAST BUT NOT LEAST (PERHAPS NOT
055440,000200:                                                                                                  #  IN IMPORTANCE ANYWAY. BIT 4
055441,000201: 01,3705           13743                           TCF      ITSWTLST                              #  IT IS A WAITLIST CALL
055442,000202: 
055443,000203: 01,3706           50156                           NDX      POINTER                               #  OBTAIN THE ORIGINAL DELTA T
055444,000204: 01,3707           32000                           CA       PRDTTAB                               #  ADDRESS FOR THIS LONGCALL
055445,000205: 
055446,000206: 01,3710           15456                           TCF      ITSLGCL1                              #  NOW GO GET THE DELTA TIME
055447,000207: 
055448,000208:                                                                                                  #  ***** THIS MUST BE IN FIXED FIXED *****
055449,000209: 
055450,000210:    5456                                           BLOCK    02                                    
055451,000211:    4000                                           SETLOC   FFTAG2                                
055452,000212:    4000                                           BANK                                           
055453,000213: 
055454,000214:    5456                                           COUNT*   $$/RSROU                              
055455,000215:    5456           22706        ITSLGCL1           LXCH     GOLOC      +1                         #  OBTAIN THE CORRECT E BANK
055456,000216:    5457           22006                           LXCH     BB                                    
055457,000217:    5460           22706                           LXCH     GOLOC      +1                         #  AND PRESERVE OUR E AND F BANKS
055458,000218: 
055459,000219:    5461           00006                           EXTEND                                         #  GET THE DELTA TIME
055460,000220:    5462           50000                           NDX      A                                     
055461,000221:    5463           30001                           DCA      0                                     
055462,000222: 
055463,000223:    5464           22706                           LXCH     GOLOC      +1                         #  RESTORE OUR E AND F BANK
055464,000224:    5465           22006                           LXCH     BB                                    #  RESTORE THE TASKS E AND F BANKS
055465,000225:    5466           22706                           LXCH     GOLOC      +1                         #  AND PRESERVE OUR L
055466,000226: 

Page 1296

055468,000228:    5467           13711                           TCF      ITSLGCL2                              #  NOW LET:S PROCESS THIS LONGCALL
055469,000229: 
055470,000230:                                                                                                  #  ***** YOU  MAY RETURN  TO SWITCHED FIXED *****
055471,000231: 
055472,000232: 01,3711                                           BANK     01                                    
055473,000233: 01,2000                                           SETLOC   RESTART                               
055474,000234: 01,2000                                           BANK                                           
055475,000235: 
055476,000236: 01,3711                                           COUNT*   $$/RSROU                              
055477,000237: 01,3711           53153        ITSLGCL2           DXCH     LONGTIME                              
055478,000238: 
055479,000239: 01,3712           00006                           EXTEND                                         #  CALCULATE TIME LEFT
055480,000240: 01,3713           40025                           DCS      TIME2                                 
055481,000241: 01,3714           21153                           DAS      LONGTIME                              
055482,000242: 01,3715           00006                           EXTEND                                         
055483,000243: 01,3716           31151                           DCA      LONGBASE                              
055484,000244: 01,3717           21153                           DAS      LONGTIME                              
055485,000245: 
055486,000246: 01,3720           11152                           CCS      LONGTIME                              #  FIND OUT HOW THIS SHOULD BE RESTARTED
055487,000247: 01,3721           13731                           TCF      LONGCLCL                              
055488,000248: 01,3722           13724                           TCF      +2                                    
055489,000249: 01,3723           13617                           TCF      IMEDIATE   -3                         
055490,000250: 01,3724           11153                           CCS      LONGTIME   +1                         
055491,000251: 01,3725           13731                           TCF      LONGCLCL                              
055492,000252: 01,3726           13727                           NOOP                                           #  CAN:T GET HERE    *********
055493,000253: 01,3727           13617                           TCF      IMEDIATE   -3                         
055494,000254: 01,3730           13622                           TCF      IMEDIATE                              
055495,000255: 
055496,000256: 01,3731           33774        LONGCLCL           CA       LGCLCADR                              #  WE WILL GO TO LONGCALL
055497,000257: 01,3732           54704                           TS       GOLOC      -1                         
055498,000258: 
055499,000259: 01,3733           00006                           EXTEND                                         #  PREPARE OUR ENTRY TO LONGCALL
055500,000260: 01,3734           31153                           DCA      LONGTIME                              
055501,000261: 01,3735           00704                           TC       GOLOC      -1                         
055502,000262: 
055503,000263: 01,3736           34352        ITSLNGCL           CA       WTLTCADR                              #  ASSUME IT WILL GO TO WAITLIST
055504,000264: 01,3737           54704                           TS       GOLOC      -1                         
055505,000265: 
055506,000266: 01,3740           50155                           NDX      TEMP2G                                
055507,000267: 01,3741           41053                           CS       PHSPRDT1                              #  GET THE DELTA T ADDRESS
055508,000268: 
055509,000269: 01,3742           15456                           TCF      ITSLGCL1                              #  NOW GET THE DELTA TIME
055510,000270: 
055511,000271: 01,3743           40706        ITSWTLST           CS       GOLOC      +1                         #  CORRECT THE BBCON INFORMATION
055512,000272: 01,3744           54706                           TS       GOLOC      +1                         
055513,000273: 
055514,000274: 01,3745           50156                           NDX      POINTER                               #  GET THE DT AND FIND OUT IF IT WAS STORED
055515,000275: 01,3746           32000                           CA       PRDTTAB                               #  DIRECTLY OR INDIRECTLY
055516,000276: 
055517,000277: 01,3747           13576                           TCF      TIMETEST                              #  FIND OUT HOW THE TIME IS STORED
055518,000278: 

Page 1297

055520,000280: 01,3750           56705        ITSAJOB2           XCH      GOLOC                                 #  STORE THE CADR
055521,000281: 
055522,000282: 01,3751           50156                           NDX      POINTER                               #  ADD THE PRIORITY AND LET:S GO
055523,000283: 01,3752           32000                           CA       PRDTTAB                               
055524,000284: 
055525,000285: 01,3753           13641                           TCF      CHKNOVAC                              
055526,000286: 
055527,000287: 01,3754           30157        ITSEVEN            CA       TEMPSWCH                              #  SET UP FOR EITHER THE SECOND PART OF THE
055528,000288: 01,3755           54707                           TS       GOLOC      +2                         #  TABLE, OR A RETURN FOR THE NEXT GROUP
055529,000289: 
055530,000290: 01,3756           50155                           NDX      TEMP2G                                #  SET UP POINTER FOR OUR LOCATION WITHIN
055531,000291: 01,3757           32002                           CA       SIZETAB                               #  THE TABLE
055532,000292: 01,3760           60154                           AD       TEMPPHS                               #  THIS MAY LOOK BAD BUT LET:S SEE YOU DO
055533,000293: 01,3761           60154                           AD       TEMPPHS                               #  BETTER IN TIME OR NUMBERR OF LOCATIONS
055534,000294: 01,3762           60154                           AD       TEMPPHS                               
055535,000295: 01,3763           54156                           TS       POINTER                               
055536,000296: 
055537,000297: 01,3764           13667                           TCF      CONTBL2                               #  NOW PROCESS WHAT IS IN THE TABLE
055538,000298: 
055539,000299: 01,3765           36250        PHSPART2           CA       THREE                                 #  SET THE POINTER FOR THE SECOND HALF OF
055540,000300: 01,3766           26156                           ADS      POINTER                               #  THE TABLE
055541,000301: 
055542,000302: 01,3767           33567                           CA       RTRNCADR                              #  THIS WILL BE OUR LAST TIME THROUGH THE
055543,000303: 01,3770           54707                           TS       GOLOC      +2                         #  EVEN TABLE , SO AFTER IT  GET THE NEXT
055544,000304:                                                                                                  #  GROUP
055545,000305: 01,3771           13667                           TCF      CONTBL2                               #  SO LET:S GET THE SECOND ENTRY IN THE TBL
055546,000306: 
055547,000307: 01,3772     0154               TEMPPHS            EQUALS   MPAC                                  
055548,000308: 01,3772     0155               TEMP2G             EQUALS   MPAC       +1                         
055549,000309: 01,3772     0156               POINTER            EQUALS   MPAC       +2                         
055550,000310: 01,3772     0157               TEMPSWCH           EQUALS   MPAC       +3                         
055551,000311: 01,3772     0705               GOLOC              EQUALS   VAC5       +20D                       
055552,000312: 01,3772     7751               MINUS2             EQUALS   NEG2                                  
055553,000313: 01,3772     6077               OCT177             EQUALS   LOW7                                  
055554,000314: 
055555,000315: 01,3772           03765        PHS2CADR           GENADR   PHSPART2                              
055556,000316: 01,3773           03543        PRT2CADR           GENADR   GETPART2                              
055557,000317: 01,3774           05310        LGCLCADR           GENADR   LONGCALL                              
055558,000318: 01,3775     4354               FVACCADR           =        TCFINDVC                              
055559,000319: 01,3775     4352               WTLTCADR           =        TCWAIT                                
055560,000320: 01,3775     4351               NOVACADR           =        TCNOVAC                               
055561,000321: 
055562,000322: 

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