Source Code

These source-code files are part of a reconstructed copy of Comanche 72, the first release of the Apollo Guidance Computer (AGC) Command Module (CM) software for Apollo 13.

They have been adapted from sources files created from a listing of Comanche 55. These source files were updated to match binary dumps of a set of Comanche 67 rope modules. They were then further modified by applying known changes between Comanche 67 and Comanche 72. A binary dump of module B2 of Comanche 72, part number 2010802-021, was also used to validate changes made to banks 05-13. The resulting code assembles to have identical memory-bank checksums as those specified in NASA drawing 2021153G; this gives reasonably high confidence that the changes that have been made are correct. In places where ambiguity exists, this ambiguity is discussed in "## Reconstruction:" comments.

Since no contemporary listings of Comanche 72 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.

062970,000002:                                                                                                  ## Copyright:   Public domain.
062971,000003:                                                                                                  ## Filename:    RTB_OP_CODES.agc
062972,000004:                                                                                                  ## Purpose:     A section of Comanche revision 072.
062973,000005:                                                                                                  ##              It is part of the reconstructed source code for the first
062974,000006:                                                                                                  ##              release of the software for the Command Module's (CM) Apollo
062975,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 13. No original listings
062976,000008:                                                                                                  ##              of this program are available; instead, this file was recreated
062977,000009:                                                                                                  ##              from a printout of Comanche 055, binary dumps of a set of
062978,000010:                                                                                                  ##              Comanche 067 rope modules, and changelogs between Comanche 067
062979,000011:                                                                                                  ##              and 072. It has been adapted such that the resulting bugger words
062980,000012:                                                                                                  ##              exactly match those specified for Comanche 072 in NASA drawing
062981,000013:                                                                                                  ##              2021153G, which gives relatively high confidence that the
062982,000014:                                                                                                  ##              reconstruction is correct.
062983,000015:                                                                                                  ## Assembler:   yaYUL
062984,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
062985,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
062986,000018:                                                                                                  ## Mod history: 2024-05-13 MAS  Created from Comanche 067.
062987,000019: 
062988,000020: 22,3510                                           BANK     22                                    
062989,000021: 22,2000                                           SETLOC   RTBCODES                              
062990,000022: 22,2000                                           BANK                                           
062991,000023: 
062992,000024: 22,3510  E5,1713                                  EBANK=   XNB                                   
062993,000025: 22,3510                                           COUNT*   $$/RTB                                
062994,000026: 
062995,000027:                                                                                                  #  LOAD TIME2, TIME1 INTO MPAC:
062996,000028: 
062997,000029: 22,3510           00006        LOADTIME           EXTEND                                         
062998,000030: 22,3511           30025                           DCA      TIME2                                 
062999,000031: 22,3512           16024                           TCF      SLOAD2                                
063000,000032: 
063001,000033:                                                                                                  #  CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
063002,000034:                                                                                                  #  DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
063003,000035: 
063004,000036: 22,3513           10154        CDULOGIC           CCS      MPAC                                  
063005,000037: 22,3514           35035                           CAF      ZERO                                  
063006,000038: 22,3515           13520                           TCF      +3                                    
063007,000039: 22,3516           13517                           NOOP                                           
063008,000040: 22,3517           45016                           CS       HALF                                  
063009,000041: 
063010,000042: 22,3520           54155                           TS       MPAC       +1                         
063011,000043: 22,3521           35035                           CAF      ZERO                                  
063012,000044: 22,3522           56154                           XCH      MPAC                                  
063013,000045: 22,3523           00006                           EXTEND                                         
063014,000046: 22,3524           75016                           MP       HALF                                  
063015,000047: 22,3525           20155                           DAS      MPAC                                  
063016,000048: 22,3526           16030                           TCF      DANZIG                                #  MODE IS ALREADY AT DOUBLE-PRECISION
063017,000049: 
063018,000050:                                                                                                  #  READ THE PIPS INTO MPAC WITHOUT CHANGING THEM:
063019,000051: 
063020,000052: 22,3527           00004        READPIPS           INHINT                                         
063021,000053: 22,3530           30037                           CA       PIPAX                                 
063022,000054: 22,3531           54154                           TS       MPAC                                  
063023,000055: 22,3532           30040                           CA       PIPAY                                 
063024,000056: 22,3533           54157                           TS       MPAC       +3                         
063025,000057: 22,3534           30041                           CA       PIPAZ                                 
063026,000058: 22,3535           00003                           RELINT                                         
063027,000059: 22,3536           54161                           TS       MPAC       +5                         
063028,000060: 
063029,000061: 22,3537           35035                           CAF      ZERO                                  
063030,000062: 22,3540           54155                           TS       MPAC       +1                         
063031,000063: 22,3541           54160                           TS       MPAC       +4                         
063032,000064: 22,3542           54162                           TS       MPAC       +6                         
063033,000065: 22,3543           16470        VECMODE            TCF      VMODE                                 
063034,000066: 
063035,000067:                                                                                                  #  FORCE TP SIGN AGREEMENT IN MPAC:
063036,000068: 
063037,000069: 22,3544           07226        SGNAGREE           TC       TPAGREE                               
063038,000070: 
063039,000071: 
063040,000072: 22,3545           16030                           TCF      DANZIG                                
063041,000073: 
063042,000074:                                                                                                  #  CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
063043,000075:                                                                                                  #  SCALED IN HALF-REVOLUTIONS.
063044,000076: 
063045,000077: 22,3546           03576        1STO2S             TC       1TO2SUB                               
063046,000078: 22,3547           35035                           CAF      ZERO                                  
063047,000079: 22,3550           54155                           TS       MPAC       +1                         
063048,000080: 22,3551           16027                           TCF      NEWMODE                               
063049,000081: 
063050,000082:                                                                                                  #  DO 1STO2S ON A VECTOR OF ANGLES:
063051,000083: 
063052,000084: 22,3552           03576        V1STO2S            TC       1TO2SUB                               #  ANSWER ARRIVES IN A AND MPAC.
063053,000085: 
063054,000086: 22,3553           52162                           DXCH     MPAC       +5                         
063055,000087: 22,3554           52155                           DXCH     MPAC                                  
063056,000088: 22,3555           03576                           TC       1TO2SUB                               
063057,000089: 22,3556           54156                           TS       MPAC       +2                         
063058,000090: 
063059,000091: 22,3557           52160                           DXCH     MPAC       +3                         
063060,000092: 22,3560           52155                           DXCH     MPAC                                  
063061,000093: 22,3561           03576                           TC       1TO2SUB                               
063062,000094: 22,3562           54155                           TS       MPAC       +1                         
063063,000095: 
063064,000096: 22,3563           30161                           CA       MPAC       +5                         
063065,000097: 22,3564           54154                           TS       MPAC                                  
063066,000098: 
063067,000099: 22,3565           35033        TPMODE             CAF      ONE                                   #  MODE IS TP.
063068,000100: 22,3566           16027                           TCF      NEWMODE                               
063069,000101: 
063070,000102:                                                                                                  #  V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
063071,000103: 
063072,000104: 22,3567           03576        2V1STO2S           TC       1TO2SUB                               
063073,000105: 22,3570           52160                           DXCH     MPAC       +3                         
063074,000106: 22,3571           52155                           DXCH     MPAC                                  
063075,000107: 22,3572           03576                           TC       1TO2SUB                               
063076,000108: 22,3573           54001                           TS       L                                     
063077,000109: 22,3574           30157                           CA       MPAC       +3                         
063078,000110: 22,3575           16024                           TCF      SLOAD2                                
063079,000111: 
063080,000112:                                                                                                  #  SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
063081,000113: 
063082,000114: 22,3576           52155        1TO2SUB            DXCH     MPAC                                  #  FINAL MPAC +1 UNSPECIFIED.
063083,000115: 22,3577           20001                           DDOUBL                                         
063084,000116: 22,3600           10000                           CCS      A                                     
063085,000117: 22,3601           65033                           AD       ONE                                   
063086,000118: 22,3602           13604                           TCF      +2                                    
063087,000119: 22,3603           40000                           COM                                            #  THIS WAS REVERSE OF MSU.
063088,000120: 
063089,000121: 22,3604           54154                           TS       MPAC                                  #  AND SKIP ON OVERFLOW.
063090,000122: 22,3605           00002                           TC       Q                                     
063091,000123: 
063092,000124: 22,3606           50000                           INDEX    A                                     #  OVERFLOW UNCORRECT AND IN MSU.
063093,000125: 22,3607           35014                           CAF      LIMITS                                
063094,000126: 22,3610           26154                           ADS      MPAC                                  
063095,000127: 22,3611           00002                           TC       Q                                     
063096,000128: 
063097,000129:                                                                                                  #  SUBROUTINE TO INCREMENT CDUS
063098,000130: 
063099,000131: 22,3612           33625        INCRCDUS           CAF      LOCTHETA                              
063100,000132: 22,3613           54130                           TS       BUF                                   #  PLACE ADRES(THETA) IN BUF.
063101,000133: 22,3614           30154                           CAE      MPAC                                  #  INCREMENT IN 1S COMPL.
063102,000134: 22,3615           03626                           TC       CDUINC                                
063103,000135: 
063104,000136: 22,3616           24130                           INCR     BUF                                   
063105,000137: 22,3617           30157                           CAE      MPAC       +3                         
063106,000138: 22,3620           03626                           TC       CDUINC                                
063107,000139: 
063108,000140: 22,3621           24130                           INCR     BUF                                   
063109,000141: 22,3622           30161                           CAE      MPAC       +5                         
063110,000142: 22,3623           03626                           TC       CDUINC                                
063111,000143: 
063112,000144: 22,3624           13543                           TCF      VECMODE                               
063113,000145: 
063114,000146: 22,3625           01155        LOCTHETA           ADRES    THETAD                                
063115,000147: 
063116,000148:                                                                                                  #  THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
063117,000149:                                                                                                  #  QUANTITY FOUND IN TEM2.  THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
063118,000150:                                                                                                  #  (+0 UNEQUAL TO -0) QUANTITY.  MAY BE CALLED BY BANKCALL/SWCALL.
063119,000151: 
063120,000152: 22,3626           54142        CDUINC             TS       TEM2                                  #  1S COMPL. QUANT. ARRIVES IN ACC.  STORE IT
063121,000153: 22,3627           50130                           INDEX    BUF                                   
063122,000154: 22,3630           10000                           CCS      0                                     #  CHANGE 2S COMPL. ANGLE (IN BUF) INTO 1S
063123,000155: 22,3631           65033                           AD       ONE                                   
063124,000156: 22,3632           13636                           TCF      +4                                    
063125,000157: 22,3633           65033                           AD       ONE                                   
063126,000158: 22,3634           65033                           AD       ONE                                   #  OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
063127,000159: 22,3635           40000                           COM                                            
063128,000160: 
063129,000161: 22,3636           60142                           AD       TEM2                                  #  SULT MOVES FROM 2ND TO 3D QUAD. (OR BACK)
063130,000162: 22,3637           10000                           CCS      A                                     #  BACK TO 2S COMPL.
063131,000163: 22,3640           65033                           AD       ONE                                   
063132,000164: 22,3641           13643                           TCF      +2                                    
063133,000165: 22,3642           40000                           COM                                            
063134,000166: 22,3643           54142                           TS       TEM2                                  #  STORE 14BIT QUANTITY WITH PRESENT SIGN
063135,000167: 22,3644           13650                           TCF      +4                                    
063136,000168: 22,3645           50000                           INDEX    A                                     #  SIGN.
063137,000169: 22,3646           35014                           CAF      LIMITS                                #  FIX IT, BY ADDING IN 37777 OR 40000
063138,000170: 22,3647           60142                           AD       TEM2                                  
063139,000171: 
063140,000172: 22,3650           50130                           INDEX    BUF                                   
063141,000173: 22,3651           54000                           TS       0                                     #  STORE NEW ANGLE IN 2S COMPLEMENT.
063142,000174: 22,3652           00002                           TC       Q                                     
063143,000175: 
063144,000176:                                                                                                  #  RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL.  ECADR OF COMMANDS ARRIVES IN X1.
063145,000177: 
063146,000178: 22,3653           50120        PULSEIMU           INDEX    FIXLOC                                #  ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
063147,000179: 22,3654           30046                           CA       X1                                    
063148,000180: 22,3655           04676                           TC       BANKCALL                              
063149,000181: 22,3656           17206                           CADR     IMUPULSE                              
063150,000182: 22,3657           16030                           TCF      DANZIG                                
063151,000183: 
063152,000184:                                                                                                  #  EACH ROUTINE TAKES A 3X3 MATRIX STORED IN DOUBLE PRECISION IN A FIXED AREA OF ERASABLE MEMORY AND REPLACES IT
063153,000185:                                                                                                  #  WITH THE TRANSPOSE MATRIX.  TRANSP1 USES LOCATIONS XNB+0,+1 THROUGH XNB+16D, 17D AND TRANSP2 USES LOCATIONS
063154,000186:                                                                                                  #  XNB1+0,+1 THROUGH XNB1+16D, 17D.  EACH MATRIX IS STORED BY ROWS.
063155,000187: 
063156,000188: 22,3660           02713        XNBEB              ECADR    XNB                                   
063157,000189: 22,3661           02554        XNB1EB             ECADR    XNB1                                  
063158,000190: 
063159,000191: 22,3662  E5,1713                                  EBANK=   XNB                                   
063160,000192: 
063161,000193: 22,3662           33660        TRANSP1            CAF      XNBEB                                 
063162,000194: 22,3663           54003                           TS       EBANK                                 
063163,000195: 22,3664           53716                           DXCH     XNB        +2                         
063164,000196: 22,3665           53722                           DXCH     XNB        +6                         
063165,000197: 22,3666           53716                           DXCH     XNB        +2                         
063166,000198: 
063167,000199: 22,3667           53720                           DXCH     XNB        +4                         
063168,000200: 22,3670           53730                           DXCH     XNB        +12D                       
063169,000201: 22,3671           53720                           DXCH     XNB        +4                         
063170,000202: 
063171,000203: 22,3672           53726                           DXCH     XNB        +10D                       
063172,000204: 22,3673           53732                           DXCH     XNB        +14D                       
063173,000205: 22,3674           53726                           DXCH     XNB        +10D                       
063174,000206: 22,3675           16030                           TCF      DANZIG                                
063175,000207: 22,3676  E5,1554                                  EBANK=   XNB1                                  
063176,000208: 
063177,000209: 22,3676           33661        TRANSP2            CAF      XNB1EB                                
063178,000210: 22,3677           54003                           TS       EBANK                                 
063179,000211: 22,3700           53557                           DXCH     XNB1       +2                         
063180,000212: 22,3701           53563                           DXCH     XNB1       +6                         
063181,000213: 22,3702           53557                           DXCH     XNB1       +2                         
063182,000214: 
063183,000215: 22,3703           53561                           DXCH     XNB1       +4                         
063184,000216: 22,3704           53571                           DXCH     XNB1       +12D                       
063185,000217: 22,3705           53561                           DXCH     XNB1       +4                         
063186,000218: 
063187,000219: 22,3706           53567                           DXCH     XNB1       +10D                       
063188,000220: 22,3707           53573                           DXCH     XNB1       +14D                       
063189,000221: 22,3710           53567                           DXCH     XNB1       +10D                       
063190,000222: 22,3711           16030                           TCF      DANZIG                                
063191,000223: 
063192,000224:                                                                                                  #  THE SUBROUTINE SIGNMPAC SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
063193,000225:                                                                                                  #  FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED.  ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
063194,000226: 
063195,000227:                                                                                                  #  ENTRY MAY BE BY EITHER OF THE FOLLOWING:
063196,000228:                                                                                                  #        1.      LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
063197,000229:                                                                                                  #                ENTRY:          BOVB
063198,000230:                                                                                                  #                                        SIGNMPAC
063199,000231:                                                                                                  #        2.      GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
063200,000232:                                                                                                  #                ENTRY:          RTB
063201,000233:                                                                                                  #                                        SIGNMPAC
063202,000234:                                                                                                  #  IN EITHER CASE, RETURN IS TO THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
063203,000235: 
063204,000236: 22,3712           00006        SIGNMPAC           EXTEND                                         
063205,000237: 22,3713           35013                           DCA      DPOSMAX                               
063206,000238: 22,3714           52155                           DXCH     MPAC                                  
063207,000239: 22,3715           10000                           CCS      A                                     
063208,000240: 22,3716           35035        DPMODE             CAF      ZERO                                  #  SETS MPAC +2 TO ZERO IN THE PROCESS
063209,000241: 22,3717           16026                           TCF      SLOAD2     +2                         
063210,000242: 22,3720           13721                           TCF      +1                                    
063211,000243: 22,3721           00006                           EXTEND                                         
063212,000244: 22,3722           45013                           DCS      DPOSMAX                               
063213,000245: 22,3723           16024                           TCF      SLOAD2                                
063214,000246: 
063215,000247:                                                                                                  #  RTB OP CODE NORMUNIT IS LIKE INTERPRETIVE INSTRUCTION UNIT, EXCEPT THAT IT CAN BE DEPENDED ON NOT TO BLOW
063216,000248:                                                                                                  #  UP WHEN THE VECTOR BEING UNITIZED IS VERY SMALL -- IT WILL BLOW UP WHEN ALL COMPONENTS ARE ZERO.  IF NORMUNIT
063217,000249:                                                                                                  #  IS USED AND THE UPPER ORDER HALVES OF ALL COMPONENTS ARE ZERO, THE MAGNITUDE RETURNED IN 36D WILL BE TOO LARGE
063218,000250:                                                                                                  #  BY A FACTOR OF 2(13) AND THE SQUARED MAGNITUDE RETURNED AT 34D WILL BE TOO BIG BY A FACTOR OF 2(26).
063219,000251: 
063220,000252: 22,3724           35033        NORMUNX1           CAF      ONE                                   
063221,000253: 22,3725           13727                           TCF      NORMUNIT   +1                         
063222,000254: 22,3726           35035        NORMUNIT           CAF      ZERO                                  
063223,000255: 22,3727           60120                           AD       FIXLOC                                
063224,000256: 22,3730           54156                           TS       MPAC       +2                         
063225,000257: 22,3731           04676                           TC       BANKCALL                              #  GET SIGN AGREEMENT IN ALL COMPONENTS
063226,000258: 22,3732           01010                           CADR     VECAGREE                              
063227,000259: 22,3733           10154                           CCS      MPAC                                  
063228,000260: 22,3734           13770                           TCF      NOSHIFT                               
063229,000261: 22,3735           13737                           TCF      +2                                    
063230,000262: 22,3736           13770                           TCF      NOSHIFT                               
063231,000263: 22,3737           10157                           CCS      MPAC       +3                         
063232,000264: 22,3740           13770                           TCF      NOSHIFT                               
063233,000265: 22,3741           13743                           TCF      +2                                    
063234,000266: 22,3742           13770                           TCF      NOSHIFT                               
063235,000267: 22,3743           10161                           CCS      MPAC       +5                         
063236,000268: 22,3744           13770                           TCF      NOSHIFT                               
063237,000269: 22,3745           13747                           TCF      +2                                    
063238,000270: 22,3746           13770                           TCF      NOSHIFT                               
063239,000271: 22,3747           30155                           CA       MPAC       +1                         #  SHIFT ALL COMPONENTS LEFT 13
063240,000272: 22,3750           00006                           EXTEND                                         
063241,000273: 22,3751           75016                           MP       BIT14                                 
063242,000274: 22,3752           20155                           DAS      MPAC                                  #  DAS GAINS A LITTLE ACCURACY
063243,000275: 22,3753           30160                           CA       MPAC       +4                         
063244,000276: 22,3754           00006                           EXTEND                                         
063245,000277: 22,3755           75016                           MP       BIT14                                 
063246,000278: 22,3756           20160                           DAS      MPAC       +3                         
063247,000279: 22,3757           30162                           CA       MPAC       +6                         
063248,000280: 22,3760           00006                           EXTEND                                         
063249,000281: 22,3761           75016                           MP       BIT14                                 
063250,000282: 22,3762           20162                           DAS      MPAC       +5                         
063251,000283: 22,3763           35041                           CAF      THIRTEEN                              
063252,000284: 22,3764           50156                           INDEX    MPAC       +2                         
063253,000285: 22,3765           54045                           TS       37D                                   
063254,000286: 22,3766           04715        OFFTUNIT           TC       POSTJUMP                              
063255,000287: 22,3767           01024                           CADR     UNIT       +1                         #  SKIP THE "TC VECAGREE" DONE AT UNIT
063256,000288: 
063257,000289: 22,3770           35035        NOSHIFT            CAF      ZERO                                  
063258,000290: 22,3771           13764                           TCF      OFFTUNIT   -2                         
063259,000291: 
063260,000292:                                                                                                  #  RTB VECSGNAG ... FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
063261,000293: 
063262,000294: 22,3772           04676        VECSGNAG           TC       BANKCALL                              
063263,000295: 22,3773           01010                           CADR     VECAGREE                              
063264,000296: 22,3774           06030                           TC       DANZIG                                

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