Source Code

These source-code files are part of a reconstructed copy of Artemis 071, the first release of the Apollo 15 through 17 Command Module (CM) Apollo Guidance Computer (AGC) software.

The reconstruction began with source code of Artemis 072 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes between the two versions. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021154-. Note that page numbers in the reconstructed code match those on the Artemis 072 printout, although the changed code would likely have changed page numbers for a real Artemis 071 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.

060447,000002:                                                                                                  ## Copyright:   Public domain.
060448,000003:                                                                                                  ## Filename:    RESTARTS_ROUTINE.agc
060449,000004:                                                                                                  ## Purpose:     A section of Artemis revision 071.
060450,000005:                                                                                                  ##              It is part of the reconstructed source code for the first
060451,000006:                                                                                                  ##              release of the flight software for the Command Module's
060452,000007:                                                                                                  ##              (CM) Apollo Guidance Computer (AGC) for Apollo 15 through
060453,000008:                                                                                                  ##              17. The code has been recreated from a copy of Artemis 072.
060454,000009:                                                                                                  ##              It has been adapted such that the resulting bugger words
060455,000010:                                                                                                  ##              exactly match those specified for Artemis 071 in NASA
060456,000011:                                                                                                  ##              drawing 2021154-, which gives relatively high confidence
060457,000012:                                                                                                  ##              that the reconstruction is correct.
060458,000013:                                                                                                  ## Reference:   1411
060459,000014:                                                                                                  ## Assembler:   yaYUL
060460,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
060461,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
060462,000017:                                                                                                  ## Mod history: 2019-08-14 MAS  Created from Artemis 072.
060463,000018: 

Page 1411

060465,000020: 01,2000                                           SETLOC   RESTART                               
060466,000021: 01,2000                                           BANK                                           
060467,000022: 
060468,000023: 01,3467  E3,1436                                  EBANK=   PHSNAME1                              #  GOPROG MUST SWITCH TO THIS EBANK
060469,000024: 
060470,000025: 01,3467                                           COUNT*   $$/RSROU                              
060471,000026: 01,3467           30161        RESTARTS           CA       MPAC       +5                         #  GET GROUP NUMBER -1
060472,000027: 01,3470           60000                           DOUBLE                                         #  SAVE FOR INDEXING
060473,000028: 01,3471           54155                           TS       TEMP2G                                
060474,000029: 
060475,000030: 01,3472           33127                           CA       PHS2CADR                              #  SET UP EXIT IN CASE IT IS AN EVEN
060476,000031: 01,3473           54157                           TS       TEMPSWCH                              #  TABLE PHASE
060477,000032: 
060478,000033: 01,3474           33526                           CA       RTRNCADR                              #  TO SAVE TIME ASSUME IT WILL GET NEXT
060479,000034: 01,3475           54707                           TS       GOLOC      +2                         #  GROUP AFTER THIS
060480,000035: 
060481,000036: 01,3476           30154                           CA       TEMPPHS                               
060482,000037: 01,3477           75024                           MASK     OCT1400                               
060483,000038: 01,3500           10000                           CCS      A                                     #  IS IT A VARIABLE OR TABLE RESTART
060484,000039: 01,3501           13512                           TCF      ITSAVAR                               #  IT:S A VARIABLE RESTART
060485,000040: 
060486,000041: 01,3502           10154        GETPART2           CCS      TEMPPHS                               #  IS IT AN X.1 RESTART
060487,000042: 01,3503           10000                           CCS      A                                     
060488,000043: 01,3504           13612                           TCF      ITSATBL                               #  NO, ITS A TABLE RESTART
060489,000044: 
060490,000045: 01,3505           35053                           CA       PRIO14                                #  IT IS AN X.1 RESTART, THEREFORE START
060491,000046: 01,3506           05135        FVACCADR           TC       FINDVAC                               #  THE DISPLAY RESTART ROUTINE (=GENADR)
060492,000047: 01,3507  E3,1400                                  EBANK=   LST1                                  
060493,000048: 01,3507           03263 20063                     2CADR    INITDSP                               
060494,000049: 
060495,000050: 
060496,000051: 01,3511           03526                           TC       RTRNCADR                              #  FINISHED WITH THIS GROUP, GET NEXT ONE
060497,000052: 
060498,000053: 01,3512           75024        ITSAVAR            MASK     OCT1400                               #  IS IT TYPE B ?
060499,000054: 01,3513           10000                           CCS      A                                     
060500,000055: 01,3514           13563                           TCF      ITSLIKEB                              #  YES, IT IS TYPE B
060501,000056: 
060502,000057: 01,3515           00006                           EXTEND                                         #  STORE THE JOB (OR TASK) 2CADR FOR EXIT
060503,000058: 01,3516           50155                           NDX      TEMP2G                                
060504,000059: 01,3517           31437                           DCA      PHSNAME1                              
060505,000060: 01,3520           52706                           DXCH     GOLOC                                 
060506,000061: 
060507,000062: 01,3521           30154                           CA       TEMPPHS                               #  SEE IF THIS IS A JOB, TASK, OR A LONGCAL
060508,000063: 01,3522           74774                           MASK     OCT7                                  
060509,000064: 01,3523           67701                           AD       MINUS2                                
060510,000065: 01,3524           10000                           CCS      A                                     
060511,000066: 01,3525           13675                           TCF      ITSLNGCL                              #  ITS A LONGCALL
060512,000067: 
060513,000068: 01,3526           04651        RTRNCADR           TC       SWRETURN                              #  CANT GET HERE
060514,000069: 01,3527           13531                           TCF      ITSAWAIT                              

