Source Code

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

The reconstruction began with source code of Zerlina 56, Luminary 210, and Luminary 131, previously transcribed from digitized copies of those programs. The code was created by combining the three, using Zerlina 56 as a base, since it was based off of Luminary 183. The differences between the three were carefully merged using the Luminary memos as a guide, with all changes made after Luminary 178 being backed out. 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 178 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.

058427,000002:                                                                                                  ## Copyright:   Public domain.
058428,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
058429,000004:                                                                                                  ## Purpose:     A section of Luminary revision 178.
058430,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
058431,000006:                                                                                                  ##              release of the flight software for the Lunar Module's
058432,000007:                                                                                                  ##              (LM) Apollo Guidance Computer (AGC) for Apollo 14. The
058433,000008:                                                                                                  ##              code has been recreated from copies of Zerlina 56, Luminary
058434,000009:                                                                                                  ##              210, and Luminary 131, as well as many Luminary memos.
058435,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
058436,000011:                                                                                                  ##              exactly match those specified for Luminary 178 in NASA
058437,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
058438,000013:                                                                                                  ##              that the reconstruction is correct.
058439,000014:                                                                                                  ## Reference:   pp. 1362-1368
058440,000015:                                                                                                  ## Assembler:   yaYUL
058441,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
058442,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
058443,000018:                                                                                                  ## Mod history: 2019-08-14 MAS  Created from Zerlina 56.
058444,000019: 

Page 1362

058446,000021: 10,3545                                           BANK     10                                    
058447,000022: 10,2000                                           SETLOC   DISPLAYS                              
058448,000023: 10,2000                                           BANK                                           
058449,000024: 10,3545                                           COUNT*   $$/DSPLA                              
058450,000025: 
058451,000026: 10,3545           00004        UPENT2             INHINT                                         
058452,000027: 10,3546           75661                           MASK     OCT77770                              
058453,000028: 10,3547           54001                           TS       L                                     
058454,000029: 10,3550           40100                           CS       FLAGWRD4                              
058455,000030: 10,3551           70001                           MASK     L                                     
058456,000031: 10,3552           26100                           ADS      FLAGWRD4                              
058457,000032: 10,3553           00003        JOIN               RELINT                                         
058458,000033: 10,3554           16742                           TCF      Q+1                                   
058459,000034: 
058460,000035: 10,3555           00004        DOWNENT2           INHINT                                         
058461,000036: 10,3556           75661                           MASK     OCT77770                              
058462,000037: 10,3557           40000                           COM                                            
058463,000038: 10,3560           70100                           MASK     FLAGWRD4                              
058464,000039: 10,3561           54100                           TS       FLAGWRD4                              
058465,000040: 10,3562           13553                           TCF      JOIN                                  
058466,000041: 
058467,000042: 10,3563     4757               OCT7               EQUALS   SEVEN                                 
058468,000043: 

Page 1363

058470,000045:                                                                                                  #      UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES.   USING THEM, WHETHER OR
058471,000046:                                                                                                  #  NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
058472,000047:                                                                                                  #  EBANK SETTING.   A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
058473,000048:                                                                                                  #  ASSEMBLER.
058474,000049: 
058475,000050:                                                                                                  #      AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS.   ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
058476,000051:                                                                                                  #  NAME ANY BIT IN ERASABLE MEMORY.
058477,000052: 
058478,000053:                                                                                                  #      CALLING SEQUENCES ARE AS FOLLOWS:-
058479,000054: 
058480,000055:                                                                                                  #                      TC     UPFLAG                    TC     DOWNFLAG
058481,000056:                                                                                                  #                      ADRES  NAME OF FLAG              ADRES  NAME OF FLAG
058482,000057: 
058483,000058:                                                                                                  #      RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
058484,000059: 
058485,000060:                                                                                                  #      UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
058486,000061: 
058487,000062:    5515                                           BLOCK    02                                    
058488,000063:    4000                                           SETLOC   FFTAG1                                
058489,000064:    4000                                           BANK                                           
058490,000065:    5515                                           COUNT*   $$/FLAG                               
058491,000066: 
058492,000067:    5515           30002        UPFLAG             CA       Q                                     
058493,000068:    5516           05533                           TC       DEBIT                                 
058494,000069:    5517           40000                           COM                                            #  +(15 - BIT)
058495,000070:    5520           00006                           EXTEND                                         
058496,000071:    5521           04001                           ROR      LCHAN                                 #  SET BIT
058497,000072:    5522           50061        COMFLAG            INDEX    ITEMP1                                
058498,000073:    5523           54074                           TS       FLAGWRD0                              
058499,000074:    5524           22063                           LXCH     ITEMP3                                
058500,000075:    5525           00003                           RELINT                                         
058501,000076:    5526           00001                           TC       L                                     
058502,000077: 
058503,000078: 
058504,000079:    5527           30002        DOWNFLAG           CA       Q                                     
058505,000080:    5530           05533                           TC       DEBIT                                 
058506,000081:    5531           70001                           MASK     L                                     #  RESET BIT
058507,000082:    5532           15522                           TCF      COMFLAG                               
058508,000083: 
058509,000084: 
058510,000085:    5533           64753        DEBIT              AD       ONE                                   #  GET DE BITS
058511,000086:    5534           00004                           INHINT                                         
058512,000087:    5535           54063                           TS       ITEMP3                                
058513,000088:    5536           34762                           CA       LOW4                                  #  DEC15
058514,000089:    5537           54061                           TS       ITEMP1                                
058515,000090:    5540           50063                           INDEX    ITEMP3                                
058516,000091:    5541           27777                           CA       0          -1                         #  ADRES
058517,000092:    5542           54001                           TS       L                                     
058518,000093:    5543           34755                           CA       ZERO                                  

