Source Code

These source code files are an attempted reconstruction of Sundance revision 306, the Apollo 9 LM (Lunar Module) AGC (Apollo Guidance Computer) flight software, created from binary dumps of original core rope program modules, as follows:
  • B1 — Revision 292
  • B2 — Revision 302
  • B3 — Revision 302
  • B4 — Revision 302
  • B5 — Revision 292
  • B6 — Revision 306
These dumps were then modified using memos, checklists, observed address changes, and the Sundance GSOPs to get the entire program to match Sundance revision 306 as closely as possible. Without more information, it is not possible to say how close it actually is; however, this code should be quite close. It is capable of flying the whole Apollo 9 mission using the original checklists and padload. Since only binary dumps (rather than listings) of Sundance are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing.

055189,000002:                                                                                                  ## Copyright:   Public domain.
055190,000003:                                                                                                  ## Filename:    RTB_OP_CODES.agc
055191,000004:                                                                                                  ## Purpose:     A section of an attempt to reconstruct Sundance revision 306
055192,000005:                                                                                                  ##              as closely as possible with available information. Sundance
055193,000006:                                                                                                  ##              306 is the source code for the Lunar Module's (LM) Apollo
055194,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 9. This program was created
055195,000008:                                                                                                  ##              using the mixed-revision SundanceXXX as a starting point, and
055196,000009:                                                                                                  ##              pulling back features from Luminary 69 believed to have been
055197,000010:                                                                                                  ##              added based on memos, checklists, observed address changes,
055198,000011:                                                                                                  ##              or the Sundance GSOPs.
055199,000012:                                                                                                  ## Assembler:   yaYUL
055200,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
055201,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
055202,000015:                                                                                                  ## Mod history: 2020-07-24 MAS  Created from SundanceXXX.
055203,000016: 
055204,000017: 
055205,000018: 
055206,000019: 22,3644                                           BANK     22                                    
055207,000020: 10,2000                                           SETLOC   RTBCODES                              
055208,000021: 10,2000                                           BANK                                           
055209,000022: 
055210,000023: 10,3454  E5,1664                                  EBANK=   XNB                                   
055211,000024: 10,3454                                           COUNT*   $$/RTB                                
055212,000025: 
055213,000026:                                                                                                  #  LOAD TIME2, TIME1 INTO MPAC:
055214,000027: 
055215,000028: 10,3454           00006        LOADTIME           EXTEND                                         
055216,000029: 10,3455           30025                           DCA      TIME2                                 
055217,000030: 10,3456           16031                           TCF      SLOAD2                                
055218,000031: 
055219,000032:                                                                                                  #  CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
055220,000033:                                                                                                  #  DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
055221,000034: 
055222,000035: 10,3457           10154        CDULOGIC           CCS      MPAC                                  
055223,000036: 10,3460           35030                           CAF      ZERO                                  
055224,000037: 10,3461           13464                           TCF      +3                                    
055225,000038: 10,3462           13463                           NOOP                                           
055226,000039: 10,3463           45011                           CS       HALF                                  
055227,000040: 
055228,000041: 10,3464           54155                           TS       MPAC       +1                         
055229,000042: 10,3465           35030                           CAF      ZERO                                  
055230,000043: 10,3466           56154                           XCH      MPAC                                  
055231,000044: 10,3467           00006                           EXTEND                                         
055232,000045: 10,3470           75011                           MP       HALF                                  
055233,000046: 10,3471           20155                           DAS      MPAC                                  
055234,000047: 10,3472           16035                           TCF      DANZIG                                #  MODE IS ALREADY AT DOUBLE-PRECISION
055235,000048: 
055236,000049:                                                                                                  #  READ THE PIPS INTO MPAC WITHOUT CHANGING THEM:
055237,000050: 
055238,000051: 10,3473           00004        READPIPS           INHINT                                         
055239,000052: 10,3474           30037                           CA       PIPAX                                 
055240,000053: 10,3475           54154                           TS       MPAC                                  
055241,000054: 10,3476           30040                           CA       PIPAY                                 
055242,000055: 10,3477           54157                           TS       MPAC       +3                         
055243,000056: 10,3500           30041                           CA       PIPAZ                                 
055244,000057: 10,3501           00003                           RELINT                                         
055245,000058: 10,3502           54161                           TS       MPAC       +5                         
055246,000059: 
055247,000060: 10,3503           35030                           CAF      ZERO                                  
055248,000061: 10,3504           54155                           TS       MPAC       +1                         
055249,000062: 10,3505           54160                           TS       MPAC       +4                         
055250,000063: 10,3506           54162                           TS       MPAC       +6                         
055251,000064: 
055252,000065: 10,3507           16475        VECMODE            TCF      VMODE                                 
055253,000066: 
055254,000067:                                                                                                  #  FORCE TP SIGN AGREEMENT IN MPAC:
055255,000068: 
055256,000069: 10,3510           07231        SGNAGREE           TC       TPAGREE                               
055257,000070: 10,3511           16035                           TCF      DANZIG                                
055258,000071: 
055259,000072:                                                                                                  #  CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
055260,000073:                                                                                                  #  SCALED IN HALF-REVOLUTIONS.
055261,000074: 
055262,000075: 10,3512           03542        1STO2S             TC       1TO2SUB                               
055263,000076: 10,3513           35030                           CAF      ZERO                                  
055264,000077: 10,3514           54155                           TS       MPAC       +1                         
055265,000078: 10,3515           16034                           TCF      NEWMODE                               
055266,000079: 
055267,000080:                                                                                                  #  DO 1STO2S ON A VECTOR OF ANGLES:
055268,000081: 
055269,000082: 10,3516           03542        V1STO2S            TC       1TO2SUB                               #  ANSWER ARRIVES IN A AND MPAC.
055270,000083: 
055271,000084: 10,3517           52162                           DXCH     MPAC       +5                         
055272,000085: 10,3520           52155                           DXCH     MPAC                                  
055273,000086: 10,3521           03542                           TC       1TO2SUB                               
055274,000087: 10,3522           54156                           TS       MPAC       +2                         
055275,000088: 
055276,000089: 10,3523           52160                           DXCH     MPAC       +3                         
055277,000090: 10,3524           52155                           DXCH     MPAC                                  
055278,000091: 10,3525           03542                           TC       1TO2SUB                               
055279,000092: 10,3526           54155                           TS       MPAC       +1                         
055280,000093: 
055281,000094: 10,3527           30161                           CA       MPAC       +5                         
055282,000095: 10,3530           54154                           TS       MPAC                                  
055283,000096: 
055284,000097: 10,3531           35026        TPMODE             CAF      ONE                                   #  MODE IS TP.
055285,000098: 10,3532           16034                           TCF      NEWMODE                               
055286,000099: 
055287,000100:                                                                                                  #  V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
055288,000101: 
055289,000102: 10,3533           03542        2V1STO2S           TC       1TO2SUB                               
055290,000103: 10,3534           52160                           DXCH     MPAC       +3                         
055291,000104: 10,3535           52155                           DXCH     MPAC                                  
055292,000105: 10,3536           03542                           TC       1TO2SUB                               
055293,000106: 10,3537           54001                           TS       L                                     
055294,000107: 10,3540           30157                           CA       MPAC       +3                         
055295,000108: 10,3541           16031                           TCF      SLOAD2                                
055296,000109: 
055297,000110:                                                                                                  #  SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
055298,000111: 
055299,000112: 10,3542           52155        1TO2SUB            DXCH     MPAC                                  #  FINAL MPAC +1 UNSPECIFIED.
055300,000113: 10,3543           20001                           DDOUBL                                         
055301,000114: 10,3544           10000                           CCS      A                                     
055302,000115: 10,3545           65026                           AD       ONE                                   
055303,000116: 10,3546           13550                           TCF      +2                                    
055304,000117: 10,3547           40000                           COM                                            #  THIS WAS REVERSE OF MSU.
055305,000118: 
055306,000119: 10,3550           54154                           TS       MPAC                                  #  AND SKIP ON OVERFLOW.
055307,000120: 10,3551           00002                           TC       Q                                     
055308,000121: 
055309,000122: 10,3552           50000                           INDEX    A                                     #  OVERFLOW UNCORRECT AND IN MSU.
055310,000123: 10,3553           35007                           CAF      LIMITS                                
055311,000124: 10,3554           26154                           ADS      MPAC                                  
055312,000125: 10,3555           00002                           TC       Q                                     
055313,000126:                                                                                                  #  SUBROUTINE TO INCREMENT CDUS
055314,000127: 10,3556           33571        INCRCDUS           CAF      LOCTHETA                              
055315,000128: 10,3557           54130                           TS       BUF                                   #  PLACE ADRES(THETA) IN BUF.
055316,000129: 10,3560           30154                           CAE      MPAC                                  #  INCREMENT IN 1S COMPL.
055317,000130: 10,3561           03572                           TC       CDUINC                                
055318,000131: 
055319,000132: 10,3562           24130                           INCR     BUF                                   
055320,000133: 10,3563           30157                           CAE      MPAC       +3                         
055321,000134: 10,3564           03572                           TC       CDUINC                                
055322,000135: 
055323,000136: 10,3565           24130                           INCR     BUF                                   
055324,000137: 10,3566           30161                           CAE      MPAC       +5                         
055325,000138: 10,3567           03572                           TC       CDUINC                                
055326,000139: 
055327,000140: 10,3570           13507                           TCF      VECMODE                               
055328,000141: 
055329,000142: 10,3571           01206        LOCTHETA           ADRES    THETAD                                
055330,000143: 
055331,000144:                                                                                                  #  THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
055332,000145:                                                                                                  #  QUANTITY FOUND IN TEM2.  THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
055333,000146:                                                                                                  #  (+0 UNEQUAL TO -0) QUANTITY.  MAY BE CALLED BY BANKCALL/SWCALL.
055334,000147: 
055335,000148: 10,3572           54142        CDUINC             TS       TEM2                                  #  1S COMPL.QUANT. ARRIVES IN ACC.  STORE IT
055336,000149: 10,3573           50130                           INDEX    BUF                                   
055337,000150: 10,3574           10000                           CCS      0                                     #  CHANGE 2S COMPL. ANGLE(IN BUF)INTO 1S
055338,000151: 10,3575           65026                           AD       ONE                                   
055339,000152: 10,3576           13602                           TCF      +4                                    
055340,000153: 10,3577           65026                           AD       ONE                                   
055341,000154: 10,3600           65026                           AD       ONE                                   #  OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
055342,000155: 10,3601           40000                           COM                                            
055343,000156: 
055344,000157: 10,3602           60142                           AD       TEM2                                  #  SULT MOVES FROM 2ND TO 3D QUAD.(OR BACK)
055345,000158: 10,3603           10000                           CCS      A                                     #  BACK TO 2S COMPL.
055346,000159: 10,3604           65026                           AD       ONE                                   
055347,000160: 10,3605           13607                           TCF      +2                                    
055348,000161: 10,3606           40000                           COM                                            
055349,000162: 10,3607           54142                           TS       TEM2                                  #  STORE 14BIT QUANTITY WITH PRESENT SIGN
055350,000163: 10,3610           13614                           TCF      +4                                    
055351,000164: 10,3611           50000                           INDEX    A                                     #   SIGN.
055352,000165: 10,3612           35007                           CAF      LIMITS                                #  FIX IT, BY ADDING IN 37777 OR 40000
055353,000166: 10,3613           60142                           AD       TEM2                                  
055354,000167: 
055355,000168: 10,3614           50130                           INDEX    BUF                                   
055356,000169: 10,3615           54000                           TS       0                                     #  STORE NEW ANGLE IN 2S COMPLEMENT.
055357,000170: 10,3616           00002                           TC       Q                                     
055358,000171: 
055359,000172:                                                                                                  #  RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL. ECADR OF COMMANDS ARRIVES IN X1.
055360,000173: 
055361,000174: 10,3617           50120        PULSEIMU           INDEX    FIXLOC                                #  ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
055362,000175: 10,3620           30046                           CA       X1                                    
055363,000176: 10,3621           04655                           TC       BANKCALL                              
055364,000177: 10,3622           17234                           CADR     IMUPULSE                              
055365,000178: 10,3623           16035                           TCF      DANZIG                                
055366,000179: 
055367,000180:                                                                                                  #  EACH ROUTINE TAKES A 3X3 MATRIX STORED IN DOUBLE PRECISION IN A FIXED AREA OF ERASABLE MEMORY AND REPLACES IT
055368,000181:                                                                                                  #  WITH THE TRANSPOSE MATRIX. TRANSP1 USES LOCATIONS XNB+0,+1 THROUGH XNB+16D, 17D AND TRANSP2 USES LOCATIONS
055369,000182:                                                                                                  #  XNB1+0,+1 THROUGH XNB1+16D, 17D. EACH MATRIX IS STORED BY ROWS.
055370,000183: 
055371,000184: 10,3624           02664        XNBEB              ECADR    XNB                                   
055372,000185: 10,3625           03456        XNB1EB             ECADR    XNB1                                  
055373,000186: 
055374,000187: 10,3626  E5,1664                                  EBANK=   XNB                                   
055375,000188: 
055376,000189: 10,3626           33624        TRANSP1            CAF      XNBEB                                 
055377,000190: 10,3627           54003                           TS       EBANK                                 
055378,000191: 10,3630           53667                           DXCH     XNB        +2                         
055379,000192: 10,3631           53673                           DXCH     XNB        +6                         
055380,000193: 10,3632           53667                           DXCH     XNB        +2                         
055381,000194: 
055382,000195: 10,3633           53671                           DXCH     XNB        +4                         
055383,000196: 10,3634           53701                           DXCH     XNB        +12D                       
055384,000197: 10,3635           53671                           DXCH     XNB        +4                         
055385,000198: 
055386,000199: 10,3636           53677                           DXCH     XNB        +10D                       
055387,000200: 10,3637           53703                           DXCH     XNB        +14D                       
055388,000201: 10,3640           53677                           DXCH     XNB        +10D                       
055389,000202: 10,3641           16035                           TCF      DANZIG                                
055390,000203: 
055391,000204: 10,3642  E7,1456                                  EBANK=   XNB1                                  
055392,000205: 
055393,000206: 10,3642           33625        TRANSP2            CAF      XNB1EB                                
055394,000207: 10,3643           54003                           TS       EBANK                                 
055395,000208: 10,3644           53461                           DXCH     XNB1       +2                         
055396,000209: 10,3645           53465                           DXCH     XNB1       +6                         
055397,000210: 10,3646           53461                           DXCH     XNB1       +2                         
055398,000211: 
055399,000212: 10,3647           53463                           DXCH     XNB1       +4                         
055400,000213: 10,3650           53473                           DXCH     XNB1       +12D                       
055401,000214: 10,3651           53463                           DXCH     XNB1       +4                         
055402,000215: 
055403,000216: 10,3652           53471                           DXCH     XNB1       +10D                       
055404,000217: 10,3653           53475                           DXCH     XNB1       +14D                       
055405,000218: 10,3654           53471                           DXCH     XNB1       +10D                       
055406,000219: 10,3655           16035                           TCF      DANZIG                                
055407,000220: 
055408,000221:                                                                                                  #  THE SUBROUTINE SIGNMPAC SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
055409,000222:                                                                                                  #  FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED.  ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
055410,000223: 
055411,000224:                                                                                                  #  ENTRY MAY BE BY EITHER OF THE FOLLOWING:
055412,000225:                                                                                                  #        1.      LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
055413,000226:                                                                                                  #                ENTRY:          BOVB
055414,000227:                                                                                                  #                                        SIGNMPAC
055415,000228:                                                                                                  #        2.      GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
055416,000229:                                                                                                  #                ENTRY:          RTB
055417,000230:                                                                                                  #                                        SIGNMPAC
055418,000231:                                                                                                  #  IN EITHER CASE, RETURN IS TO THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
055419,000232: 
055420,000233: 10,3656           00006        SIGNMPAC           EXTEND                                         
055421,000234: 10,3657           35006                           DCA      DPOSMAX                               
055422,000235: 10,3660           52155                           DXCH     MPAC                                  
055423,000236: 10,3661           10000                           CCS      A                                     
055424,000237: 10,3662           35030        DPMODE             CAF      ZERO                                  #  SETS MPAC +2 TO ZERO IN THE PROCESS
055425,000238: 10,3663           16033                           TCF      SLOAD2     +2                         
055426,000239: 10,3664           13665                           TCF      +1                                    
055427,000240: 10,3665           00006                           EXTEND                                         
055428,000241: 10,3666           45006                           DCS      DPOSMAX                               
055429,000242: 10,3667           16031                           TCF      SLOAD2                                
055430,000243: 
055431,000244:                                                                                                  #  RTB OP CODE NORMUNIT IS LIKE INTERPRETIVE INSTRUCTION UNIT, EXCEPT THAT IT CAN BE DEPENDED ON NOT TO BLOW
055432,000245:                                                                                                  #  UP WHEN THE VECTOR BEING UNITIZED IS VERY SMALL -- IT WILL BLOW UP WHEN ALL COMPONENTS ARE ZERO.  IF NORMUNIT
055433,000246:                                                                                                  #  IS USED AND THE UPPER ORDER HALVES OF ALL COMPONENTS ARE ZERO, THE MAGNITUDE RETURNED IN 36D WILL BE TOO LARGE
055434,000247:                                                                                                  #  BY A FACTOR OF 2(13) AND THE SQUARED MAGNITUDE RETURNED AT 34D WILL BE TOO BIG BY A FACTOR OF 2(26).
055435,000248: 
055436,000249: 10,3670           35026        NORMUNX1           CAF      ONE                                   
055437,000250: 10,3671           13673                           TCF      NORMUNIT   +1                         
055438,000251: 10,3672           35030        NORMUNIT           CAF      ZERO                                  
055439,000252: 10,3673           60120                           AD       FIXLOC                                
055440,000253: 10,3674           54156                           TS       MPAC       +2                         
055441,000254: 10,3675           04655                           TC       BANKCALL                              #  GET SIGN AGREEMENT IN ALL COMPONENTS
055442,000255: 10,3676           01010                           CADR     VECAGREE                              
055443,000256: 10,3677           10154                           CCS      MPAC                                  
055444,000257: 10,3700           13734                           TCF      NOSHIFT                               
055445,000258: 10,3701           13703                           TCF      +2                                    
055446,000259: 10,3702           13734                           TCF      NOSHIFT                               
055447,000260: 10,3703           10157                           CCS      MPAC       +3                         
055448,000261: 10,3704           13734                           TCF      NOSHIFT                               
055449,000262: 10,3705           13707                           TCF      +2                                    
055450,000263: 10,3706           13734                           TCF      NOSHIFT                               
055451,000264: 10,3707           10161                           CCS      MPAC       +5                         
055452,000265: 10,3710           13734                           TCF      NOSHIFT                               
055453,000266: 10,3711           13713                           TCF      +2                                    
055454,000267: 10,3712           13734                           TCF      NOSHIFT                               
055455,000268: 10,3713           30155                           CA       MPAC       +1                         #  SHIFT ALL COMPONENTS LEFT 13
055456,000269: 10,3714           00006                           EXTEND                                         
055457,000270: 10,3715           75011                           MP       BIT14                                 
055458,000271: 10,3716           20155                           DAS      MPAC                                  #  DAS GAINS A LITTLE ACCURACY
055459,000272: 10,3717           30160                           CA       MPAC       +4                         
055460,000273: 10,3720           00006                           EXTEND                                         
055461,000274: 10,3721           75011                           MP       BIT14                                 
055462,000275: 10,3722           20160                           DAS      MPAC       +3                         
055463,000276: 10,3723           30162                           CA       MPAC       +6                         
055464,000277: 10,3724           00006                           EXTEND                                         
055465,000278: 10,3725           75011                           MP       BIT14                                 
055466,000279: 10,3726           20162                           DAS      MPAC       +5                         
055467,000280: 10,3727           35034                           CAF      THIRTEEN                              
055468,000281: 10,3730           50156                           INDEX    MPAC       +2                         
055469,000282: 10,3731           54045                           TS       37D                                   
055470,000283: 10,3732           04674        OFFTUNIT           TC       POSTJUMP                              
055471,000284: 10,3733           01024                           CADR     UNIT       +1                         #  SKIP THE "TC VECAGREE" DONE AT UNIT
055472,000285: 
055473,000286: 10,3734           35030        NOSHIFT            CAF      ZERO                                  
055474,000287: 10,3735           13730                           TCF      OFFTUNIT   -2                         
055475,000288: 
055476,000289:                                                                                                  #  RTB VECSGNAG ... FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
055477,000290: 
055478,000291: 10,3736           04655        VECSGNAG           TC       BANKCALL                              
055479,000292: 10,3737           01010                           CADR     VECAGREE                              
055480,000293: 10,3740           06035                           TC       DANZIG                                

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