Source Code

These source-code files are part of a reconstructed copy of Luminary 69/2, the flown, final release of the Apollo 10 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction is based on the source code of Luminary 69 — i.e., the initial, unflown version, "revision 0" — of which a contemporary listing was available. The code was then updated by incorporating the differences between Luminary 69 and Luminary 69/2, known from other contemporary documentation. The only such difference is the implementation in Luminary 69/2 of the "R-2 Lunar Potential Model", the source code for which was taken from program Luminary 99/1 (Apollo 11 LM), of which a contemporary listing was also available. Finally, the now-reconstructed Luminary 69/2 was then validated by assembling it to executable form and verifying that its memory banks had the correct checksums, known from still other contemporary documentation.

Note that page numbers in the reconstructed code match those in the original Luminary 69 program listing, or in the ORBITAL INTEGRATION log section, in Luminary 99/1. Page numbers would certainly differ somewhat in a contemporary Luminary 69/2 listing. Moreover, annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change in Luminary 69/2 relative to Luminary 69. Here's a guide to the Apollo documentation referenced in those annotations:
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.

059075,000002:                                                                                                  ## Copyright:   Public domain.
059076,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
059077,000004:                                                                                                  ## Purpose:     A section of LUM69 revision 2.
059078,000005:                                                                                                  ##              It is part of the reconstructed source code for the flown
059079,000006:                                                                                                  ##              version of the flight software for the Lunar Module's (LM)
059080,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 10. The code has
059081,000008:                                                                                                  ##              been recreated from a copy of Luminary revsion 069, using
059082,000009:                                                                                                  ##              changes present in Luminary 099 which were described in
059083,000010:                                                                                                  ##              Luminary memos 75 and 78. The code has been adapted such
059084,000011:                                                                                                  ##              that the resulting bugger words exactly match those specified
059085,000012:                                                                                                  ##              for LUM69 revision 2 in NASA drawing 2021152B, which gives
059086,000013:                                                                                                  ##              relatively high confidence that the reconstruction is correct.
059087,000014:                                                                                                  ## Reference:   pp. 1368-1374
059088,000015:                                                                                                  ## Assembler:   yaYUL
059089,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
059090,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
059091,000018:                                                                                                  ## Mod history: 2019-07-27 MAS  Created from Luminary 69.
059092,000019: 

Page 1368

059094,000021: 10,3416                                           BANK     10                                    
059095,000022: 10,2000                                           SETLOC   DISPLAYS                              
059096,000023: 10,2000                                           BANK                                           
059097,000024: 10,3416                                           COUNT*   $$/DSPLA                              
059098,000025: 
059099,000026: 10,3416           54001        UPENT2             TS       L                                     #  WHICH FLAGWORD IS IT
059100,000027: 10,3417           74757                           MASK     OCT7                                  
059101,000028: 10,3420           56001                           XCH      L                                     #  SAVE IN L FOR INDEXING
059102,000029: 
059103,000030: 10,3421           75660                           MASK     OCT77770                              #  OBTAIN THE BIT INFORMATION
059104,000031: 10,3422           00004                           INHINT                                         #  PREVENT INTERUPTS
059105,000032: 10,3423           54061                           TS       ITEMP1                                #  STORE THE BIT INFORMATION TEMPORARIALY
059106,000033: 
059107,000034: 10,3424           50001                           NDX      L                                     
059108,000035: 10,3425           40074                           CS       FLAGWRD0                              
059109,000036: 10,3426           70061                           MASK     ITEMP1                                
059110,000037: 10,3427           50001                           NDX      L                                     
059111,000038: 10,3430           26074                           ADS      FLAGWRD0                              
059112,000039: 10,3431           00003                           RELINT                                         #  RELEASE INTERUPT INHIBIT
059113,000040: 
059114,000041: 10,3432           24002                           INCR     Q                                     #  OBTAIN THE CORRECT RETURN ADDRESS
059115,000042: 10,3433           00002                           TC       Q                                     #  RETURN
059116,000043: 
059117,000044: 10,3434           54001        DOWNENT2           TS       L                                     #  WHICH FLAGWORD IS IT
059118,000045: 10,3435           74757                           MASK     OCT7                                  
059119,000046: 10,3436           56001                           XCH      L                                     #  SAVE IN L FOR INDEXING
059120,000047: 
059121,000048: 10,3437           75660                           MASK     OCT77770                              #  OBTAIN THE BIT INFORMATION
059122,000049: 10,3440           40000                           COM                                            #  START TO PROCESS THE INFORMATION
059123,000050: 
059124,000051: 10,3441           00004                           INHINT                                         #  PREVENT INTERUPTS
059125,000052: 10,3442           50001                           NDX      L                                     
059126,000053: 10,3443           70074                           MASK     FLAGWRD0                              
059127,000054: 10,3444           50001                           NDX      L                                     
059128,000055: 10,3445           54074                           TS       FLAGWRD0                              
059129,000056: 10,3446           00003                           RELINT                                         #  RELEASE INTERUPT INHIBIT
059130,000057: 
059131,000058: 10,3447           24002                           INCR     Q                                     #  OBTAIN THE CORRECT RETURN ADDRESS
059132,000059: 10,3450           00002                           TC       Q                                     #  RETURN
059133,000060: 
059134,000061: 10,3451     4757               OCT7               EQUALS   SEVEN                                 
059135,000062: 

