Source Code

These source-code files are part of a reconstructed copy of Skylark 048, the Block II Command Module (CM) Apollo Guidance Computer (AGC) software for the Skylab-2, Skylab-3, Skylab-4, and Apollo-Soyuz Test Project missions.

They have been created via disassembly of binary dumps of the original core rope memory modules actually flown on Skylab-2, part numbers 2010802-541, 2010802-551, 2010802-561, 2010802-571, 2010802-581, and 2010802-591. Access to these modules was provided by the New Mexico Museum of Space History, who we are much indebted to.

The source code for the Apollo 15, 16, and 17 software, Artemis 072, was used as a starting point. Heavy use was made of TRW 4900.5-244, Programmed Guidance Equations for Skylark Command Module Earth Orbital Program, dated 14 February 1972. This document contains pseudocode of essentially all of Skylark, using original program labels which have been copied for this source reconstruction.

Since only binary dumps (rather than listings) of Skylark are available as source material, all comments and labels are approximate. They have been taken from the Programmed Guidance Equations or other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing.

059445,000002:                                                                                                  ## Copyright:   Public domain.
059446,000003:                                                                                                  ## Filename:    SERVICE_ROUTINES.agc
059447,000004:                                                                                                  ## Purpose:     A section of Skylark revision 048.
059448,000005:                                                                                                  ##              It is part of the source code for the Apollo Guidance Computer (AGC)
059449,000006:                                                                                                  ##              for Skylab-2, Skylab-3, Skylab-4, and ASTP. No original listings of
059450,000007:                                                                                                  ##              this software are available; instead, this file was created via
059451,000008:                                                                                                  ##              disassembly of dumps of the core rope modules actually flown on
059452,000009:                                                                                                  ##              Skylab-2. Access to these modules was provided by the New Mexico
059453,000010:                                                                                                  ##              Museum of Space History.
059454,000011:                                                                                                  ## Assembler:   yaYUL
059455,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
059456,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
059457,000014:                                                                                                  ## Mod history: 2023-09-04 MAS  Created from Artemis 072.
059458,000015:                                                                                                  ##              2024-03-05 MAS  Updated for Skylark 48.
059459,000016: 
059460,000017: 
059461,000018: 10,2000                                           SETLOC   DISPLAYS                              
059462,000019: 10,2000                                           BANK                                           
059463,000020: 10,3635                                           COUNT*   $$/DSPLA                              
059464,000021: 10,3635           54001        UPENT2             TS       L                                     
059465,000022: 10,3636           40100                           CS       FLAGWRD4                              
059466,000023: 10,3637           70001                           MASK     L                                     
059467,000024: 10,3640           26100                           ADS      FLAGWRD4                              
059468,000025: 10,3641           00002                           TC       Q                                     #  RETURN
059469,000026: 
059470,000027: 10,3642           40000        DOWNENT2           COM                                            #  START TO PROCESS INFORMATION
059471,000028: 10,3643           70100                           MASK     FLAGWRD4                              
059472,000029: 10,3644           54100                           TS       FLAGWRD4                              
059473,000030: 10,3645           00002                           TC       Q                                     #  RETURN
059474,000031: 
059475,000032: 10,3646     5005               OCT7               EQUALS   SEVEN                                 
059476,000033: 
059477,000034: 
059478,000035:    7706                                           BLOCK    3                                     
059479,000036:    6000                                           SETLOC   FFTAG6                                
059480,000037:    6000                                           BANK                                           
059481,000038: 
059482,000039:    7706                                           COUNT*   $$/DKDAP                              
059483,000040: 
059484,000041:    7706           00006        MAKERUPT           EXTEND                                         
059485,000042:    7707           07706                           EDRUPT   MAKERUPT                              
059486,000043: 
059487,000044: 
059488,000045:                                                                                                  #  UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES.  USING THEM, WHETHER OR
059489,000046:                                                                                                  #  NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
059490,000047:                                                                                                  #  EBANK SETTING.  A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
059491,000048:                                                                                                  #  ASSEMBLER.
059492,000049: 
059493,000050:                                                                                                  #  AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS.  ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
059494,000051:                                                                                                  #  NAME ANY BIT IN ERASABLE MEMORY.
059495,000052: 
059496,000053:                                                                                                  #  CALLING SEQUENCES ARE AS FOLLOWS:-
059497,000054:                                                                                                  #                TC      UPFLAG                  TC      DOWNFLAG
059498,000055:                                                                                                  #                ADRES   NAME OF FLAG            ADRES   NAME OF FLAG
059499,000056: 
059500,000057:                                                                                                  #  RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
059501,000058:                                                                                                  #  UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
059502,000059: 
059503,000060:    6000                                           SETLOC   FFTAG13                               
059504,000061:    6000                                           BANK                                           
059505,000062:    7710                                           COUNT*   $$/FLAG                               
059506,000063: 
059507,000064:    7710           30002        UPFLAG             CA       Q                                     
059508,000065:    7711           07726                           TC       DEBIT                                 
059509,000066:    7712           40000                           COM                                            #  +(15 - BIT)
059510,000067:    7713           00006                           EXTEND                                         
059511,000068:    7714           04001                           ROR      LCHAN                                 #  SET BIT
059512,000069:    7715           50061        COMFLAG            INDEX    ITEMP1                                
059513,000070:    7716           54074                           TS       FLAGWRD0                              
059514,000071:    7717           22063                           LXCH     ITEMP3                                
059515,000072:    7720           00003                           RELINT                                         
059516,000073:    7721           00001                           TC       L                                     
059517,000074: 
059518,000075:    7722           30002        DOWNFLAG           CA       Q                                     
059519,000076:    7723           07726                           TC       DEBIT                                 
059520,000077:    7724           70001                           MASK     L                                     #  RESET BIT
059521,000078:    7725           17715                           TCF      COMFLAG                               
059522,000079: 
059523,000080:    7726           65001        DEBIT              AD       ONE                                   #  GET DE BITS
059524,000081:    7727           00004                           INHINT                                         
059525,000082:    7730           54063                           TS       ITEMP3                                
059526,000083:    7731           35010                           CA       LOW4                                  #  DEC15
059527,000084:    7732           54061                           TS       ITEMP1                                
059528,000085:    7733           50063                           INDEX    ITEMP3                                
059529,000086:    7734           27777                           CA       0          -1                         #  ADRES
059530,000087:    7735           54001                           TS       L                                     
059531,000088:    7736           35003                           CA       ZERO                                  
059532,000089:    7737           00006                           EXTEND                                         
059533,000090:    7740           10061                           DV       ITEMP1                                #  A = FLAGWRD, L = (15 - BIT)
059534,000091:    7741           52062                           DXCH     ITEMP1                                
059535,000092:    7742           50061                           INDEX    ITEMP1                                
059536,000093:    7743           30074                           CA       FLAGWRD0                              
059537,000094:    7744           54001                           TS       L                                     #  CURRENT STATE
059538,000095:    7745           50062                           INDEX    ITEMP2                                
059539,000096:    7746           44763                           CS       BIT15                                 #  -(15 - BIT)
059540,000097:    7747           00002                           TC       Q                                     
059541,000098: 
059542,000099: 
059543,000100:                                                                                                  #  DELAYJOB - A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
059544,000101: 
059545,000102:                                                                                                  #  ENTRANCE REQUIREMENTS ...
059546,000103:                                                                                                  #                CAF     DT              DELAY JOB FOR DT CENTISECS
059547,000104:                                                                                                  #                TC      BANKCALL
059548,000105:                                                                                                  #                CADR    DELAYJOB
059549,000106: 
059550,000107: 00,2000                                           SETLOC   DLAYJOB                               
059551,000108: 00,2000                                           BANK                                           
059552,000109: 
059553,000110:                                                                                                  #  THIS MUST REMAIN IN BANK 0 *****************************************
059554,000111: 00,3730                                           COUNT*   $$/DELAY                              
059555,000112: 00,3730           35030        1SECDELY           CAF      1SEC                                  
059556,000113: 00,3731           00004        DELAYJOB           INHINT                                         
059557,000114: 00,3732           54002                           TS       Q                                     #  STORE DELAY DT IN Q FOR DLY -1 IN
059558,000115: 
059559,000116: 00,3733           36214                           CAF      DELAYNUM                              #  WAITLIST
059560,000117: 00,3734           54070        DELLOOP            TS       RUPTREG1                              
059561,000118: 00,3735           50000                           INDEX    A                                     
059562,000119: 00,3736           30773                           CA       DELAYLOC                              #  IS THIS DELAYLOC AVAILABLE
059563,000120: 00,3737           00006                           EXTEND                                         
059564,000121: 00,3740           13745                           BZF      OK2DELAY                              #  YES
059565,000122: 
059566,000123: 00,3741           10070                           CCS      RUPTREG1                              #  NO, TRY NEXT DELAYLOC
059567,000124: 00,3742           13734                           TCF      DELLOOP                               
059568,000125: 
059569,000126: 00,3743           07750                           TC       BAILOUT                               #  NO AVAILABLE LOCS AVAILABLE.
059570,000127: 00,3744           31104                           OCT      31104                                 
059571,000128: 
059572,000129: 00,3745           33765        OK2DELAY           CA       TCSLEEP                               #  SET WAITLIST IMMEDIATE RETURN
059573,000130: 00,3746           54061                           TS       WAITEXIT                              
059574,000131: 
059575,000132: 00,3747           30004                           CA       FBANK                                 
059576,000133: 00,3750           60070                           AD       RUPTREG1                              #  STORE BBANK FOR TASK CALL
059577,000134: 00,3751           54001                           TS       L                                     
059578,000135: 
059579,000136: 00,3752           33766                           CAF      WAKECAD                               #  STORE CADR FOR TASK CALL
059580,000137: 00,3753           15256                           TCF      DLY2       -1                         #  DLY IS IN WAITLIST ROUTINE
059581,000138: 
059582,000139: 00,3754           04676        TCGETCAD           TC       MAKECADR                              #  GET CALLERS FCADR
059583,000140: 
059584,000141: 00,3755           50070                           INDEX    RUPTREG1                              
059585,000142: 00,3756           54773                           TS       DELAYLOC                              #  SAVE DELAY CADRS
059586,000143: 
059587,000144: 00,3757           05176                           TC       JOBSLEEP                              
059588,000145: 
059589,000146: 00,3760           35003        WAKER              CAF      ZERO                                  
059590,000147: 00,3761           50006                           INDEX    BBANK                                 
059591,000148: 00,3762           56773                           XCH      DELAYLOC                              #  MAKE DELAYLOC AVAILABLE
059592,000149: 00,3763           05202                           TC       JOBWAKE                               
059593,000150: 00,3764           05327                           TC       TASKOVER                              
059594,000151: 
059595,000152: 00,3765           03752        TCSLEEP            GENADR   TCGETCAD   -2                         
059596,000153: 00,3766           03760        WAKECAD            GENADR   WAKER                                 
059597,000154: 
059598,000155: 
059599,000156:                                                                                                  #  GENTRAN, A BLOCK TRANSFER ROUTINE.
059600,000157: 
059601,000158:                                                                                                  #  WRITTEN BY D. EYLES
059602,000159:                                                                                                  #  MOD 1 BY KERNAN                                               UTILITYM REV 17 11/18/67
059603,000160: 
059604,000161:                                                                                                  #  MOD 2 BY SCHULENBERG  (REMOVE RELINT)   SKIPPER REV 4 2/28/68
059605,000162: 
059606,000163:                                                                                                  #  THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
059607,000164:                                                                                                  #  CONSECUTIVE ERASABLE LOCATIONS.  IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
059608,000165: 
059609,000166:                                                                                                  #  GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT.  THE CALLING SEQUENCE IS:
059610,000167: 
059611,000168:                                                                                                  #        I       CA      N-1             # OF QUANTITIES MINUS ONE.
059612,000169:                                                                                                  #        I +1    TC      GENTRAN         IN FIXED-FIXED.
059613,000170:                                                                                                  #        I +2    ADRES   L               STARTING ADRES OF DATA TO BE MOVED.
059614,000171:                                                                                                  #        I +3    ADRES   M               STARTING ADRES OF DUPLICATION BLOCK.
059615,000172:                                                                                                  #        I +4                            RETURNS HERE.
059616,000173: 
059617,000174:                                                                                                  #  GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
059618,000175: 
059619,000176:                                                                                                  #  A, L AND ITEMP1 ARE NOT PRESERVED.
059620,000177: 
059621,000178:    4000                                           SETLOC   FFTAG4                                
059622,000179:    4000                                           BANK                                           
059623,000180: 
059624,000181:    5562     0061                                  EBANK=   ITEMP1                                
059625,000182: 
059626,000183:    5562                                           COUNT*   $$/TRAN                               
059627,000184: 
059628,000185:    5562           00004        GENTRAN            INHINT                                         
059629,000186:    5563           54061                 +1        TS       ITEMP1                                #  SAVE N-1
059630,000187:    5564           50002                           INDEX    Q                                     #  C(Q) = ADRES L.
059631,000188:    5565           60000                           AD       0                                     #  ADRES (L + N - 1).
059632,000189:    5566           50000                           INDEX    A                                     
059633,000190:    5567           30000                           CA       0                                     #  C(ABOVE).
059634,000191:    5570           54001                           TS       L                                     #  SAVE DATA.
059635,000192:    5571           30061                           CA       ITEMP1                                
059636,000193:    5572           50002                           INDEX    Q                                     
059637,000194:    5573           60001                           AD       1                                     #  ADRES (M + N - 1).
059638,000195:    5574           50000                           INDEX    A                                     
059639,000196:    5575           22000                           LXCH     0                                     #  STUFF IT.
059640,000197:    5576           10061                           CCS      ITEMP1                                #  LOOP UNTIL N-1 = 0.
059641,000198:    5577           15563                           TCF      GENTRAN    +1                         
059642,000199:    5600           16710                           TCF      Q+2                                   #  RETURN TO CALLER.
059643,000200: 
059644,000201: 
059645,000202:                                                                                                  #  B5OFF         ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
059646,000203:                                                                                                  #  MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
059647,000204: 
059648,000205:    5601                                           COUNT*   $$/EXTVB                              
059649,000206: 
059650,000207:    5601           44775        B5OFF              CS       BIT5                                  
059651,000208:    5602           71237                           MASK     EXTVBACT                              
059652,000209:    5603           55237                           TS       EXTVBACT                              
059653,000210:    5604           05220                           TC       ENDOFJOB                              
059654,000211: 
059655,000212: 
059656,000213:                                                                                                  #  SUBROUTINES TO TURN OFF AND TURN ON TRACKER FAIL LIGHT.
059657,000214: 
059658,000215:    5605                                           COUNT*   $$/DSPLA                              
059659,000216:    5605           00004        TRFAILOF           INHINT                                         
059660,000217:    5606           47670                           CS       OCT40200                              #  TURN OFF TRACKER LIGHT
059661,000218:    5607           71231                           MASK     DSPTAB     +11D                       
059662,000219:    5610           64763                           AD       BIT15                                 
059663,000220:    5611           55231                           TS       DSPTAB     +11D                       
059664,000221:    5612           41327                           CS       OPTMODES                              #  TO INSURE THAT OCDU FAIL WILL GO ON
059665,000222:    5613           74773                           MASK     OCDUFBIT                              #  AGAIN IF IT WAS ON IN ADDITION TO
059666,000223:    5614           27327                           ADS      OPTMODES                              #  TRACKER FAIL.
059667,000224: 
059668,000225:    5615           00003        REQ                RELINT                                         
059669,000226:    5616           00002                           TC       Q                                     
059670,000227: 
059671,000228:    5617           00004        TRFAILON           INHINT                                         
059672,000229:    5620           41231                           CS       DSPTAB     +11D                       #  TURN ON
059673,000230:    5621           77670                           MASK     OCT40200                              
059674,000231:    5622           27231                           ADS      DSPTAB     +11D                       
059675,000232:    5623           15615                           TCF      REQ                                   
059676,000233: 
059677,000234:    5624           10000        INCRQCK            CCS      A                                     
059678,000235:    5625           24002                           INCR     Q                                     
059679,000236:    5626           00002                           TC       Q                                     
059680,000237:    5627                                           COUNT*   $$/CFAIL                              
059681,000238:    5627           54001        C31BTCHK           TS       L                                     #  SAVE MASK
059682,000239:    5630           30373                           CA       C31FLWRD                              
059683,000240:    5631           74346                           MASK     FAILBIT                               
059684,000241:    5632           10000                           CCS      A                                     
059685,000242:    5633           15642                           TCF      USEFLBTS                              
059686,000243:    5634           00006                           EXTEND                                         
059687,000244:    5635           00031                           READ     CHAN31                                
059688,000245:    5636           70001        C31CMCHK           MASK     L                                     
059689,000246:    5637           00006                           EXTEND                                         
059690,000247:    5640           16711                           BZF      TCQ                                   #  BITS SET
059691,000248:    5641           16706                           TCF      Q+1                                   #  BITS NOT SET
059692,000249: 
059693,000250:    5642           30373        USEFLBTS           CA       C31FLWRD                              
059694,000251:    5643           15636                           TCF      C31CMCHK                              
059695,000252: 
059696,000253:    5644     4346               FAILBIT            =        PRIO30                                
059697,000254: 

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