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.

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

Page 1478

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

Page 1479

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

Page 1480

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

Page 1481

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

Page 1482

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

Page 1483

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

Page 1484

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

Page 1485

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

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