Source Code

These source-code files are part of a reconstructed copy of Luminary 98, a development version of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

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 memo 85, using asterisks indicating changed lines in the listing as a guide. While no listing of this version is known to exist, nor are the memory-bank checksums available, the reconstruction is believed to be correct because it was an an intermediate step in reconstructing Luminary 97 whose reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152G. 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 98 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.

057535,000002:                                                                                                  ## Copyright:   Public domain.
057536,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
057537,000004:                                                                                                  ## Purpose:     A section of Luminary revision 98.
057538,000005:                                                                                                  ##              It is part of the reconstructed source code for the a
057539,000006:                                                                                                  ##              development version of the flight software for the Lunar 
057540,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
057541,000008:                                                                                                  ##              The code has been recreated from a copy of Luminary 99
057542,000009:                                                                                                  ##              revision 001, using asterisks indicating changed lines in
057543,000010:                                                                                                  ##              the listing and Luminary Memo #85, which lists changes between
057544,000011:                                                                                                  ##              Luminary 98 and 99.
057545,000012:                                                                                                  ## Reference:   pp. 1374-1380
057546,000013:                                                                                                  ## Assembler:   yaYUL
057547,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
057548,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
057549,000016:                                                                                                  ## Mod history: 2019-07-28 MAS  Created from Luminary 99.
057550,000017: 

Page 1374

057552,000019: 10,3544                                           BANK     10                                    
057553,000020: 10,2000                                           SETLOC   DISPLAYS                              
057554,000021: 10,2000                                           BANK                                           
057555,000022: 10,3544                                           COUNT*   $$/DSPLA                              
057556,000023: 
057557,000024: 10,3544           00004        UPENT2             INHINT                                         
057558,000025: 10,3545           75660                           MASK     OCT77770                              
057559,000026: 10,3546           54001                           TS       L                                     
057560,000027: 10,3547           40100                           CS       FLAGWRD4                              
057561,000028: 10,3550           70001                           MASK     L                                     
057562,000029: 10,3551           26100                           ADS      FLAGWRD4                              
057563,000030: 10,3552           00003        JOIN               RELINT                                         
057564,000031: 10,3553           16737                           TCF      Q+1                                   
057565,000032: 
057566,000033: 10,3554           00004        DOWNENT2           INHINT                                         
057567,000034: 10,3555           75660                           MASK     OCT77770                              
057568,000035: 10,3556           40000                           COM                                            
057569,000036: 10,3557           70100                           MASK     FLAGWRD4                              
057570,000037: 10,3560           54100                           TS       FLAGWRD4                              
057571,000038: 10,3561           13552                           TCF      JOIN                                  
057572,000039: 
057573,000040: 10,3562     4757               OCT7               EQUALS   SEVEN                                 
057574,000041: 

Page 1375

057576,000043:                                                                                                  #  UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES.  USING THEM, WHETHER OR
057577,000044:                                                                                                  #  NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
057578,000045:                                                                                                  #  EBANK SETTING.  A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
057579,000046:                                                                                                  #  ASSEMBLER.
057580,000047: 
057581,000048:                                                                                                  #  AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS.  ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
057582,000049:                                                                                                  #  NAME ANY BIT IN ERASABLE MEMORY.
057583,000050: 
057584,000051:                                                                                                  #  CALLING SEQUENCES ARE AS FOLLOWS :-
057585,000052:                                                                                                  #                TC      UPFLAG                  TC      DOWNFLAG
057586,000053:                                                                                                  #                ADRES   NAME OF FLAG            ADRES   NAME OF FLAG
057587,000054: 
057588,000055:                                                                                                  #  RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
057589,000056:                                                                                                  #  UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
057590,000057: 
057591,000058:    5504                                           BLOCK    02                                    
057592,000059:    4000                                           SETLOC   FFTAG1                                
057593,000060:    4000                                           BANK                                           
057594,000061:    5504                                           COUNT*   $$/FLAG                               
057595,000062: 
057596,000063:    5504           30002        UPFLAG             CA       Q                                     
057597,000064:    5505           05522                           TC       DEBIT                                 
057598,000065:    5506           40000                           COM                                            #  +(15 - BIT)
057599,000066:    5507           00006                           EXTEND                                         
057600,000067:    5510           04001                           ROR      LCHAN                                 #  SET BIT
057601,000068:    5511           50061        COMFLAG            INDEX    ITEMP1                                
057602,000069:    5512           54074                           TS       FLAGWRD0                              
057603,000070:    5513           22063                           LXCH     ITEMP3                                
057604,000071:    5514           00003                           RELINT                                         
057605,000072:    5515           00001                           TC       L                                     
057606,000073: 
057607,000074:    5516           30002        DOWNFLAG           CA       Q                                     
057608,000075:    5517           05522                           TC       DEBIT                                 
057609,000076:    5520           70001                           MASK     L                                     #  RESET BIT
057610,000077:    5521           15511                           TCF      COMFLAG                               
057611,000078: 
057612,000079:    5522           64753        DEBIT              AD       ONE                                   #  GET DE BITS
057613,000080:    5523           00004                           INHINT                                         
057614,000081:    5524           54063                           TS       ITEMP3                                
057615,000082:    5525           34762                           CA       LOW4                                  #  DEC15
057616,000083:    5526           54061                           TS       ITEMP1                                
057617,000084:    5527           50063                           INDEX    ITEMP3                                
057618,000085:    5530           27777                           CA       0          -1                         #  ADRES
057619,000086:    5531           54001                           TS       L                                     
057620,000087:    5532           34755                           CA       ZERO                                  

