Source Code

These source code files are an attempted reconstruction of Sundance revision 306, the Apollo 9 LM (Lunar Module) AGC (Apollo Guidance Computer) flight software, created from binary dumps of original core rope program modules, as follows:
  • B1 — Revision 292
  • B2 — Revision 302
  • B3 — Revision 302
  • B4 — Revision 302
  • B5 — Revision 292
  • B6 — Revision 306
These dumps were then modified using memos, checklists, observed address changes, and the Sundance GSOPs to get the entire program to match Sundance revision 306 as closely as possible. Without more information, it is not possible to say how close it actually is; however, this code should be quite close. It is capable of flying the whole Apollo 9 mission using the original checklists and padload. Since only binary dumps (rather than listings) of Sundance are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing.

054204,000002:                                                                                                  ## Copyright:   Public domain.
054205,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
054206,000004:                                                                                                  ## Purpose:     A section of an attempt to reconstruct Sundance revision 306
054207,000005:                                                                                                  ##              as closely as possible with available information. Sundance
054208,000006:                                                                                                  ##              306 is the source code for the Lunar Module's (LM) Apollo
054209,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 9. This program was created
054210,000008:                                                                                                  ##              using the mixed-revision SundanceXXX as a starting point, and
054211,000009:                                                                                                  ##              pulling back features from Luminary 69 believed to have been
054212,000010:                                                                                                  ##              added based on memos, checklists, observed address changes,
054213,000011:                                                                                                  ##              or the Sundance GSOPs.
054214,000012:                                                                                                  ## Assembler:   yaYUL
054215,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
054216,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
054217,000015:                                                                                                  ## Mod history: 2020-07-24 MAS  Created from SundanceXXX.
054218,000016:                                                                                                  ##              2020-07-29 MAS  Added a custom implementation of SETXDSP.
054219,000017: 
054220,000018: 
054221,000019:    7727                                           BLOCK    3                                     
054222,000020:    6000                                           SETLOC   FFTAG6                                
054223,000021:    6000                                           BANK                                           
054224,000022:    7727                                           COUNT*   $$/FLAG                               
054225,000023: 
054226,000024:    7727           50002                 -2        INDEX    Q                                     
054227,000025:    7730           30000                           CA       0                                     
054228,000026:    7731           54001        UPENT2             TS       L                                     #  WHICH FLAGWORD IS IT
054229,000027:    7732           75032                           MASK     OCT7                                  
054230,000028:    7733           56001                           XCH      L                                     #  SAVE IN L FOR INDEXING
054231,000029: 
054232,000030:    7734           77716                           MASK     OCT77770                              #  OBTAIN THE BIT INFORMATION
054233,000031:    7735           00004                           INHINT                                         #  PREVENT INTERUPTS
054234,000032:    7736           54061                           TS       ITEMP1                                #  STORE THE BIT INFORMATION TEMPORARIALY
054235,000033: 
054236,000034:    7737           50001                           NDX      L                                     
054237,000035:    7740           40074                           CS       FLAGWRD0                              
054238,000036:    7741           70061                           MASK     ITEMP1                                
054239,000037:    7742           50001                           NDX      L                                     
054240,000038:    7743           26074                           ADS      FLAGWRD0                              
054241,000039:    7744           00003                           RELINT                                         #  RELEASE INTERUPT INHIBIT
054242,000040: 
054243,000041:    7745           24002                           INCR     Q                                     #  OBTAIN THE CORRECT RETURN ADDRESS
054244,000042:    7746           00002                           TC       Q                                     #  RETURN
054245,000043: 
054246,000044:    7747           50002                 -2        INDEX    Q                                     
054247,000045:    7750           30000                           CA       0                                     
054248,000046:    7751           54001        DOWNENT2           TS       L                                     #  WHICH FLAGWORD IS IT
054249,000047:    7752           75032                           MASK     OCT7                                  
054250,000048:    7753           56001                           XCH      L                                     #  SAVE IN L FOR INDEXING
054251,000049: 
054252,000050:    7754           77716                           MASK     OCT77770                              #  OBTAIN THE BIT INFORMATION
054253,000051:    7755           40000                           COM                                            #  START TO PROCESS THE INFORMATION
054254,000052: 
054255,000053:    7756           00004                           INHINT                                         #  PREVENT INTERUPTS
054256,000054:    7757           50001                           NDX      L                                     
054257,000055:    7760           70074                           MASK     FLAGWRD0                              
054258,000056:    7761           50001                           NDX      L                                     
054259,000057:    7762           54074                           TS       FLAGWRD0                              
054260,000058:    7763           00003                           RELINT                                         #  RELEASE INTERUPT INHIBIT
054261,000059: 
054262,000060:    7764           24002                           INCR     Q                                     #  OBTAIN THE CORRECT RETURN ADDRESS
054263,000061:    7765           00002                           TC       Q                                     #  RETURN
054264,000062: 
054265,000063:    7766     5032               OCT7               EQUALS   SEVEN                                 
054266,000064: 
054267,000065:                                                                                                  #      UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES.   USING THEM, WHETHER OR
054268,000066:                                                                                                  #  NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
054269,000067:                                                                                                  #  EBANK SETTING.   A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
054270,000068:                                                                                                  #  ASSEMBLER.
054271,000069: 
054272,000070:                                                                                                  #      AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS.   ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
054273,000071:                                                                                                  #  NAME ANY BIT IN ERASABLE MEMORY.
054274,000072: 
054275,000073:                                                                                                  #      CALLING SEQUENCES ARE AS FOLLOWS :-
054276,000074:                                                                                                  #                TC      UPFLAG                  TC      DOWNFLAG
054277,000075:                                                                                                  #                ADRES   NAME OF FLAG            ADRES   NAME OF FLAG
054278,000076: 
054279,000077:                                                                                                  #      RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
054280,000078: 
054281,000079:                                                                                                  #      UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
054282,000080: 
054283,000081:    5566                                           BLOCK    02                                    
054284,000082:    4000                                           SETLOC   FFTAG1                                
054285,000083:    4000                                           BANK                                           
054286,000084:    5566                                           COUNT*   $$/FLAG                               
054287,000085: 
054288,000086:    5566           30002        UPFLAG             CA       Q                                     
054289,000087:    5567           05604                           TC       DEBIT                                 
054290,000088:    5570           40000                           COM                                            #  +(15 - BIT)
054291,000089:    5571           00006                           EXTEND                                         
054292,000090:    5572           04001                           ROR      LCHAN                                 #  SET BIT
054293,000091:    5573           50061        COMFLAG            INDEX    ITEMP1                                
054294,000092:    5574           54074                           TS       FLAGWRD0                              
054295,000093:    5575           22063                           LXCH     ITEMP3                                
054296,000094:    5576           00003                           RELINT                                         
054297,000095:    5577           00001                           TC       L                                     
054298,000096: 
054299,000097:    5600           30002        DOWNFLAG           CA       Q                                     
054300,000098:    5601           05604                           TC       DEBIT                                 
054301,000099:    5602           70001                           MASK     L                                     #  RESET BIT
054302,000100:    5603           15573                           TCF      COMFLAG                               
054303,000101: 
054304,000102:    5604           65026        DEBIT              AD       ONE                                   #  GET DE BITS
054305,000103:    5605           00004                           INHINT                                         
054306,000104:    5606           54063                           TS       ITEMP3                                
054307,000105:    5607           35035                           CA       LOW4                                  #  DEC15
054308,000106:    5610           54061                           TS       ITEMP1                                
054309,000107:    5611           50063                           INDEX    ITEMP3                                
054310,000108:    5612           27777                           CA       0          -1                         #  ADRES
054311,000109:    5613           54001                           TS       L                                     
054312,000110:    5614           35030                           CA       ZERO                                  
054313,000111:    5615           00006                           EXTEND                                         
054314,000112:    5616           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
054315,000113:    5617           52062                           DXCH     ITEMP1                                
054316,000114:    5620           50061                           INDEX    ITEMP1                                
054317,000115:    5621           30074                           CA       FLAGWRD0                              
054318,000116:    5622           54001                           TS       L                                     #  CURRENT STATE
054319,000117:    5623           50062                           INDEX    ITEMP2                                
054320,000118:    5624           45010                           CS       BIT15                                 #  -(15 - BIT)
054321,000119:    5625           00002                           TC       Q                                     
054322,000120: 
054323,000121:                                                                                                  #  DELAYJOB - A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
054324,000122: 
054325,000123:                                                                                                  #  ENTRANCE REQUIREMENTS ...
054326,000124:                                                                                                  #                CAF     DT              DELAY JOB FOR DT CENTISECS
054327,000125:                                                                                                  #                TC      BANKCALL
054328,000126:                                                                                                  #                CADR    DELAYJOB
054329,000127: 
054330,000128: 06,3712                                           BANK     06                                    
054331,000129: 00,2000                                           SETLOC   DLAYJOB                               
054332,000130: 00,2000                                           BANK                                           
054333,000131: 
054334,000132:                                                                                                  #  THIS MUST REMAIN IN BANK 0 *****************************************
054335,000133: 
054336,000134: 00,3732                                           COUNT*   $$/DELAY                              
054337,000135: 00,3732           00004        DELAYJOB           INHINT                                         
054338,000136: 00,3733           54002                           TS       Q                                     #  STORE DELAY DT IN Q FOR DLY -1 IN
054339,000137: 
054340,000138: 00,3734           35025                           CAF      DELAYNUM                              #  WAITLIST
054341,000139: 00,3735           54070        DELLOOP            TS       RUPTREG1                              
054342,000140: 00,3736           50000                           INDEX    A                                     
054343,000141: 00,3737           31332                           CA       DELAYLOC                              #  IS THIS DELAYLOC AVAILABLE
054344,000142: 00,3740           00006                           EXTEND                                         
054345,000143: 00,3741           13746                           BZF      OK2DELAY                              #  YES
054346,000144: 
054347,000145: 00,3742           10070                           CCS      RUPTREG1                              #  NO, TRY NEXT DELAYLOC
054348,000146: 00,3743           13735                           TCF      DELLOOP                               
054349,000147: 
054350,000148: 00,3744           05716                           TC       ABORT                                 #  NO AVAILABLE LOCS.
054351,000149: 00,3745           01104                           OCT      1104                                  
054352,000150: 
054353,000151: 00,3746           33766        OK2DELAY           CA       TCSLEEP                               #  SET WAITLIST IMMEDIATE RETURN
054354,000152: 00,3747           54061                           TS       WAITEXIT                              
054355,000153: 
054356,000154: 00,3750           30004                           CA       FBANK                                 
054357,000155: 00,3751           60070                           AD       RUPTREG1                              #  STORE BBANK FOR TASK CALL
054358,000156: 00,3752           54001                           TS       L                                     
054359,000157: 
054360,000158: 00,3753           33767                           CAF      WAKECAD                               #  STORE CADR FOR TASK CALL
054361,000159: 00,3754           15260                           TCF      DLY2       -1                         #  DLY IS IN WAITLIST ROUTINE
054362,000160: 
054363,000161: 00,3755           04704        TCGETCAD           TC       MAKECADR                              #  GET CALLERS FCADR
054364,000162: 
054365,000163: 00,3756           50070                           INDEX    RUPTREG1                              
054366,000164: 00,3757           55332                           TS       DELAYLOC                              #  SAVE DELAY CADRS
054367,000165: 
054368,000166: 00,3760           05203                           TC       JOBSLEEP                              
054369,000167: 
054370,000168: 00,3761           35030        WAKER              CAF      ZERO                                  
054371,000169: 00,3762           50006                           INDEX    BBANK                                 
054372,000170: 00,3763           57332                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE
054373,000171: 00,3764           05207                           TC       JOBWAKE                               
054374,000172: 
054375,000173: 00,3765           05331                           TC       TASKOVER                              
054376,000174: 
054377,000175: 00,3766           03753        TCSLEEP            GENADR   TCGETCAD   -2                         
054378,000176: 00,3767           03761        WAKECAD            GENADR   WAKER                                 
054379,000177: 
054380,000178:                                                                                                  #  GENTRAN, A BLOCK TRANSFER ROUTINE.
054381,000179: 
054382,000180:                                                                                                  #  WRITTEN BY D. EYLES
054383,000181:                                                                                                  #  MOD 1 BY KERNAN                               UTILITYM REV 17 11/18/67
054384,000182: 
054385,000183:                                                                                                  #  MOD 2 BY SCHULENBERG (REMOVE RELINT) SKIPPER REV 4 2/28/68
054386,000184: 
054387,000185:                                                                                                  #           THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
054388,000186:                                                                                                  #  CONSECUTIVE ERASABLE LOCATIONS.  IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
054389,000187: 
054390,000188:                                                                                                  #           GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT.  THE CALLING SEQUENCE IS:
054391,000189:                                                                                                  #                                          I        CA    N-1              # OF QUANTITIES MINUS ONE.
054392,000190:                                                                                                  #                                          I +1     TC    GENTRAN          IN FIXED-FIXED.
054393,000191:                                                                                                  #                                          I +2     ADRES L                STARTING ADRES OF DATA TO BE MOVED.
054394,000192:                                                                                                  #                                          I +3     ADRES M                STARTING ADRES OF DUPLICATION BLOCK.
054395,000193:                                                                                                  #                                          I +4                            RETURNS HERE.
054396,000194: 
054397,000195:                                                                                                  #           GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
054398,000196:                                                                                                  #           A, L AND ITEMP1 ARE NOT PRESERVED.
054399,000197: 
054400,000198:    5626                                           BLOCK    02                                    
054401,000199:    4000                                           SETLOC   FFTAG4                                
054402,000200:    4000                                           BANK                                           
054403,000201: 
054404,000202:    5626     0061                                  EBANK=   ITEMP1                                
054405,000203: 
054406,000204:    5626                                           COUNT*   $$/TRAN                               
054407,000205: 
054408,000206:    5626           00004        GENTRAN            INHINT                                         
054409,000207:    5627           54061                           TS       ITEMP1                                #  SAVE N-1.
054410,000208:    5630           50002                           INDEX    Q                                     #  C(Q) = ADRES L.
054411,000209:    5631           60000                           AD       0                                     #  ADRES (L + N - 1).
054412,000210:    5632           50000                           INDEX    A                                     
054413,000211:    5633           30000                           CA       0                                     #  C(ABOVE).
054414,000212:    5634           54001                           TS       L                                     #  SAVE DATA.
054415,000213:    5635           30061                           CA       ITEMP1                                
054416,000214:    5636           50002                           INDEX    Q                                     
054417,000215:    5637           60001                           AD       1                                     #  ADRES (M + N - 1).
054418,000216:    5640           50000                           INDEX    A                                     
054419,000217:    5641           22000                           LXCH     0                                     #  STUFF IT.
054420,000218:    5642           10061                           CCS      ITEMP1                                #  LOOP UNTIL N-1 = 0.
054421,000219:    5643           15627                           TCF      GENTRAN    +1                         
054422,000220:    5644           16715                           TCF      Q+2                                   #  RETURN TO CALLER.
054423,000221: 
054424,000222:                                                                                                  #  B5OFF   ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
054425,000223:                                                                                                  #           MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
054426,000224: 
054427,000225:    5645                                           COUNT*   $$/EXTVB                              
054428,000226: 
054429,000227:    5645           45022        B5OFF              CS       BIT5                                  
054430,000228:    5646           71045                           MASK     EXTVBACT                              
054431,000229:    5647           55045                           TS       EXTVBACT                              
054432,000230:    5650           05225                           TC       ENDOFJOB                              
054433,000231: 

