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.

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

Page 1478

063528,000020: 
063529,000021: 10,2000                                           SETLOC   DISPLAYS                              
063530,000022: 10,2000                                           BANK                                           
063531,000023: 10,3755                                           COUNT*   $$/DSPLA                              
063532,000024: 10,3755           54001        UPENT2             TS       L                                     
063533,000025: 10,3756           40100                           CS       FLAGWRD4                              
063534,000026: 10,3757           70001                           MASK     L                                     
063535,000027: 10,3760           26100                           ADS      FLAGWRD4                              
063536,000028: 10,3761           00002                           TC       Q                                     #  RETURN
063537,000029: 
063538,000030: 10,3762           40000        DOWNENT2           COM                                            #  START TO PROCESS INFORMATION
063539,000031: 10,3763           70100                           MASK     FLAGWRD4                              
063540,000032: 10,3764           54100                           TS       FLAGWRD4                              
063541,000033: 10,3765           00002                           TC       Q                                     #  RETURN
063542,000034: 
063543,000035: 10,3766     4774               OCT7               EQUALS   SEVEN                                 
063544,000036: 

Page 1479

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

Page 1480

063593,000085:    5577           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
063594,000086:    5600           52062                           DXCH     ITEMP1                                
063595,000087:    5601           50061                           INDEX    ITEMP1                                
063596,000088:    5602           30074                           CA       FLAGWRD0                              
063597,000089:    5603           54001                           TS       L                                     #  CURRENT STATE
063598,000090:    5604           50062                           INDEX    ITEMP2                                
063599,000091:    5605           44752                           CS       BIT15                                 #  -(15 - BIT)
063600,000092:    5606           00002                           TC       Q                                     
063601,000093: 

Page 1481

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

Page 1482

063655,000147: 00,3764           05314                           TC       TASKOVER                              
063656,000148: 
063657,000149: 00,3765           03752        TCSLEEP            GENADR   TCGETCAD   -2                         
063658,000150: 00,3766           03760        WAKECAD            GENADR   WAKER                                 
063659,000151: 

Page 1483

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

Page 1484

063708,000200: 
063709,000201:                                                                                                  #  B5OFF         ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
063710,000202:                                                                                                  #  MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
063711,000203: 
063712,000204:    5626                                           COUNT*   $$/EXTVB                              
063713,000205: 
063714,000206:    5626           44764        B5OFF              CS       BIT5                                  
063715,000207:    5627           71247                           MASK     EXTVBACT                              
063716,000208:    5630           55247                           TS       EXTVBACT                              
063717,000209:    5631           05205                           TC       ENDOFJOB                              
063718,000210: 

Page 1485

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

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