Page 1412

060516,000071: 01,3530           13576                           TCF      ITSAJOB                               #  ITS A JOB
060517,000072: 
060518,000073: 01,3531           33463        ITSAWAIT           CA       WTLTCADR                              #  SET UP WAITLIST CALL
060519,000074: 01,3532           54704                           TS       GOLOC      -1                         
060520,000075: 
060521,000076: 01,3533           50155                           NDX      TEMP2G                                #  DIRECTLY STORED
060522,000077: 01,3534           31260                           CA       PHSPRDT1                              
060523,000078: 01,3535           10000        TIMETEST           CCS      A                                     #  IS IT AN IMMEDIATE RESTART
060524,000079: 01,3536           24000                           INCR     A                                     #  NO,
060525,000080: 01,3537           13542                           TCF      FINDTIME                              #  FIND OUT WHEN IT SHOULD BEGIN
060526,000081: 
060527,000082: 01,3540           15470                           TCF      ITSINDIR                              #  STORED INDIRECTLY
060528,000083: 
060529,000084: 01,3541           13561                           TCF      IMEDIATE                              #  IT WANTS AN IMMEDIATE RESTART
060530,000085: 
060531,000086:                                                                                                  #  ***** THIS MUST BE IN FIXED FIXED *****
060532,000087: 
060533,000088:    4000                                           SETLOC   FFTAG2                                
060534,000089:    4000                                           BANK                                           
060535,000090: 
060536,000091:    5470                                           COUNT*   $$/RSROU                              
060537,000092:    5470           22706        ITSINDIR           LXCH     GOLOC      +1                         #  GET THE CORRECT E BANK IN CASE THIS IS
060538,000093:    5471           22006                           LXCH     BB                                    #  SWITCHED ERRASIBLE
060539,000094: 
060540,000095:    5472           50000                           NDX      A                                     #  GET THE TIME INDIRECTLY
060541,000096:    5473           30001                           CA       1                                     
060542,000097: 
060543,000098:    5474           22006                           LXCH     BB                                    #  RESTORE THE BB AND GOLOC
060544,000099:    5475           22706                           LXCH     GOLOC      +1                         
060545,000100: 
060546,000101:    5476           13542                           TCF      FINDTIME                              #  FIND OUT WHEN IT SHOULD BEGIN
060547,000102: 
060548,000103:                                                                                                  #  ***** YOU MAY RETURN TO  SWITCHED FIXED *****
060549,000104: 
060550,000105: 01,2000                                           SETLOC   RESTART                               
060551,000106: 01,2000                                           BANK                                           
060552,000107: 
060553,000108: 01,3542                                           COUNT*   $$/RSROU                              
060554,000109: 01,3542           40000        FINDTIME           COM                                            #  MAKE NEGITIVE SINCE IT WILL BE SUBTRACTD
060555,000110: 01,3543           54001                           TS       L                                     #  AND SAVE
060556,000111: 01,3544           50155                           NDX      TEMP2G                                
060557,000112: 01,3545           41257                           CS       TBASE1                                
060558,000113: 01,3546           00006                           EXTEND                                         
060559,000114: 01,3547           60025                           SU       TIME1                                 
060560,000115: 01,3550           10000                           CCS      A                                     
060561,000116: 01,3551           40000                           COM                                            
060562,000117: 01,3552           67663                           AD       OCT37776                              
060563,000118: 01,3553           64770                           AD       ONE                                   
060564,000119: 01,3554           60001                           AD       L                                     
060565,000120: 01,3555           10000                           CCS      A                                     

