Source Code

These source-code files were transcribed from scans made from Don Eyles's personal copy of Luminary 069. They were scanned at archive.org's Boston facility, and the scanning was sponsored by Onno Hommes. The code was transcribed from these scans by a team of volunteers who are referenced in the program comments. Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". In some cases, where similar code blocks exist in previously-transcribed AGC programs (primarily Luminary 99, from Apollo 11) those code blocks were used as a starting point and then corrected to agree with the Luminary 69 scans. The full scans are available at the Virtual AGC project's collection at archive.org, while more-convenient reduced-size (but reduced-quality) images are available at the main Virtual AGC website. Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository. Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 069 OF AGC PROGRAM LUMINARY BY NASA 2021112-011
	19:02 NOV. 25,1968
Note that the date is the date of the printout, not the date of the program revision.

059317,000002:                                                                                                  ## Copyright:   Public domain.
059318,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
059319,000004:                                                                                                  ## Purpose:     The main source file for Luminary revision 069.
059320,000005:                                                                                                  ##              It is part of the source code for the original release
059321,000006:                                                                                                  ##              of the flight software for the Lunar Module's (LM) Apollo
059322,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 10. The actual flown
059323,000008:                                                                                                  ##              version was Luminary 69 revision 2, which included a
059324,000009:                                                                                                  ##              newer lunar gravity model and only affected module 2.
059325,000010:                                                                                                  ##              This file is intended to be a faithful transcription, except
059326,000011:                                                                                                  ##              that the code format has been changed to conform to the
059327,000012:                                                                                                  ##              requirements of the yaYUL assembler rather than the
059328,000013:                                                                                                  ##              original YUL assembler.
059329,000014:                                                                                                  ## Reference:   pp. 1368-1374
059330,000015:                                                                                                  ## Assembler:   yaYUL
059331,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
059332,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
059333,000018:                                                                                                  ## Mod history: 2016-12-13 MAS  Created from Luminary 99.
059334,000019:                                                                                                  ##              2016-12-18 MAS  Updated from comment-proofed Luminary 99 version.
059335,000020:                                                                                                  ##              2017-01-10 RRB  Updated for Luminary 69.
059336,000021:                                                                                                  ##              2017-01-21 HG   fix operand OCT 7 -> OCT7
059337,000022:                                                                                                  ##              2017-01-28 RSB  Proofed comment text using octopus/prooferComments
059338,000023:                                                                                                  ##                              and fixed errors found.
059339,000024: 

Page 1368

059341,000026: 10,3416                                           BANK     10                                    
059342,000027: 10,2000                                           SETLOC   DISPLAYS                              
059343,000028: 10,2000                                           BANK                                           
059344,000029: 10,3416                                           COUNT*   $$/DSPLA                              
059345,000030: 
059346,000031: 10,3416           54001        UPENT2             TS       L                                     #  WHICH FLAGWORD IS IT
059347,000032: 10,3417           74757                           MASK     OCT7                                  
059348,000033: 10,3420           56001                           XCH      L                                     #  SAVE IN L FOR INDEXING
059349,000034: 
059350,000035: 10,3421           75660                           MASK     OCT77770                              #  OBTAIN THE BIT INFORMATION
059351,000036: 10,3422           00004                           INHINT                                         #  PREVENT INTERUPTS
059352,000037: 10,3423           54061                           TS       ITEMP1                                #  STORE THE BIT INFORMATION TEMPORARIALY
059353,000038: 
059354,000039: 10,3424           50001                           NDX      L                                     
059355,000040: 10,3425           40074                           CS       FLAGWRD0                              
059356,000041: 10,3426           70061                           MASK     ITEMP1                                
059357,000042: 10,3427           50001                           NDX      L                                     
059358,000043: 10,3430           26074                           ADS      FLAGWRD0                              
059359,000044: 10,3431           00003                           RELINT                                         #  RELEASE INTERUPT INHIBIT
059360,000045: 
059361,000046: 10,3432           24002                           INCR     Q                                     #  OBTAIN THE CORRECT RETURN ADDRESS
059362,000047: 10,3433           00002                           TC       Q                                     #  RETURN
059363,000048: 
059364,000049: 10,3434           54001        DOWNENT2           TS       L                                     #  WHICH FLAGWORD IS IT
059365,000050: 10,3435           74757                           MASK     OCT7                                  
059366,000051: 10,3436           56001                           XCH      L                                     #  SAVE IN L FOR INDEXING
059367,000052: 
059368,000053: 10,3437           75660                           MASK     OCT77770                              #  OBTAIN THE BIT INFORMATION
059369,000054: 10,3440           40000                           COM                                            #  START TO PROCESS THE INFORMATION
059370,000055: 
059371,000056: 10,3441           00004                           INHINT                                         #  PREVENT INTERUPTS
059372,000057: 10,3442           50001                           NDX      L                                     
059373,000058: 10,3443           70074                           MASK     FLAGWRD0                              
059374,000059: 10,3444           50001                           NDX      L                                     
059375,000060: 10,3445           54074                           TS       FLAGWRD0                              
059376,000061: 10,3446           00003                           RELINT                                         #  RELEASE INTERUPT INHIBIT
059377,000062: 
059378,000063: 10,3447           24002                           INCR     Q                                     #  OBTAIN THE CORRECT RETURN ADDRESS
059379,000064: 10,3450           00002                           TC       Q                                     #  RETURN
059380,000065: 
059381,000066: 10,3451     4757               OCT7               EQUALS   SEVEN                                 
059382,000067: 