Page 1364

058520,000095:    5544           00006                           EXTEND                                         
058521,000096:    5545           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
058522,000097:    5546           52062                           DXCH     ITEMP1                                
058523,000098:    5547           50061                           INDEX    ITEMP1                                
058524,000099:    5550           30074                           CA       FLAGWRD0                              
058525,000100:    5551           54001                           TS       L                                     #  CURRENT STATE
058526,000101:    5552           50062                           INDEX    ITEMP2                                
058527,000102:    5553           44735                           CS       BIT15                                 #  -(15 - BIT)
058528,000103:    5554           00002                           TC       Q                                     
058529,000104: 

Page 1365

058531,000106:                                                                                                  #  DELAYJOB- A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
058532,000107: 
058533,000108:                                                                                                  #  ENTRANCE REQUIREMENTS...
058534,000109:                                                                                                  #                                                   CAF    DT              DELAY JOB FOR DT CENTISECS
058535,000110:                                                                                                  #                                                   TC     BANKCALL
058536,000111:                                                                                                  #                                                   CADR   DELAYJOB
058537,000112: 
058538,000113: 06,3772                                           BANK     06                                    
058539,000114: 00,2000                                           SETLOC   DLAYJOB                               
058540,000115: 00,2000                                           BANK                                           
058541,000116: 
058542,000117:                                                                                                  #  THIS MUST REMAIN IN BANK 0 *****************************************
058543,000118: 00,3735                                           COUNT*   $$/DELAY                              
058544,000119: 00,3735           35000        2SECDELY           CAF      2SECS                                 
058545,000120: 00,3736           00004        DELAYJOB           INHINT                                         
058546,000121: 00,3737           54002                           TS       Q                                     #  STORE DELAY DT IN Q FOR DLY -1 IN
058547,000122: 
058548,000123: 00,3740           34752                           CAF      DELAYNUM                              #  WAITLIST
058549,000124: 00,3741           54070        DELLOOP            TS       RUPTREG1                              
058550,000125: 00,3742           50000                           INDEX    A                                     
058551,000126: 00,3743           31323                           CA       DELAYLOC                              #  IS THIS DELAYLOC AVAILABLE
058552,000127: 00,3744           00006                           EXTEND                                         
058553,000128: 00,3745           13753                           BZF      OK2DELAY                              #  YES
058554,000129: 
058555,000130: 00,3746           10070                           CCS      RUPTREG1                              #  NO, TRY NEXT DELAYLOC
058556,000131: 00,3747           13741                           TCF      DELLOOP                               
058557,000132: 
058558,000133: 00,3750           52134                           DXCH     BUF2                                  
058559,000134: 00,3751           05717                           TC       BAILOUT1                              #  NO AVAILABLE LOCS.
058560,000135: 00,3752           31104                           OCT      31104                                 
058561,000136: 
058562,000137: 00,3753           33773        OK2DELAY           CA       TCSLEEP                               #  SET WAITLIST IMMEDIATE RETURN
058563,000138: 00,3754           54061                           TS       WAITEXIT                              
058564,000139: 
058565,000140: 00,3755           30004                           CA       FBANK                                 
058566,000141: 00,3756           60070                           AD       RUPTREG1                              #  STORE BBANK FOR TASK CALL
058567,000142: 00,3757           54001                           TS       L                                     
058568,000143: 
058569,000144: 00,3760           33774                           CAF      WAKECAD                               #  STORE CADR FOR TASK CALL
058570,000145: 00,3761           15222                           TCF      DLY2       -1                         #  DLY IS IN WAITLIST ROUTINE
058571,000146: 
058572,000147: 00,3762           04645        TCGETCAD           TC       MAKECADR                              #  GET CALLERS FCADR
058573,000148: 
058574,000149: 00,3763           50070                           INDEX    RUPTREG1                              
058575,000150: 00,3764           55323                           TS       DELAYLOC                              #  SAVE DELAY CADRS
058576,000151: 
058577,000152: 00,3765           05133                           TC       JOBSLEEP                              
058578,000153: 
058579,000154: 00,3766           34755        WAKER              CAF      ZERO                                  
058580,000155: 00,3767           50006                           INDEX    BBANK                                 
058581,000156: 

