Source Code

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

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

Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

058259,000002:                                                                                                  ## Copyright:   Public domain.
058260,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
058261,000004:                                                                                                  ## Purpose:     A section of Luminary revision 163.
058262,000005:                                                                                                  ##              It is part of the reconstructed source code for the first
058263,000006:                                                                                                  ##              (unflown) release of the flight software for the Lunar
058264,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 14.
058265,000008:                                                                                                  ##              The code has been recreated from a reconstructed copy of
058266,000009:                                                                                                  ##              Luminary 173, as well as Luminary memos 157 amd 158.
058267,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
058268,000011:                                                                                                  ##              exactly match those specified for Luminary 163 in NASA
058269,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
058270,000013:                                                                                                  ##              that the reconstruction is correct.
058271,000014:                                                                                                  ## Reference:   pp. 1362-1368
058272,000015:                                                                                                  ## Assembler:   yaYUL
058273,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
058274,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
058275,000018:                                                                                                  ## Mod history: 2019-08-21 MAS  Created from Luminary 173.
058276,000019: 

Page 1362

058278,000021: 10,3545                                           BANK     10                                    
058279,000022: 10,2000                                           SETLOC   DISPLAYS                              
058280,000023: 10,2000                                           BANK                                           
058281,000024: 10,3545                                           COUNT*   $$/DSPLA                              
058282,000025: 
058283,000026: 10,3545           00004        UPENT2             INHINT                                         
058284,000027: 10,3546           75661                           MASK     OCT77770                              
058285,000028: 10,3547           54001                           TS       L                                     
058286,000029: 10,3550           40100                           CS       FLAGWRD4                              
058287,000030: 10,3551           70001                           MASK     L                                     
058288,000031: 10,3552           26100                           ADS      FLAGWRD4                              
058289,000032: 10,3553           00003        JOIN               RELINT                                         
058290,000033: 10,3554           16742                           TCF      Q+1                                   
058291,000034: 
058292,000035: 10,3555           00004        DOWNENT2           INHINT                                         
058293,000036: 10,3556           75661                           MASK     OCT77770                              
058294,000037: 10,3557           40000                           COM                                            
058295,000038: 10,3560           70100                           MASK     FLAGWRD4                              
058296,000039: 10,3561           54100                           TS       FLAGWRD4                              
058297,000040: 10,3562           13553                           TCF      JOIN                                  
058298,000041: 
058299,000042: 10,3563     4757               OCT7               EQUALS   SEVEN                                 
058300,000043: 

Page 1363

058302,000045:                                                                                                  #      UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES.   USING THEM, WHETHER OR
058303,000046:                                                                                                  #  NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
058304,000047:                                                                                                  #  EBANK SETTING.   A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
058305,000048:                                                                                                  #  ASSEMBLER.
058306,000049: 
058307,000050:                                                                                                  #      AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS.   ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
058308,000051:                                                                                                  #  NAME ANY BIT IN ERASABLE MEMORY.
058309,000052: 
058310,000053:                                                                                                  #      CALLING SEQUENCES ARE AS FOLLOWS:-
058311,000054: 
058312,000055:                                                                                                  #                      TC     UPFLAG                    TC     DOWNFLAG
058313,000056:                                                                                                  #                      ADRES  NAME OF FLAG              ADRES  NAME OF FLAG
058314,000057: 
058315,000058:                                                                                                  #      RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
058316,000059: 
058317,000060:                                                                                                  #      UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
058318,000061: 
058319,000062:    5515                                           BLOCK    02                                    
058320,000063:    4000                                           SETLOC   FFTAG1                                
058321,000064:    4000                                           BANK                                           
058322,000065:    5515                                           COUNT*   $$/FLAG                               
058323,000066: 
058324,000067:    5515           30002        UPFLAG             CA       Q                                     
058325,000068:    5516           05533                           TC       DEBIT                                 
058326,000069:    5517           40000                           COM                                            #  +(15 - BIT)
058327,000070:    5520           00006                           EXTEND                                         
058328,000071:    5521           04001                           ROR      LCHAN                                 #  SET BIT
058329,000072:    5522           50061        COMFLAG            INDEX    ITEMP1                                
058330,000073:    5523           54074                           TS       FLAGWRD0                              
058331,000074:    5524           22063                           LXCH     ITEMP3                                
058332,000075:    5525           00003                           RELINT                                         
058333,000076:    5526           00001                           TC       L                                     
058334,000077: 
058335,000078: 
058336,000079:    5527           30002        DOWNFLAG           CA       Q                                     
058337,000080:    5530           05533                           TC       DEBIT                                 
058338,000081:    5531           70001                           MASK     L                                     #  RESET BIT
058339,000082:    5532           15522                           TCF      COMFLAG                               
058340,000083: 
058341,000084: 
058342,000085:    5533           64753        DEBIT              AD       ONE                                   #  GET DE BITS
058343,000086:    5534           00004                           INHINT                                         
058344,000087:    5535           54063                           TS       ITEMP3                                
058345,000088:    5536           34762                           CA       LOW4                                  #  DEC15
058346,000089:    5537           54061                           TS       ITEMP1                                
058347,000090:    5540           50063                           INDEX    ITEMP3                                
058348,000091:    5541           27777                           CA       0          -1                         #  ADRES
058349,000092:    5542           54001                           TS       L                                     
058350,000093:    5543           34755                           CA       ZERO                                  

