Source Code

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

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

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

058327,000002:                                                                                                  ## Copyright:   Public domain.
058328,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
058329,000004:                                                                                                  ## Purpose:     A section of Luminary revision 173.
058330,000005:                                                                                                  ##              It is part of the reconstructed source code for the second
058331,000006:                                                                                                  ##              (unflown) release of the flight software for the Lunar
058332,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 14.
058333,000008:                                                                                                  ##              The code has been recreated from a reconstructed copy of
058334,000009:                                                                                                  ##              Luminary 178, as well as Luminary memo 167 (revision 1).
058335,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
058336,000011:                                                                                                  ##              exactly match those specified for Luminary 173 in NASA
058337,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
058338,000013:                                                                                                  ##              that the reconstruction is correct.
058339,000014:                                                                                                  ## Reference:   pp. 1362-1368
058340,000015:                                                                                                  ## Assembler:   yaYUL
058341,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
058342,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
058343,000018:                                                                                                  ## Mod history: 2019-09-18 MAS  Created from Luminary 178.
058344,000019: 

Page 1362

058346,000021: 10,3545                                           BANK     10                                    
058347,000022: 10,2000                                           SETLOC   DISPLAYS                              
058348,000023: 10,2000                                           BANK                                           
058349,000024: 10,3545                                           COUNT*   $$/DSPLA                              
058350,000025: 
058351,000026: 10,3545           00004        UPENT2             INHINT                                         
058352,000027: 10,3546           75661                           MASK     OCT77770                              
058353,000028: 10,3547           54001                           TS       L                                     
058354,000029: 10,3550           40100                           CS       FLAGWRD4                              
058355,000030: 10,3551           70001                           MASK     L                                     
058356,000031: 10,3552           26100                           ADS      FLAGWRD4                              
058357,000032: 10,3553           00003        JOIN               RELINT                                         
058358,000033: 10,3554           16742                           TCF      Q+1                                   
058359,000034: 
058360,000035: 10,3555           00004        DOWNENT2           INHINT                                         
058361,000036: 10,3556           75661                           MASK     OCT77770                              
058362,000037: 10,3557           40000                           COM                                            
058363,000038: 10,3560           70100                           MASK     FLAGWRD4                              
058364,000039: 10,3561           54100                           TS       FLAGWRD4                              
058365,000040: 10,3562           13553                           TCF      JOIN                                  
058366,000041: 
058367,000042: 10,3563     4757               OCT7               EQUALS   SEVEN                                 
058368,000043: 

Page 1363

058370,000045:                                                                                                  #      UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES.   USING THEM, WHETHER OR
058371,000046:                                                                                                  #  NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
058372,000047:                                                                                                  #  EBANK SETTING.   A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
058373,000048:                                                                                                  #  ASSEMBLER.
058374,000049: 
058375,000050:                                                                                                  #      AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS.   ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
058376,000051:                                                                                                  #  NAME ANY BIT IN ERASABLE MEMORY.
058377,000052: 
058378,000053:                                                                                                  #      CALLING SEQUENCES ARE AS FOLLOWS:-
058379,000054: 
058380,000055:                                                                                                  #                      TC     UPFLAG                    TC     DOWNFLAG
058381,000056:                                                                                                  #                      ADRES  NAME OF FLAG              ADRES  NAME OF FLAG
058382,000057: 
058383,000058:                                                                                                  #      RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
058384,000059: 
058385,000060:                                                                                                  #      UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
058386,000061: 
058387,000062:    5515                                           BLOCK    02                                    
058388,000063:    4000                                           SETLOC   FFTAG1                                
058389,000064:    4000                                           BANK                                           
058390,000065:    5515                                           COUNT*   $$/FLAG                               
058391,000066: 
058392,000067:    5515           30002        UPFLAG             CA       Q                                     
058393,000068:    5516           05533                           TC       DEBIT                                 
058394,000069:    5517           40000                           COM                                            #  +(15 - BIT)
058395,000070:    5520           00006                           EXTEND                                         
058396,000071:    5521           04001                           ROR      LCHAN                                 #  SET BIT
058397,000072:    5522           50061        COMFLAG            INDEX    ITEMP1                                
058398,000073:    5523           54074                           TS       FLAGWRD0                              
058399,000074:    5524           22063                           LXCH     ITEMP3                                
058400,000075:    5525           00003                           RELINT                                         
058401,000076:    5526           00001                           TC       L                                     
058402,000077: 
058403,000078: 
058404,000079:    5527           30002        DOWNFLAG           CA       Q                                     
058405,000080:    5530           05533                           TC       DEBIT                                 
058406,000081:    5531           70001                           MASK     L                                     #  RESET BIT
058407,000082:    5532           15522                           TCF      COMFLAG                               
058408,000083: 
058409,000084: 
058410,000085:    5533           64753        DEBIT              AD       ONE                                   #  GET DE BITS
058411,000086:    5534           00004                           INHINT                                         
058412,000087:    5535           54063                           TS       ITEMP3                                
058413,000088:    5536           34762                           CA       LOW4                                  #  DEC15
058414,000089:    5537           54061                           TS       ITEMP1                                
058415,000090:    5540           50063                           INDEX    ITEMP3                                
058416,000091:    5541           27777                           CA       0          -1                         #  ADRES
058417,000092:    5542           54001                           TS       L                                     
058418,000093:    5543           34755                           CA       ZERO                                  

