Source Code

These source-code files are part of a reconstructed copy of Artemis 071, the first release of the Apollo 15 through 17 Command Module (CM) Apollo Guidance Computer (AGC) software.

The reconstruction began with source code of Artemis 072 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes between the two versions. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021154-. Note that page numbers in the reconstructed code match those on the Artemis 072 printout, although the changed code would likely have changed page numbers for a real Artemis 071 listing.

Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

063350,000002:                                                                                                  ## Copyright:   Public domain.
063351,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
063352,000004:                                                                                                  ## Purpose:     A section of Artemis revision 071.
063353,000005:                                                                                                  ##              It is part of the reconstructed source code for the first
063354,000006:                                                                                                  ##              release of the flight software for the Command Module's
063355,000007:                                                                                                  ##              (CM) Apollo Guidance Computer (AGC) for Apollo 15 through
063356,000008:                                                                                                  ##              17. The code has been recreated from a copy of Artemis 072.
063357,000009:                                                                                                  ##              It has been adapted such that the resulting bugger words
063358,000010:                                                                                                  ##              exactly match those specified for Artemis 071 in NASA
063359,000011:                                                                                                  ##              drawing 2021154-, which gives relatively high confidence
063360,000012:                                                                                                  ##              that the reconstruction is correct.
063361,000013:                                                                                                  ## Reference:   1478
063362,000014:                                                                                                  ## Assembler:   yaYUL
063363,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
063364,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
063365,000017:                                                                                                  ## Mod history: 2019-08-14 MAS  Created from Artemis 072.
063366,000018: 

Page 1478

063368,000020: 
063369,000021: 10,2000                                           SETLOC   DISPLAYS                              
063370,000022: 10,2000                                           BANK                                           
063371,000023: 10,3755                                           COUNT*   $$/DSPLA                              
063372,000024: 10,3755           54001        UPENT2             TS       L                                     
063373,000025: 10,3756           40100                           CS       FLAGWRD4                              
063374,000026: 10,3757           70001                           MASK     L                                     
063375,000027: 10,3760           26100                           ADS      FLAGWRD4                              
063376,000028: 10,3761           00002                           TC       Q                                     #  RETURN
063377,000029: 
063378,000030: 10,3762           40000        DOWNENT2           COM                                            #  START TO PROCESS INFORMATION
063379,000031: 10,3763           70100                           MASK     FLAGWRD4                              
063380,000032: 10,3764           54100                           TS       FLAGWRD4                              
063381,000033: 10,3765           00002                           TC       Q                                     #  RETURN
063382,000034: 
063383,000035: 10,3766     4774               OCT7               EQUALS   SEVEN                                 
063384,000036: 

Page 1479

063386,000038: 
063387,000039:                                                                                                  #  UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES.  USING THEM, WHETHER OR
063388,000040:                                                                                                  #  NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
063389,000041:                                                                                                  #  EBANK SETTING.  A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
063390,000042:                                                                                                  #  ASSEMBLER.
063391,000043: 
063392,000044:                                                                                                  #  AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS.  ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
063393,000045:                                                                                                  #  NAME ANY BIT IN ERASABLE MEMORY.
063394,000046: 
063395,000047:                                                                                                  #  CALLING SEQUENCES ARE AS FOLLOWS:-
063396,000048:                                                                                                  #                TC      UPFLAG                  TC      DOWNFLAG
063397,000049:                                                                                                  #                ADRES   NAME OF FLAG            ADRES   NAME OF FLAG
063398,000050: 
063399,000051:                                                                                                  #  RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
063400,000052:                                                                                                  #  UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
063401,000053: 
063402,000054:    4000                                           SETLOC   FFTAG1                                
063403,000055:    4000                                           BANK                                           
063404,000056:    5547                                           COUNT*   $$/FLAG                               
063405,000057: 
063406,000058:    5547           30002        UPFLAG             CA       Q                                     
063407,000059:    5550           05565                           TC       DEBIT                                 
063408,000060:    5551           40000                           COM                                            #  +(15 - BIT)
063409,000061:    5552           00006                           EXTEND                                         
063410,000062:    5553           04001                           ROR      LCHAN                                 #  SET BIT
063411,000063:    5554           50061        COMFLAG            INDEX    ITEMP1                                
063412,000064:    5555           54074                           TS       FLAGWRD0                              
063413,000065:    5556           22063                           LXCH     ITEMP3                                
063414,000066:    5557           00003                           RELINT                                         
063415,000067:    5560           00001                           TC       L                                     
063416,000068: 
063417,000069:    5561           30002        DOWNFLAG           CA       Q                                     
063418,000070:    5562           05565                           TC       DEBIT                                 
063419,000071:    5563           70001                           MASK     L                                     #  RESET BIT
063420,000072:    5564           15554                           TCF      COMFLAG                               
063421,000073: 
063422,000074:    5565           64770        DEBIT              AD       ONE                                   #  GET DE BITS
063423,000075:    5566           00004                           INHINT                                         
063424,000076:    5567           54063                           TS       ITEMP3                                
063425,000077:    5570           34777                           CA       LOW4                                  #  DEC15
063426,000078:    5571           54061                           TS       ITEMP1                                
063427,000079:    5572           50063                           INDEX    ITEMP3                                
063428,000080:    5573           27777                           CA       0          -1                         #  ADRES
063429,000081:    5574           54001                           TS       L                                     
063430,000082:    5575           34772                           CA       ZERO                                  
063431,000083:    5576           00006                           EXTEND                                         

