Source Code

These source-code files are part of a reconstructed copy of Comanche 44, the initial release (though not the final mission release) of the Apollo 10 Command Module (CM) Apollo Guidance Computer (AGC) software. Subsequent releases were Comanche 45 and Comanche 45/2 (the flown release on Apollo 10). The reconstruction is believed to be exactly accurate, but in the absence of an actual Apollo-era listing of Comanche 44, some explanation of the reconstruction process is needed to insure confidence in that accuracy.

The starting point was the source code of Comanche 51 (separately previously reconstructed from an Apollo-era listing of Comanche 55, flown on Apollo 11). Comanche 51 source code was then modified by undoing changes known to have been made between revisions 44 and 51. The now-reconstructed Comanche 44 source code was verified by assembling it and checking that the assembled code had the expected known-correct memory-bank checksums. Note that page numbers in the reconstructed code match those on the Comanche 55 printout, although the source code would likely have different page numbers in a contemporary Comanche 44 listing.

Annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change relative to Comanche 51. Here's a guide to the Apollo documentation referenced in those annotations:
In most cases, only the titles (rather than the full texts) of PCRs are known. In addition to the explanatory annotations, there is also a step-by-step commentary about the reconstruction process.

Comments expected to have been present in the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC Project's GitHub repository.

064619,000002:                                                                                                  ## Copyright:   Public domain.
064620,000003:                                                                                                  ## Filename:    RTB_OP_CODES.agc
064621,000004:                                                                                                  ## Purpose:     A section of Comanche revision 044.
064622,000005:                                                                                                  ##              It is part of the reconstructed source code for the
064623,000006:                                                                                                  ##              original release of the flight software for the Command
064624,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
064625,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
064626,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
064627,000010:                                                                                                  ##              exactly match those specified for Comanche 44 in NASA drawing
064628,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
064629,000012:                                                                                                  ##              reconstruction is correct.
064630,000013:                                                                                                  ## Assembler:   yaYUL
064631,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
064632,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
064633,000016:                                                                                                  ## Mod history: 2020-12-03 MAS  Created from Comanche 51.
064634,000017: 

Page 1508

064636,000019: 22,3510                                           BANK     22                                    
064637,000020: 22,2000                                           SETLOC   RTBCODES                              
064638,000021: 22,2000                                           BANK                                           
064639,000022: 
064640,000023: 22,3510  E5,1713                                  EBANK=   XNB                                   
064641,000024: 22,3510                                           COUNT*   $$/RTB                                
064642,000025: 
064643,000026:                                                                                                  #  LOAD TIME2, TIME1 INTO MPAC:
064644,000027: 
064645,000028: 22,3510           00006        LOADTIME           EXTEND                                         
064646,000029: 22,3511           30025                           DCA      TIME2                                 
064647,000030: 22,3512           16024                           TCF      SLOAD2                                
064648,000031: 
064649,000032:                                                                                                  #  CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
064650,000033:                                                                                                  #  DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
064651,000034: 
064652,000035: 22,3513           10154        CDULOGIC           CCS      MPAC                                  
064653,000036: 22,3514           35021                           CAF      ZERO                                  
064654,000037: 22,3515           13520                           TCF      +3                                    
064655,000038: 22,3516           13517                           NOOP                                           
064656,000039: 22,3517           45002                           CS       HALF                                  
064657,000040: 
064658,000041: 22,3520           54155                           TS       MPAC       +1                         
064659,000042: 22,3521           35021                           CAF      ZERO                                  
064660,000043: 22,3522           56154                           XCH      MPAC                                  
064661,000044: 22,3523           00006                           EXTEND                                         
064662,000045: 22,3524           75002                           MP       HALF                                  
064663,000046: 22,3525           20155                           DAS      MPAC                                  
064664,000047: 22,3526           16030                           TCF      DANZIG                                #  MODE IS ALREADY AT DOUBLE-PRECISION
064665,000048: 
064666,000049:                                                                                                  #  READ THE PIPS INTO MPAC WITHOUT CHANGING THEM:
064667,000050: 
064668,000051: 22,3527           00004        READPIPS           INHINT                                         
064669,000052: 22,3530           30037                           CA       PIPAX                                 
064670,000053: 22,3531           54154                           TS       MPAC                                  
064671,000054: 22,3532           30040                           CA       PIPAY                                 
064672,000055: 22,3533           54157                           TS       MPAC       +3                         
064673,000056: 22,3534           30041                           CA       PIPAZ                                 
064674,000057: 22,3535           00003                           RELINT                                         
064675,000058: 22,3536           54161                           TS       MPAC       +5                         
064676,000059: 
064677,000060: 22,3537           35021                           CAF      ZERO                                  
064678,000061: 22,3540           54155                           TS       MPAC       +1                         
064679,000062: 22,3541           54160                           TS       MPAC       +4                         
064680,000063: 22,3542           54162                           TS       MPAC       +6                         
064681,000064: 22,3543           16470        VECMODE            TCF      VMODE                                 
064682,000065: 
064683,000066:                                                                                                  #  FORCE TP SIGN AGREEMENT IN MPAC:
064684,000067: 
064685,000068: 22,3544           07226        SGNAGREE           TC       TPAGREE                               
064686,000069: 