Page 1369

059384,000069:                                                                                                  #      UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES.   USING THEM, WHETHER OR
059385,000070:                                                                                                  #  NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
059386,000071:                                                                                                  #  EBANK SETTING.   A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
059387,000072:                                                                                                  #  ASSEMBLER.
059388,000073: 
059389,000074:                                                                                                  #      AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS.   ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
059390,000075:                                                                                                  #  NAME ANY BIT IN ERASABLE MEMORY.
059391,000076: 
059392,000077:                                                                                                  #      CALLING SEQUENCES ARE AS FOLLOWS :-
059393,000078:                                                                                                  #                TC      UPFLAG                  TC      DOWNFLAG
059394,000079:                                                                                                  #                ADRES   NAME OF FLAG            ADRES   NAME OF FLAG
059395,000080: 
059396,000081:                                                                                                  #      RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
059397,000082: 
059398,000083:                                                                                                  #      UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
059399,000084: 
059400,000085:    5504                                           BLOCK    02                                    
059401,000086:    4000                                           SETLOC   FFTAG1                                
059402,000087:    4000                                           BANK                                           
059403,000088:    5504                                           COUNT*   $$/FLAG                               
059404,000089: 
059405,000090:    5504           30002        UPFLAG             CA       Q                                     
059406,000091:    5505           05522                           TC       DEBIT                                 
059407,000092:    5506           40000                           COM                                            #  +(15 - BIT)
059408,000093:    5507           00006                           EXTEND                                         
059409,000094:    5510           04001                           ROR      LCHAN                                 #  SET BIT
059410,000095:    5511           50061        COMFLAG            INDEX    ITEMP1                                
059411,000096:    5512           54074                           TS       FLAGWRD0                              
059412,000097:    5513           22063                           LXCH     ITEMP3                                
059413,000098:    5514           00003                           RELINT                                         
059414,000099:    5515           00001                           TC       L                                     
059415,000100: 
059416,000101:    5516           30002        DOWNFLAG           CA       Q                                     
059417,000102:    5517           05522                           TC       DEBIT                                 
059418,000103:    5520           70001                           MASK     L                                     #  RESET BIT
059419,000104:    5521           15511                           TCF      COMFLAG                               
059420,000105: 
059421,000106:    5522           64753        DEBIT              AD       ONE                                   #  GET DE BITS
059422,000107:    5523           00004                           INHINT                                         
059423,000108:    5524           54063                           TS       ITEMP3                                
059424,000109:    5525           34762                           CA       LOW4                                  #  DEC15
059425,000110:    5526           54061                           TS       ITEMP1                                
059426,000111:    5527           50063                           INDEX    ITEMP3                                
059427,000112:    5530           27777                           CA       0          -1                         #  ADRES
059428,000113:    5531           54001                           TS       L                                     
059429,000114:    5532           34755                           CA       ZERO                                  