Page 1369

059137,000064:                                                                                                  #      UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES.   USING THEM, WHETHER OR
059138,000065:                                                                                                  #  NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
059139,000066:                                                                                                  #  EBANK SETTING.   A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
059140,000067:                                                                                                  #  ASSEMBLER.
059141,000068: 
059142,000069:                                                                                                  #      AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS.   ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
059143,000070:                                                                                                  #  NAME ANY BIT IN ERASABLE MEMORY.
059144,000071: 
059145,000072:                                                                                                  #      CALLING SEQUENCES ARE AS FOLLOWS :-
059146,000073:                                                                                                  #                TC      UPFLAG                  TC      DOWNFLAG
059147,000074:                                                                                                  #                ADRES   NAME OF FLAG            ADRES   NAME OF FLAG
059148,000075: 
059149,000076:                                                                                                  #      RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
059150,000077: 
059151,000078:                                                                                                  #      UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
059152,000079: 
059153,000080:    5504                                           BLOCK    02                                    
059154,000081:    4000                                           SETLOC   FFTAG1                                
059155,000082:    4000                                           BANK                                           
059156,000083:    5504                                           COUNT*   $$/FLAG                               
059157,000084: 
059158,000085:    5504           30002        UPFLAG             CA       Q                                     
059159,000086:    5505           05522                           TC       DEBIT                                 
059160,000087:    5506           40000                           COM                                            #  +(15 - BIT)
059161,000088:    5507           00006                           EXTEND                                         
059162,000089:    5510           04001                           ROR      LCHAN                                 #  SET BIT
059163,000090:    5511           50061        COMFLAG            INDEX    ITEMP1                                
059164,000091:    5512           54074                           TS       FLAGWRD0                              
059165,000092:    5513           22063                           LXCH     ITEMP3                                
059166,000093:    5514           00003                           RELINT                                         
059167,000094:    5515           00001                           TC       L                                     
059168,000095: 
059169,000096:    5516           30002        DOWNFLAG           CA       Q                                     
059170,000097:    5517           05522                           TC       DEBIT                                 
059171,000098:    5520           70001                           MASK     L                                     #  RESET BIT
059172,000099:    5521           15511                           TCF      COMFLAG                               
059173,000100: 
059174,000101:    5522           64753        DEBIT              AD       ONE                                   #  GET DE BITS
059175,000102:    5523           00004                           INHINT                                         
059176,000103:    5524           54063                           TS       ITEMP3                                
059177,000104:    5525           34762                           CA       LOW4                                  #  DEC15
059178,000105:    5526           54061                           TS       ITEMP1                                
059179,000106:    5527           50063                           INDEX    ITEMP3                                
059180,000107:    5530           27777                           CA       0          -1                         #  ADRES
059181,000108:    5531           54001                           TS       L                                     
059182,000109:    5532           34755                           CA       ZERO                                  

Page 1370