Page 1509

064688,000071: 
064689,000072: 22,3545           16030                           TCF      DANZIG                                
064690,000073: 
064691,000074:                                                                                                  #  CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
064692,000075:                                                                                                  #  SCALED IN HALF-REVOLUTIONS.
064693,000076: 
064694,000077: 22,3546           03576        1STO2S             TC       1TO2SUB                               
064695,000078: 22,3547           35021                           CAF      ZERO                                  
064696,000079: 22,3550           54155                           TS       MPAC       +1                         
064697,000080: 22,3551           16027                           TCF      NEWMODE                               
064698,000081: 
064699,000082:                                                                                                  #  DO 1STO2S ON A VECTOR OF ANGLES:
064700,000083: 
064701,000084: 22,3552           03576        V1STO2S            TC       1TO2SUB                               #  ANSWER ARRIVES IN A AND MPAC.
064702,000085: 
064703,000086: 22,3553           52162                           DXCH     MPAC       +5                         
064704,000087: 22,3554           52155                           DXCH     MPAC                                  
064705,000088: 22,3555           03576                           TC       1TO2SUB                               
064706,000089: 22,3556           54156                           TS       MPAC       +2                         
064707,000090: 
064708,000091: 22,3557           52160                           DXCH     MPAC       +3                         
064709,000092: 22,3560           52155                           DXCH     MPAC                                  
064710,000093: 22,3561           03576                           TC       1TO2SUB                               
064711,000094: 22,3562           54155                           TS       MPAC       +1                         
064712,000095: 
064713,000096: 22,3563           30161                           CA       MPAC       +5                         
064714,000097: 22,3564           54154                           TS       MPAC                                  
064715,000098: 
064716,000099: 22,3565           35017        TPMODE             CAF      ONE                                   #  MODE IS TP.
064717,000100: 22,3566           16027                           TCF      NEWMODE                               
064718,000101: 
064719,000102:                                                                                                  #  V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
064720,000103: 
064721,000104: 22,3567           03576        2V1STO2S           TC       1TO2SUB                               
064722,000105: 22,3570           52160                           DXCH     MPAC       +3                         
064723,000106: 22,3571           52155                           DXCH     MPAC                                  
064724,000107: 22,3572           03576                           TC       1TO2SUB                               
064725,000108: 22,3573           54001                           TS       L                                     
064726,000109: 22,3574           30157                           CA       MPAC       +3                         
064727,000110: 22,3575           16024                           TCF      SLOAD2                                
064728,000111: 
064729,000112:                                                                                                  #  SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
064730,000113: 
064731,000114: 22,3576           52155        1TO2SUB            DXCH     MPAC                                  #  FINAL MPAC +1 UNSPECIFIED.
064732,000115: 22,3577           20001                           DDOUBL                                         
064733,000116: 22,3600           10000                           CCS      A                                     
064734,000117: 22,3601           65017                           AD       ONE                                   
064735,000118: 22,3602           13604                           TCF      +2                                    
064736,000119: 22,3603           40000                           COM                                            #  THIS WAS REVERSE OF MSU.
064737,000120: 
064738,000121: 22,3604           54154                           TS       MPAC                                  #  AND SKIP ON OVERFLOW.

Page 1510

064740,000123: 22,3605           00002                           TC       Q                                     
064741,000124: 
064742,000125: 22,3606           50000                           INDEX    A                                     #  OVERFLOW UNCORRECT AND IN MSU.
064743,000126: 22,3607           35000                           CAF      LIMITS                                
064744,000127: 22,3610           26154                           ADS      MPAC                                  
064745,000128: 22,3611           00002                           TC       Q                                     
064746,000129: 