Page 1413

060567,000122: 01,3556           34772                 -3        CAF      ZERO                                  
060568,000123: 01,3557           13561                           TCF      +2                                    
060569,000124: 01,3560           13561                           TCF      +1                                    
060570,000125: 01,3561           64770        IMEDIATE           AD       ONE                                   
060571,000126: 01,3562           00704                           TC       GOLOC      -1                         
060572,000127: 01,3563           33526        ITSLIKEB           CA       RTRNCADR                              #  TYPE B, SO STORE RETURN IN
060573,000128: 01,3564           54157                           TS       TEMPSWCH                              #  TEMPSWCH IN CASE OF AN EVEN PHASE
060574,000129: 
060575,000130: 01,3565           33133                           CA       PRT2CADR                              #  SET UP EXIT TO GET TABLE PART OF THIS
060576,000131: 01,3566           54707                           TS       GOLOC      +2                         #  VARIABLE TYPE OF PHASE
060577,000132: 
060578,000133: 01,3567           30154                           CA       TEMPPHS                               #  MAKE THE PHASE LOOK RIGHT FOR THE TABLE
060579,000134: 01,3570           76043                           MASK     OCT177                                #  PART OF THIS VARIABLE PHASE
060580,000135: 01,3571           54154                           TS       TEMPPHS                               
060581,000136: 
060582,000137: 01,3572           00006                           EXTEND                                         
060583,000138: 01,3573           50155                           NDX      TEMP2G                                #  OBTAIN THE JOB:S 2CADR
060584,000139: 01,3574           31437                           DCA      PHSNAME1                              
060585,000140: 01,3575           52706                           DXCH     GOLOC                                 
060586,000141: 
060587,000142: 01,3576           50155        ITSAJOB            NDX      TEMP2G                                #  NOW ADD THE PRIORITY AND LET:S GO
060588,000143: 01,3577           31260                           CA       PHSPRDT1                              
060589,000144: 01,3600           54704        CHKNOVAC           TS       GOLOC      -1                         #  SAVE PRIO UNTIL WE SEE IF ITS
060590,000145: 01,3601           00006                           EXTEND                                         #  A FINDVAC OR A NOVAC
060591,000146: 01,3602           63606                           BZMF     ITSNOVAC                              
060592,000147: 
060593,000148: 01,3603           33506                           CAF      FVACCADR                              #  POSITIVE, SET UP FINDVAC CALL.
060594,000149: 01,3604           56704                           XCH      GOLOC      -1                         #  PICK UP PRIO,
060595,000150: 01,3605           00704                           TC       GOLOC      -1                         #  AND GO
060596,000151: 
060597,000152: 01,3606           35310        ITSNOVAC           CAF      NOVACADR                              #  NEGATIVE,
060598,000153: 01,3607           56704                           XCH      GOLOC      -1                         #  SET UP NOVAC CALL,
060599,000154: 01,3610           40000                           COM                                            #  CORRECT PRIO,
060600,000155: 01,3611           00704                           TC       GOLOC      -1                         #  AND GO
060601,000156: 
060602,000157: 01,3612           54020        ITSATBL            TS       CYR                                   #  FIND OUT IF THE PHASE IS ODD OR EVEN
060603,000158: 01,3613           10020                           CCS      CYR                                   
060604,000159: 01,3614           13615                           TCF      +1                                    #  IT:S EVEN
060605,000160: 01,3615           13713                           TCF      ITSEVEN                               
060606,000161: 
060607,000162: 01,3616           33526                           CA       RTRNCADR                              #  IN CASE THIS IS THE SECOND PART OF A
060608,000163: 01,3617           54707                           TS       GOLOC      +2                         #  TYPE B RESTART, WE NEED PROPER EXIT
060609,000164: 
060610,000165: 01,3620           30154                           CA       TEMPPHS                               #  SET UP POINTER FOR FINDING OUR PLACE IN
060611,000166: 01,3621           54021                           TS       SR                                    #  THE RESTART TABLES
060612,000167: 01,3622           60021                           AD       SR                                    
060613,000168: 01,3623           50155                           NDX      TEMP2G                                
060614,000169: 01,3624           62001                           AD       SIZETAB    +1                         
060615,000170: 01,3625           54156                           TS       POINTER                               

