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.

017708,000002:                                                                                                  ## Copyright:   Public domain.
017709,000003:                                                                                                  ## Filename:    KALCMANU_STEERING.agc
017710,000004:                                                                                                  ## Purpose:     A section of Skylark revision 048.
017711,000005:                                                                                                  ##              It is part of the source code for the Apollo Guidance Computer (AGC)
017712,000006:                                                                                                  ##              for Skylab-2, Skylab-3, Skylab-4, and ASTP. No original listings of
017713,000007:                                                                                                  ##              this software are available; instead, this file was created via
017714,000008:                                                                                                  ##              disassembly of dumps of the core rope modules actually flown on
017715,000009:                                                                                                  ##              Skylab-2. Access to these modules was provided by the New Mexico
017716,000010:                                                                                                  ##              Museum of Space History.
017717,000011:                                                                                                  ## Assembler:   yaYUL
017718,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
017719,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
017720,000014:                                                                                                  ## Mod history: 2023-09-04 MAS  Created from Artemis 072.
017721,000015:                                                                                                  ##              2024-03-01 MAS  Updated for Skylark 48.
017722,000016: 
017723,000017: 
017724,000018:                                                                                                  #  GENERATION OF STEERING COMMANDS FOR DIGITAL AUTOPILOT FREE FALL MANEUVERS
017725,000019: 
017726,000020:                                                                                                  #  NEW COMMANDS WILL BE GENERATED EVERY ONE SECOND DURING THE MANEUVER
017727,000021: 
017728,000022: 22,2000                                           SETLOC   KALCMON1                              
017729,000023: 22,2000                                           BANK                                           
017730,000024: 
017731,000025: 22,3104  E6,1712                                  EBANK=   BCDU                                  
017732,000026: 
017733,000027: 22,3104                                           COUNT*   $$/KALC                               
017734,000028: 22,3104           35000        NEWDELHI           CAF      R67BIT                                
017735,000029: 22,3105           70104                           MASK     FLAGWRD8                              
017736,000030: 22,3106           00006                           EXTEND                                         
017737,000031: 22,3107           13114                           BZF      NEWANGL    -3                         #  NON-R67 SEQUENCE
017738,000032: 
017739,000033: 22,3110           34775                           CAF      TRACKBIT                              
017740,000034: 22,3111           70075                           MASK     FLAGWRD1                              
017741,000035: 22,3112           00006                           EXTEND                                         #  CHECK TRACKFLAG
017742,000036: 22,3113           13226                           BZF      MYSTEND                               #  IF OFF DO MYSTEND
017743,000037: 
017744,000038: 22,3114           41330                 -3        CS       HOLDFLAG                              
017745,000039: 22,3115           00006                           EXTEND                                         #  CHECK HOLDFLAG
017746,000040: 22,3116           62720                           BZMF     NOGOM2                                #  IF POS, DO STOPRATE
017747,000041: 
017748,000042: 22,3117           06006        NEWANGL            TC       INTPRET                               
017749,000043: 22,3120           75160                 +1        AXC,1    AXC,2                                 
017750,000044: 22,3121           02271                                    MIS                                   #  COMPUTE THE NEW MATRIX FROM S/C TO
017751,000045: 22,3122           03425                                    DEL                                   #  STABLE MEMBER AXES
017752,000046: 22,3123           77624                           CALL                                           
017753,000047: 22,3124           44304                                    MXM3                                  
017754,000048: 22,3125           45575                           VLOAD    STADR                                 
017755,000049: 22,3126           51471                           STOVL    MIS        +12D                       #  CALCULATE NEW DESIRED CDU ANGLES
017756,000050: 22,3127           77626                           STADR                                          
017757,000051: 22,3130           51477                           STOVL    MIS        +6D                        
017758,000052: 22,3131           77626                           STADR                                          
017759,000053: 22,3132           75505                           STORE    MIS                                   
017760,000054: 22,3133           45160                           AXC,1    CALL                                  
017761,000055: 22,3134           02271                                    MIS                                   
017762,000056: 22,3135           44647                                    DCMTOCDU                              #  PICK UP THE NEW CDU ANGLES FROM MATRIX
017763,000057: 22,3136           77634                           RTB                                            
017764,000058: 22,3137           45625                                    V1STO2S                               
017765,000059: 22,3140           03320        NWNGL17D           STORE    NCDU                                  #  NEW CDU ANGLES (TAG IS USED BY EDIT)
017766,000060: 22,3141           77414                           BONCLR   EXIT                                  
017767,000061: 22,3142           01215                                    CALCMAN2                              
017768,000062: 22,3143           40064                                    MANUSTAT                              #  TO START MANEUVER
017769,000063: 22,3144           35000                 -1        CAF      TWO                                   #           +0 OTHERWISE
017770,000064: 22,3145           55715        INCRDCDU           TS       KSPNDX                                
017771,000065: 22,3146           60000                           DOUBLE                                         
017772,000066: 22,3147           55716                           TS       KDPNDX                                
017773,000067: 22,3150           51715                           INDEX    KSPNDX                                
017774,000068: 22,3151           31717                           CA       NCDU                                  #  NEW DESIRED CDU ANGLES
017775,000069: 22,3152           00006                           EXTEND                                         
017776,000070: 22,3153           51715                           INDEX    KSPNDX                                
017777,000071: 22,3154           21712                           MSU      BCDU                                  #  INITIAL S/C ANGLE OR PREVIOUS DESIRED
017778,000072: 22,3155           00006                           EXTEND                                         #  CDU ANGLES
017779,000073: 22,3156           73056                           MP       QUADROT                               
017780,000074: 22,3157           51716                           INDEX    KDPNDX                                
017781,000075: 22,3160           53627                           DXCH     DELCDUX                               #  ANGLE INCREMENTS TO BE ADDED TO
017782,000076: 22,3161           51715                           INDEX    KSPNDX                                #  DCDU EVERY TENTH SEC
017783,000077: 22,3162           31717                           CA       NCDU                                  #  BY LEM DAP
017784,000078: 22,3163           51715                           INDEX    KSPNDX                                
017785,000079: 22,3164           57712                           XCH      BCDU                                  
017786,000080: 22,3165           51716                           INDEX    KDPNDX                                
017787,000081: 22,3166           55677                           TS       CDUXD                                 
017788,000082: 22,3167           11715                           CCS      KSPNDX                                
017789,000083: 22,3170           13145                           TCF      INCRDCDU                              #  LOOP FOR THREE AXES
017790,000084: 
017791,000085: 22,3171           00003                           RELINT                                         
017792,000086: 
017793,000087:                                                                                                  #  COMPARE PRESENT TIME WITH TIME TO TERMINATE MANEUVER
017794,000088: 
017795,000089: 22,3172           03202        TMANUCHK           TC       TIMECHK                               
017796,000090: 22,3173           04666                           TC       POSTJUMP                              
017797,000091: 22,3174           40151                           CADR     CONTMANU                              
017798,000092: 
017799,000093: 22,3175           35001                           CAF      ONE                                   
017800,000094: 22,3176           05246        MANUSTAL           TC       WAITLIST                              
017801,000095: 22,3177  E6,1712                                  EBANK=   BCDU                                  
017802,000096: 22,3177           02257 20066                     2CADR    MANUSTOP                              
017803,000097: 
017804,000098: 22,3201           15220                           TCF      ENDOFJOB                              
017805,000099: 
017806,000100: 
017807,000101: 22,3202           00006        TIMECHK            EXTEND                                         
017808,000102: 22,3203           40025                           DCS      TIME2                                 
017809,000103: 22,3204           53724                           DXCH     TTEMP                                 
017810,000104: 22,3205           00006                           EXTEND                                         
017811,000105: 22,3206           31750                           DCA      TM                                    
017812,000106: 22,3207           21724                           DAS      TTEMP                                 
017813,000107: 22,3210           11723                           CCS      TTEMP                                 
017814,000108: 22,3211           00002                           TC       Q                                     
017815,000109: 22,3212           13214                           TCF      +2                                    
017816,000110: 22,3213           13224                           TCF      2NDRETRN                              
017817,000111: 22,3214           11724                           CCS      TTEMP      +1                         
017818,000112: 22,3215           00002                           TC       Q                                     
017819,000113: 22,3216           13220                           TCF      MANUOFF                               
017820,000114: 22,3217           40000                           COM                                            
017821,000115: 22,3220           65030        MANUOFF            AD       1SEC                                  
017822,000116: 22,3221           00006                           EXTEND                                         
017823,000117: 22,3222           63224                           BZMF     2NDRETRN                              
017824,000118: 22,3223           24002                           INCR     Q                                     
017825,000119: 22,3224           24002        2NDRETRN           INCR     Q                                     
017826,000120: 22,3225           16706                           TCF      Q+1                                   
017827,000121: 22,3226           04666        MYSTEND            TC       POSTJUMP                              
017828,000122: 22,3227           74662                           CADR     FIXDB                                 
017829,000123: 
017830,000124: 20,2000                                           SETLOC   MANUSTUF                              
017831,000125: 20,2000                                           BANK                                           
017832,000126: 
017833,000127: 20,2064                                           COUNT*   $$/KALC                               
017834,000128: 20,2064           77776        MANUSTAT           EXIT                                           #  INITIALIZATION ROUTINE FOR AUTO
017835,000129: 20,2065           35000                           CAF      R67BIT                                #                      MANEUVERS
017836,000130: 20,2066           70104                           MASK     FLAGWRD8                              
017837,000131: 20,2067           00006                           EXTEND                                         
017838,000132: 20,2070           12075                           BZF      +5                                    
017839,000133: 20,2071           00006                           EXTEND                                         #  R67 RUNNING
017840,000134: 20,2072           34761                           DCA      DPOSMAX                               
017841,000135: 20,2073           53750                           DXCH     TM                                    
017842,000136: 20,2074           12104                           TCF      TMDON                                 
017843,000137: 20,2075           00006                           EXTEND                                         #  NON-R67 PROGRAM
017844,000138: 20,2076           30025                           DCA      TIME2                                 
017845,000139: 20,2077           21750                           DAS      TM                                    #  TM+T0    MANEUVER COMPLETION TIME
017846,000140: 20,2100           45030                           CS       1SEC                                  
017847,000141: 20,2101           54001                           TS       L                                     
017848,000142: 20,2102           45003                           CS       ZERO                                  
017849,000143: 20,2103           21750                           DAS      TM                                    #  (TM+T0)-1
017850,000144: 20,2104           00004        TMDON              INHINT                                         
017851,000145: 20,2105           45001                           CS       ONE                                   #  ENABLE AUTOPILOT TO PERFORM
017852,000146: 20,2106           55330                           TS       HOLDFLAG                              #  AUTOMATIC MANEUVERS
017853,000147: 20,2107           51475                           INDEX    WHICHDAP                              
017854,000148: 20,2110           12111                           TCF      +1                                    
017855,000149: 20,2111           12115                           TCF      +4                                    
017856,000150: 20,2112           44353                           CS       OCT25                                 
017857,000151: 20,2113           55663                           TS       CH31TEMP                              
017858,000152: 20,2114           12125                           TCF      HIGHGAIN   +3                         
017859,000153: 20,2115           40767                           CS       RATEINDX                              #  SEE IF MANEUVERING AT HIGH RATE
017860,000154: 20,2116           66211                           AD       SIX                                   
017861,000155: 20,2117           00006                           EXTEND                                         
017862,000156: 20,2120           62122                           BZMF     HIGHGAIN                              
017863,000157: 20,2121           12125                           TCF      +4                                    
017864,000158: 20,2122           41530        HIGHGAIN           CS       RCSFLAGS                              #  IF SO, SET HIGH RATE FLAG (BIT 15 OF
017865,000159: 20,2123           74763                           MASK     BIT15                                 #  RCSFLAGS)
017866,000160: 20,2124           27530                           ADS      RCSFLAGS                              
017867,000161: 20,2125           00006                           EXTEND                                         
017868,000162: 20,2126           31742                           DCA      BRATE                                 #  X-AXIS MANEUVER RATE
017869,000163: 20,2127           53555                           DXCH     WBODY                                 
017870,000164: 20,2130           00006                           EXTEND                                         
017871,000165: 20,2131           31744                           DCA      BRATE      +2                         #  Y-AXIS MANEUVER RATE
017872,000166: 20,2132           53557                           DXCH     WBODY1                                
017873,000167: 20,2133           00006                           EXTEND                                         
017874,000168: 20,2134           31746                           DCA      BRATE      +4                         #  Z-AXIS MANEUVER RATE
017875,000169: 20,2135           53561                           DXCH     WBODY2                                
017876,000170: 20,2136           31726                           CA       BIASTEMP   +1                         #  INSERT ATTITUDE ERROR BIASES
017877,000171: 20,2137           55615                           TS       BIAS                                  #  INTO AUTOPILOT
017878,000172: 20,2140           31730                           CA       BIASTEMP   +3                         
017879,000173: 20,2141           55616                           TS       BIAS1                                 
017880,000174: 20,2142           31732                           CA       BIASTEMP   +5                         
017881,000175: 20,2143           55617                           TS       BIAS2                                 
017882,000176: 20,2144           30025                           CA       TIME1                                 
017883,000177: 20,2145           65030                           AD       1SEC                                  
017884,000178: 20,2146           57722                           XCH      NEXTIME                               
017885,000179: 20,2147           04666                           TC       POSTJUMP                              
017886,000180: 20,2150           45144                           CADR     INCRDCDU   -1                         
017887,000181: 
017888,000182: 20,2151           00004        CONTMANU           INHINT                                         #  CONTINUE WITH UPDATE PROCESS
017889,000183: 20,2152           40025                           CS       TIME1                                 
017890,000184: 20,2153           61722                           AD       NEXTIME                               
017891,000185: 20,2154           10000                           CCS      A                                     
017892,000186: 20,2155           65001                           AD       ONE                                   
017893,000187: 20,2156           12161                           TCF      MANUCALL                              
017894,000188: 20,2157           64763                           AD       NEGMAX                                
017895,000189: 20,2160           40000                           COM                                            
017896,000190: 20,2161           05236        MANUCALL           TC       TWIDDLE                               
017897,000191: 20,2162           02167                           ADRES    UPDTCALL                              
017898,000192: 20,2163           00003                           RELINT                                         
017899,000193: 20,2164           35030                           CAF      1SEC                                  #  INCREMENT TIME FOR NEXT UPDATE
017900,000194: 20,2165           27722                           ADS      NEXTIME                               
017901,000195: 20,2166           15220                           TCF      ENDOFJOB                              
017902,000196: 
017903,000197: 20,2167           35000        UPDTCALL           CAF      R67BIT                                
017904,000198: 20,2170           70104                           MASK     FLAGWRD8                              
017905,000199: 20,2171           00006                           EXTEND                                         
017906,000200: 20,2172           12177                           BZF      +5                                    
017907,000201: 
017908,000202: 20,2173           11776                           CCS      R61CNTR                               
017909,000203: 20,2174           12176                           TCF      +2                                    
017910,000204: 20,2175           12204                           TCF      DOREMIS                               
017911,000205: 20,2176           55776                           TS       R61CNTR                               
017912,000206: 
017913,000207: 20,2177           37650                           CAF      PRIO26                                
017914,000208: 20,2200           05150                           TC       FINDVAC                               #  OF STEERING COMMANDS
017915,000209: 20,2201  E6,1712                                  EBANK=   BCDU                                  
017916,000210: 20,2201           03104 44066                     2CADR    NEWDELHI                              
017917,000211: 
017918,000212: 20,2203           05327                           TC       TASKOVER                              
017919,000213: 
017920,000214: 20,2204           37650        DOREMIS            CAF      PRIO26                                
017921,000215: 20,2205           05150                           TC       FINDVAC                               
017922,000216: 20,2206  E6,1712                                  EBANK=   BCDU                                  
017923,000217: 20,2206           02640 74066                     2CADR    R67RSTRT                              #  MAKE SURE MIS DOES DEGRADE
017924,000218: 
017925,000219: 20,2210           05327                           TC       TASKOVER                              
017926,000220: 
017927,000221:                                                                                                  #  ROUTINE FOR TERMINATING AUTOMATIC MANEUVERS
017928,000222: 
017929,000223: 10,2000                                           SETLOC   KALCMON3                              
017930,000224: 10,2000                                           BANK                                           
017931,000225: 
017932,000226: 10,2257                                           COUNT*   $$/KALC                               
017933,000227: 10,2257           04513        MANUSTOP           TC       STOPYZ                                
017934,000228: 10,2260           04725                           TC       IBNKCALL                              
017935,000229: 10,2261           45232                           CADR     LOADYZ                                
017936,000230: 
017937,000231: 10,2262           31277        ENDROLL            CA       CPHI                                  
017938,000232: 10,2263           55677                           TS       CDUXD                                 #  SET CDUXD TO THE COMMANDED OUTER GIMBAL
017939,000233: 10,2264           04463                           TC       STOPRATE                              
017940,000234: 10,2265           35065        ENDMANU            CAF      PRIO14                                
017941,000235: 10,2266           05150                           TC       FINDVAC                               
017942,000236: 10,2267  E6,1776                                  EBANK=   R61CNTR                               
017943,000237: 10,2267           02045 56066                     2CADR    ENDMANUV                              
017944,000238: 
017945,000239: 10,2271           05327                           TC       TASKOVER                              
017946,000240: 
017947,000241:    4000                                           SETLOC   STOPRAT                               
017948,000242:    4000                                           BANK                                           
017949,000243:    4463                                           COUNT*   $$/KALC                               
017950,000244:    4463           35003        STOPRATE           CAF      ZERO                                  
017951,000245:    4464           55626                           TS       DELCDUX                               
017952,000246:    4465           55627                           TS       DELCDUX    +1                         #  ZERO ROLL INCREMENTAL ANGLES
017953,000247:    4466           55554                           TS       WBODY                                 #  RATE
017954,000248:    4467           55555                           TS       WBODY      +1                         
017955,000249:    4470           55615                           TS       BIAS                                  #  BIAS
017956,000250: 
017957,000251:    4471           44763                           CS       BIT15                                 #  MAKE SURE HIGH RATE FLAG (BIT 15 OF
017958,000252:    4472           71530                           MASK     RCSFLAGS                              #  RCSFLAGS) IS RESET.
017959,000253:    4473           55530                           TS       RCSFLAGS                              
017960,000254: 
017961,000255:    4474           11330                           CCS      HOLDFLAG                              
017962,000256:    4475           14513                           TCF      STOPYZ                                
017963,000257:    4476           14513                           TCF      STOPYZ                                
017964,000258:    4477           55330                           TS       HOLDFLAG                              
017965,000259:    4500           31677                           CA       CDUXD                                 
017966,000260:    4501           55623                           TS       THETADX                               
017967,000261:    4502           31701                           CA       CDUYD                                 
017968,000262:    4503           55624                           TS       THETADY                               
017969,000263:    4504           31703                           CA       CDUZD                                 
017970,000264:    4505           55625                           TS       THETADZ                               
017971,000265:    4506           51475                           INDEX    WHICHDAP                              
017972,000266:    4507           14510                           TCF      +1                                    
017973,000267:    4510           14513                           TCF      STOPYZ                                
017974,000268:    4511           44353                           CS       OCT25                                 
017975,000269:    4512           55663                           TS       CH31TEMP                              
017976,000270: 
017977,000271:    4513           35003        STOPYZ             CAF      ZERO                                  
017978,000272:    4514           55630                           TS       DELCDUY                               #  ZERO PITCH, YAW
017979,000273:    4515           55631                           TS       DELCDUY    +1                         #  INCREMENTAL ANGLES
017980,000274:    4516           55632                           TS       DELCDUZ                               
017981,000275:    4517           55633                           TS       DELCDUZ    +1                         
017982,000276:    4520           55556                           TS       WBODY1                                #  RATES
017983,000277:    4521           55557                           TS       WBODY1     +1                         
017984,000278:    4522           55560                           TS       WBODY2                                
017985,000279:    4523           55561                           TS       WBODY2     +1                         
017986,000280:    4524           55616                           TS       BIAS1                                 #  BIASES
017987,000281:    4525           55617                           TS       BIAS2                                 
017988,000282:    4526           00002                           TC       Q                                     
017989,000283: 
017990,000284: 20,2000                                           SETLOC   MANUSTUF                              
017991,000285: 20,2000                                           BANK                                           
017992,000286: 
017993,000287: 20,2211                                           COUNT*   $$/KALC                               
017994,000288: 20,2211           30032        ZEROEROR           CA       CDUX                                  #  PICK UP CDU ANGLES AND STORE IN
017995,000289: 20,2212           55677                           TS       CDUXD                                 #  CDU DESIRED
017996,000290: 20,2213           30033                           CA       CDUY                                  
017997,000291: 20,2214           55701                           TS       CDUYD                                 
017998,000292: 20,2215           30034                           CA       CDUZ                                  
017999,000293: 20,2216           55703                           TS       CDUZD                                 
018000,000294: 20,2217           00002                           TC       Q                                     
018001,000295: 
018002,000296: 22,2000                                           SETLOC   KALCMON1                              
018003,000297: 22,2000                                           BANK                                           
018004,000298: 
018005,000299: 22,3230                                           COUNT*   $$/KALC                               
018006,000300: 22,3230           31277        LOADCDUD           CA       CPHI                                  #  STORE TERMINAL ANGLES INTO
018007,000301: 22,3231           55677                           TS       CDUXD                                 #  COMMAND ANGLES
018008,000302: 22,3232           31300        LOADYZ             CA       CTHETA                                
018009,000303: 22,3233           55701                           TS       CDUYD                                 
018010,000304: 22,3234           31301                           CA       CPSI                                  
018011,000305: 22,3235           55703                           TS       CDUZD                                 
018012,000306: 22,3236           00002                           TC       Q                                     

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