059184,000111:    5533           00006                           EXTEND                                         
059185,000112:    5534           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
059186,000113:    5535           52062                           DXCH     ITEMP1                                
059187,000114:    5536           50061                           INDEX    ITEMP1                                
059188,000115:    5537           30074                           CA       FLAGWRD0                              
059189,000116:    5540           54001                           TS       L                                     #  CURRENT STATE
059190,000117:    5541           50062                           INDEX    ITEMP2                                
059191,000118:    5542           44735                           CS       BIT15                                 #  -(15 - BIT)
059192,000119:    5543           00002                           TC       Q                                     
059193,000120: 

Page 1371

059195,000122:                                                                                                  #  DELAYJOB - A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
059196,000123: 
059197,000124:                                                                                                  #  ENTRANCE REQUIREMENTS ...
059198,000125:                                                                                                  #                CAF     DT              DELAY JOB FOR DT CENTISECS
059199,000126:                                                                                                  #                TC      BANKCALL
059200,000127:                                                                                                  #                CADR    DELAYJOB
059201,000128: 
059202,000129: 06,3715                                           BANK     06                                    
059203,000130: 00,2000                                           SETLOC   DLAYJOB                               
059204,000131: 00,2000                                           BANK                                           
059205,000132: 
059206,000133:                                                                                                  #  THIS MUST REMAIN IN BANK 0 *****************************************
059207,000134: 
059208,000135: 00,3735                                           COUNT*   $$/DELAY                              
059209,000136: 00,3735           00004        DELAYJOB           INHINT                                         
059210,000137: 00,3736           54002                           TS       Q                                     #  STORE DELAY DT IN Q FOR DLY -1 IN
059211,000138: 
059212,000139: 00,3737           34752                           CAF      DELAYNUM                              #  WAITLIST
059213,000140: 00,3740           54070        DELLOOP            TS       RUPTREG1                              
059214,000141: 00,3741           50000                           INDEX    A                                     
059215,000142: 00,3742           31326                           CA       DELAYLOC                              #  IS THIS DELAYLOC AVAILABLE
059216,000143: 00,3743           00006                           EXTEND                                         
059217,000144: 00,3744           13752                           BZF      OK2DELAY                              #  YES
059218,000145: 
059219,000146: 00,3745           10070                           CCS      RUPTREG1                              #  NO, TRY NEXT DELAYLOC
059220,000147: 00,3746           13740                           TCF      DELLOOP                               
059221,000148: 
059222,000149: 00,3747           52134                           DXCH     BUF2                                  
059223,000150: 00,3750           05710                           TC       BAILOUT1                              #  NO AVAILABLE LOCS.
059224,000151: 00,3751           01104                           OCT      1104                                  
059225,000152: 
059226,000153: 00,3752           33772        OK2DELAY           CA       TCSLEEP                               #  SET WAITLIST IMMEDIATE RETURN
059227,000154: 00,3753           54061                           TS       WAITEXIT                              
059228,000155: 
059229,000156: 00,3754           30004                           CA       FBANK                                 
059230,000157: 00,3755           60070                           AD       RUPTREG1                              #  STORE BBANK FOR TASK CALL
059231,000158: 00,3756           54001                           TS       L                                     
059232,000159: 
059233,000160: 00,3757           33773                           CAF      WAKECAD                               #  STORE CADR FOR TASK CALL
059234,000161: 00,3760           15211                           TCF      DLY2       -1                         #  DLY IS IN WAITLIST ROUTINE
059235,000162: 
059236,000163: 00,3761           04645        TCGETCAD           TC       MAKECADR                              #  GET CALLERS FCADR
059237,000164: 
059238,000165: 00,3762           50070                           INDEX    RUPTREG1                              
059239,000166: 00,3763           55326                           TS       DELAYLOC                              #  SAVE DELAY CADRS
059240,000167: 
059241,000168: 00,3764           05133                           TC       JOBSLEEP                              
059242,000169: 
059243,000170: 00,3765           34755        WAKER              CAF      ZERO                                  
059244,000171: 00,3766           50006                           INDEX    BBANK                                 
059245,000172: 00,3767           57326                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE

Page 1372