Page 1511

064748,000131:                                                                                                  #  SUBROUTINE TO INCREMENT CDUS
064749,000132: 
064750,000133: 22,3612           33625        INCRCDUS           CAF      LOCTHETA                              
064751,000134: 22,3613           54130                           TS       BUF                                   #  PLACE ADRES(THETA) IN BUF.
064752,000135: 22,3614           30154                           CAE      MPAC                                  #  INCREMENT IN 1S COMPL.
064753,000136: 22,3615           03626                           TC       CDUINC                                
064754,000137: 
064755,000138: 22,3616           24130                           INCR     BUF                                   
064756,000139: 22,3617           30157                           CAE      MPAC       +3                         
064757,000140: 22,3620           03626                           TC       CDUINC                                
064758,000141: 
064759,000142: 22,3621           24130                           INCR     BUF                                   
064760,000143: 22,3622           30161                           CAE      MPAC       +5                         
064761,000144: 22,3623           03626                           TC       CDUINC                                
064762,000145: 
064763,000146: 22,3624           13543                           TCF      VECMODE                               
064764,000147: 
064765,000148: 22,3625           01155        LOCTHETA           ADRES    THETAD                                
064766,000149: 
064767,000150:                                                                                                  #  THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
064768,000151:                                                                                                  #  QUANTITY FOUND IN TEM2.  THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
064769,000152:                                                                                                  #  (+0 UNEQUAL TO -0) QUANTITY.  MAY BE CALLED BY BANKCALL/SWCALL.
064770,000153: 
064771,000154: 22,3626           54142        CDUINC             TS       TEM2                                  #  1S COMPL. QUANT. ARRIVES IN ACC.  STORE IT
064772,000155: 22,3627           50130                           INDEX    BUF                                   
064773,000156: 22,3630           10000                           CCS      0                                     #  CHANGE 2S COMPL. ANGLE (IN BUF) INTO 1S
064774,000157: 22,3631           65017                           AD       ONE                                   
064775,000158: 22,3632           13636                           TCF      +4                                    
064776,000159: 22,3633           65017                           AD       ONE                                   
064777,000160: 22,3634           65017                           AD       ONE                                   #  OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
064778,000161: 22,3635           40000                           COM                                            
064779,000162: 
064780,000163: 22,3636           60142                           AD       TEM2                                  #  SULT MOVES FROM 2ND TO 3D QUAD. (OR BACK)
064781,000164: 22,3637           10000                           CCS      A                                     #  BACK TO 2S COMPL.
064782,000165: 22,3640           65017                           AD       ONE                                   
064783,000166: 22,3641           13643                           TCF      +2                                    
064784,000167: 22,3642           40000                           COM                                            
064785,000168: 22,3643           54142                           TS       TEM2                                  #  STORE 14BIT QUANTITY WITH PRESENT SIGN
064786,000169: 22,3644           13650                           TCF      +4                                    
064787,000170: 22,3645           50000                           INDEX    A                                     #  SIGN.
064788,000171: 22,3646           35000                           CAF      LIMITS                                #  FIX IT, BY ADDING IN 37777 OR 40000
064789,000172: 22,3647           60142                           AD       TEM2                                  
064790,000173: 
064791,000174: 22,3650           50130                           INDEX    BUF                                   
064792,000175: 22,3651           54000                           TS       0                                     #  STORE NEW ANGLE IN 2S COMPLEMENT.
064793,000176: 22,3652           00002                           TC       Q                                     
064794,000177: 

Page 1512

064796,000179:                                                                                                  #  RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL.  ECADR OF COMMANDS ARRIVES IN X1.
064797,000180: 
064798,000181: 22,3653           50120        PULSEIMU           INDEX    FIXLOC                                #  ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
064799,000182: 22,3654           30046                           CA       X1                                    
064800,000183: 22,3655           04662                           TC       BANKCALL                              
064801,000184: 22,3656           17206                           CADR     IMUPULSE                              
064802,000185: 22,3657           16030                           TCF      DANZIG                                
064803,000186: 

Page 1513