Page 1376

057622,000089:    5533           00006                           EXTEND                                         
057623,000090:    5534           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
057624,000091:    5535           52062                           DXCH     ITEMP1                                
057625,000092:    5536           50061                           INDEX    ITEMP1                                
057626,000093:    5537           30074                           CA       FLAGWRD0                              
057627,000094:    5540           54001                           TS       L                                     #  CURRENT STATE
057628,000095:    5541           50062                           INDEX    ITEMP2                                
057629,000096:    5542           44735                           CS       BIT15                                 #  -(15 - BIT)
057630,000097:    5543           00002                           TC       Q                                     
057631,000098: 

Page 1377

057633,000100:                                                                                                  #  DELAYJOB - A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
057634,000101: 
057635,000102:                                                                                                  #  ENTRANCE REQUIREMENTS ...
057636,000103:                                                                                                  #                CAF     DT              DELAY JOB FOR DT CENTISECS
057637,000104:                                                                                                  #                TC      BANKCALL
057638,000105:                                                                                                  #                CADR    DELAYJOB
057639,000106: 
057640,000107: 06,3764                                           BANK     06                                    
057641,000108: 00,2000                                           SETLOC   DLAYJOB                               
057642,000109: 00,2000                                           BANK                                           
057643,000110: 
057644,000111:                                                                                                  #  THIS MUST REMAIN IN BANK 0 *****************************************
057645,000112: 
057646,000113: 00,3735                                           COUNT*   $$/DELAY                              
057647,000114: 00,3735           00004        DELAYJOB           INHINT                                         
057648,000115: 00,3736           54002                           TS       Q                                     #  STORE DELAY DT IN Q FOR DLY -1 IN
057649,000116: 00,3737           34752                           CAF      DELAYNUM                              #  WAITLIST
057650,000117: 00,3740           54070        DELLOOP            TS       RUPTREG1                              
057651,000118: 00,3741           50000                           INDEX    A                                     
057652,000119: 00,3742           31326                           CA       DELAYLOC                              #  IS THIS DELAYLOC AVAILABLE
057653,000120: 00,3743           00006                           EXTEND                                         
057654,000121: 00,3744           13752                           BZF      OK2DELAY                              #  YES
057655,000122: 
057656,000123: 00,3745           10070                           CCS      RUPTREG1                              #  NO, TRY NEXT DELAYLOC
057657,000124: 00,3746           13740                           TCF      DELLOOP                               
057658,000125: 
057659,000126: 00,3747           52134                           DXCH     BUF2                                  
057660,000127: 00,3750           05716                           TC       BAILOUT1                              #  NO AVAILABLE LOCS.
057661,000128: 00,3751           01104                           OCT      1104                                  
057662,000129: 
057663,000130: 00,3752           33772        OK2DELAY           CA       TCSLEEP                               #  SET WAITLIST IMMEDIATE RETURN
057664,000131: 00,3753           54061                           TS       WAITEXIT                              
057665,000132: 
057666,000133: 00,3754           30004                           CA       FBANK                                 
057667,000134: 00,3755           60070                           AD       RUPTREG1                              #  STORE BBANK FOR TASK CALL
057668,000135: 00,3756           54001                           TS       L                                     
057669,000136: 
057670,000137: 00,3757           33773                           CAF      WAKECAD                               #  STORE CADR FOR TASK CALL
057671,000138: 00,3760           15211                           TCF      DLY2       -1                         #  DLY IS IN WAITLIST ROUTINE
057672,000139: 
057673,000140: 00,3761           04645        TCGETCAD           TC       MAKECADR                              #  GET CALLERS FCADR
057674,000141: 
057675,000142: 00,3762           50070                           INDEX    RUPTREG1                              
057676,000143: 00,3763           55326                           TS       DELAYLOC                              #  SAVE DELAY CADRS
057677,000144: 
057678,000145: 00,3764           05133                           TC       JOBSLEEP                              
057679,000146: 
057680,000147: 00,3765           34755        WAKER              CAF      ZERO                                  
057681,000148: 00,3766           50006                           INDEX    BBANK                                 
057682,000149: 00,3767           57326                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE

Page 1378

057684,000151: 00,3770           05137                           TC       JOBWAKE                               
057685,000152: 
057686,000153: 00,3771           05261                           TC       TASKOVER                              
057687,000154: 
057688,000155: 00,3772           03757        TCSLEEP            GENADR   TCGETCAD   -2                         
057689,000156: 00,3773           03765        WAKECAD            GENADR   WAKER                                 
057690,000157: 

Page 1379

057692,000159:                                                                                                  #  GENTRAN, A BLOCK TRANSFER ROUTINE.
057693,000160:                                                                                                  #  WRITTEN BY D. EYLES
057694,000161:                                                                                                  #  MOD 1 BY KERNAN                               UTILITYM REV 17 11/18/67
057695,000162:                                                                                                  #  MOD 2 BY SCHULENBERG (REMOVE RELINT) SKIPPER REV 4 2/28/68
057696,000163: 
057697,000164:                                                                                                  #  THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
057698,000165:                                                                                                  #  CONSECUTIVE ERASABLE LOCATIONS.  IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
057699,000166: 
057700,000167:                                                                                                  #  GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT.  THE CALLING SEQUENCE IS:
057701,000168:                                                                                                  #        I       CA      N-1             # OF QUANTITIES MINUS ONE.
057702,000169:                                                                                                  #        I +1    TC      GENTRAN         IN FIXED-FIXED.
057703,000170:                                                                                                  #        I +2    ADRES   L               STARTING ADRES OF DATA TO BE MOVED.
057704,000171:                                                                                                  #        I +3    ADRES   M               STARTING ADRES OF DUPLICATION BLOCK.
057705,000172:                                                                                                  #        I +4                            RETURNS HERE.
057706,000173: 
057707,000174:                                                                                                  #  GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
057708,000175:                                                                                                  #  A, L AND ITEMP1 ARE NOT PRESERVED.
057709,000176: 
057710,000177:    5544                                           BLOCK    02                                    
057711,000178:    4000                                           SETLOC   FFTAG4                                
057712,000179:    4000                                           BANK                                           
057713,000180: 
057714,000181:    5544     0061                                  EBANK=   ITEMP1                                
057715,000182: 
057716,000183:    5544                                           COUNT*   $$/TRAN                               
057717,000184: 
057718,000185:    5544           00004        GENTRAN            INHINT                                         
057719,000186:    5545           54061                           TS       ITEMP1                                #  SAVE N-1.
057720,000187:    5546           50002                           INDEX    Q                                     #  C(Q) = ADRES L.
057721,000188:    5547           60000                           AD       0                                     #  ADRES (L + N - 1).
057722,000189:    5550           50000                           INDEX    A                                     
057723,000190:    5551           30000                           CA       0                                     #  C(ABOVE).
057724,000191:    5552           54001                           TS       L                                     #  SAVE DATA.
057725,000192:    5553           30061                           CA       ITEMP1                                
057726,000193:    5554           50002                           INDEX    Q                                     
057727,000194:    5555           60001                           AD       1                                     #  ADRES (M + N - 1).
057728,000195:    5556           50000                           INDEX    A                                     
057729,000196:    5557           22000                           LXCH     0                                     #  STUFF IT.
057730,000197:    5560           10061                           CCS      ITEMP1                                #  LOOP UNTIL N-1 = 0.
057731,000198:    5561           15545                           TCF      GENTRAN    +1                         
057732,000199:    5562           16741                           TCF      Q+2                                   #  RETURN TO CALLER.
057733,000200: 

Page 1380

057735,000202:                                                                                                  #  B5OFF         ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
057736,000203:                                                                                                  #  MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
057737,000204: 
057738,000205:    5563                                           COUNT*   $$/EXTVB                              
057739,000206: 
057740,000207:    5563           44747        B5OFF              CS       BIT5                                  
057741,000208:    5564           71044                           MASK     EXTVBACT                              
057742,000209:    5565           55044                           TS       EXTVBACT                              
057743,000210:    5566           05155                           TC       ENDOFJOB                              
057744,000211: 
057745,000212: 
057746,000213: 

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