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. |
037289,000002: ## Copyright: Public domain.
037290,000003: ## Filename: CM_BODY_ATTITUDE.agc
037291,000004: ## Purpose: A section of Skylark revision 048.
037292,000005: ## It is part of the source code for the Apollo Guidance Computer (AGC)
037293,000006: ## for Skylab-2, Skylab-3, Skylab-4, and ASTP. No original listings of
037294,000007: ## this software are available; instead, this file was created via
037295,000008: ## disassembly of dumps of the core rope modules actually flown on
037296,000009: ## Skylab-2. Access to these modules was provided by the New Mexico
037297,000010: ## Museum of Space History.
037298,000011: ## Assembler: yaYUL
037299,000012: ## Contact: Ron Burkey <info@sandroid.org>.
037300,000013: ## Website: www.ibiblio.org/apollo/index.html
037301,000014: ## Mod history: 2023-09-04 MAS Created from Artemis 072.
037302,000015:
037303,000016: 37,2000 SETLOC BODYATT
037304,000017: 37,2000 BANK
037305,000018:
037306,000019: 37,3265 COUNT* $$/CMBAT
037307,000020: # PDL 12D - 15D SAFE.
037308,000021:
037309,000022: # VALUES OF GIMBAL AND BODY ANGLES VALID AT PIP TIME ARE SAVED DURING READACCS.
037310,000023:
037311,000024: 37,3265 E7,1451 EBANK= RTINIT # LET INTERPRETER SET EB
037312,000025:
037313,000026: 37,3265 06006 CM/POSE TC INTPRET # COME HERE VIA AVEGEXIT.
037314,000027:
037315,000028: 37,3266 77201 SETPD VLOAD
037316,000029: 37,3267 00001 0
037317,000030: 37,3270 01030 VN # KVSCALE = (12800/ .3048) /2VS
037318,000031: 37,3271 63361 VXSC PDVL
037319,000032: 37,3272 37561 -KVSCALE # KVSCALE = .81491944
037320,000033: 37,3273 02031 UNITW # FULL UNIT VECTOR
037321,000034: 37,3274 74235 VXV VXSC # VREL = V - WE*R
037322,000035: 37,3275 02250 UNITR
037323,000036: 37,3276 15114 KWE
037324,000037: 37,3277 45455 VAD STADR
037325,000038: 37,3300 74251 STORE -VREL # SAVE FOR ENTRY GUIDANCE. REF COORDS
037326,000039:
037327,000040: 37,3301 72056 UNIT LXA,1
037328,000041: 37,3302 00044 36D # ABVAL( -VREL) TO X1
037329,000042: 37,3303 03542 STORE UXA/2 # -UVREL REF COORDS
037330,000043:
037331,000044: 37,3304 57435 VXV VCOMP
037332,000045: 37,3305 02250 UNITR # .5 UNIT REF COORDS
037333,000046: 37,3306 66256 UNIT SSP # THE FOLLOWING IS TO PROVIDE A STABLE
037334,000047: 37,3307 00051 S1 # UN FOR THE END OF THE TERMINAL PHASE.
037335,000048: 37,3310 00476 SPVQUIT DEC .019405 # 1000/ 2 VS
037336,000049: 37,3311 77300 TIX,1 VLOAD # IF V-VQUIT POS, BRANCH.
037337,000050: 37,3312 77314 CM/POSE2 # SAVE UYA IN OLDUYA
037338,000051: 37,3313 03534 OLDUYA # OTHERWISE CONTINUE TO USE OLDUYA.
037339,000052: 37,3314 03550 CM/POSE2 STORE UYA/2 # REF COORDS
037340,000053:
037341,000054: 37,3315 03534 STORE OLDUYA # RESTORE, OR SAVE AS CASE MAY BE.
037342,000055:
037343,000056: 37,3316 57435 VXV VCOMP
037344,000057: 37,3317 03542 UXA/2 # FINISH OBTAINING TRAJECTORY TRIAD.
037345,000058: 37,3320 77772 VSL1
037346,000059: 37,3321 03556 STORE UZA/2 # REF COORDS
037347,000060:
037348,000061: 37,3322 77751 TLOAD # PICK UP CDUX, CDUY, CDUZ CORRESPONDING
037349,000062: 37,3323 03321 AOG/PIP # TO PIPUP TIME IN 2S,C AND SAVE.
037350,000063: 37,3324 14031 CM/TRIO STODL 24D
037351,000064: 37,3325 00032 25D # AIG/PIP
037352,000065:
037353,000066: 37,3326 41434 RTB PUSH # TO PDL0
037354,000067: 37,3327 45566 CDULOGIC
037355,000068: 37,3330 77746 COS
037356,000069: 37,3331 17564 STODL UBX/2 # CI /2
037357,000070: # AIG/PIP FROM PDL 0
037358,000071: 37,3332 57556 SIN DCOMP
037359,000072: 37,3333 17570 STODL UBX/2 +4 # -SI /2
037360,000073: 37,3334 00033 26D # AMG/PIP
037361,000074: 37,3335 41434 RTB PUSH # TO PDL 0
037362,000075: 37,3336 45566 CDULOGIC
037363,000076: 37,3337 65356 SIN PDDL # XCH PDL 0. SAVE SM /2
037364,000077: 37,3340 65346 COS PDDL # CM /2 TO PDL 2
037365,000078: 37,3341 00001 0 # SM /2
037366,000079: 37,3342 74276 DCOMP VXSC
037367,000080: 37,3343 03564 UBX/2
037368,000081: 37,3344 77772 VSL1 # NOISE WONT OVFL.
037369,000082: 37,3345 17572 STODL UBY/2 # =(-SMCI, NOISE, SMSI)/2
037370,000083: 37,3346 00003 2 # CM /2 REPLACES NOISE
037371,000084: 37,3347 17574 STODL UBY/2 +2 # UBY/2=(-SMCI, CM, SMSI)/2
037372,000085: 37,3350 00031 24D # AOG/PIP
037373,000086: 37,3351 41434 RTB PUSH # TO PDL 4
037374,000087: 37,3352 45566 CDULOGIC
037375,000088: 37,3353 65356 SIN PDDL # XCH PDL 4. SAVE SO /2
037376,000089: 37,3354 74346 COS VXSC # CO /2
037377,000090: 37,3355 03572 UBY/2
037378,000091: 37,3356 17572 STODL UBY/2 # UBY/2=(-COSMCI, COCM, COSMSI)/4
037379,000092: 37,3357 00005 4D # SO /2
037380,000093: 37,3360 57405 DMP DCOMP
037381,000094: 37,3361 03570 UBX/2 +4 # -SI /2
037382,000095: 37,3362 77615 DAD
037383,000096: 37,3363 03572 UBY/2 # INCREMENT BY (SOSI /4)
037384,000097: 37,3364 17572 STODL UBY/2
037385,000098: # SO /2 FROM PDL 4
037386,000099: 37,3365 43205 DMP DAD
037387,000100: 37,3366 03564 UBX/2 # CI /2
037388,000101: 37,3367 03576 UBY/2 +4
037389,000102: 37,3370 27576 STOVL UBY/2 +4 # YB/4 PLATFORM COORDS
037390,000103:
037391,000104: # YB = (-COSMCI + SOSI , COCM , COSMSI + SOCI )
037392,000105:
037393,000106: 37,3371 03572 UBY/2
037394,000107: 37,3372 72505 VXM VSL2
037395,000108: 37,3373 01720 REFSMMAT # .5 UNIT
037396,000109: 37,3374 17572 STODL UBY/2 # YB/2 DONE REF COORDS
037397,000110:
037398,000111: # CM /2 FROM PDL 2
037399,000112: 37,3375 76561 VXSC VSL1
037400,000113: 37,3376 03564 UBX/2
037401,000114: 37,3377 17564 STODL UBX/2 # =( CMCI, NOISE, -CMSI)/2
037402,000115: 37,3400 77626 STADR # SM /2 FROM PDL 0
037403,000116: 37,3401 50211 STOVL UBX/2 +2 # SM /2 REPLACES NOISE
037404,000117: 37,3402 03564 UBX/2 # XB/2 PLATFORM COORDS
037405,000118:
037406,000119: # XB = ( CMCI , SM , -CMSI )
037407,000120:
037408,000121: 37,3403 76505 VXM VSL1
037409,000122: 37,3404 01720 REFSMMAT # .5 UNIT
037410,000123: 37,3405 03564 STORE UBX/2 # XB/2 DONE REF COORDS
037411,000124:
037412,000125: 37,3406 76435 VXV VSL1
037413,000126: 37,3407 03572 UBY/2
037414,000127: 37,3410 27600 STOVL UBZ/2 # ZB/2 DONE REF COORDS
037415,000128:
037416,000129: # EQUIVALENT TO
037417,000130: # ZB = ( SOSMCI + COSI , -SOCM , -SOSMSI + COCI)
037418,000131:
037419,000132: 37,3411 03542 UXA/2 # -UVREL/2 = -UVA/2
037420,000133: 37,3412 53435 VXV UNIT # GET UNIT(-UVREL*UBY)/2 = UL/2
037421,000134: 37,3413 03572 UBY/2 # YB/2
037422,000135: 37,3414 50206 PUSH DOT # UL/2 TO PDL 0,5
037423,000136: 37,3415 03556 UZA/2 # UNA/2
037424,000137: 37,3416 24021 STOVL COSTH # COS(ROLL)/4
037425,000138: 37,3417 00001 0 # UL/2
037426,000139:
037427,000140: 37,3420 77641 DOT
037428,000141: 37,3421 03550 UYA/2
037429,000142: 37,3422 34023 STCALL SINTH # -SIN(ROLL)/4
037430,000143: 37,3423 47250 ARCTRIG
037431,000144: 37,3424 24007 STOVL 6D # -(ROLL/180) /2
037432,000145: 37,3425 03572 UBY/2
037433,000146: 37,3426 72441 DOT SL1 # -UVA.UBY = -SIN(BETA)
037434,000147: 37,3427 03542 UXA/2 # -UVREL/2
037435,000148: 37,3430 77736 ARCSIN
037436,000149: 37,3431 24010 STOVL 7D # -(BETA/180) /2
037437,000150: 37,3432 03564 UBX/2 # XB/2
037438,000151: 37,3433 77641 DOT # UL.UBX = -SIN(ALFA)
037439,000152: 37,3434 00001 0 # UL/2
037440,000153: 37,3435 24023 STOVL SINTH # -SIN(ALFA)/4
037441,000154: 37,3436 77641 DOT # UL/2 FROM PDL 0
037442,000155: 37,3437 03600 UBZ/2
037443,000156: 37,3440 34021 STCALL COSTH # COS(ALFA)/4
037444,000157: 37,3441 47250 ARCTRIG
037445,000158: 37,3442 24011 STOVL 8D # -(ALFA/180) /2
037446,000159: 37,3443 02250 UNITR # UR/2 REF COORDS
037447,000160: 37,3444 72441 DOT SL1
037448,000161: 37,3445 03556 UZA/2 # MORE ACCURATE AT LARGE ARG.
037449,000162: 37,3446 77726 ARCCOS
037450,000163: 37,3447 00013 STORE 10D # (-GAMA/180)/2
037451,000164: 37,3450 77551 TLOAD EXIT # ANGLES IN MPAC IN THE ORDER
037452,000165: # -( (ROLL, BETA, ALFA) /180)/2
037453,000166: 37,3451 00007 6D # THESE VALUES CORRECT AT PIPUP TIME.
037454,000167: # SPACER
037455,000168:
037456,000169: # BASIC SUBROUTINE TO UPDATE ATTITUDE ANGLES
037457,000170:
037458,000171: 37,3452 E6,1712 EBANK= AOG
037459,000172:
037460,000173: 37,3452 04611 CM/ATUP TC E6SETTER
037461,000174:
037462,000175: 37,3453 50120 CMTR1 INDEX FIXLOC
037463,000176: 37,3454 40012 CS 10D # (GAMA/180)/2
037464,000177: 37,3455 57753 XCH GAMA
037465,000178: 37,3456 54001 TS L
037466,000179:
037467,000180: 37,3457 00004 INHINT
037468,000181: # MUST REMAIN INHINTED UNTIL UPDATE OF BODY
037469,000182: # ANGLES, SO THAT GAMDIFSW IS VALID FIRST PASS
037470,000183: # INDICATOR.
037471,000184:
037472,000185: 37,3460 40102 CS CM/FLAGS
037473,000186: 37,3461 74767 MASK GMDIFBIT # GAMDIFSW = 94D BIT11 INITLY=
037474,000187: 37,3462 00006 EXTEND # DONT CALC GAMA DOT UNTIL HAVE FORMD
037475,000188: # ONE DIFFERENCE.
037476,000189: 37,3463 13466 BZF DOGAMDOT # IS OK, GO ON.
037477,000190: 37,3464 26102 ADS CM/FLAGS # KNOW BIT IS 0
037478,000191: 37,3465 03501 TC NOGAMDOT # SET GAMDOT = 0
037479,000192:
037480,000193: 37,3466 40001 DOGAMDOT CS L
037481,000194: 37,3467 61753 AD GAMA # DEL GAMA/360= T GAMDOT/360
037482,000195: 37,3470 00006 EXTEND
037483,000196: 37,3471 73562 MP TCDU # TCDU = .1 SEC, T = 2 SEC.
037484,000197: 37,3472 55754 TS GAMDOT # GAMA DOT TCDU / 180
037485,000198:
037486,000199: 37,3473 00006 EXTEND # IGNORE GAMDOT IF LEQ .5 DEG/SEC
037487,000200: 37,3474 63476 BZMF +2
037488,000201: 37,3475 40000 COM
037489,000202: 37,3476 65004 AD FIVE
037490,000203: 37,3477 00006 EXTEND
037491,000204: 37,3500 63503 BZMF +3 # SET GAMDOT=+0 AS TAG IF TOO SMALL.
037492,000205:
037493,000206: 37,3501 35003 NOGAMDOT CA ZERO # COME HERE INHINTED.
037494,000207: 37,3502 55754 TS GAMDOT
037495,000208: # FOR NOW LEAVE IN 2S,C
037496,000209: # UPDATE ANGLES BY CORRECTING EUILER ANG
037497,000210: # FOR ACCRUED INCREMENT SINCE PIPUP
037498,000211: # R = R EUIL + R(NOW) -R(PIPUP)
037499,000212: 37,3503 40154 CS MPAC # GET (R EUL/180) /2
037500,000213: 37,3504 60000 DOUBLE # POSSIBLE OVERFLOW
037501,000214: 37,3505 03552 TC CORANGOV # CORRECT FOR OVFL IF ANY
037502,000215: 37,3506 00006 EXTEND
037503,000216: 37,3507 61723 SU ROLL/PIP # GET INCR SINCE PIPUP
037504,000217: 37,3510 61715 AD ROLL/180 # ONLY SINGLE OVFL POSSIBLE.
037505,000218: 37,3511 03552 TC CORANGOV # CORRECT FOR OVFL IF ANY
037506,000219: 37,3512 55772 TS TEMPROLL
037507,000220:
037508,000221: 37,3513 40156 CS MPAC +2 # GET (ALFA EUL/180) /2
037509,000222: 37,3514 60000 DOUBLE # SAME AS FOR ROLL. NEEDED FOR EXT ATM DAP
037510,000223: 37,3515 03552 TC CORANGOV # CORRECT FOR OVFL IF ANY
037511,000224: 37,3516 00006 EXTEND
037512,000225: 37,3517 61724 SU ALFA/PIP
037513,000226: 37,3520 61716 AD ALFA/180
037514,000227: 37,3521 03552 TC CORANGOV # CORRECT FOR OVFL IF ANY
037515,000228: 37,3522 55773 TS TEMPALFA
037516,000229:
037517,000230: 37,3523 40155 CS MPAC +1 # GET (BETA EUL/180) /2
037518,000231: 37,3524 60000 CMTR2 DOUBLE
037519,000232: 37,3525 00006 EXTEND
037520,000233: 37,3526 61725 SU BETA/PIP
037521,000234: 37,3527 61717 AD BETA/180
037522,000235: 37,3530 57774 XCH TEMPBETA # OVFL NOT EXPECTED.
037523,000236:
037524,000237: 37,3531 35037 CA EBANK3
037525,000238: 37,3532 54003 TS EBANK
037526,000239:
037527,000240: 37,3533 E3,1446 EBANK= PHSNAME5
037528,000241: 37,3533 00006 EXTEND
037529,000242: 37,3534 33564 DCA REPOSADR # THIS ASSUMES THAT THE TC PHASCHNG
037530,000243: 37,3535 53447 DXCH PHSNAME5 # IS NOT CHANGED IN OCT 10035
037531,000244: # SERVICER.
037532,000245:
037533,000246: 37,3536 04611 TC E6SETTER
037534,000247:
037535,000248: 37,3537 E6,1712 EBANK= AOG
037536,000249: 37,3537 00006 REDOPOSE EXTEND # RE-STARTS COME HERE
037537,000250: 37,3540 31773 DCA TEMPROLL
037538,000251: 37,3541 53716 DXCH ROLL/180
037539,000252: 37,3542 31774 CA TEMPBETA
037540,000253: 37,3543 55717 TS BETA/180
037541,000254:
037542,000255: 37,3544 06006 TC INTPRET # CANT TC DANZIG AFTER PHASCHNG.
037543,000256: 37,3545 51575 CM/POSE3 VLOAD ABVAL # RETURN FROM CM/ATUP. (RESTART)
037544,000257: 37,3546 01030 VN # 2(-7) M/CS
037545,000258: 37,3547 03723 STORE VMAGI # FOR DISPLAY ON CALL.
037546,000259:
037547,000260: 37,3550 77650 GOTO
037548,000261: 37,3551 03355 POSEXIT # ENDEXIT, STARTENT, OR SCALEPOP.
037549,000262:
037550,000263: 37,3552 54001 CORANGOV TS L
037551,000264: 37,3553 00002 TC Q
037552,000265: 37,3554 50000 INDEX A
037553,000266: 37,3555 34762 CA LIMITS
037554,000267: 37,3556 26001 ADS L
037555,000268: 37,3557 00002 TC Q # COSTS 2 MCT TO USE. SEE ANGOVCOR.
037556,000269:
037557,000270: 37,3560 45730 53410 -KVSCALE 2DEC -.81491944 # -12800/(2 VS .3048)
037558,000271: 37,3562 03146 TCDU DEC .1 # TCDU = .1 SEC.
037559,000272:
037560,000273: 37,3563 E6,1712 EBANK= AOG
037561,000274: 37,3563 03537 76066 REPOSADR 2CADR REDOPOSE
End of include-file CM_BODY_ATTITUDE.agc. Parent file is MAIN.agc