Page 1370

059431,000116:    5533           00006                           EXTEND                                         
059432,000117:    5534           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
059433,000118:    5535           52062                           DXCH     ITEMP1                                
059434,000119:    5536           50061                           INDEX    ITEMP1                                
059435,000120:    5537           30074                           CA       FLAGWRD0                              
059436,000121:    5540           54001                           TS       L                                     #  CURRENT STATE
059437,000122:    5541           50062                           INDEX    ITEMP2                                
059438,000123:    5542           44735                           CS       BIT15                                 #  -(15 - BIT)
059439,000124:    5543           00002                           TC       Q                                     
059440,000125: 

Page 1371

059442,000127:                                                                                                  #  DELAYJOB - A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
059443,000128: 
059444,000129:                                                                                                  #  ENTRANCE REQUIREMENTS ...
059445,000130:                                                                                                  #                CAF     DT              DELAY JOB FOR DT CENTISECS
059446,000131:                                                                                                  #                TC      BANKCALL
059447,000132:                                                                                                  #                CADR    DELAYJOB
059448,000133: 
059449,000134: 06,3715                                           BANK     06                                    
059450,000135: 00,2000                                           SETLOC   DLAYJOB                               
059451,000136: 00,2000                                           BANK                                           
059452,000137: 
059453,000138:                                                                                                  #  THIS MUST REMAIN IN BANK 0 *****************************************
059454,000139: 
059455,000140: 00,3735                                           COUNT*   $$/DELAY                              
059456,000141: 00,3735           00004        DELAYJOB           INHINT                                         
059457,000142: 00,3736           54002                           TS       Q                                     #  STORE DELAY DT IN Q FOR DLY -1 IN
059458,000143: 
059459,000144: 00,3737           34752                           CAF      DELAYNUM                              #  WAITLIST
059460,000145: 00,3740           54070        DELLOOP            TS       RUPTREG1                              
059461,000146: 00,3741           50000                           INDEX    A                                     
059462,000147: 00,3742           31326                           CA       DELAYLOC                              #  IS THIS DELAYLOC AVAILABLE
059463,000148: 00,3743           00006                           EXTEND                                         
059464,000149: 00,3744           13752                           BZF      OK2DELAY                              #  YES
059465,000150: 
059466,000151: 00,3745           10070                           CCS      RUPTREG1                              #  NO, TRY NEXT DELAYLOC
059467,000152: 00,3746           13740                           TCF      DELLOOP                               
059468,000153: 
059469,000154: 00,3747           52134                           DXCH     BUF2                                  
059470,000155: 00,3750           05710                           TC       BAILOUT1                              #  NO AVAILABLE LOCS.
059471,000156: 00,3751           01104                           OCT      1104                                  
059472,000157: 
059473,000158: 00,3752           33772        OK2DELAY           CA       TCSLEEP                               #  SET WAITLIST IMMEDIATE RETURN
059474,000159: 00,3753           54061                           TS       WAITEXIT                              
059475,000160: 
059476,000161: 00,3754           30004                           CA       FBANK                                 
059477,000162: 00,3755           60070                           AD       RUPTREG1                              #  STORE BBANK FOR TASK CALL
059478,000163: 00,3756           54001                           TS       L                                     
059479,000164: 
059480,000165: 00,3757           33773                           CAF      WAKECAD                               #  STORE CADR FOR TASK CALL
059481,000166: 00,3760           15211                           TCF      DLY2       -1                         #  DLY IS IN WAITLIST ROUTINE
059482,000167: 
059483,000168: 00,3761           04645        TCGETCAD           TC       MAKECADR                              #  GET CALLERS FCADR
059484,000169: 
059485,000170: 00,3762           50070                           INDEX    RUPTREG1                              
059486,000171: 00,3763           55326                           TS       DELAYLOC                              #  SAVE DELAY CADRS
059487,000172: 
059488,000173: 00,3764           05133                           TC       JOBSLEEP                              
059489,000174: 
059490,000175: 00,3765           34755        WAKER              CAF      ZERO                                  
059491,000176: 00,3766           50006                           INDEX    BBANK                                 
059492,000177: 00,3767           57326                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE

Page 1372

059494,000179: 00,3770           05137                           TC       JOBWAKE                               
059495,000180: 
059496,000181: 00,3771           05261                           TC       TASKOVER                              
059497,000182: 
059498,000183: 00,3772           03757        TCSLEEP            GENADR   TCGETCAD   -2                         
059499,000184: 00,3773           03765        WAKECAD            GENADR   WAKER                                 
059500,000185: 

Page 1373

059502,000187:                                                                                                  #  GENTRAN, A BLOCK TRANSFER ROUTINE.
059503,000188: 
059504,000189:                                                                                                  #  WRITTEN BY D. EYLES
059505,000190:                                                                                                  #  MOD 1 BY KERNAN                               UTILITYM REV 17 11/18/67
059506,000191: 
059507,000192:                                                                                                  #  MOD 2 BY SCHULENBERG (REMOVE RELINT) SKIPPER REV 4 2/28/68
059508,000193: 
059509,000194:                                                                                                  #           THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
059510,000195:                                                                                                  #  CONSECUTIVE ERASABLE LOCATIONS.  IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
059511,000196: 
059512,000197:                                                                                                  #           GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT.  THE CALLING SEQUENCE IS:
059513,000198:                                                                                                  #                                          I        CA    N-1              # OF QUANTITIES MINUS ONE.
059514,000199:                                                                                                  #                                          I +1     TC    GENTRAN          IN FIXED-FIXED.
059515,000200:                                                                                                  #                                          I +2     ADRES L                STARTING ADRES OF DATA TO BE MOVED.
059516,000201:                                                                                                  #                                          I +3     ADRES M                STARTING ADRES OF DUPLICATION BLOCK.
059517,000202:                                                                                                  #                                          I +4                            RETURNS HERE.
059518,000203: 
059519,000204:                                                                                                  #           GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
059520,000205:                                                                                                  #           A, L AND ITEMP1 ARE NOT PRESERVED.
059521,000206: 
059522,000207:    5544                                           BLOCK    02                                    
059523,000208:    4000                                           SETLOC   FFTAG4                                
059524,000209:    4000                                           BANK                                           
059525,000210: 
059526,000211:    5544     0061                                  EBANK=   ITEMP1                                
059527,000212: 
059528,000213:    5544                                           COUNT*   $$/TRAN                               
059529,000214: 
059530,000215:    5544           00004        GENTRAN            INHINT                                         
059531,000216:    5545           54061                           TS       ITEMP1                                #  SAVE N-1.
059532,000217:    5546           50002                           INDEX    Q                                     #  C(Q) = ADRES L.
059533,000218:    5547           60000                           AD       0                                     #  ADRES (L + N - 1).
059534,000219:    5550           50000                           INDEX    A                                     
059535,000220:    5551           30000                           CA       0                                     #  C(ABOVE).
059536,000221:    5552           54001                           TS       L                                     #  SAVE DATA.
059537,000222:    5553           30061                           CA       ITEMP1                                
059538,000223:    5554           50002                           INDEX    Q                                     
059539,000224:    5555           60001                           AD       1                                     #  ADRES (M + N - 1).
059540,000225:    5556           50000                           INDEX    A                                     
059541,000226:    5557           22000                           LXCH     0                                     #  STUFF IT.
059542,000227:    5560           10061                           CCS      ITEMP1                                #  LOOP UNTIL N-1 = 0.
059543,000228:    5561           15545                           TCF      GENTRAN    +1                         
059544,000229:    5562           16740                           TCF      Q+2                                   #  RETURN TO CALLER.
059545,000230: 

Page 1374

059547,000232:                                                                                                  #  B5OFF   ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
059548,000233:                                                                                                  #           MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
059549,000234: 
059550,000235:    5563                                           COUNT*   $$/EXTVB                              
059551,000236: 
059552,000237:    5563           44747        B5OFF              CS       BIT5                                  
059553,000238:    5564           71044                           MASK     EXTVBACT                              
059554,000239:    5565           55044                           TS       EXTVBACT                              
059555,000240:    5566           05155                           TC       ENDOFJOB                              
059556,000241: 
059557,000242: 
059558,000243: 

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