059247,000174: 00,3770           05137                           TC       JOBWAKE                               
059248,000175: 
059249,000176: 00,3771           05261                           TC       TASKOVER                              
059250,000177: 
059251,000178: 00,3772           03757        TCSLEEP            GENADR   TCGETCAD   -2                         
059252,000179: 00,3773           03765        WAKECAD            GENADR   WAKER                                 
059253,000180: 

Page 1373

059255,000182:                                                                                                  #  GENTRAN, A BLOCK TRANSFER ROUTINE.
059256,000183: 
059257,000184:                                                                                                  #  WRITTEN BY D. EYLES
059258,000185:                                                                                                  #  MOD 1 BY KERNAN                               UTILITYM REV 17 11/18/67
059259,000186: 
059260,000187:                                                                                                  #  MOD 2 BY SCHULENBERG (REMOVE RELINT) SKIPPER REV 4 2/28/68
059261,000188: 
059262,000189:                                                                                                  #           THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
059263,000190:                                                                                                  #  CONSECUTIVE ERASABLE LOCATIONS.  IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
059264,000191: 
059265,000192:                                                                                                  #           GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT.  THE CALLING SEQUENCE IS:
059266,000193:                                                                                                  #                                          I        CA    N-1              # OF QUANTITIES MINUS ONE.
059267,000194:                                                                                                  #                                          I +1     TC    GENTRAN          IN FIXED-FIXED.
059268,000195:                                                                                                  #                                          I +2     ADRES L                STARTING ADRES OF DATA TO BE MOVED.
059269,000196:                                                                                                  #                                          I +3     ADRES M                STARTING ADRES OF DUPLICATION BLOCK.
059270,000197:                                                                                                  #                                          I +4                            RETURNS HERE.
059271,000198: 
059272,000199:                                                                                                  #           GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
059273,000200:                                                                                                  #           A, L AND ITEMP1 ARE NOT PRESERVED.
059274,000201: 
059275,000202:    5544                                           BLOCK    02                                    
059276,000203:    4000                                           SETLOC   FFTAG4                                
059277,000204:    4000                                           BANK                                           
059278,000205: 
059279,000206:    5544     0061                                  EBANK=   ITEMP1                                
059280,000207: 
059281,000208:    5544                                           COUNT*   $$/TRAN                               
059282,000209: 
059283,000210:    5544           00004        GENTRAN            INHINT                                         
059284,000211:    5545           54061                           TS       ITEMP1                                #  SAVE N-1.
059285,000212:    5546           50002                           INDEX    Q                                     #  C(Q) = ADRES L.
059286,000213:    5547           60000                           AD       0                                     #  ADRES (L + N - 1).
059287,000214:    5550           50000                           INDEX    A                                     
059288,000215:    5551           30000                           CA       0                                     #  C(ABOVE).
059289,000216:    5552           54001                           TS       L                                     #  SAVE DATA.
059290,000217:    5553           30061                           CA       ITEMP1                                
059291,000218:    5554           50002                           INDEX    Q                                     
059292,000219:    5555           60001                           AD       1                                     #  ADRES (M + N - 1).
059293,000220:    5556           50000                           INDEX    A                                     
059294,000221:    5557           22000                           LXCH     0                                     #  STUFF IT.
059295,000222:    5560           10061                           CCS      ITEMP1                                #  LOOP UNTIL N-1 = 0.
059296,000223:    5561           15545                           TCF      GENTRAN    +1                         
059297,000224:    5562           16740                           TCF      Q+2                                   #  RETURN TO CALLER.
059298,000225: 

Page 1374

059300,000227:                                                                                                  #  B5OFF   ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
059301,000228:                                                                                                  #           MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
059302,000229: 
059303,000230:    5563                                           COUNT*   $$/EXTVB                              
059304,000231: 
059305,000232:    5563           44747        B5OFF              CS       BIT5                                  
059306,000233:    5564           71044                           MASK     EXTVBACT                              
059307,000234:    5565           55044                           TS       EXTVBACT                              
059308,000235:    5566           05155                           TC       ENDOFJOB                              
059309,000236: 
059310,000237: 
059311,000238: 

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