Source Code

These source-code files were obtained by digitally photographing an Artemis 72 (Apollo 15-17 Command Module) program listing from a private collection and then modifying pre-existing Comanche 55 (Apollo 11) source files to incorporate changes. Photography was by Ron Burkey, and transcription was performed by a team of volunteers. Note that the page images presented online are of reduced quality, and that additional images may be available. Report any conversion errors or legibility problems in page images to info@sandroid.org. Notations on the program listing read, in part:

	GAP: ASSEMBLE REVISION 072 OF AGC PROGRAM ARTEMIS 
	BY NASA 2021114-011 11:40 FEB. 26, 1971
Note that the date is the date of the printout, not the date of the program revision.

063524,000002:                                                                                                  ## Copyright:   Public domain.
063525,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
063526,000004:                                                                                                  ## Purpose:     Part of the source code for Artemis (i.e., Colossus 3),
063527,000005:                                                                                                  ##              build 072.  This is for the Command Module's (CM)
063528,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for
063529,000007:                                                                                                  ##              Apollo 15-17.
063530,000008:                                                                                                  ## Assembler:   yaYUL
063531,000009:                                                                                                  ## Contact:     Jim Lawton <jim DOT lawton AT gmail DOT com>
063532,000010:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
063533,000011:                                                                                                  ## Page Scans:  www.ibiblio.org/apollo/ScansForConversion/Artemis072/
063534,000012:                                                                                                  ## Mod history: 2009-08-18 JL   Adapted from corresponding Comanche 055 file.
063535,000013:                                                                                                  ##              2010-02-01 JL   Fixed build error: missing code at end.
063536,000014:                                                                                                  ##              2010-02-07 JL   Removed spurious NDX instruction on p1478.
063537,000015:                                                                                                  ##              2010-02-20 RSB  Un-##'d this header.
063538,000016:                                                                                                  ##              2017-02-08 RSB  Proofed comment text by diff'ing vs Comanche 55
063539,000017:                                                                                                  ##                              and/or octopus/ProoferComments as most-appropriate.
063540,000018: 

Page 1478

063542,000020: 
063543,000021: 10,2000                                           SETLOC   DISPLAYS                              
063544,000022: 10,2000                                           BANK                                           
063545,000023: 10,3755                                           COUNT*   $$/DSPLA                              
063546,000024: 10,3755           54001        UPENT2             TS       L                                     
063547,000025: 10,3756           40100                           CS       FLAGWRD4                              
063548,000026: 10,3757           70001                           MASK     L                                     
063549,000027: 10,3760           26100                           ADS      FLAGWRD4                              
063550,000028: 10,3761           00002                           TC       Q                                     #  RETURN
063551,000029: 
063552,000030: 10,3762           40000        DOWNENT2           COM                                            #  START TO PROCESS INFORMATION
063553,000031: 10,3763           70100                           MASK     FLAGWRD4                              
063554,000032: 10,3764           54100                           TS       FLAGWRD4                              
063555,000033: 10,3765           00002                           TC       Q                                     #  RETURN
063556,000034: 
063557,000035: 10,3766     4774               OCT7               EQUALS   SEVEN                                 
063558,000036: 

Page 1479