Page 1480

063433,000085:    5577           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
063434,000086:    5600           52062                           DXCH     ITEMP1                                
063435,000087:    5601           50061                           INDEX    ITEMP1                                
063436,000088:    5602           30074                           CA       FLAGWRD0                              
063437,000089:    5603           54001                           TS       L                                     #  CURRENT STATE
063438,000090:    5604           50062                           INDEX    ITEMP2                                
063439,000091:    5605           44752                           CS       BIT15                                 #  -(15 - BIT)
063440,000092:    5606           00002                           TC       Q                                     
063441,000093: 

Page 1481

063443,000095: 
063444,000096:                                                                                                  #  DELAYJOB - A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
063445,000097: 
063446,000098:                                                                                                  #  ENTRANCE REQUIREMENTS ...
063447,000099:                                                                                                  #                CAF     DT              DELAY JOB FOR DT CENTISECS
063448,000100:                                                                                                  #                TC      BANKCALL
063449,000101:                                                                                                  #                CADR    DELAYJOB
063450,000102: 
063451,000103: 00,2000                                           SETLOC   DLAYJOB                               
063452,000104: 00,2000                                           BANK                                           
063453,000105: 
063454,000106:                                                                                                  #  THIS MUST REMAIN IN BANK 0 *****************************************
063455,000107: 00,3730                                           COUNT*   $$/DELAY                              
063456,000108: 00,3730           35016        1SECDELY           CAF      1SEC                                  
063457,000109: 00,3731           00004        DELAYJOB           INHINT                                         
063458,000110: 00,3732           54002                           TS       Q                                     #  STORE DELAY DT IN Q FOR DLY -1 IN
063459,000111: 
063460,000112: 00,3733           36214                           CAF      DELAYNUM                              #  WAITLIST
063461,000113: 00,3734           54070        DELLOOP            TS       RUPTREG1                              
063462,000114: 00,3735           50000                           INDEX    A                                     
063463,000115: 00,3736           31000                           CA       DELAYLOC                              #  IS THIS DELAYLOC AVAILABLE
063464,000116: 00,3737           00006                           EXTEND                                         
063465,000117: 00,3740           13745                           BZF      OK2DELAY                              #  YES
063466,000118: 
063467,000119: 00,3741           10070                           CCS      RUPTREG1                              #  NO, TRY NEXT DELAYLOC
063468,000120: 00,3742           13734                           TCF      DELLOOP                               
063469,000121: 
063470,000122: 00,3743           07706                           TC       BAILOUT                               #  NO AVAILABLE LOCS AVAILABLE.
063471,000123: 00,3744           31104                           OCT      31104                                 
063472,000124: 
063473,000125: 00,3745           33765        OK2DELAY           CA       TCSLEEP                               #  SET WAITLIST IMMEDIATE RETURN
063474,000126: 00,3746           54061                           TS       WAITEXIT                              
063475,000127: 
063476,000128: 00,3747           30004                           CA       FBANK                                 
063477,000129: 00,3750           60070                           AD       RUPTREG1                              #  STORE BBANK FOR TASK CALL
063478,000130: 00,3751           54001                           TS       L                                     
063479,000131: 
063480,000132: 00,3752           33766                           CAF      WAKECAD                               #  STORE CADR FOR TASK CALL
063481,000133: 00,3753           15243                           TCF      DLY2       -1                         #  DLY IS IN WAITLIST ROUTINE
063482,000134: 
063483,000135: 00,3754           04665        TCGETCAD           TC       MAKECADR                              #  GET CALLERS FCADR
063484,000136: 
063485,000137: 00,3755           50070                           INDEX    RUPTREG1                              
063486,000138: 00,3756           55000                           TS       DELAYLOC                              #  SAVE DELAY CADRS
063487,000139: 
063488,000140: 00,3757           05163                           TC       JOBSLEEP                              
063489,000141: 
063490,000142: 00,3760           34772        WAKER              CAF      ZERO                                  
063491,000143: 00,3761           50006                           INDEX    BBANK                                 
063492,000144: 00,3762           57000                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE
063493,000145: 00,3763           05167                           TC       JOBWAKE                               