The following function, which assembles to address 7766, was added in Sundance 302. Unfortunately, we only have revision 292 of this bank. We currently believe that this routine corresponds with the following change which went into Colossus and Luminary in May 1968, right about when Sundance 302 was being finalized:

054438,000236:                                                                                                  ##

"A change was put into the Display Routines to set the XDSPFLAG for every MARK display set up. The only way to reset this bit is by means of ENDEXT. This change will lock out any normal displays throughout an extended verb as soon as the first display in the extended verb is initiated."

054442,000240:                                                                                                  ##

This change do the display interface routines is *not* present in Sundance 302 -- however, it is possible that they decided to not globablly make this change in a rope that had already been released, but to instead add this function which allowed them to manually set the bit whenever they explicitly wanted it. In this form, this subroutine essentially performs the function "past this point, normal displays can no longer appear".

054448,000246: 
054449,000247:    7766                                           BLOCK    03                                    
054450,000248:    6000                                           SETLOC   FFTAG5                                
054451,000249:    6000                                           BANK                                           
054452,000250: 
054453,000251:    7766     0061                                  EBANK=   ITEMP1                                
054454,000252: 
054455,000253:    7766                                           COUNT*   $$/EXTVB                              
054456,000254: 
054457,000255:    7766           00004        SETXDSP            INHINT                                         
054458,000256:    7767           40100                           CS       FLAGWRD4                              
054459,000257:    7770           75026                           MASK     XDSPBIT                               
054460,000258:    7771           26100                           ADS      FLAGWRD4                              
054461,000259:    7772           00003                           RELINT                                         
054462,000260:    7773           00002                           TC       Q                                     

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