Page 1364

058352,000095:    5544           00006                           EXTEND                                         
058353,000096:    5545           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
058354,000097:    5546           52062                           DXCH     ITEMP1                                
058355,000098:    5547           50061                           INDEX    ITEMP1                                
058356,000099:    5550           30074                           CA       FLAGWRD0                              
058357,000100:    5551           54001                           TS       L                                     #  CURRENT STATE
058358,000101:    5552           50062                           INDEX    ITEMP2                                
058359,000102:    5553           44735                           CS       BIT15                                 #  -(15 - BIT)
058360,000103:    5554           00002                           TC       Q                                     
058361,000104: 

Page 1365

058363,000106:                                                                                                  #  DELAYJOB- A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
058364,000107: 
058365,000108:                                                                                                  #  ENTRANCE REQUIREMENTS...
058366,000109:                                                                                                  #                                                   CAF    DT              DELAY JOB FOR DT CENTISECS
058367,000110:                                                                                                  #                                                   TC     BANKCALL
058368,000111:                                                                                                  #                                                   CADR   DELAYJOB
058369,000112: 
058370,000113: 06,3772                                           BANK     06                                    
058371,000114: 00,2000                                           SETLOC   DLAYJOB                               
058372,000115: 00,2000                                           BANK                                           
058373,000116: 
058374,000117:                                                                                                  #  THIS MUST REMAIN IN BANK 0 *****************************************
058375,000118: 00,3735                                           COUNT*   $$/DELAY                              
058376,000119: 00,3735           35000        2SECDELY           CAF      2SECS                                 
058377,000120: 00,3736           00004        DELAYJOB           INHINT                                         
058378,000121: 00,3737           54002                           TS       Q                                     #  STORE DELAY DT IN Q FOR DLY -1 IN
058379,000122: 
058380,000123: 00,3740           34752                           CAF      DELAYNUM                              #  WAITLIST
058381,000124: 00,3741           54070        DELLOOP            TS       RUPTREG1                              
058382,000125: 00,3742           50000                           INDEX    A                                     
058383,000126: 00,3743           31323                           CA       DELAYLOC                              #  IS THIS DELAYLOC AVAILABLE
058384,000127: 00,3744           00006                           EXTEND                                         
058385,000128: 00,3745           13753                           BZF      OK2DELAY                              #  YES
058386,000129: 
058387,000130: 00,3746           10070                           CCS      RUPTREG1                              #  NO, TRY NEXT DELAYLOC
058388,000131: 00,3747           13741                           TCF      DELLOOP                               
058389,000132: 
058390,000133: 00,3750           52134                           DXCH     BUF2                                  
058391,000134: 00,3751           05717                           TC       BAILOUT1                              #  NO AVAILABLE LOCS.
058392,000135: 00,3752           31104                           OCT      31104                                 
058393,000136: 
058394,000137: 00,3753           33773        OK2DELAY           CA       TCSLEEP                               #  SET WAITLIST IMMEDIATE RETURN
058395,000138: 00,3754           54061                           TS       WAITEXIT                              
058396,000139: 
058397,000140: 00,3755           30004                           CA       FBANK                                 
058398,000141: 00,3756           60070                           AD       RUPTREG1                              #  STORE BBANK FOR TASK CALL
058399,000142: 00,3757           54001                           TS       L                                     
058400,000143: 
058401,000144: 00,3760           33774                           CAF      WAKECAD                               #  STORE CADR FOR TASK CALL
058402,000145: 00,3761           15222                           TCF      DLY2       -1                         #  DLY IS IN WAITLIST ROUTINE
058403,000146: 
058404,000147: 00,3762           04645        TCGETCAD           TC       MAKECADR                              #  GET CALLERS FCADR
058405,000148: 
058406,000149: 00,3763           50070                           INDEX    RUPTREG1                              
058407,000150: 00,3764           55323                           TS       DELAYLOC                              #  SAVE DELAY CADRS
058408,000151: 
058409,000152: 00,3765           05133                           TC       JOBSLEEP                              
058410,000153: 
058411,000154: 00,3766           34755        WAKER              CAF      ZERO                                  
058412,000155: 00,3767           50006                           INDEX    BBANK                                 
058413,000156: 

