Source Code

These source-code files are part of a reconstructed copy of Luminary 97, the second release of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer (AGC) software. It was created to fix two incorrect ephemeris constants in Luminary 96, as described by anomaly report LNY-59.

The reconstruction began with source code of Luminary 99 revision 1 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes described in original Luminary memos 83 and 85, using asterisks indicating changed lines in the listing as a guide. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152D. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 97 listing.

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.

057974,000002:                                                                                                  ## Copyright:   Public domain.
057975,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
057976,000004:                                                                                                  ## Purpose:     A section of Luminary revision 97.
057977,000005:                                                                                                  ##              It is part of the reconstructed source code for the
057978,000006:                                                                                                  ##              second release of the flight software for the Lunar 
057979,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
057980,000008:                                                                                                  ##              It was created to fix two incorrect ephemeris constants in
057981,000009:                                                                                                  ##              Luminary 96, as described by anomaly report LNY-59.
057982,000010:                                                                                                  ##              The code has been recreated from a copy of Luminary 99
057983,000011:                                                                                                  ##              revision 001, using asterisks indicating changed lines in
057984,000012:                                                                                                  ##              the listing and Luminary Memos #83 and #85, which list 
057985,000013:                                                                                                  ##              changes between Luminary 97 and 98, and 98 and 99. The
057986,000014:                                                                                                  ##              code has been adapted such that the resulting bugger words
057987,000015:                                                                                                  ##              exactly match those specified for Luminary 97 in NASA drawing
057988,000016:                                                                                                  ##              2021152D, which gives relatively high confidence that the
057989,000017:                                                                                                  ##              reconstruction is correct.
057990,000018:                                                                                                  ## Reference:   pp. 1374-1380
057991,000019:                                                                                                  ## Assembler:   yaYUL
057992,000020:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
057993,000021:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
057994,000022:                                                                                                  ## Mod history: 2019-07-28 MAS  Created from Luminary 99.
057995,000023: 

Page 1374

057997,000025: 10,3544                                           BANK     10                                    
057998,000026: 10,2000                                           SETLOC   DISPLAYS                              
057999,000027: 10,2000                                           BANK                                           
058000,000028: 10,3544                                           COUNT*   $$/DSPLA                              
058001,000029: 
058002,000030: 10,3544           00004        UPENT2             INHINT                                         
058003,000031: 10,3545           75660                           MASK     OCT77770                              
058004,000032: 10,3546           54001                           TS       L                                     
058005,000033: 10,3547           40100                           CS       FLAGWRD4                              
058006,000034: 10,3550           70001                           MASK     L                                     
058007,000035: 10,3551           26100                           ADS      FLAGWRD4                              
058008,000036: 10,3552           00003        JOIN               RELINT                                         
058009,000037: 10,3553           16737                           TCF      Q+1                                   
058010,000038: 
058011,000039: 10,3554           00004        DOWNENT2           INHINT                                         
058012,000040: 10,3555           75660                           MASK     OCT77770                              
058013,000041: 10,3556           40000                           COM                                            
058014,000042: 10,3557           70100                           MASK     FLAGWRD4                              
058015,000043: 10,3560           54100                           TS       FLAGWRD4                              
058016,000044: 10,3561           13552                           TCF      JOIN                                  
058017,000045: 
058018,000046: 10,3562     4757               OCT7               EQUALS   SEVEN                                 
058019,000047: 

Page 1375

058021,000049:                                                                                                  #  UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES.  USING THEM, WHETHER OR
058022,000050:                                                                                                  #  NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
058023,000051:                                                                                                  #  EBANK SETTING.  A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
058024,000052:                                                                                                  #  ASSEMBLER.
058025,000053: 
058026,000054:                                                                                                  #  AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS.  ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
058027,000055:                                                                                                  #  NAME ANY BIT IN ERASABLE MEMORY.
058028,000056: 
058029,000057:                                                                                                  #  CALLING SEQUENCES ARE AS FOLLOWS :-
058030,000058:                                                                                                  #                TC      UPFLAG                  TC      DOWNFLAG
058031,000059:                                                                                                  #                ADRES   NAME OF FLAG            ADRES   NAME OF FLAG
058032,000060: 
058033,000061:                                                                                                  #  RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
058034,000062:                                                                                                  #  UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
058035,000063: 
058036,000064:    5504                                           BLOCK    02                                    
058037,000065:    4000                                           SETLOC   FFTAG1                                
058038,000066:    4000                                           BANK                                           
058039,000067:    5504                                           COUNT*   $$/FLAG                               
058040,000068: 
058041,000069:    5504           30002        UPFLAG             CA       Q                                     
058042,000070:    5505           05522                           TC       DEBIT                                 
058043,000071:    5506           40000                           COM                                            #  +(15 - BIT)
058044,000072:    5507           00006                           EXTEND                                         
058045,000073:    5510           04001                           ROR      LCHAN                                 #  SET BIT
058046,000074:    5511           50061        COMFLAG            INDEX    ITEMP1                                
058047,000075:    5512           54074                           TS       FLAGWRD0                              
058048,000076:    5513           22063                           LXCH     ITEMP3                                
058049,000077:    5514           00003                           RELINT                                         
058050,000078:    5515           00001                           TC       L                                     
058051,000079: 
058052,000080:    5516           30002        DOWNFLAG           CA       Q                                     
058053,000081:    5517           05522                           TC       DEBIT                                 
058054,000082:    5520           70001                           MASK     L                                     #  RESET BIT
058055,000083:    5521           15511                           TCF      COMFLAG                               
058056,000084: 
058057,000085:    5522           64753        DEBIT              AD       ONE                                   #  GET DE BITS
058058,000086:    5523           00004                           INHINT                                         
058059,000087:    5524           54063                           TS       ITEMP3                                
058060,000088:    5525           34762                           CA       LOW4                                  #  DEC15
058061,000089:    5526           54061                           TS       ITEMP1                                
058062,000090:    5527           50063                           INDEX    ITEMP3                                
058063,000091:    5530           27777                           CA       0          -1                         #  ADRES
058064,000092:    5531           54001                           TS       L                                     
058065,000093:    5532           34755                           CA       ZERO                                  