Page 1366

058583,000158: 00,3770           57323                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE
058584,000159: 00,3771           05137                           TC       JOBWAKE                               
058585,000160: 
058586,000161: 00,3772           05272                           TC       TASKOVER                              
058587,000162: 
058588,000163: 00,3773           03760        TCSLEEP            GENADR   TCGETCAD   -2                         
058589,000164: 00,3774           03766        WAKECAD            GENADR   WAKER                                 
058590,000165: 

Page 1367

058592,000167:                                                                                                  #  GENTRAN, A BLOCK TRANSFER ROUTINE.
058593,000168: 
058594,000169:                                                                                                  #  WRITTEN BY D. EYLES
058595,000170:                                                                                                  #  MOD 1 BY KERNAN                                                         UTILITYM REV 17 11/18/67
058596,000171: 
058597,000172:                                                                                                  #  MOD 2 BY SCHULENBERG  (REMOVE RELINT)   SKIPPER REV 4 2/28/68
058598,000173: 
058599,000174:                                                                                                  #           THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
058600,000175:                                                                                                  #  CONSECUTIVE ERASABLE LOCATIONS.  IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
058601,000176: 
058602,000177:                                                                                                  #           GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT.  THE CALLING SEQUENCE IS:
058603,000178: 
058604,000179:                                                                                                  #                                          I        CA     N-1             # OF QUANTITIES MINUS ONE.
058605,000180:                                                                                                  #                                          I +1     TC     GENTRAN         IN FIXED-FIXED.
058606,000181:                                                                                                  #                                          I +2     ADRES  L               STARTING ADRES OF DATA TO BE MOVED.
058607,000182:                                                                                                  #                                          I +3     ADRES  M               STARTING ADRES OF DUPLICATION BLOCK.
058608,000183:                                                                                                  #                                          I +4                            RETURNS HERE.
058609,000184: 
058610,000185:                                                                                                  #           GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
058611,000186: 
058612,000187:                                                                                                  #           A, L AND ITEMP1 ARE NOT PRESERVED.
058613,000188: 
058614,000189:    5555                                           BLOCK    02                                    
058615,000190:    4000                                           SETLOC   FFTAG4                                
058616,000191:    4000                                           BANK                                           
058617,000192: 
058618,000193:    5555     0061                                  EBANK=   ITEMP1                                
058619,000194: 
058620,000195:    5555                                           COUNT*   $$/TRAN                               
058621,000196: 
058622,000197:    5555           00004        GENTRAN            INHINT                                         
058623,000198:    5556           54061                           TS       ITEMP1                                #  SAVE N-1.
058624,000199:    5557           50002                           INDEX    Q                                     #  C(Q) = ADRES L.
058625,000200:    5560           60000                           AD       0                                     #  ADRES (L + N - 1).
058626,000201:    5561           50000                           INDEX    A                                     
058627,000202:    5562           30000                           CA       0                                     #  C(ABOVE).
058628,000203:    5563           54001                           TS       L                                     #  SAVE DATA.
058629,000204:    5564           30061                           CA       ITEMP1                                
058630,000205:    5565           50002                           INDEX    Q                                     
058631,000206:    5566           60001                           AD       1                                     #  ADRES (M + N - 1).
058632,000207:    5567           50000                           INDEX    A                                     
058633,000208:    5570           22000                           LXCH     0                                     #  STUFF IT.
058634,000209:    5571           10061                           CCS      ITEMP1                                #  LOOP UNTIL N-1 = 0.
058635,000210:    5572           15556                           TCF      GENTRAN    +1                         
058636,000211:    5573           16744                           TCF      Q+2                                   #  RETURN TO CALLER.
058637,000212: 

Page 1368

058639,000214:                                                                                                  #  B5OFF   ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
058640,000215: 
058641,000216:                                                                                                  #           MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
058642,000217: 
058643,000218:    5574                                           COUNT*   $$/EXTVB                              
058644,000219: 
058645,000220:    5574           44747        B5OFF              CS       BIT5                                  
058646,000221:    5575           71043                           MASK     EXTVBACT                              
058647,000222:    5576           55043                           TS       EXTVBACT                              
058648,000223:    5577           05155                           TC       ENDOFJOB                              

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