063560,000038: 
063561,000039:                                                                                                  #  UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES.  USING THEM, WHETHER OR
063562,000040:                                                                                                  #  NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
063563,000041:                                                                                                  #  EBANK SETTING.  A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
063564,000042:                                                                                                  #  ASSEMBLER.
063565,000043: 
063566,000044:                                                                                                  #  AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS.  ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
063567,000045:                                                                                                  #  NAME ANY BIT IN ERASABLE MEMORY.
063568,000046: 
063569,000047:                                                                                                  #  CALLING SEQUENCES ARE AS FOLLOWS:-
063570,000048:                                                                                                  #                TC      UPFLAG                  TC      DOWNFLAG
063571,000049:                                                                                                  #                ADRES   NAME OF FLAG            ADRES   NAME OF FLAG
063572,000050: 
063573,000051:                                                                                                  #  RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
063574,000052:                                                                                                  #  UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
063575,000053: 
063576,000054:    4000                                           SETLOC   FFTAG1                                
063577,000055:    4000                                           BANK                                           
063578,000056:    5547                                           COUNT*   $$/FLAG                               
063579,000057: 
063580,000058:    5547           30002        UPFLAG             CA       Q                                     
063581,000059:    5550           05565                           TC       DEBIT                                 
063582,000060:    5551           40000                           COM                                            #  +(15 - BIT)
063583,000061:    5552           00006                           EXTEND                                         
063584,000062:    5553           04001                           ROR      LCHAN                                 #  SET BIT
063585,000063:    5554           50061        COMFLAG            INDEX    ITEMP1                                
063586,000064:    5555           54074                           TS       FLAGWRD0                              
063587,000065:    5556           22063                           LXCH     ITEMP3                                
063588,000066:    5557           00003                           RELINT                                         
063589,000067:    5560           00001                           TC       L                                     
063590,000068: 
063591,000069:    5561           30002        DOWNFLAG           CA       Q                                     
063592,000070:    5562           05565                           TC       DEBIT                                 
063593,000071:    5563           70001                           MASK     L                                     #  RESET BIT
063594,000072:    5564           15554                           TCF      COMFLAG                               
063595,000073: 
063596,000074:    5565           64770        DEBIT              AD       ONE                                   #  GET DE BITS
063597,000075:    5566           00004                           INHINT                                         
063598,000076:    5567           54063                           TS       ITEMP3                                
063599,000077:    5570           34777                           CA       LOW4                                  #  DEC15
063600,000078:    5571           54061                           TS       ITEMP1                                
063601,000079:    5572           50063                           INDEX    ITEMP3                                
063602,000080:    5573           27777                           CA       0          -1                         #  ADRES
063603,000081:    5574           54001                           TS       L                                     
063604,000082:    5575           34772                           CA       ZERO                                  
063605,000083:    5576           00006                           EXTEND                                         

Page 1480

063607,000085:    5577           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
063608,000086:    5600           52062                           DXCH     ITEMP1                                
063609,000087:    5601           50061                           INDEX    ITEMP1                                
063610,000088:    5602           30074                           CA       FLAGWRD0                              
063611,000089:    5603           54001                           TS       L                                     #  CURRENT STATE
063612,000090:    5604           50062                           INDEX    ITEMP2                                
063613,000091:    5605           44752                           CS       BIT15                                 #  -(15 - BIT)
063614,000092:    5606           00002                           TC       Q                                     
063615,000093: 

Page 1481

063617,000095: 
063618,000096:                                                                                                  #  DELAYJOB - A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
063619,000097: 
063620,000098:                                                                                                  #  ENTRANCE REQUIREMENTS ...
063621,000099:                                                                                                  #                CAF     DT              DELAY JOB FOR DT CENTISECS
063622,000100:                                                                                                  #                TC      BANKCALL
063623,000101:                                                                                                  #                CADR    DELAYJOB
063624,000102: 
063625,000103: 00,2000                                           SETLOC   DLAYJOB                               
063626,000104: 00,2000                                           BANK                                           
063627,000105: 
063628,000106:                                                                                                  #  THIS MUST REMAIN IN BANK 0 *****************************************
063629,000107: 00,3730                                           COUNT*   $$/DELAY                              
063630,000108: 00,3730           35016        1SECDELY           CAF      1SEC                                  
063631,000109: 00,3731           00004        DELAYJOB           INHINT                                         
063632,000110: 00,3732           54002                           TS       Q                                     #  STORE DELAY DT IN Q FOR DLY -1 IN
063633,000111: 
063634,000112: 00,3733           36214                           CAF      DELAYNUM                              #  WAITLIST
063635,000113: 00,3734           54070        DELLOOP            TS       RUPTREG1                              
063636,000114: 00,3735           50000                           INDEX    A                                     
063637,000115: 00,3736           31000                           CA       DELAYLOC                              #  IS THIS DELAYLOC AVAILABLE
063638,000116: 00,3737           00006                           EXTEND                                         
063639,000117: 00,3740           13745                           BZF      OK2DELAY                              #  YES
063640,000118: 
063641,000119: 00,3741           10070                           CCS      RUPTREG1                              #  NO, TRY NEXT DELAYLOC
063642,000120: 00,3742           13734                           TCF      DELLOOP                               
063643,000121: 
063644,000122: 00,3743           07706                           TC       BAILOUT                               #  NO AVAILABLE LOCS AVAILABLE.
063645,000123: 00,3744           31104                           OCT      31104                                 
063646,000124: 
063647,000125: 00,3745           33765        OK2DELAY           CA       TCSLEEP                               #  SET WAITLIST IMMEDIATE RETURN
063648,000126: 00,3746           54061                           TS       WAITEXIT                              
063649,000127: 
063650,000128: 00,3747           30004                           CA       FBANK                                 
063651,000129: 00,3750           60070                           AD       RUPTREG1                              #  STORE BBANK FOR TASK CALL
063652,000130: 00,3751           54001                           TS       L                                     
063653,000131: 
063654,000132: 00,3752           33766                           CAF      WAKECAD                               #  STORE CADR FOR TASK CALL
063655,000133: 00,3753           15243                           TCF      DLY2       -1                         #  DLY IS IN WAITLIST ROUTINE
063656,000134: 
063657,000135: 00,3754           04665        TCGETCAD           TC       MAKECADR                              #  GET CALLERS FCADR
063658,000136: 
063659,000137: 00,3755           50070                           INDEX    RUPTREG1                              
063660,000138: 00,3756           55000                           TS       DELAYLOC                              #  SAVE DELAY CADRS
063661,000139: 
063662,000140: 00,3757           05163                           TC       JOBSLEEP                              
063663,000141: 
063664,000142: 00,3760           34772        WAKER              CAF      ZERO                                  
063665,000143: 00,3761           50006                           INDEX    BBANK                                 
063666,000144: 00,3762           57000                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE
063667,000145: 00,3763           05167                           TC       JOBWAKE                               