Page 1482

063495,000147: 00,3764           05314                           TC       TASKOVER                              
063496,000148: 
063497,000149: 00,3765           03752        TCSLEEP            GENADR   TCGETCAD   -2                         
063498,000150: 00,3766           03760        WAKECAD            GENADR   WAKER                                 
063499,000151: 

Page 1483

063501,000153: 
063502,000154:                                                                                                  #  GENTRAN, A BLOCK TRANSFER ROUTINE.
063503,000155: 
063504,000156:                                                                                                  #  WRITTEN BY D. EYLES
063505,000157:                                                                                                  #  MOD 1 BY KERNAN                                               UTILITYM REV 17 11/18/67
063506,000158: 
063507,000159:                                                                                                  #  MOD 2 BY SCHULENBERG  (REMOVE RELINT)   SKIPPER REV 4 2/28/68
063508,000160: 
063509,000161:                                                                                                  #  THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
063510,000162:                                                                                                  #  CONSECUTIVE ERASABLE LOCATIONS.  IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
063511,000163: 
063512,000164:                                                                                                  #  GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT.  THE CALLING SEQUENCE IS:
063513,000165: 
063514,000166:                                                                                                  #        I       CA      N-1             # OF QUANTITIES MINUS ONE.
063515,000167:                                                                                                  #        I +1    TC      GENTRAN         IN FIXED-FIXED.
063516,000168:                                                                                                  #        I +2    ADRES   L               STARTING ADRES OF DATA TO BE MOVED.
063517,000169:                                                                                                  #        I +3    ADRES   M               STARTING ADRES OF DUPLICATION BLOCK.
063518,000170:                                                                                                  #        I +4                            RETURNS HERE.
063519,000171: 
063520,000172:                                                                                                  #  GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
063521,000173: 
063522,000174:                                                                                                  #  A, L AND ITEMP1 ARE NOT PRESERVED.
063523,000175: 
063524,000176:    4000                                           SETLOC   FFTAG4                                
063525,000177:    4000                                           BANK                                           
063526,000178: 
063527,000179:    5607     0061                                  EBANK=   ITEMP1                                
063528,000180: 
063529,000181:    5607                                           COUNT*   $$/TRAN                               
063530,000182: 
063531,000183:    5607           00004        GENTRAN            INHINT                                         
063532,000184:    5610           54061                 +1        TS       ITEMP1                                #  SAVE N-1
063533,000185:    5611           50002                           INDEX    Q                                     #  C(Q) = ADRES L.
063534,000186:    5612           60000                           AD       0                                     #  ADRES (L + N - 1).
063535,000187:    5613           50000                           INDEX    A                                     
063536,000188:    5614           30000                           CA       0                                     #  C(ABOVE).
063537,000189:    5615           54001                           TS       L                                     #  SAVE DATA.
063538,000190:    5616           30061                           CA       ITEMP1                                
063539,000191:    5617           50002                           INDEX    Q                                     
063540,000192:    5620           60001                           AD       1                                     #  ADRES (M + N - 1).
063541,000193:    5621           50000                           INDEX    A                                     
063542,000194:    5622           22000                           LXCH     0                                     #  STUFF IT.
063543,000195:    5623           10061                           CCS      ITEMP1                                #  LOOP UNTIL N-1 = 0.
063544,000196:    5624           15610                           TCF      GENTRAN    +1                         
063545,000197:    5625           16710                           TCF      Q+2                                   #  RETURN TO CALLER.
063546,000198: 