Page 1366

058415,000158: 00,3770           57323                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE
058416,000159: 00,3771           05137                           TC       JOBWAKE                               
058417,000160: 
058418,000161: 00,3772           05272                           TC       TASKOVER                              
058419,000162: 
058420,000163: 00,3773           03760        TCSLEEP            GENADR   TCGETCAD   -2                         
058421,000164: 00,3774           03766        WAKECAD            GENADR   WAKER                                 
058422,000165: 

Page 1367

058424,000167:                                                                                                  #  GENTRAN, A BLOCK TRANSFER ROUTINE.
058425,000168: 
058426,000169:                                                                                                  #  WRITTEN BY D. EYLES
058427,000170:                                                                                                  #  MOD 1 BY KERNAN                                                         UTILITYM REV 17 11/18/67
058428,000171: 
058429,000172:                                                                                                  #  MOD 2 BY SCHULENBERG  (REMOVE RELINT)   SKIPPER REV 4 2/28/68
058430,000173: 
058431,000174:                                                                                                  #           THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
058432,000175:                                                                                                  #  CONSECUTIVE ERASABLE LOCATIONS.  IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
058433,000176: 
058434,000177:                                                                                                  #           GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT.  THE CALLING SEQUENCE IS:
058435,000178: 
058436,000179:                                                                                                  #                                          I        CA     N-1             # OF QUANTITIES MINUS ONE.
058437,000180:                                                                                                  #                                          I +1     TC     GENTRAN         IN FIXED-FIXED.
058438,000181:                                                                                                  #                                          I +2     ADRES  L               STARTING ADRES OF DATA TO BE MOVED.
058439,000182:                                                                                                  #                                          I +3     ADRES  M               STARTING ADRES OF DUPLICATION BLOCK.
058440,000183:                                                                                                  #                                          I +4                            RETURNS HERE.
058441,000184: 
058442,000185:                                                                                                  #           GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
058443,000186: 
058444,000187:                                                                                                  #           A, L AND ITEMP1 ARE NOT PRESERVED.
058445,000188: 
058446,000189:    5555                                           BLOCK    02                                    
058447,000190:    4000                                           SETLOC   FFTAG4                                
058448,000191:    4000                                           BANK                                           
058449,000192: 
058450,000193:    5555     0061                                  EBANK=   ITEMP1                                
058451,000194: 
058452,000195:    5555                                           COUNT*   $$/TRAN                               
058453,000196: 
058454,000197:    5555           00004        GENTRAN            INHINT                                         
058455,000198:    5556           54061                           TS       ITEMP1                                #  SAVE N-1.
058456,000199:    5557           50002                           INDEX    Q                                     #  C(Q) = ADRES L.
058457,000200:    5560           60000                           AD       0                                     #  ADRES (L + N - 1).
058458,000201:    5561           50000                           INDEX    A                                     
058459,000202:    5562           30000                           CA       0                                     #  C(ABOVE).
058460,000203:    5563           54001                           TS       L                                     #  SAVE DATA.
058461,000204:    5564           30061                           CA       ITEMP1                                
058462,000205:    5565           50002                           INDEX    Q                                     
058463,000206:    5566           60001                           AD       1                                     #  ADRES (M + N - 1).
058464,000207:    5567           50000                           INDEX    A                                     
058465,000208:    5570           22000                           LXCH     0                                     #  STUFF IT.
058466,000209:    5571           10061                           CCS      ITEMP1                                #  LOOP UNTIL N-1 = 0.
058467,000210:    5572           15556                           TCF      GENTRAN    +1                         
058468,000211:    5573           16744                           TCF      Q+2                                   #  RETURN TO CALLER.
058469,000212: 

Page 1368

058471,000214:                                                                                                  #  B5OFF   ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
058472,000215: 
058473,000216:                                                                                                  #           MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
058474,000217: 
058475,000218:    5574                                           COUNT*   $$/EXTVB                              
058476,000219: 
058477,000220:    5574           44747        B5OFF              CS       BIT5                                  
058478,000221:    5575           71043                           MASK     EXTVBACT                              
058479,000222:    5576           55043                           TS       EXTVBACT                              
058480,000223:    5577           05155                           TC       ENDOFJOB                              

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