Page 1482

063669,000147: 00,3764           05314                           TC       TASKOVER                              
063670,000148: 
063671,000149: 00,3765           03752        TCSLEEP            GENADR   TCGETCAD   -2                         
063672,000150: 00,3766           03760        WAKECAD            GENADR   WAKER                                 
063673,000151: 

Page 1483

063675,000153: 
063676,000154:                                                                                                  #  GENTRAN, A BLOCK TRANSFER ROUTINE.
063677,000155: 
063678,000156:                                                                                                  #  WRITTEN BY D. EYLES
063679,000157:                                                                                                  #  MOD 1 BY KERNAN                                               UTILITYM REV 17 11/18/67
063680,000158: 
063681,000159:                                                                                                  #  MOD 2 BY SCHULENBERG  (REMOVE RELINT)   SKIPPER REV 4 2/28/68
063682,000160: 
063683,000161:                                                                                                  #  THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
063684,000162:                                                                                                  #  CONSECUTIVE ERASABLE LOCATIONS.  IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
063685,000163: 
063686,000164:                                                                                                  #  GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT.  THE CALLING SEQUENCE IS:
063687,000165: 
063688,000166:                                                                                                  #        I       CA      N-1             # OF QUANTITIES MINUS ONE.
063689,000167:                                                                                                  #        I +1    TC      GENTRAN         IN FIXED-FIXED.
063690,000168:                                                                                                  #        I +2    ADRES   L               STARTING ADRES OF DATA TO BE MOVED.
063691,000169:                                                                                                  #        I +3    ADRES   M               STARTING ADRES OF DUPLICATION BLOCK.
063692,000170:                                                                                                  #        I +4                            RETURNS HERE.
063693,000171: 
063694,000172:                                                                                                  #  GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
063695,000173: 
063696,000174:                                                                                                  #  A, L AND ITEMP1 ARE NOT PRESERVED.
063697,000175: 
063698,000176:    4000                                           SETLOC   FFTAG4                                
063699,000177:    4000                                           BANK                                           
063700,000178: 
063701,000179:    5607     0061                                  EBANK=   ITEMP1                                
063702,000180: 
063703,000181:    5607                                           COUNT*   $$/TRAN                               
063704,000182: 
063705,000183:    5607           00004        GENTRAN            INHINT                                         
063706,000184:    5610           54061                 +1        TS       ITEMP1                                #  SAVE N-1
063707,000185:    5611           50002                           INDEX    Q                                     #  C(Q) = ADRES L.
063708,000186:    5612           60000                           AD       0                                     #  ADRES (L + N - 1).
063709,000187:    5613           50000                           INDEX    A                                     
063710,000188:    5614           30000                           CA       0                                     #  C(ABOVE).
063711,000189:    5615           54001                           TS       L                                     #  SAVE DATA.
063712,000190:    5616           30061                           CA       ITEMP1                                
063713,000191:    5617           50002                           INDEX    Q                                     
063714,000192:    5620           60001                           AD       1                                     #  ADRES (M + N - 1).
063715,000193:    5621           50000                           INDEX    A                                     
063716,000194:    5622           22000                           LXCH     0                                     #  STUFF IT.
063717,000195:    5623           10061                           CCS      ITEMP1                                #  LOOP UNTIL N-1 = 0.
063718,000196:    5624           15610                           TCF      GENTRAN    +1                         
063719,000197:    5625           16710                           TCF      Q+2                                   #  RETURN TO CALLER.
063720,000198: 