Page 1414

060617,000172: 
060618,000173: 01,3626           00006        CONTBL2            EXTEND                                         #  FIND OUT WHAT:S IN THE TABLE
060619,000174: 01,3627           50156                           NDX      POINTER                               
060620,000175: 01,3630           32002                           DCA      CADRTAB                               #  GET THE 2CADR
060621,000176: 
060622,000177: 01,3631           22706                           LXCH     GOLOC      +1                         #  STORE THE BB INFORMATION
060623,000178: 
060624,000179: 01,3632           10000                           CCS      A                                     #  IS IT A JOB OR IS IT TIMED
060625,000180: 01,3633           24000                           INCR     A                                     #  POSITIVE, MUST BE A JOB
060626,000181: 01,3634           13707                           TCF      ITSAJOB2                              
060627,000182: 
060628,000183: 01,3635           24000                           INCR     A                                     #  MUST BE EITHER A WAITLIST OR LONGCALL
060629,000184: 01,3636           54705                           TS       GOLOC                                 #  LET-S STORE THE CORRECT CADR
060630,000185: 
060631,000186: 01,3637           33463                           CA       WTLTCADR                              #  SET UP OUR EXIT TO WAITLIST
060632,000187: 01,3640           54704                           TS       GOLOC      -1                         
060633,000188: 
060634,000189: 01,3641           30706                           CA       GOLOC      +1                         #  NOW FIND OUT IF IT IS A WAITLIST CALL
060635,000190: 01,3642           74757                           MASK     BIT10                                 #  THIS SHOULD BE ONE IF WE HAVE -BB
060636,000191: 01,3643           10000                           CCS      A                                     #  FOR THAT MATTER SO SHOULD BE BITS 9,8,7,
060637,000192:                                                                                                  #  6,5, AND LAST BUT NOT LEAST (PERHAPS NOT
060638,000193:                                                                                                  #  IN IMPORTANCE ANYWAY. BIT 4
060639,000194: 01,3644           13702                           TCF      ITSWTLST                              #  IT IS A WAITLIST CALL
060640,000195: 
060641,000196: 01,3645           50156                           NDX      POINTER                               #  OBTAIN THE ORIGINAL DELTA T
060642,000197: 01,3646           32000                           CA       PRDTTAB                               #  ADDRESS FOR THIS LONGCALL
060643,000198: 
060644,000199: 01,3647           15477                           TCF      ITSLGCL1                              #  NOW GO GET THE DELTA TIME
060645,000200: 
060646,000201:                                                                                                  #  ***** THIS MUST BE IN FIXED FIXED *****
060647,000202: 
060648,000203:    4000                                           SETLOC   FFTAG2                                
060649,000204:    4000                                           BANK                                           
060650,000205: 
060651,000206:    5477                                           COUNT*   $$/RSROU                              
060652,000207:    5477           22706        ITSLGCL1           LXCH     GOLOC      +1                         #  OBTAIN THE CORRECT E BANK
060653,000208:    5500           22006                           LXCH     BB                                    
060654,000209:    5501           22706                           LXCH     GOLOC      +1                         #  AND PRESERVE OUR E AND F BANKS
060655,000210: 
060656,000211:    5502           00006                           EXTEND                                         #  GET THE DELTA TIME
060657,000212:    5503           50000                           NDX      A                                     
060658,000213:    5504           30001                           DCA      0                                     
060659,000214:    5505           22706                           LXCH     GOLOC      +1                         #  RESTORE OUR E AND F BANK
060660,000215:    5506           22006                           LXCH     BB                                    #  RESTORE THE TASKS E AND F BANKS
060661,000216:    5507           22706                           LXCH     GOLOC      +1                         #  AND PRESERVE OUR L
060662,000217: 
060663,000218:    5510           13650                           TCF      ITSLGCL2                              #  NOW LET:S PROCESS THIS LONGCALL
060664,000219: 
060665,000220:                                                                                                  #  ***** YOU MAY RETURN TO  SWITCHED FIXED *****
060666,000221: 