Page 1364

058420,000095:    5544           00006                           EXTEND                                         
058421,000096:    5545           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
058422,000097:    5546           52062                           DXCH     ITEMP1                                
058423,000098:    5547           50061                           INDEX    ITEMP1                                
058424,000099:    5550           30074                           CA       FLAGWRD0                              
058425,000100:    5551           54001                           TS       L                                     #  CURRENT STATE
058426,000101:    5552           50062                           INDEX    ITEMP2                                
058427,000102:    5553           44735                           CS       BIT15                                 #  -(15 - BIT)
058428,000103:    5554           00002                           TC       Q                                     
058429,000104: 

Page 1365

058431,000106:                                                                                                  #  DELAYJOB- A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
058432,000107: 
058433,000108:                                                                                                  #  ENTRANCE REQUIREMENTS...
058434,000109:                                                                                                  #                                                   CAF    DT              DELAY JOB FOR DT CENTISECS
058435,000110:                                                                                                  #                                                   TC     BANKCALL
058436,000111:                                                                                                  #                                                   CADR   DELAYJOB
058437,000112: 
058438,000113: 06,3772                                           BANK     06                                    
058439,000114: 00,2000                                           SETLOC   DLAYJOB                               
058440,000115: 00,2000                                           BANK                                           
058441,000116: 
058442,000117:                                                                                                  #  THIS MUST REMAIN IN BANK 0 *****************************************
058443,000118: 00,3735                                           COUNT*   $$/DELAY                              
058444,000119: 00,3735           35000        2SECDELY           CAF      2SECS                                 
058445,000120: 00,3736           00004        DELAYJOB           INHINT                                         
058446,000121: 00,3737           54002                           TS       Q                                     #  STORE DELAY DT IN Q FOR DLY -1 IN
058447,000122: 
058448,000123: 00,3740           34752                           CAF      DELAYNUM                              #  WAITLIST
058449,000124: 00,3741           54070        DELLOOP            TS       RUPTREG1                              
058450,000125: 00,3742           50000                           INDEX    A                                     
058451,000126: 00,3743           31323                           CA       DELAYLOC                              #  IS THIS DELAYLOC AVAILABLE
058452,000127: 00,3744           00006                           EXTEND                                         
058453,000128: 00,3745           13753                           BZF      OK2DELAY                              #  YES
058454,000129: 
058455,000130: 00,3746           10070                           CCS      RUPTREG1                              #  NO, TRY NEXT DELAYLOC
058456,000131: 00,3747           13741                           TCF      DELLOOP                               
058457,000132: 
058458,000133: 00,3750           52134                           DXCH     BUF2                                  
058459,000134: 00,3751           05717                           TC       BAILOUT1                              #  NO AVAILABLE LOCS.
058460,000135: 00,3752           31104                           OCT      31104                                 
058461,000136: 
058462,000137: 00,3753           33773        OK2DELAY           CA       TCSLEEP                               #  SET WAITLIST IMMEDIATE RETURN
058463,000138: 00,3754           54061                           TS       WAITEXIT                              
058464,000139: 
058465,000140: 00,3755           30004                           CA       FBANK                                 
058466,000141: 00,3756           60070                           AD       RUPTREG1                              #  STORE BBANK FOR TASK CALL
058467,000142: 00,3757           54001                           TS       L                                     
058468,000143: 
058469,000144: 00,3760           33774                           CAF      WAKECAD                               #  STORE CADR FOR TASK CALL
058470,000145: 00,3761           15222                           TCF      DLY2       -1                         #  DLY IS IN WAITLIST ROUTINE
058471,000146: 
058472,000147: 00,3762           04645        TCGETCAD           TC       MAKECADR                              #  GET CALLERS FCADR
058473,000148: 
058474,000149: 00,3763           50070                           INDEX    RUPTREG1                              
058475,000150: 00,3764           55323                           TS       DELAYLOC                              #  SAVE DELAY CADRS
058476,000151: 
058477,000152: 00,3765           05133                           TC       JOBSLEEP                              
058478,000153: 
058479,000154: 00,3766           34755        WAKER              CAF      ZERO                                  
058480,000155: 00,3767           50006                           INDEX    BBANK                                 
058481,000156: 