Page 1484

063722,000200: 
063723,000201:                                                                                                  #  B5OFF         ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
063724,000202:                                                                                                  #  MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
063725,000203: 
063726,000204:    5626                                           COUNT*   $$/EXTVB                              
063727,000205: 
063728,000206:    5626           44764        B5OFF              CS       BIT5                                  
063729,000207:    5627           71247                           MASK     EXTVBACT                              
063730,000208:    5630           55247                           TS       EXTVBACT                              
063731,000209:    5631           05205                           TC       ENDOFJOB                              
063732,000210: 

Page 1485

063734,000212: 
063735,000213:                                                                                                  #  SUBROUTINES TO TURN OFF AND TURN ON TRACKER FAIL LIGHT.
063736,000214: 
063737,000215:    5632                                           COUNT*   $$/DSPLA                              
063738,000216:    5632           00004        TRFAILOF           INHINT                                         
063739,000217:    5633           47670                           CS       OCT40200                              #  TURN OFF TRACKER LIGHT
063740,000218:    5634           71241                           MASK     DSPTAB     +11D                       
063741,000219:    5635           64752                           AD       BIT15                                 
063742,000220:    5636           55241                           TS       DSPTAB     +11D                       
063743,000221:    5637           41337                           CS       OPTMODES                              #  TO INSURE THAT OCDU FAIL WILL GO ON
063744,000222:    5640           74762                           MASK     OCDUFBIT                              #  AGAIN IF IT WAS ON IN ADDITION TO
063745,000223:    5641           27337                           ADS      OPTMODES                              #  TRACKER FAIL.
063746,000224: 
063747,000225:    5642           00003        REQ                RELINT                                         
063748,000226:    5643           00002                           TC       Q                                     
063749,000227: 
063750,000228:    5644           00004        TRFAILON           INHINT                                         
063751,000229:    5645           41241                           CS       DSPTAB     +11D                       #  TURN ON
063752,000230:    5646           77670                           MASK     OCT40200                              
063753,000231:    5647           27241                           ADS      DSPTAB     +11D                       
063754,000232:    5650           15642                           TCF      REQ                                   
063755,000233: 
063756,000234:    5651           10000        INCRQCK            CCS      A                                     
063757,000235:    5652           24002                           INCR     Q                                     
063758,000236:    5653           00002                           TC       Q                                     
063759,000237:    5654                                           COUNT*   $$/CFAIL                              
063760,000238:    5654           54001        C31BTCHK           TS       L                                     #  SAVE MASK
063761,000239:    5655           30374                           CA       C31FLWRD                              
063762,000240:    5656           74346                           MASK     FAILBIT                               
063763,000241:    5657           10000                           CCS      A                                     
063764,000242:    5660           15667                           TCF      USEFLBTS                              
063765,000243:    5661           00006                           EXTEND                                         
063766,000244:    5662           00031                           READ     CHAN31                                
063767,000245:    5663           70001        C31CMCHK           MASK     L                                     
063768,000246:    5664           00006                           EXTEND                                         
063769,000247:    5665           16711                           BZF      TCQ                                   #  BITS SET
063770,000248:    5666           16706                           TCF      Q+1                                   #  BITS NOT SET
063771,000249: 
063772,000250:    5667           30374        USEFLBTS           CA       C31FLWRD                              
063773,000251:    5670           15663                           TCF      C31CMCHK                              
063774,000252: 
063775,000253:    5671     4346               FAILBIT            =        PRIO30                                
063776,000254: 

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