Page 1415

060668,000223: 01,2000                                           SETLOC   RESTART                               
060669,000224: 01,2000                                           BANK                                           
060670,000225: 
060671,000226: 01,3650                                           COUNT*   $$/RSROU                              
060672,000227: 01,3650           53305        ITSLGCL2           DXCH     LONGTIME                              
060673,000228: 
060674,000229: 01,3651           00006                           EXTEND                                         #  CALCULATE TIME LEFT
060675,000230: 01,3652           40025                           DCS      TIME2                                 
060676,000231: 01,3653           21305                           DAS      LONGTIME                              
060677,000232: 01,3654           00006                           EXTEND                                         
060678,000233: 01,3655           31303                           DCA      LONGBASE                              
060679,000234: 01,3656           21305                           DAS      LONGTIME                              
060680,000235: 
060681,000236: 01,3657           11304                           CCS      LONGTIME                              #  FIND OUT HOW THIS SHOULD BE RESTARTED
060682,000237: 01,3660           13670                           TCF      LONGCLCL                              
060683,000238: 01,3661           13663                           TCF      +2                                    
060684,000239: 01,3662           13556                           TCF      IMEDIATE   -3                         
060685,000240: 01,3663           11305                           CCS      LONGTIME   +1                         
060686,000241: 01,3664           13670                           TCF      LONGCLCL                              
060687,000242: 01,3665           13666                           NOOP                                           #  CAN:T GET HERE    *********
060688,000243: 01,3666           13556                           TCF      IMEDIATE   -3                         
060689,000244: 01,3667           13561                           TCF      IMEDIATE                              
060690,000245: 
060691,000246: 01,3670           33137        LONGCLCL           CA       LGCLCADR                              #  WE WILL GO TO LONGCALL
060692,000247: 01,3671           54704                           TS       GOLOC      -1                         
060693,000248: 
060694,000249: 01,3672           00006                           EXTEND                                         #  PREPARE OUR ENTRY TO LONGCALL
060695,000250: 01,3673           31305                           DCA      LONGTIME                              
060696,000251: 01,3674           00704                           TC       GOLOC      -1                         
060697,000252: 
060698,000253: 01,3675           33463        ITSLNGCL           CA       WTLTCADR                              #  ASSUME IT WILL GO TO WAITLIST
060699,000254: 01,3676           54704                           TS       GOLOC      -1                         
060700,000255: 
060701,000256: 01,3677           50155                           NDX      TEMP2G                                
060702,000257: 01,3700           41260                           CS       PHSPRDT1                              #  GET THE DELTA T ADDRESS
060703,000258: 
060704,000259: 01,3701           15477                           TCF      ITSLGCL1                              #  NOW GET THE DELTA TIME
060705,000260: 
060706,000261: 01,3702           40706        ITSWTLST           CS       GOLOC      +1                         #  CORRECT THE BBCON INFORMATION
060707,000262: 01,3703           54706                           TS       GOLOC      +1                         
060708,000263: 
060709,000264: 01,3704           50156                           NDX      POINTER                               #  GET THE DT AND FIND OUT IF IT WAS STORED
060710,000265: 01,3705           32000                           CA       PRDTTAB                               #  DIRECTLY OR INDIRECTLY
060711,000266: 
060712,000267: 01,3706           13535                           TCF      TIMETEST                              #  FIND OUT HOW THE TIME IS STORED
060713,000268: 
060714,000269: 01,3707           56705        ITSAJOB2           XCH      GOLOC                                 #  STORE THE CADR
060715,000270: 
060716,000271: 01,3710           50156                           NDX      POINTER                               #  ADD THE PRIORITY AND LET:S GO
060717,000272: 01,3711           32000                           CA       PRDTTAB                               
060718,000273: 