064805,000188:                                                                                                  #  EACH ROUTINE TAKES A 3X3 MATRIX STORED IN DOUBLE PRECISION IN A FIXED AREA OF ERASABLE MEMORY AND REPLACES IT
064806,000189:                                                                                                  #  WITH THE TRANSPOSE MATRIX.  TRANSP1 USES LOCATIONS XNB+0,+1 THROUGH XNB+16D, 17D AND TRANSP2 USES LOCATIONS
064807,000190:                                                                                                  #  XNB1+0,+1 THROUGH XNB1+16D, 17D.  EACH MATRIX IS STORED BY ROWS.
064808,000191: 
064809,000192: 22,3660           02713        XNBEB              ECADR    XNB                                   
064810,000193: 22,3661           02554        XNB1EB             ECADR    XNB1                                  
064811,000194: 
064812,000195: 22,3662  E5,1713                                  EBANK=   XNB                                   
064813,000196: 
064814,000197: 22,3662           33660        TRANSP1            CAF      XNBEB                                 
064815,000198: 22,3663           54003                           TS       EBANK                                 
064816,000199: 22,3664           53716                           DXCH     XNB        +2                         
064817,000200: 22,3665           53722                           DXCH     XNB        +6                         
064818,000201: 22,3666           53716                           DXCH     XNB        +2                         
064819,000202: 
064820,000203: 22,3667           53720                           DXCH     XNB        +4                         
064821,000204: 22,3670           53730                           DXCH     XNB        +12D                       
064822,000205: 22,3671           53720                           DXCH     XNB        +4                         
064823,000206: 
064824,000207: 22,3672           53726                           DXCH     XNB        +10D                       
064825,000208: 22,3673           53732                           DXCH     XNB        +14D                       
064826,000209: 22,3674           53726                           DXCH     XNB        +10D                       
064827,000210: 22,3675           16030                           TCF      DANZIG                                
064828,000211: 22,3676  E5,1554                                  EBANK=   XNB1                                  
064829,000212: 
064830,000213: 22,3676           33661        TRANSP2            CAF      XNB1EB                                
064831,000214: 22,3677           54003                           TS       EBANK                                 
064832,000215: 22,3700           53557                           DXCH     XNB1       +2                         
064833,000216: 22,3701           53563                           DXCH     XNB1       +6                         
064834,000217: 22,3702           53557                           DXCH     XNB1       +2                         
064835,000218: 
064836,000219: 22,3703           53561                           DXCH     XNB1       +4                         
064837,000220: 22,3704           53571                           DXCH     XNB1       +12D                       
064838,000221: 22,3705           53561                           DXCH     XNB1       +4                         
064839,000222: 
064840,000223: 22,3706           53567                           DXCH     XNB1       +10D                       
064841,000224: 22,3707           53573                           DXCH     XNB1       +14D                       
064842,000225: 22,3710           53567                           DXCH     XNB1       +10D                       
064843,000226: 22,3711           16030                           TCF      DANZIG                                
064844,000227: 

Page 1514

