Source Code

This is a reconstructed version of Luminary 130, the initial AGC program released in November 1969 for the Apollo 13 LM. Three more releases followed before the flown revision was finally manufactured in February 1970.

This reconstruction was created from a previous transcription of the original listing of Luminary 131, combined with Luminary memo #129 which describes the small difference between the Luminary 130 and 131. The reconstructed source code was verified by matching memory-bank checksums to those listed for Luminary 130 in drawing 2021152G.

In this source code, program comments from the original (Luminary 131) code are prefixed with '#', while those added later by the Virtual AGC project are prefixed with '##'.

057961,000002:                                                                                                  ## Copyright:   Public domain.
057962,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
057963,000004:                                                                                                  ## Purpose:     A section of the reconstructed source code for Luminary 130.
057964,000005:                                                                                                  ##              This was the original program released for the Apollo 13 LM,
057965,000006:                                                                                                  ##              although several more revisions would follow. It has been
057966,000007:                                                                                                  ##              reconstructed from a listing of Luminary 131, from which it
057967,000008:                                                                                                  ##              differs on only two lines in P70-P71. The difference is
057968,000009:                                                                                                  ##              described in detail in Luminary memo #129, which was used
057969,000010:                                                                                                  ##              to perform the reconstruction. This file is intended to be a
057970,000011:                                                                                                  ##              faithful reconstruction, except that the code format has been
057971,000012:                                                                                                  ##              changed to conform to the requirements of the yaYUL assembler
057972,000013:                                                                                                  ##              rather than the original YUL assembler.
057973,000014:                                                                                                  ## Reference:   pp. 1366-1372
057974,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
057975,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
057976,000017:                                                                                                  ## Mod history: 06/06/03 RSB.   Began transcribing.
057977,000018:                                                                                                  ##              05/14/05 RSB    Corrected website references above.
057978,000019:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
057979,000020:                                                                                                  ##                              original hardcopy, as opposed to the PDF page
057980,000021:                                                                                                  ##                              numbers in 1701.pdf.
057981,000022:                                                                                                  ##              2017-02-28 RSB  Proofed comment text using octopus/ProoferComments.
057982,000023:                                                                                                  ##              2017-03-01 RSB  Fixed lingering comment-text typos.
057983,000024:                                                                                                  ##              2017-03-14 RSB  Comment-text fixes noted in proofing Luminary 116.
057984,000025:                                                                                                  ##              2017-03-16 RSB  Comment-text fixes identified in 5-way
057985,000026:                                                                                                  ##                              side-by-side diff of Luminary 69/99/116/131/210.
057986,000027:                                                                                                  ##              2018-09-04 MAS  Copied from Luminary 131 for Luminary 130.
057987,000028: 

Page 1366

057989,000030: 10,3545                                           BANK     10                                    
057990,000031: 10,2000                                           SETLOC   DISPLAYS                              
057991,000032: 10,2000                                           BANK                                           
057992,000033: 10,3545                                           COUNT*   $$/DSPLA                              
057993,000034: 
057994,000035: 10,3545           00004        UPENT2             INHINT                                         
057995,000036: 10,3546           75650                           MASK     OCT77770                              
057996,000037: 10,3547           54001                           TS       L                                     
057997,000038: 10,3550           40100                           CS       FLAGWRD4                              
057998,000039: 10,3551           70001                           MASK     L                                     
057999,000040: 10,3552           26100                           ADS      FLAGWRD4                              
058000,000041: 10,3553           00003        JOIN               RELINT                                         
058001,000042: 10,3554           16742                           TCF      Q+1                                   
058002,000043: 
058003,000044: 10,3555           00004        DOWNENT2           INHINT                                         
058004,000045: 10,3556           75650                           MASK     OCT77770                              
058005,000046: 10,3557           40000                           COM                                            
058006,000047: 10,3560           70100                           MASK     FLAGWRD4                              
058007,000048: 10,3561           54100                           TS       FLAGWRD4                              
058008,000049: 10,3562           13553                           TCF      JOIN                                  
058009,000050: 
058010,000051: 10,3563     4757               OCT7               EQUALS   SEVEN                                 
058011,000052: 

Page 1367

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

Page 1368

058059,000100:    5533           00006                           EXTEND                                         
058060,000101:    5534           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
058061,000102:    5535           52062                           DXCH     ITEMP1                                
058062,000103:    5536           50061                           INDEX    ITEMP1                                
058063,000104:    5537           30074                           CA       FLAGWRD0                              
058064,000105:    5540           54001                           TS       L                                     #  CURRENT STATE
058065,000106:    5541           50062                           INDEX    ITEMP2                                
058066,000107:    5542           44735                           CS       BIT15                                 #  -(15 - BIT)
058067,000108:    5543           00002                           TC       Q                                     
058068,000109: 

Page 1369

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

Page 1370

058121,000162: 00,3770           57323                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE
058122,000163: 00,3771           05137                           TC       JOBWAKE                               
058123,000164: 
058124,000165: 00,3772           05261                           TC       TASKOVER                              
058125,000166: 
058126,000167: 00,3773           03760        TCSLEEP            GENADR   TCGETCAD   -2                         
058127,000168: 00,3774           03766        WAKECAD            GENADR   WAKER                                 
058128,000169: 

Page 1371

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

Page 1372

058173,000214:                                                                                                  #  B5OFF         ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
058174,000215:                                                                                                  #  MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
058175,000216: 
058176,000217:    5563                                           COUNT*   $$/EXTVB                              
058177,000218: 
058178,000219:    5563           44747        B5OFF              CS       BIT5                                  
058179,000220:    5564           71043                           MASK     EXTVBACT                              
058180,000221:    5565           55043                           TS       EXTVBACT                              
058181,000222:    5566           05155                           TC       ENDOFJOB                              
058182,000223: 
058183,000224: 
058184,000225: 

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