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. |
054263,000002: ## Copyright: Public domain.
054264,000003: ## Filename: INFLIGHT_ALIGNMENT_ROUTINES.agc
054265,000004: ## Purpose: A section of Skylark revision 048.
054266,000005: ## It is part of the source code for the Apollo Guidance Computer (AGC)
054267,000006: ## for Skylab-2, Skylab-3, Skylab-4, and ASTP. No original listings of
054268,000007: ## this software are available; instead, this file was created via
054269,000008: ## disassembly of dumps of the core rope modules actually flown on
054270,000009: ## Skylab-2. Access to these modules was provided by the New Mexico
054271,000010: ## Museum of Space History.
054272,000011: ## Assembler: yaYUL
054273,000012: ## Contact: Ron Burkey <info@sandroid.org>.
054274,000013: ## Website: www.ibiblio.org/apollo/index.html
054275,000014: ## Mod history: 2023-09-04 MAS Created from Artemis 072.
054276,000015: ## 2024-02-27 MAS Updated for Skylark 48.
054277,000016:
054278,000017:
054279,000018: 23,2000 SETLOC INFLIGHT
054280,000019: 23,2000 BANK
054281,000020:
054282,000021: 23,3177 E5,1660 EBANK= XSM
054283,000022:
054284,000023: # CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
054285,000024:
054286,000025: # THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES. THE THREE
054287,000026: # HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
054288,000027:
054289,000028: # THE OUTPUTS ARE THE THREE GYRO TORQUING ANGLES TO BE APPLIED TO THE Y, Z, AND X GYROS AND ARE STORED DP AT IGC,
054290,000029: # MGC, AND OGC RESPECTIVELY.
054291,000030:
054292,000031: 23,3177 COUNT* $$/INFLT
054293,000032: 23,3177 71220 CALCGTA ITA DLOAD # PUSHDOWN 00-03,16D-27D,34D-37D
054294,000033: 23,3200 00051 S2 # XDC = (XD1 XD2 XD3)
054295,000034: 23,3201 02703 XDC # YDC = (YD1 YD2 YD3)
054296,000035: 23,3202 65325 PDDL PDDL # ZDC = (ZD1 ZD2 ZD3)
054297,000036: 23,3203 15204 HI6ZEROS
054298,000037: 23,3204 02707 XDC +4
054299,000038: 23,3205 55476 DCOMP VDEF
054300,000039: 23,3206 77656 UNIT
054301,000040: 23,3207 14027 STODL ZPRIME # ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
054302,000041: 23,3210 00027 ZPRIME
054303,000042:
054304,000043: 23,3211 77742 SR1
054305,000044: 23,3212 14023 STODL SINTH # SIN(IGC) = ZP1
054306,000045: 23,3213 00033 ZPRIME +4
054307,000046: 23,3214 77742 SR1
054308,000047: 23,3215 34021 STCALL COSTH # COS(IGC) = ZP3
054309,000048: 23,3216 47250 ARCTRIG
054310,000049:
054311,000050: 23,3217 16762 STODL IGC # Y GYRO TORQUING ANGLE FRACTION OF REV.
054312,000051: 23,3220 02705 XDC +2
054313,000052: 23,3221 77742 SR1
054314,000053: 23,3222 14023 STODL SINTH # SIN(MGC) = XD2
054315,000054: 23,3223 00027 ZPRIME
054316,000055:
054317,000056: 23,3224 65205 DMP PDDL
054318,000057: 23,3225 02707 XDC +4 # PD00 = (ZP1)(XD3)
054319,000058: 23,3226 00033 ZPRIME +4
054320,000059:
054321,000060: 23,3227 45205 DMP DSU
054322,000061: 23,3230 02703 XDC # MPAC = (ZP3)(XD1)
054323,000062: 23,3231 77626 STADR
054324,000063: 23,3232 43756 STCALL COSTH # COS(MGC) = MPAC - PD00
054325,000064: 23,3233 47250 ARCTRIG
054326,000065: 23,3234 26764 STOVL MGC # Z GYRO TORQUING ANGLE FRACTION OF REV.
054327,000066: 23,3235 00027 ZPRIME
054328,000067: 23,3236 77641 DOT
054329,000068: 23,3237 02717 ZDC
054330,000069: 23,3240 24021 STOVL COSTH # COS(OGC) = ZP . ZDC
054331,000070: 23,3241 00027 ZPRIME
054332,000071: 23,3242 77641 DOT
054333,000072: 23,3243 02711 YDC
054334,000073: 23,3244 34023 STCALL SINTH # SIN(OGC) = ZP . YDC
054335,000074: 23,3245 47250 ARCTRIG
054336,000075:
054337,000076: 23,3246 36760 STCALL OGC # X GYRO TORQUING ANGLE FRACTION OF REV.
054338,000077: 23,3247 00051 S2
054339,000078:
054340,000079:
054341,000080: # ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
054342,000081:
054343,000082: # THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
054344,000083:
054345,000084: # THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA. THE OUTPUT IS ALSO
054346,000085: # AVAILABLE AT MPAC.
054347,000086:
054348,000087: 23,3250 51545 ARCTRIG DLOAD ABS # PUSHDOWN 16D-21D
054349,000088: 23,3251 00023 SINTH
054350,000089: 23,3252 50025 DSU BMN
054351,000090: 23,3253 07466 QTSN45 # ABS(SIN/4) - SIN(45)/4
054352,000091: 23,3254 47263 TRIG1 # IF (-45,45) OR (135,-135)
054353,000092:
054354,000093: 23,3255 72545 DLOAD SL1 # (45,135) OR (-135,-45)
054355,000094: 23,3256 00021 COSTH
054356,000095: 23,3257 75326 ACOS SIGN
054357,000096: 23,3260 00023 SINTH
054358,000097: 23,3261 00025 STORE THETA # X = ARCCOS(COS) WITH SIGN(SIN)
054359,000098: 23,3262 77616 RVQ
054360,000099:
054361,000100: 23,3263 72545 TRIG1 DLOAD SL1 # (-45,45) OR (135,-135)
054362,000101: 23,3264 00023 SINTH
054363,000102: 23,3265 77736 ASIN
054364,000103: 23,3266 14025 STODL THETA # X = ARCSIN(SIN) WITH SIGN(SIN)
054365,000104: 23,3267 00021 COSTH
054366,000105: 23,3270 77640 BMN
054367,000106: 23,3271 47274 TRIG2 # IF (135,-135)
054368,000107:
054369,000108: 23,3272 43545 DLOAD RVQ
054370,000109: 23,3273 00025 THETA # X = ARCSIN(SIN) (-45,45)
054371,000110:
054372,000111: 23,3274 75345 TRIG2 DLOAD SIGN # (135,-135)
054373,000112: 23,3275 15202 HIDPHALF
054374,000113: 23,3276 00023 SINTH
054375,000114: 23,3277 77625 DSU
054376,000115: 23,3300 00025 THETA
054377,000116: 23,3301 00025 STORE THETA # X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
054378,000117: 23,3302 77616 RVQ # (+) - (+) OR (-) - (-)
054379,000118:
054380,000119: # SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
054381,000120: # COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
054382,000121: # FLIGHT SUBROUTINES.
054383,000122:
054384,000123: # CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
054385,000124:
054386,000125: # THE INPUTS ARE 1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM. THE THREE HALF-UNIT
054387,000126: # VECTORS ARE STORED AT XNB, YNB, AND ZNB. 2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
054388,000127: # COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
054389,000128:
054390,000129: # THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
054391,000130:
054392,000131: 23,3303 77601 CALCGA SETPD # PUSHDOWN 00-05, 16D-21D, 34D-37D
054393,000132: 23,3304 00001 0
054394,000133: 23,3305 47375 VLOAD VXV
054395,000134: 23,3306 02703 XNB # XNB = OGA (OUTER GIMBAL AXIS)
054396,000135: 23,3307 02667 YSM # YSM = IGA (INNER GIMBAL AXIS)
054397,000136: 23,3310 41456 UNIT PUSH # PD0 = UNIT(OGA X IGA) = MGA
054398,000137:
054399,000138: 23,3311 44041 DOT ITA
054400,000139: 23,3312 02717 ZNB
054401,000140: 23,3313 00051 S2
054402,000141: 23,3314 24021 STOVL COSTH # COS(OG) = MGA . ZNB
054403,000142: 23,3315 00001 0
054404,000143: 23,3316 77641 DOT
054405,000144: 23,3317 02711 YNB
054406,000145: 23,3320 34023 STCALL SINTH # SIN(OG) = MGA . YNB
054407,000146: 23,3321 47250 ARCTRIG
054408,000147: 23,3322 26760 STOVL OGC
054409,000148: 23,3323 00001 0
054410,000149:
054411,000150: 23,3324 50235 VXV DOT # PROVISION FOR MG ANGLE OF 90 DEGREES
054412,000151: 23,3325 02703 XNB
054413,000152: 23,3326 02667 YSM
054414,000153: 23,3327 77752 SL1
054415,000154: 23,3330 24021 STOVL COSTH # COS(MG) = IGA . (MGA X OGA)
054416,000155: 23,3331 02667 YSM
054417,000156: 23,3332 77641 DOT
054418,000157: 23,3333 02703 XNB
054419,000158: 23,3334 34023 STCALL SINTH # SIN(MG) = IGA . OGA
054420,000159: 23,3335 47250 ARCTRIG
054421,000160: 23,3336 02764 STORE MGC
054422,000161:
054423,000162: 23,3337 45246 ABS DSU
054424,000163: 23,3340 07470 .166...
054425,000164: 23,3341 51014 BONCLR BPL
054426,000165: 23,3342 00205 P50FLAG
054427,000166: 23,3343 47345 CALCGA1
054428,000167: 23,3344 47363 GIMLOCK1 # IF ANGLE GREATER THAN 60 DEGREES
054429,000168:
054430,000169: 23,3345 50375 CALCGA1 VLOAD DOT
054431,000170: 23,3346 02675 ZSM
054432,000171: 23,3347 00001 0
054433,000172: 23,3350 24021 STOVL COSTH # COS(IG) = ZSM . MGA
054434,000173: 23,3351 02661 XSM
054435,000174: 23,3352 45441 DOT STADR
054436,000175: 23,3353 43754 STCALL SINTH # SIN(IG) = XSM . MGA
054437,000176: 23,3354 47250 ARCTRIG
054438,000177:
054439,000178: 23,3355 26762 STOVL IGC
054440,000179: 23,3356 02760 OGC
054441,000180: 23,3357 77634 RTB
054442,000181: 23,3360 45625 V1STO2S
054443,000182: 23,3361 35300 STCALL THETAD
054444,000183: 23,3362 00051 S2
054445,000184:
054446,000185: 23,3363 77776 GIMLOCK1 EXIT
054447,000186: 23,3364 05644 TC ALARM
054448,000187: 23,3365 00401 OCT 00401
054449,000188: 23,3366 07710 TC UPFLAG # GIMBAL LOCK HAS OCCURED
054450,000189: 23,3367 00056 ADRES GLOKFAIL
054451,000190:
054452,000191: 23,3370 06006 TC INTPRET
054453,000192: 23,3371 77650 GOTO
054454,000193: 23,3372 47345 CALCGA1
054455,000194:
054456,000195:
054457,000196: # AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
054458,000197:
054459,000198: # THE INPUTS ARE 1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD. 2) THE STAR2 VECTOR
054460,000199: # REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6. 3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
054461,000200: # AT LOCATION 6 OF THE VAC AREA. 4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
054462,000201: # THE VAC AREA.
054463,000202:
054464,000203: # THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B. THE THREE HALF-UNIT VECTORS ARE STORED
054465,000204: # AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
054466,000205:
054467,000206: 23,3373 66370 AXISGEN AXT,1 SSP # PUSHDOWN 00-30D,34D-37D
054468,000207: 23,3374 02732 STARAD +6
054469,000208: 23,3375 00051 S1
054470,000209: 23,3376 02716 STARAD -6
054471,000210:
054472,000211: 23,3377 77601 SETPD
054473,000212: 23,3400 00001 0
054474,000213: 23,3401 46773 AXISGEN1 VLOAD* VXV* # 06D UA = S1
054475,000214: 23,3402 02741 STARAD +12D,1 # STARAD +00D UB = S1
054476,000215: 23,3403 02747 STARAD +18D,1
054477,000216: 23,3404 77656 UNIT # 12D VA = UNIT(S1 X S2)
054478,000217: 23,3405 06747 STORE STARAD +18D,1 # STARAD +06D VB = UNIT(S1 X S2)
054479,000218: 23,3406 77773 VLOAD*
054480,000219: 23,3407 02741 STARAD +12D,1
054481,000220:
054482,000221: 23,3410 76433 VXV* VSL1
054483,000222: 23,3411 02747 STARAD +18D,1 # 18D WA = UA X VA
054484,000223: 23,3412 06755 STORE STARAD +24D,1 # STARAD +12D WB = UB X VB
054485,000224:
054486,000225: 23,3413 77700 TIX,1
054487,000226: 23,3414 47401 AXISGEN1
054488,000227:
054489,000228: 23,3415 66160 AXC,1 SXA,1
054490,000229: 23,3416 00006 6
054491,000230: 23,3417 00036 30D
054492,000231:
054493,000232: 23,3420 66370 AXT,1 SSP
054494,000233: 23,3421 00022 18D
054495,000234: 23,3422 00051 S1
054496,000235: 23,3423 00006 6
054497,000236:
054498,000237: 23,3424 66374 AXT,2 SSP
054499,000238: 23,3425 00006 6
054500,000239: 23,3426 00052 S2
054501,000240: 23,3427 00002 2
054502,000241:
054503,000242: 23,3430 76720 AXISGEN2 XCHX,1 VLOAD*
054504,000243: 23,3431 00036 30D # X1=-6 X2=+6 X1=-6 X2=+4 X1=-6 X2=+2
054505,000244: 23,3432 00001 0,1
054506,000245:
054507,000246: 23,3433 62757 VXSC* PDVL* # J=(UA)(UB1) J=(UA)(UB2) J=(UA)(UB3)
054508,000247: 23,3434 75044 STARAD +6,2
054509,000248: 23,3435 00007 6,1
054510,000249: 23,3436 77757 VXSC*
054511,000250: 23,3437 75036 STARAD +12D,2
054512,000251: 23,3440 30031 STOVL* 24D # K=(VA)(VB1) J=(VA)(VB2) J=(VA)(VB3)
054513,000252: 23,3441 00015 12D,1
054514,000253:
054515,000254: 23,3442 53357 VXSC* VAD
054516,000255: 23,3443 75030 STARAD +18D,2 # L=(WA)(WB1) J=(WA)(WB2) J=(WA)(WB3)
054517,000256: 23,3444 76455 VAD VSL1
054518,000257: 23,3445 00031 24D
054519,000258: 23,3446 53520 XCHX,1 UNIT
054520,000259: 23,3447 00036 30D
054521,000260: 23,3450 06725 STORE XDC +18D,1 # XDC = L+J+K YDC = L+J+K ZDC = L+J+K
054522,000261:
054523,000262: 23,3451 77700 TIX,1
054524,000263: 23,3452 47453 AXISGEN3
054525,000264:
054526,000265: 23,3453 77704 AXISGEN3 TIX,2
054527,000266: 23,3454 47430 AXISGEN2
054528,000267:
054529,000268: 23,3455 77775 VLOAD
054530,000269: 23,3456 02703 XDC
054531,000270: 23,3457 26725 STOVL STARAD
054532,000271: 23,3460 02711 YDC
054533,000272: 23,3461 26733 STOVL STARAD +6
054534,000273: 23,3462 02717 ZDC
054535,000274: 23,3463 02741 STORE STARAD +12D
054536,000275:
054537,000276: 23,3464 77616 RVQ
054538,000277:
054539,000278: 23,3465 05520 26075 QTSN45 2DEC .1768
054540,000279: 23,3467 05252 25253 .166... 2DEC .1666666667
End of include-file INFLIGHT_ALIGNMENT_ROUTINES.agc. Parent file is MAIN.agc