064846,000229:                                                                                                  #  THE SUBROUTINE SIGNMPAC SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
064847,000230:                                                                                                  #  FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED.  ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
064848,000231: 
064849,000232:                                                                                                  #  ENTRY MAY BE BY EITHER OF THE FOLLOWING:
064850,000233:                                                                                                  #        1.      LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
064851,000234:                                                                                                  #                ENTRY:          BOVB
064852,000235:                                                                                                  #                                        SIGNMPAC
064853,000236:                                                                                                  #        2.      GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
064854,000237:                                                                                                  #                ENTRY:          RTB
064855,000238:                                                                                                  #                                        SIGNMPAC
064856,000239:                                                                                                  #  IN EITHER CASE, RETURN IS TO THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
064857,000240: 
064858,000241: 22,3712           00006        SIGNMPAC           EXTEND                                         
064859,000242: 22,3713           34777                           DCA      DPOSMAX                               
064860,000243: 22,3714           52155                           DXCH     MPAC                                  
064861,000244: 22,3715           10000                           CCS      A                                     
064862,000245: 22,3716           35021        DPMODE             CAF      ZERO                                  #  SETS MPAC +2 TO ZERO IN THE PROCESS
064863,000246: 22,3717           16026                           TCF      SLOAD2     +2                         
064864,000247: 22,3720           13721                           TCF      +1                                    
064865,000248: 22,3721           00006                           EXTEND                                         
064866,000249: 22,3722           44777                           DCS      DPOSMAX                               
064867,000250: 22,3723           16024                           TCF      SLOAD2                                
064868,000251: 
064869,000252:                                                                                                  #  RTB OP CODE NORMUNIT IS LIKE INTERPRETIVE INSTRUCTION UNIT, EXCEPT THAT IT CAN BE DEPENDED ON NOT TO BLOW
064870,000253:                                                                                                  #  UP WHEN THE VECTOR BEING UNITIZED IS VERY SMALL -- IT WILL BLOW UP WHEN ALL COMPONENTS ARE ZERO.  IF NORMUNIT
064871,000254:                                                                                                  #  IS USED AND THE UPPER ORDER HALVES OF ALL COMPONENTS ARE ZERO, THE MAGNITUDE RETURNED IN 36D WILL BE TOO LARGE
064872,000255:                                                                                                  #  BY A FACTOR OF 2(13) AND THE SQUARED MAGNITUDE RETURNED AT 34D WILL BE TOO BIG BY A FACTOR OF 2(26).
064873,000256: 
064874,000257: 22,3724           35017        NORMUNX1           CAF      ONE                                   
064875,000258: 22,3725           13727                           TCF      NORMUNIT   +1                         
064876,000259: 22,3726           35021        NORMUNIT           CAF      ZERO                                  
064877,000260: 22,3727           60120                           AD       FIXLOC                                
064878,000261: 22,3730           54156                           TS       MPAC       +2                         
064879,000262: 22,3731           04662                           TC       BANKCALL                              #  GET SIGN AGREEMENT IN ALL COMPONENTS
064880,000263: 22,3732           01010                           CADR     VECAGREE                              
064881,000264: 22,3733           10154                           CCS      MPAC                                  
064882,000265: 22,3734           13770                           TCF      NOSHIFT                               
064883,000266: 22,3735           13737                           TCF      +2                                    
064884,000267: 22,3736           13770                           TCF      NOSHIFT                               
064885,000268: 22,3737           10157                           CCS      MPAC       +3                         
064886,000269: 22,3740           13770                           TCF      NOSHIFT                               
064887,000270: 22,3741           13743                           TCF      +2                                    
064888,000271: 22,3742           13770                           TCF      NOSHIFT                               
064889,000272: 22,3743           10161                           CCS      MPAC       +5                         
064890,000273: 22,3744           13770                           TCF      NOSHIFT                               
064891,000274: 22,3745           13747                           TCF      +2                                    
064892,000275: 22,3746           13770                           TCF      NOSHIFT                               

Page 1515

064894,000277: 22,3747           30155                           CA       MPAC       +1                         #  SHIFT ALL COMPONENTS LEFT 13
064895,000278: 22,3750           00006                           EXTEND                                         
064896,000279: 22,3751           75002                           MP       BIT14                                 
064897,000280: 22,3752           20155                           DAS      MPAC                                  #  DAS GAINS A LITTLE ACCURACY
064898,000281: 22,3753           30160                           CA       MPAC       +4                         
064899,000282: 22,3754           00006                           EXTEND                                         
064900,000283: 22,3755           75002                           MP       BIT14                                 
064901,000284: 22,3756           20160                           DAS      MPAC       +3                         
064902,000285: 22,3757           30162                           CA       MPAC       +6                         
064903,000286: 22,3760           00006                           EXTEND                                         
064904,000287: 22,3761           75002                           MP       BIT14                                 
064905,000288: 22,3762           20162                           DAS      MPAC       +5                         
064906,000289: 22,3763           35025                           CAF      THIRTEEN                              
064907,000290: 22,3764           50156                           INDEX    MPAC       +2                         
064908,000291: 22,3765           54045                           TS       37D                                   
064909,000292: 22,3766           04701        OFFTUNIT           TC       POSTJUMP                              
064910,000293: 22,3767           01024                           CADR     UNIT       +1                         #  SKIP THE "TC VECAGREE" DONE AT UNIT
064911,000294: 
064912,000295: 22,3770           35021        NOSHIFT            CAF      ZERO                                  
064913,000296: 22,3771           13764                           TCF      OFFTUNIT   -2                         
064914,000297: 
064915,000298:                                                                                                  #  RTB VECSGNAG ... FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
064916,000299: 
064917,000300: 22,3772           04662        VECSGNAG           TC       BANKCALL                              
064918,000301: 22,3773           01010                           CADR     VECAGREE                              
064919,000302: 22,3774           06030                           TC       DANZIG                                
064920,000303: 

Page 1516


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