Page 1416

060720,000275: 01,3712           13600                           TCF      CHKNOVAC                              
060721,000276: 
060722,000277: 01,3713           30157        ITSEVEN            CA       TEMPSWCH                              #  SET UP FOR EITHER THE SECOND PART OF THE
060723,000278: 01,3714           54707                           TS       GOLOC      +2                         #  TABLE, OR A RETURN FOR THE NEXT GROUP
060724,000279: 
060725,000280: 01,3715           50155                           NDX      TEMP2G                                #  SET UP POINTER FOR OUR LOCATION WITHIN
060726,000281: 01,3716           32000                           CA       SIZETAB                               #  THE TABLE
060727,000282: 01,3717           60154                           AD       TEMPPHS                               #  THIS MAY LOOK BAD BUT LET:S SEE YOU DO
060728,000283: 01,3720           60154                           AD       TEMPPHS                               #  BETTER IN TIME OR NUMBERR OF LOCATIONS
060729,000284: 01,3721           60154                           AD       TEMPPHS                               
060730,000285: 01,3722           54156                           TS       POINTER                               
060731,000286: 
060732,000287: 01,3723           13626                           TCF      CONTBL2                               #  NOW PROCESS WHAT IS IN THE TABLE
060733,000288: 
060734,000289: 01,3724           36214        PHSPART2           CA       THREE                                 #  SET THE POINTER FOR THE SECOND HALF OF
060735,000290: 01,3725           26156                           ADS      POINTER                               #  THE TABLE
060736,000291: 
060737,000292: 01,3726           33526                           CA       RTRNCADR                              #  THIS WILL BE OUR LAST TIME THROUGH THE
060738,000293: 01,3727           54707                           TS       GOLOC      +2                         #  EVEN TABLE, SO AFTER IT GET THE NEXT
060739,000294:                                                                                                  #  GROUP
060740,000295: 01,3730           13626                           TCF      CONTBL2                               #  SO LET:S GET THE SECOND ENTRY IN THE TBL
060741,000296: 
060742,000297: 01,3731     0154               TEMPPHS            EQUALS   MPAC                                  
060743,000298: 01,3731     0155               TEMP2G             EQUALS   MPAC       +1                         
060744,000299: 01,3731     0156               POINTER            EQUALS   MPAC       +2                         
060745,000300: 01,3731     0157               TEMPSWCH           EQUALS   MPAC       +3                         
060746,000301: 01,3731     7701               MINUS2             EQUALS   NEG2                                  
060747,000302: 01,3731     6043               OCT177             EQUALS   LOW7                                  
060748,000303: 

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