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.

045422,000002:                                                                                                  ## Copyright:   Public domain.
045423,000003:                                                                                                  ## Filename:    INTER-BANK_COMMUNICATION.agc
045424,000004:                                                                                                  ## Purpose:     A section of Skylark revision 048.
045425,000005:                                                                                                  ##              It is part of the source code for the Apollo Guidance Computer (AGC)
045426,000006:                                                                                                  ##              for Skylab-2, Skylab-3, Skylab-4, and ASTP. No original listings of
045427,000007:                                                                                                  ##              this software are available; instead, this file was created via
045428,000008:                                                                                                  ##              disassembly of dumps of the core rope modules actually flown on
045429,000009:                                                                                                  ##              Skylab-2. Access to these modules was provided by the New Mexico
045430,000010:                                                                                                  ##              Museum of Space History.
045431,000011:                                                                                                  ## Assembler:   yaYUL
045432,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
045433,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
045434,000014:                                                                                                  ## Mod history: 2023-09-04 MAS  Created from Artemis 072.
045435,000015: 
045436,000016: 
045437,000017:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED TO CALL A SUBROUTINE IN ANOTHER BANK. IN THE BANKCALL VERSION, THE
045438,000018:                                                                                                  #  CADR OF THE SUBROUTINE IMMEDIATELY FOLLOWS THE  TC BANKCALL  INSTRUCTION, WITH C(A) AND C(L) PRESERVED.
045439,000019: 
045440,000020:    4000                                           SETLOC   FFTAG1                                
045441,000021:    4000                                           BANK                                           
045442,000022: 
045443,000023:    4647                                           COUNT*   $$/BANK                               
045444,000024:    4647           52134        BANKCALL           DXCH     BUF2                                  #  SAVE INCOMING A,L.
045445,000025:    4650           50002                           INDEX    Q                                     #  PICK UP CADR.
045446,000026:    4651           30000                           CA       0                                     
045447,000027:    4652           24002                 -1        INCR     Q                                     #  SO WE RETURN TO THE LOC. AFTER THE CADR.
045448,000028: 
045449,000029:                                                                                                  #  SWCALL IS  IDENTICAL TO BANKCALL, EXCEPT THAT THE CADR ARRIVES IN A.
045450,000030: 
045451,000031:    4653           54001        SWCALL             TS       L                                     
045452,000032:    4654           22004                           LXCH     FBANK                                 #  SWITCH BANKS, SAVING RETURN.
045453,000033:    4655           75053                           MASK     LOW10                                 #  GET SUB-ADDRESS OF CADR.
045454,000034:    4656           56002                           XCH      Q                                     #  A,L NOW CONTAINS DP RETURN.
045455,000035:    4657           52134                           DXCH     BUF2                                  #  RESTORING INPUTS IF THIS IS A BANKCALL.
045456,000036:    4660           50002                           INDEX    Q                                     
045457,000037:    4661           02000                           TC       10000                                 #  SETTING Q TO SWRETURN.
045458,000038: 
045459,000039:    4662           56134        SWRETURN           XCH      BUF2       +1                         #  COMES HERE TO RETURN TO CALLER. C(A,L)
045460,000040:    4663           56004                           XCH      FBANK                                 #  ARE PRESERVED FOR RETURN.
045461,000041:    4664           56134                           XCH      BUF2       +1                         
045462,000042:    4665           00133                           TC       BUF2                                  
045463,000043: 
045464,000044:                                                                                                  #  THE FOLLOWING ROUTINE CAN BE USED AS A UNILATERAL JUMP WITH C(A,L) PRESERVED AND THE CADR IMMEDIATELY
045465,000045:                                                                                                  #  FOLLOWING THE TC POSTJUMP INSTRUCTION.
045466,000046: 
045467,000047:    4666           56002        POSTJUMP           XCH      Q                                     #  SAVE INCOMING C(A).
045468,000048:    4667           50000                           INDEX    A                                     #  GET CADR.
045469,000049:    4670           30000                           CA       0                                     
045470,000050: 
045471,000051:                                                                                                  #  BANKJUMP IS THE SAME AS POSTJUMP, EXCEPT THAT THE CADR ARRIVES IN A.
045472,000052: 
045473,000053:    4671           54004        BANKJUMP           TS       FBANK                                 
045474,000054:    4672           75053                           MASK     LOW10                                 
045475,000055:    4673           56002                           XCH      Q                                     #  RESTORING INPUT C(A) IF THIS WAS A
045476,000056:    4674           50002        Q+10000            INDEX    Q                                     #  POSTJUMP.
045477,000057:    4675           12000        PRIO12             TCF      10000                                 #  PRIO12 = TCF  10000 = 12000
045478,000058: 
045479,000059: 
045480,000060:                                                                                                  #  THE FOLLOWING ROUTINE GETS THE RETURN CADR SAVED BY SWCALL OR BANKCALL AND LEAVES IT IN A.
045481,000061: 
045482,000062:    4676           35053        MAKECADR           CAF      LOW10                                 
045483,000063:    4677           70133                           MASK     BUF2                                  
045484,000064:    4700           60134                           AD       BUF2       +1                         
045485,000065:    4701           00002                           TC       Q                                     
045486,000066: 
045487,000067:    4702           54135        SUPDACAL           TS       MPTEMP                                
045488,000068:    4703           56004                           XCH      FBANK                                 #  SET FBANK FOR DATA.
045489,000069:    4704           00006                           EXTEND                                         
045490,000070:    4705           04007                           ROR      SUPERBNK                              #  SAVE FBANK IN BITS 15-11, AND
045491,000071:    4706           56135                           XCH      MPTEMP                                #  SUPERBANK IN BITS 7-5.
045492,000072:    4707           75053                           MASK     LOW10                                 
045493,000073:    4710           56001                           XCH      L                                     #  SAVE REL. ADR. IN BANK, FETCH SUPERBITS.
045494,000074:    4711           00004                           INHINT                                         #  BECAUSE RUPT DOES NOT SAVE SUPERBANK.
045495,000075:    4712           00006                           EXTEND                                         
045496,000076:    4713           01007                           WRITE    SUPERBNK                              #  SET SUPERBANK FOR DATA.
045497,000077:    4714           50001                           INDEX    L                                     
045498,000078:    4715           32000                           CA       10000                                 #  PINBALL (FIX MEM DISP) PREVENTS DCA HERE
045499,000079:    4716           56135                           XCH      MPTEMP                                #  SAVE 1ST WD, FETCH OLD FBANK AND SBANK.
045500,000080:    4717           00006                           EXTEND                                         
045501,000081:    4720           01007                           WRITE    SUPERBNK                              #  RESTORE SUPERBANK.
045502,000082:    4721           00003                           RELINT                                         
045503,000083:    4722           54004                           TS       FBANK                                 #  RESTORE FBANK.
045504,000084:    4723           30135                           CA       MPTEMP                                #  RECOVER FIRST WORD OF DATA.
045505,000085:    4724           00002                           RETURN                                         #  24 WDS. DATACALL 516 MU, SUPDACAL 432 MU
045506,000086: 
045507,000087: 
045508,000088:                                                                                                  #  THE FOLLOWING ROUTINES ARE IDENTICAL TO BANKCALL AND SWCALL EXCEPT THAT THEY ARE USED IN INTERRUPT.
045509,000089: 
045510,000090:    4725           52073        IBNKCALL           DXCH     RUPTREG3                              #  USES RUPTREG3,4 FOR DP RETURN ADDRESS.
045511,000091:    4726           50002                           INDEX    Q                                     
045512,000092:    4727           30000                           CAF      0                                     
045513,000093:    4730           24002                           INCR     Q                                     
045514,000094: 
045515,000095:    4731           54001        ISWCALL            TS       L                                     
045516,000096:    4732           22004                           LXCH     FBANK                                 
045517,000097:    4733           75053                           MASK     LOW10                                 
045518,000098:    4734           56002                           XCH      Q                                     
045519,000099:    4735           52073                           DXCH     RUPTREG3                              
045520,000100:    4736           50002                           INDEX    Q                                     
045521,000101:    4737           02000                           TC       10000                                 
045522,000102: 
045523,000103:    4740           56073        ISWRETRN           XCH      RUPTREG4                              
045524,000104:    4741           56004                           XCH      FBANK                                 
045525,000105:    4742           56073                           XCH      RUPTREG4                              
045526,000106:    4743           00072                           TC       RUPTREG3                              
045527,000107: 
045528,000108:                                                                                                  #  2. USPRCADR ACCESSES INTERPRETIVE CODING IN OTHER THAN THE USER'S FBANK. THE CALLING SEQUENCE IS AS FOLLOWS:
045529,000109: 
045530,000110:                                                                                                  #        L       TC      USPRCADR
045531,000111:                                                                                                  #        L+1     CADR    INTPRETX        INTPRETX IS THE INTERPRETIVE CODING
045532,000112:                                                                                                  #                                        RETURN IS TO L+2
045533,000113: 
045534,000114:    4744           54164        USPRCADR           TS       LOC                                   #  SAVE A
045535,000115:    4745           34772                           CA       BIT8                                  
045536,000116:    4746           54023                           TS       EDOP                                  #  EXIT INSTRUCTION TO EDOP
045537,000117:    4747           30006                           CA       BBANK                                 
045538,000118:    4750           54165                           TS       BANKSET                               #  USER'S BBANK TO BANKSET
045539,000119:    4751           50002                           INDEX    Q                                     
045540,000120:    4752           30000                           CA       0                                     
045541,000121:    4753           54004                           TS       FBANK                                 #  INTERPRETIVE BANK TO FBANK
045542,000122:    4754           75053                           MASK     LOW10                                 #  YIELDS INTERPRETIVE RELATIVE ADDRESS
045543,000123:    4755           56002                           XCH      Q                                     #  INTERPRETIVE ADDRESS TO Q, FETCHING L+1
045544,000124:    4756           56164                           XCH      LOC                                   #  L+1 TO LOC, RETRIEVING ORIGINAL A
045545,000125:    4757           14674                           TCF      Q+10000                               
045546,000126: 
045547,000127: 
045548,000128:                                                                                                  #  THERE ARE FOUR POSSIBLE SETTINGS FOR CHANNEL 07.  (CHANNEL 07 CONTAINS THE SUPERBANK SETTING.)
045549,000129: 
045550,000130:                                                                                                  #                                                PSEUDO-FIXED    OCTAL PSEUDO
045551,000131:                                                                                                  #  SUPERBANK     SETTING         S-REG. VALUE    BANK NUMBERS    ADDRESSES
045552,000132:                                                                                                  #  ----------    -------         ------------     ------------    ------------
045553,000133:                                                                                                  #  SUPERBANK 3     0XX            2000 - 3777       30 - 37      70000 - 107777          (WHERE XX CAN BE ANYTHING AND
045554,000134:                                                                                                  #                                                                                        WILL USUALLY BE SEEN AS 11)
045555,000135:                                                                                                  #  SUPERBANK 4     100            2000 - 3777       40 - 47      110000 - 127777         (AS FAR AS IT CAN BE SEEN,
045556,000136:                                                                                                  #                                                                                        ONLY BANKS 40-43 WILL EVER BE
045557,000137:                                                                                                  #                                                                                        AND ARE PRESENTLY AVAILABLE)
045558,000138:                                                                                                  #  SUPERBANK 5     101            2000 - 3777       50 - 57      130000 - 147777         (PRESENTLY NOT AVAILABLE TO
045559,000139:                                                                                                  #                                                                                        THE USER)
045560,000140:                                                                                                  #  SUPERBANK 6     110            2000 - 3777       60 - 67      150000 - 167777         (PRESENTLY NOT AVAILABLE TO
045561,000141:                                                                                                  #                                                                                        THE USER)
045562,000142: 

End of include-file INTER-BANK_COMMUNICATION.agc.  Parent file is MAIN.agc