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. |
056627,000002: ## Copyright: Public domain.
056628,000003: ## Filename: RESTARTS_ROUTINE.agc
056629,000004: ## Purpose: A section of Skylark revision 048.
056630,000005: ## It is part of the source code for the Apollo Guidance Computer (AGC)
056631,000006: ## for Skylab-2, Skylab-3, Skylab-4, and ASTP. No original listings of
056632,000007: ## this software are available; instead, this file was created via
056633,000008: ## disassembly of dumps of the core rope modules actually flown on
056634,000009: ## Skylab-2. Access to these modules was provided by the New Mexico
056635,000010: ## Museum of Space History.
056636,000011: ## Assembler: yaYUL
056637,000012: ## Contact: Ron Burkey <info@sandroid.org>.
056638,000013: ## Website: www.ibiblio.org/apollo/index.html
056639,000014: ## Mod history: 2023-09-04 MAS Created from Artemis 072.
056640,000015:
056641,000016: 01,2000 SETLOC RESTART
056642,000017: 01,2000 BANK
056643,000018:
056644,000019: 01,3475 E3,1436 EBANK= PHSNAME1 # GOPROG MUST SWITCH TO THIS EBANK
056645,000020:
056646,000021: 01,3475 COUNT* $$/RSROU
056647,000022: 01,3475 30161 RESTARTS CA MPAC +5 # GET GROUP NUMBER -1
056648,000023: 01,3476 60000 DOUBLE # SAVE FOR INDEXING
056649,000024: 01,3477 54155 TS TEMP2G
056650,000025:
056651,000026: 01,3500 33135 CA PHS2CADR # SET UP EXIT IN CASE IT IS AN EVEN
056652,000027: 01,3501 54157 TS TEMPSWCH # TABLE PHASE
056653,000028:
056654,000029: 01,3502 33534 CA RTRNCADR # TO SAVE TIME ASSUME IT WILL GET NEXT
056655,000030: 01,3503 54707 TS GOLOC +2 # GROUP AFTER THIS
056656,000031:
056657,000032: 01,3504 30154 CA TEMPPHS
056658,000033: 01,3505 75037 MASK OCT1400
056659,000034: 01,3506 10000 CCS A # IS IT A VARIABLE OR TABLE RESTART
056660,000035: 01,3507 13520 TCF ITSAVAR # IT:S A VARIABLE RESTART
056661,000036:
056662,000037: 01,3510 10154 GETPART2 CCS TEMPPHS # IS IT AN X.1 RESTART
056663,000038: 01,3511 10000 CCS A
056664,000039: 01,3512 13620 TCF ITSATBL # NO, ITS A TABLE RESTART
056665,000040:
056666,000041: 01,3513 35065 CA PRIO14 # IT IS AN X.1 RESTART, THEREFORE START
056667,000042: 01,3514 05150 FVACCADR TC FINDVAC # THE DISPLAY RESTART ROUTINE (=GENADR)
056668,000043: 01,3515 E3,1400 EBANK= LST1
056669,000044: 01,3515 03143 20063 2CADR INITDSP
056670,000045:
056671,000046:
056672,000047: 01,3517 03534 TC RTRNCADR # FINISHED WITH THIS GROUP, GET NEXT ONE
056673,000048:
056674,000049: 01,3520 75037 ITSAVAR MASK OCT1400 # IS IT TYPE B ?
056675,000050: 01,3521 10000 CCS A
056676,000051: 01,3522 13571 TCF ITSLIKEB # YES, IT IS TYPE B
056677,000052:
056678,000053: 01,3523 00006 EXTEND # STORE THE JOB (OR TASK) 2CADR FOR EXIT
056679,000054: 01,3524 50155 NDX TEMP2G
056680,000055: 01,3525 31437 DCA PHSNAME1
056681,000056: 01,3526 52706 DXCH GOLOC
056682,000057:
056683,000058: 01,3527 30154 CA TEMPPHS # SEE IF THIS IS A JOB, TASK, OR A LONGCAL
056684,000059: 01,3530 75005 MASK OCT7
056685,000060: 01,3531 67701 AD MINUS2
056686,000061: 01,3532 10000 CCS A
056687,000062: 01,3533 13703 TCF ITSLNGCL # ITS A LONGCALL
056688,000063:
056689,000064: 01,3534 04662 RTRNCADR TC SWRETURN # CANT GET HERE
056690,000065: 01,3535 13537 TCF ITSAWAIT
056691,000066: 01,3536 13604 TCF ITSAJOB # ITS A JOB
056692,000067:
056693,000068: 01,3537 33471 ITSAWAIT CA WTLTCADR # SET UP WAITLIST CALL
056694,000069: 01,3540 54704 TS GOLOC -1
056695,000070:
056696,000071: 01,3541 50155 NDX TEMP2G # DIRECTLY STORED
056697,000072: 01,3542 31250 CA PHSPRDT1
056698,000073: 01,3543 10000 TIMETEST CCS A # IS IT AN IMMEDIATE RESTART
056699,000074: 01,3544 24000 INCR A # NO,
056700,000075: 01,3545 13550 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
056701,000076:
056702,000077: 01,3546 15503 TCF ITSINDIR # STORED INDIRECTLY
056703,000078:
056704,000079: 01,3547 13567 TCF IMEDIATE # IT WANTS AN IMMEDIATE RESTART
056705,000080:
056706,000081: # ***** THIS MUST BE IN FIXED FIXED *****
056707,000082:
056708,000083: 4000 SETLOC FFTAG2
056709,000084: 4000 BANK
056710,000085:
056711,000086: 5503 COUNT* $$/RSROU
056712,000087: 5503 22706 ITSINDIR LXCH GOLOC +1 # GET THE CORRECT E BANK IN CASE THIS IS
056713,000088: 5504 22006 LXCH BB # SWITCHED ERRASIBLE
056714,000089:
056715,000090: 5505 50000 NDX A # GET THE TIME INDIRECTLY
056716,000091: 5506 30001 CA 1
056717,000092:
056718,000093: 5507 22006 LXCH BB # RESTORE THE BB AND GOLOC
056719,000094: 5510 22706 LXCH GOLOC +1
056720,000095:
056721,000096: 5511 13550 TCF FINDTIME # FIND OUT WHEN IT SHOULD BEGIN
056722,000097:
056723,000098: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
056724,000099:
056725,000100: 01,2000 SETLOC RESTART
056726,000101: 01,2000 BANK
056727,000102:
056728,000103: 01,3550 COUNT* $$/RSROU
056729,000104: 01,3550 40000 FINDTIME COM # MAKE NEGITIVE SINCE IT WILL BE SUBTRACTD
056730,000105: 01,3551 54001 TS L # AND SAVE
056731,000106: 01,3552 50155 NDX TEMP2G
056732,000107: 01,3553 41247 CS TBASE1
056733,000108: 01,3554 00006 EXTEND
056734,000109: 01,3555 60025 SU TIME1
056735,000110: 01,3556 10000 CCS A
056736,000111: 01,3557 40000 COM
056737,000112: 01,3560 67663 AD OCT37776
056738,000113: 01,3561 65001 AD ONE
056739,000114: 01,3562 60001 AD L
056740,000115: 01,3563 10000 CCS A
056741,000116: 01,3564 35003 -3 CAF ZERO
056742,000117: 01,3565 13567 TCF +2
056743,000118: 01,3566 13567 TCF +1
056744,000119: 01,3567 65001 IMEDIATE AD ONE
056745,000120: 01,3570 00704 TC GOLOC -1
056746,000121: 01,3571 33534 ITSLIKEB CA RTRNCADR # TYPE B, SO STORE RETURN IN
056747,000122: 01,3572 54157 TS TEMPSWCH # TEMPSWCH IN CASE OF AN EVEN PHASE
056748,000123:
056749,000124: 01,3573 33141 CA PRT2CADR # SET UP EXIT TO GET TABLE PART OF THIS
056750,000125: 01,3574 54707 TS GOLOC +2 # VARIABLE TYPE OF PHASE
056751,000126:
056752,000127: 01,3575 30154 CA TEMPPHS # MAKE THE PHASE LOOK RIGHT FOR THE TABLE
056753,000128: 01,3576 76043 MASK OCT177 # PART OF THIS VARIABLE PHASE
056754,000129: 01,3577 54154 TS TEMPPHS
056755,000130:
056756,000131: 01,3600 00006 EXTEND
056757,000132: 01,3601 50155 NDX TEMP2G # OBTAIN THE JOB:S 2CADR
056758,000133: 01,3602 31437 DCA PHSNAME1
056759,000134: 01,3603 52706 DXCH GOLOC
056760,000135:
056761,000136: 01,3604 50155 ITSAJOB NDX TEMP2G # NOW ADD THE PRIORITY AND LET:S GO
056762,000137: 01,3605 31250 CA PHSPRDT1
056763,000138: 01,3606 54704 CHKNOVAC TS GOLOC -1 # SAVE PRIO UNTIL WE SEE IF ITS
056764,000139: 01,3607 00006 EXTEND # A FINDVAC OR A NOVAC
056765,000140: 01,3610 63614 BZMF ITSNOVAC
056766,000141:
056767,000142: 01,3611 33514 CAF FVACCADR # POSITIVE, SET UP FINDVAC CALL.
056768,000143: 01,3612 56704 XCH GOLOC -1 # PICK UP PRIO,
056769,000144: 01,3613 00704 TC GOLOC -1 # AND GO
056770,000145:
056771,000146: 01,3614 35323 ITSNOVAC CAF NOVACADR # NEGATIVE,
056772,000147: 01,3615 56704 XCH GOLOC -1 # SET UP NOVAC CALL,
056773,000148: 01,3616 40000 COM # CORRECT PRIO,
056774,000149: 01,3617 00704 TC GOLOC -1 # AND GO
056775,000150:
056776,000151: 01,3620 54020 ITSATBL TS CYR # FIND OUT IF THE PHASE IS ODD OR EVEN
056777,000152: 01,3621 10020 CCS CYR
056778,000153: 01,3622 13623 TCF +1 # IT:S EVEN
056779,000154: 01,3623 13721 TCF ITSEVEN
056780,000155:
056781,000156: 01,3624 33534 CA RTRNCADR # IN CASE THIS IS THE SECOND PART OF A
056782,000157: 01,3625 54707 TS GOLOC +2 # TYPE B RESTART, WE NEED PROPER EXIT
056783,000158:
056784,000159: 01,3626 30154 CA TEMPPHS # SET UP POINTER FOR FINDING OUR PLACE IN
056785,000160: 01,3627 54021 TS SR # THE RESTART TABLES
056786,000161: 01,3630 60021 AD SR
056787,000162: 01,3631 50155 NDX TEMP2G
056788,000163: 01,3632 62001 AD SIZETAB +1
056789,000164: 01,3633 54156 TS POINTER
056790,000165:
056791,000166: 01,3634 00006 CONTBL2 EXTEND # FIND OUT WHAT:S IN THE TABLE
056792,000167: 01,3635 50156 NDX POINTER
056793,000168: 01,3636 32002 DCA CADRTAB # GET THE 2CADR
056794,000169:
056795,000170: 01,3637 22706 LXCH GOLOC +1 # STORE THE BB INFORMATION
056796,000171:
056797,000172: 01,3640 10000 CCS A # IS IT A JOB OR IS IT TIMED
056798,000173: 01,3641 24000 INCR A # POSITIVE, MUST BE A JOB
056799,000174: 01,3642 13715 TCF ITSAJOB2
056800,000175:
056801,000176: 01,3643 24000 INCR A # MUST BE EITHER A WAITLIST OR LONGCALL
056802,000177: 01,3644 54705 TS GOLOC # LET-S STORE THE CORRECT CADR
056803,000178:
056804,000179: 01,3645 33471 CA WTLTCADR # SET UP OUR EXIT TO WAITLIST
056805,000180: 01,3646 54704 TS GOLOC -1
056806,000181:
056807,000182: 01,3647 30706 CA GOLOC +1 # NOW FIND OUT IF IT IS A WAITLIST CALL
056808,000183: 01,3650 74770 MASK BIT10 # THIS SHOULD BE ONE IF WE HAVE -BB
056809,000184: 01,3651 10000 CCS A # FOR THAT MATTER SO SHOULD BE BITS 9,8,7,
056810,000185: # 6,5, AND LAST BUT NOT LEAST (PERHAPS NOT
056811,000186: # IN IMPORTANCE ANYWAY. BIT 4
056812,000187: 01,3652 13710 TCF ITSWTLST # IT IS A WAITLIST CALL
056813,000188:
056814,000189: 01,3653 50156 NDX POINTER # OBTAIN THE ORIGINAL DELTA T
056815,000190: 01,3654 32000 CA PRDTTAB # ADDRESS FOR THIS LONGCALL
056816,000191:
056817,000192: 01,3655 15512 TCF ITSLGCL1 # NOW GO GET THE DELTA TIME
056818,000193:
056819,000194: # ***** THIS MUST BE IN FIXED FIXED *****
056820,000195:
056821,000196: 4000 SETLOC FFTAG2
056822,000197: 4000 BANK
056823,000198:
056824,000199: 5512 COUNT* $$/RSROU
056825,000200: 5512 22706 ITSLGCL1 LXCH GOLOC +1 # OBTAIN THE CORRECT E BANK
056826,000201: 5513 22006 LXCH BB
056827,000202: 5514 22706 LXCH GOLOC +1 # AND PRESERVE OUR E AND F BANKS
056828,000203:
056829,000204: 5515 00006 EXTEND # GET THE DELTA TIME
056830,000205: 5516 50000 NDX A
056831,000206: 5517 30001 DCA 0
056832,000207: 5520 22706 LXCH GOLOC +1 # RESTORE OUR E AND F BANK
056833,000208: 5521 22006 LXCH BB # RESTORE THE TASKS E AND F BANKS
056834,000209: 5522 22706 LXCH GOLOC +1 # AND PRESERVE OUR L
056835,000210:
056836,000211: 5523 13656 TCF ITSLGCL2 # NOW LET:S PROCESS THIS LONGCALL
056837,000212:
056838,000213: # ***** YOU MAY RETURN TO SWITCHED FIXED *****
056839,000214:
056840,000215: 01,2000 SETLOC RESTART
056841,000216: 01,2000 BANK
056842,000217:
056843,000218: 01,3656 COUNT* $$/RSROU
056844,000219: 01,3656 53275 ITSLGCL2 DXCH LONGTIME
056845,000220:
056846,000221: 01,3657 00006 EXTEND # CALCULATE TIME LEFT
056847,000222: 01,3660 40025 DCS TIME2
056848,000223: 01,3661 21275 DAS LONGTIME
056849,000224: 01,3662 00006 EXTEND
056850,000225: 01,3663 31273 DCA LONGBASE
056851,000226: 01,3664 21275 DAS LONGTIME
056852,000227:
056853,000228: 01,3665 11274 CCS LONGTIME # FIND OUT HOW THIS SHOULD BE RESTARTED
056854,000229: 01,3666 13676 TCF LONGCLCL
056855,000230: 01,3667 13671 TCF +2
056856,000231: 01,3670 13564 TCF IMEDIATE -3
056857,000232: 01,3671 11275 CCS LONGTIME +1
056858,000233: 01,3672 13676 TCF LONGCLCL
056859,000234: 01,3673 13674 NOOP # CAN:T GET HERE *********
056860,000235: 01,3674 13564 TCF IMEDIATE -3
056861,000236: 01,3675 13567 TCF IMEDIATE
056862,000237:
056863,000238: 01,3676 33145 LONGCLCL CA LGCLCADR # WE WILL GO TO LONGCALL
056864,000239: 01,3677 54704 TS GOLOC -1
056865,000240:
056866,000241: 01,3700 00006 EXTEND # PREPARE OUR ENTRY TO LONGCALL
056867,000242: 01,3701 31275 DCA LONGTIME
056868,000243: 01,3702 00704 TC GOLOC -1
056869,000244:
056870,000245: 01,3703 33471 ITSLNGCL CA WTLTCADR # ASSUME IT WILL GO TO WAITLIST
056871,000246: 01,3704 54704 TS GOLOC -1
056872,000247:
056873,000248: 01,3705 50155 NDX TEMP2G
056874,000249: 01,3706 41250 CS PHSPRDT1 # GET THE DELTA T ADDRESS
056875,000250:
056876,000251: 01,3707 15512 TCF ITSLGCL1 # NOW GET THE DELTA TIME
056877,000252:
056878,000253: 01,3710 40706 ITSWTLST CS GOLOC +1 # CORRECT THE BBCON INFORMATION
056879,000254: 01,3711 54706 TS GOLOC +1
056880,000255:
056881,000256: 01,3712 50156 NDX POINTER # GET THE DT AND FIND OUT IF IT WAS STORED
056882,000257: 01,3713 32000 CA PRDTTAB # DIRECTLY OR INDIRECTLY
056883,000258:
056884,000259: 01,3714 13543 TCF TIMETEST # FIND OUT HOW THE TIME IS STORED
056885,000260:
056886,000261: 01,3715 56705 ITSAJOB2 XCH GOLOC # STORE THE CADR
056887,000262:
056888,000263: 01,3716 50156 NDX POINTER # ADD THE PRIORITY AND LET:S GO
056889,000264: 01,3717 32000 CA PRDTTAB
056890,000265:
056891,000266: 01,3720 13606 TCF CHKNOVAC
056892,000267:
056893,000268: 01,3721 30157 ITSEVEN CA TEMPSWCH # SET UP FOR EITHER THE SECOND PART OF THE
056894,000269: 01,3722 54707 TS GOLOC +2 # TABLE, OR A RETURN FOR THE NEXT GROUP
056895,000270:
056896,000271: 01,3723 50155 NDX TEMP2G # SET UP POINTER FOR OUR LOCATION WITHIN
056897,000272: 01,3724 32000 CA SIZETAB # THE TABLE
056898,000273: 01,3725 60154 AD TEMPPHS # THIS MAY LOOK BAD BUT LET:S SEE YOU DO
056899,000274: 01,3726 60154 AD TEMPPHS # BETTER IN TIME OR NUMBERR OF LOCATIONS
056900,000275: 01,3727 60154 AD TEMPPHS
056901,000276: 01,3730 54156 TS POINTER
056902,000277:
056903,000278: 01,3731 13634 TCF CONTBL2 # NOW PROCESS WHAT IS IN THE TABLE
056904,000279:
056905,000280: 01,3732 36214 PHSPART2 CA THREE # SET THE POINTER FOR THE SECOND HALF OF
056906,000281: 01,3733 26156 ADS POINTER # THE TABLE
056907,000282:
056908,000283: 01,3734 33534 CA RTRNCADR # THIS WILL BE OUR LAST TIME THROUGH THE
056909,000284: 01,3735 54707 TS GOLOC +2 # EVEN TABLE, SO AFTER IT GET THE NEXT
056910,000285: # GROUP
056911,000286: 01,3736 13634 TCF CONTBL2 # SO LET:S GET THE SECOND ENTRY IN THE TBL
056912,000287:
056913,000288: 01,3737 0154 TEMPPHS EQUALS MPAC
056914,000289: 01,3737 0155 TEMP2G EQUALS MPAC +1
056915,000290: 01,3737 0156 POINTER EQUALS MPAC +2
056916,000291: 01,3737 0157 TEMPSWCH EQUALS MPAC +3
056917,000292: 01,3737 7701 MINUS2 EQUALS NEG2
056918,000293: 01,3737 6043 OCT177 EQUALS LOW7
056919,000294:
End of include-file RESTARTS_ROUTINE.agc. Parent file is MAIN.agc