Page 1376

058067,000095:    5533           00006                           EXTEND                                         
058068,000096:    5534           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
058069,000097:    5535           52062                           DXCH     ITEMP1                                
058070,000098:    5536           50061                           INDEX    ITEMP1                                
058071,000099:    5537           30074                           CA       FLAGWRD0                              
058072,000100:    5540           54001                           TS       L                                     #  CURRENT STATE
058073,000101:    5541           50062                           INDEX    ITEMP2                                
058074,000102:    5542           44735                           CS       BIT15                                 #  -(15 - BIT)
058075,000103:    5543           00002                           TC       Q                                     
058076,000104: 

Page 1377

058078,000106:                                                                                                  #  DELAYJOB - A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
058079,000107: 
058080,000108:                                                                                                  #  ENTRANCE REQUIREMENTS ...
058081,000109:                                                                                                  #                CAF     DT              DELAY JOB FOR DT CENTISECS
058082,000110:                                                                                                  #                TC      BANKCALL
058083,000111:                                                                                                  #                CADR    DELAYJOB
058084,000112: 
058085,000113: 06,3764                                           BANK     06                                    
058086,000114: 00,2000                                           SETLOC   DLAYJOB                               
058087,000115: 00,2000                                           BANK                                           
058088,000116: 
058089,000117:                                                                                                  #  THIS MUST REMAIN IN BANK 0 *****************************************
058090,000118: 
058091,000119: 00,3735                                           COUNT*   $$/DELAY                              
058092,000120: 00,3735           00004        DELAYJOB           INHINT                                         
058093,000121: 00,3736           54002                           TS       Q                                     #  STORE DELAY DT IN Q FOR DLY -1 IN
058094,000122: 00,3737           34752                           CAF      DELAYNUM                              #  WAITLIST
058095,000123: 00,3740           54070        DELLOOP            TS       RUPTREG1                              
058096,000124: 00,3741           50000                           INDEX    A                                     
058097,000125: 00,3742           31326                           CA       DELAYLOC                              #  IS THIS DELAYLOC AVAILABLE
058098,000126: 00,3743           00006                           EXTEND                                         
058099,000127: 00,3744           13752                           BZF      OK2DELAY                              #  YES
058100,000128: 
058101,000129: 00,3745           10070                           CCS      RUPTREG1                              #  NO, TRY NEXT DELAYLOC
058102,000130: 00,3746           13740                           TCF      DELLOOP                               
058103,000131: 
058104,000132: 00,3747           52134                           DXCH     BUF2                                  
058105,000133: 00,3750           05716                           TC       BAILOUT1                              #  NO AVAILABLE LOCS.
058106,000134: 00,3751           01104                           OCT      1104                                  
058107,000135: 
058108,000136: 00,3752           33772        OK2DELAY           CA       TCSLEEP                               #  SET WAITLIST IMMEDIATE RETURN
058109,000137: 00,3753           54061                           TS       WAITEXIT                              
058110,000138: 
058111,000139: 00,3754           30004                           CA       FBANK                                 
058112,000140: 00,3755           60070                           AD       RUPTREG1                              #  STORE BBANK FOR TASK CALL
058113,000141: 00,3756           54001                           TS       L                                     
058114,000142: 
058115,000143: 00,3757           33773                           CAF      WAKECAD                               #  STORE CADR FOR TASK CALL
058116,000144: 00,3760           15211                           TCF      DLY2       -1                         #  DLY IS IN WAITLIST ROUTINE
058117,000145: 
058118,000146: 00,3761           04645        TCGETCAD           TC       MAKECADR                              #  GET CALLERS FCADR
058119,000147: 
058120,000148: 00,3762           50070                           INDEX    RUPTREG1                              
058121,000149: 00,3763           55326                           TS       DELAYLOC                              #  SAVE DELAY CADRS
058122,000150: 
058123,000151: 00,3764           05133                           TC       JOBSLEEP                              
058124,000152: 
058125,000153: 00,3765           34755        WAKER              CAF      ZERO                                  
058126,000154: 00,3766           50006                           INDEX    BBANK                                 
058127,000155: 00,3767           57326                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE

Page 1378

058129,000157: 00,3770           05137                           TC       JOBWAKE                               
058130,000158: 
058131,000159: 00,3771           05261                           TC       TASKOVER                              
058132,000160: 
058133,000161: 00,3772           03757        TCSLEEP            GENADR   TCGETCAD   -2                         
058134,000162: 00,3773           03765        WAKECAD            GENADR   WAKER                                 
058135,000163: 

Page 1379

058137,000165:                                                                                                  #  GENTRAN, A BLOCK TRANSFER ROUTINE.
058138,000166:                                                                                                  #  WRITTEN BY D. EYLES
058139,000167:                                                                                                  #  MOD 1 BY KERNAN                               UTILITYM REV 17 11/18/67
058140,000168:                                                                                                  #  MOD 2 BY SCHULENBERG (REMOVE RELINT) SKIPPER REV 4 2/28/68
058141,000169: 
058142,000170:                                                                                                  #  THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
058143,000171:                                                                                                  #  CONSECUTIVE ERASABLE LOCATIONS.  IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
058144,000172: 
058145,000173:                                                                                                  #  GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT.  THE CALLING SEQUENCE IS:
058146,000174:                                                                                                  #        I       CA      N-1             # OF QUANTITIES MINUS ONE.
058147,000175:                                                                                                  #        I +1    TC      GENTRAN         IN FIXED-FIXED.
058148,000176:                                                                                                  #        I +2    ADRES   L               STARTING ADRES OF DATA TO BE MOVED.
058149,000177:                                                                                                  #        I +3    ADRES   M               STARTING ADRES OF DUPLICATION BLOCK.
058150,000178:                                                                                                  #        I +4                            RETURNS HERE.
058151,000179: 
058152,000180:                                                                                                  #  GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
058153,000181:                                                                                                  #  A, L AND ITEMP1 ARE NOT PRESERVED.
058154,000182: 
058155,000183:    5544                                           BLOCK    02                                    
058156,000184:    4000                                           SETLOC   FFTAG4                                
058157,000185:    4000                                           BANK                                           
058158,000186: 
058159,000187:    5544     0061                                  EBANK=   ITEMP1                                
058160,000188: 
058161,000189:    5544                                           COUNT*   $$/TRAN                               
058162,000190: 
058163,000191:    5544           00004        GENTRAN            INHINT                                         
058164,000192:    5545           54061                           TS       ITEMP1                                #  SAVE N-1.
058165,000193:    5546           50002                           INDEX    Q                                     #  C(Q) = ADRES L.
058166,000194:    5547           60000                           AD       0                                     #  ADRES (L + N - 1).
058167,000195:    5550           50000                           INDEX    A                                     
058168,000196:    5551           30000                           CA       0                                     #  C(ABOVE).
058169,000197:    5552           54001                           TS       L                                     #  SAVE DATA.
058170,000198:    5553           30061                           CA       ITEMP1                                
058171,000199:    5554           50002                           INDEX    Q                                     
058172,000200:    5555           60001                           AD       1                                     #  ADRES (M + N - 1).
058173,000201:    5556           50000                           INDEX    A                                     
058174,000202:    5557           22000                           LXCH     0                                     #  STUFF IT.
058175,000203:    5560           10061                           CCS      ITEMP1                                #  LOOP UNTIL N-1 = 0.
058176,000204:    5561           15545                           TCF      GENTRAN    +1                         
058177,000205:    5562           16741                           TCF      Q+2                                   #  RETURN TO CALLER.
058178,000206: 

Page 1380

058180,000208:                                                                                                  #  B5OFF         ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
058181,000209:                                                                                                  #  MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
058182,000210: 
058183,000211:    5563                                           COUNT*   $$/EXTVB                              
058184,000212: 
058185,000213:    5563           44747        B5OFF              CS       BIT5                                  
058186,000214:    5564           71044                           MASK     EXTVBACT                              
058187,000215:    5565           55044                           TS       EXTVBACT                              
058188,000216:    5566           05155                           TC       ENDOFJOB                              
058189,000217: 
058190,000218: 
058191,000219: 

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