Page 1484

063548,000200: 
063549,000201:                                                                                                  #  B5OFF         ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
063550,000202:                                                                                                  #  MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
063551,000203: 
063552,000204:    5626                                           COUNT*   $$/EXTVB                              
063553,000205: 
063554,000206:    5626           44764        B5OFF              CS       BIT5                                  
063555,000207:    5627           71247                           MASK     EXTVBACT                              
063556,000208:    5630           55247                           TS       EXTVBACT                              
063557,000209:    5631           05205                           TC       ENDOFJOB                              
063558,000210: 

Page 1485

063560,000212: 
063561,000213:                                                                                                  #  SUBROUTINES TO TURN OFF AND TURN ON TRACKER FAIL LIGHT.
063562,000214: 
063563,000215:    5632                                           COUNT*   $$/DSPLA                              
063564,000216:    5632           00004        TRFAILOF           INHINT                                         
063565,000217:    5633           47670                           CS       OCT40200                              #  TURN OFF TRACKER LIGHT
063566,000218:    5634           71241                           MASK     DSPTAB     +11D                       
063567,000219:    5635           64752                           AD       BIT15                                 
063568,000220:    5636           55241                           TS       DSPTAB     +11D                       
063569,000221:    5637           41337                           CS       OPTMODES                              #  TO INSURE THAT OCDU FAIL WILL GO ON
063570,000222:    5640           74762                           MASK     OCDUFBIT                              #  AGAIN IF IT WAS ON IN ADDITION TO
063571,000223:    5641           27337                           ADS      OPTMODES                              #  TRACKER FAIL.
063572,000224: 
063573,000225:    5642           00003        REQ                RELINT                                         
063574,000226:    5643           00002                           TC       Q                                     
063575,000227: 
063576,000228:    5644           00004        TRFAILON           INHINT                                         
063577,000229:    5645           41241                           CS       DSPTAB     +11D                       #  TURN ON
063578,000230:    5646           77670                           MASK     OCT40200                              
063579,000231:    5647           27241                           ADS      DSPTAB     +11D                       
063580,000232:    5650           15642                           TCF      REQ                                   
063581,000233: 
063582,000234:    5651           10000        INCRQCK            CCS      A                                     
063583,000235:    5652           24002                           INCR     Q                                     
063584,000236:    5653           00002                           TC       Q                                     
063585,000237:    5654                                           COUNT*   $$/CFAIL                              
063586,000238:    5654           54001        C31BTCHK           TS       L                                     #  SAVE MASK
063587,000239:    5655           30374                           CA       C31FLWRD                              
063588,000240:    5656           74346                           MASK     FAILBIT                               
063589,000241:    5657           10000                           CCS      A                                     
063590,000242:    5660           15667                           TCF      USEFLBTS                              
063591,000243:    5661           00006                           EXTEND                                         
063592,000244:    5662           00031                           READ     CHAN31                                
063593,000245:    5663           70001        C31CMCHK           MASK     L                                     
063594,000246:    5664           00006                           EXTEND                                         
063595,000247:    5665           16711                           BZF      TCQ                                   #  BITS SET
063596,000248:    5666           16706                           TCF      Q+1                                   #  BITS NOT SET
063597,000249: 
063598,000250:    5667           30374        USEFLBTS           CA       C31FLWRD                              
063599,000251:    5670           15663                           TCF      C31CMCHK                              
063600,000252: 
063601,000253:    5671     4346               FAILBIT            =        PRIO30                                
063602,000254: 

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