Page 1366

058483,000158: 00,3770           57323                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE
058484,000159: 00,3771           05137                           TC       JOBWAKE                               
058485,000160: 
058486,000161: 00,3772           05272                           TC       TASKOVER                              
058487,000162: 
058488,000163: 00,3773           03760        TCSLEEP            GENADR   TCGETCAD   -2                         
058489,000164: 00,3774           03766        WAKECAD            GENADR   WAKER                                 
058490,000165: 

Page 1367

058492,000167:                                                                                                  #  GENTRAN, A BLOCK TRANSFER ROUTINE.
058493,000168: 
058494,000169:                                                                                                  #  WRITTEN BY D. EYLES
058495,000170:                                                                                                  #  MOD 1 BY KERNAN                                                         UTILITYM REV 17 11/18/67
058496,000171: 
058497,000172:                                                                                                  #  MOD 2 BY SCHULENBERG  (REMOVE RELINT)   SKIPPER REV 4 2/28/68
058498,000173: 
058499,000174:                                                                                                  #           THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
058500,000175:                                                                                                  #  CONSECUTIVE ERASABLE LOCATIONS.  IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
058501,000176: 
058502,000177:                                                                                                  #           GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT.  THE CALLING SEQUENCE IS:
058503,000178: 
058504,000179:                                                                                                  #                                          I        CA     N-1             # OF QUANTITIES MINUS ONE.
058505,000180:                                                                                                  #                                          I +1     TC     GENTRAN         IN FIXED-FIXED.
058506,000181:                                                                                                  #                                          I +2     ADRES  L               STARTING ADRES OF DATA TO BE MOVED.
058507,000182:                                                                                                  #                                          I +3     ADRES  M               STARTING ADRES OF DUPLICATION BLOCK.
058508,000183:                                                                                                  #                                          I +4                            RETURNS HERE.
058509,000184: 
058510,000185:                                                                                                  #           GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
058511,000186: 
058512,000187:                                                                                                  #           A, L AND ITEMP1 ARE NOT PRESERVED.
058513,000188: 
058514,000189:    5555                                           BLOCK    02                                    
058515,000190:    4000                                           SETLOC   FFTAG4                                
058516,000191:    4000                                           BANK                                           
058517,000192: 
058518,000193:    5555     0061                                  EBANK=   ITEMP1                                
058519,000194: 
058520,000195:    5555                                           COUNT*   $$/TRAN                               
058521,000196: 
058522,000197:    5555           00004        GENTRAN            INHINT                                         
058523,000198:    5556           54061                           TS       ITEMP1                                #  SAVE N-1.
058524,000199:    5557           50002                           INDEX    Q                                     #  C(Q) = ADRES L.
058525,000200:    5560           60000                           AD       0                                     #  ADRES (L + N - 1).
058526,000201:    5561           50000                           INDEX    A                                     
058527,000202:    5562           30000                           CA       0                                     #  C(ABOVE).
058528,000203:    5563           54001                           TS       L                                     #  SAVE DATA.
058529,000204:    5564           30061                           CA       ITEMP1                                
058530,000205:    5565           50002                           INDEX    Q                                     
058531,000206:    5566           60001                           AD       1                                     #  ADRES (M + N - 1).
058532,000207:    5567           50000                           INDEX    A                                     
058533,000208:    5570           22000                           LXCH     0                                     #  STUFF IT.
058534,000209:    5571           10061                           CCS      ITEMP1                                #  LOOP UNTIL N-1 = 0.
058535,000210:    5572           15556                           TCF      GENTRAN    +1                         
058536,000211:    5573           16744                           TCF      Q+2                                   #  RETURN TO CALLER.
058537,000212: 

Page 1368

058539,000214:                                                                                                  #  B5OFF   ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
058540,000215: 
058541,000216:                                                                                                  #           MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
058542,000217: 
058543,000218:    5574                                           COUNT*   $$/EXTVB                              
058544,000219: 
058545,000220:    5574           44747        B5OFF              CS       BIT5                                  
058546,000221:    5575           71043                           MASK     EXTVBACT                              
058547,000222:    5576           55043                           TS       EXTVBACT                              
058548,000223:    5577           05155                           TC       ENDOFJOB                              

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