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.

038964,000002:                                                                                                  ## Copyright:   Public domain.
038965,000003:                                                                                                  ## Filename:    CM_BODY_ATTITUDE.agc
038966,000004:                                                                                                  ## Purpose:     A section of Comanche revision 044.
038967,000005:                                                                                                  ##              It is part of the reconstructed source code for the
038968,000006:                                                                                                  ##              original release of the flight software for the Command
038969,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
038970,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
038971,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
038972,000010:                                                                                                  ##              exactly match those specified for Comanche 44 in NASA drawing
038973,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
038974,000012:                                                                                                  ##              reconstruction is correct.
038975,000013:                                                                                                  ## Assembler:   yaYUL
038976,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
038977,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
038978,000016:                                                                                                  ## Mod history: 2020-12-03 MAS  Created from Comanche 51.
038979,000017: 

Page 883

038981,000019: 35,3504                                           BANK     35                                    
038982,000020: 
038983,000021: 37,2000                                           SETLOC   BODYATT                               
038984,000022: 37,2000                                           BANK                                           
038985,000023: 
038986,000024: 37,3467                                           COUNT    37/CMBAT                              
038987,000025: 
038988,000026:                                                                                                  #  PDL 12D - 15D SAFE.
038989,000027: 
038990,000028:                                                                                                  #  VALUES OF GIMBAL AND BODY ANGLES VALID AT PIP TIME ARE SAVED DURING  READACCS.
038991,000029: 
038992,000030: 37,3467  E7,1451                                  EBANK=   RTINIT                                #  LET INTERPRETER SET EB
038993,000031: 
038994,000032: 37,3467           06006        CM/POSE            TC       INTPRET                               #  COME HERE VIA AVEGEXIT.
038995,000033: 
038996,000034: 37,3470           77201                           SETPD    VLOAD                                 
038997,000035: 37,3471           00001                                    0                                     
038998,000036: 37,3472           01177                                    VN                                    #  KVSCALE = (12800/ .3048) /2VS
038999,000037: 37,3473           63361                           VXSC     PDVL                                  
039000,000038: 37,3474           37766                                    -KVSCALE                              #  KVSCALE = .81491944
039001,000039: 37,3475           01714                                    UNITW                                 #  FULL UNIT VECTOR
039002,000040: 37,3476           74235                           VXV      VXSC                                  #  VREL = V - WE*R
039003,000041: 37,3477           01760                                    UNITR                                 
039004,000042: 37,3500           15245                                    KWE                                   
039005,000043: 37,3501           45455                           VAD      STADR                                 
039006,000044: 37,3502           74251                           STORE    -VREL                                 #  SAVE FOR ENTRY GUIDANCE.      REF COORDS
039007,000045: 
039008,000046: 37,3503           72056                           UNIT     LXA,1                                 
039009,000047: 37,3504           00044                                    36D                                   #  ABVAL( -VREL) TO X1
039010,000048: 37,3505           03542                           STORE    UXA/2                                 #  -UVREL                        REF COORDS
039011,000049: 
039012,000050: 37,3506           57435                           VXV      VCOMP                                 
039013,000051: 37,3507           01760                                    UNITR                                 #  .5 UNIT                       REF COORDS
039014,000052: 37,3510           66256                           UNIT     SSP                                   #  THE FOLLOWING IS TO PROVIDE A STABLE
039015,000053: 37,3511           00051                                    S1                                    #  UN FOR THE END OF THE TERMINAL PHASE.
039016,000054: 37,3512           00476        SPVQUIT            DEC      .019405                               #  1000/ 2 VS
039017,000055: 37,3513           77300                           TIX,1    VLOAD                                 #  IF V-VQUIT POS, BRANCH.
039018,000056: 37,3514           77516                                    CM/POSE2                              #  SAVE UYA IN OLDUYA
039019,000057: 37,3515           03534                                    OLDUYA                                #  OTHERWISE CONTINUE TO USE OLDUYA.
039020,000058: 37,3516           03550        CM/POSE2           STORE    UYA/2                                 #                                REF COORDS
039021,000059: 
039022,000060: 37,3517           03534                           STORE    OLDUYA                                #  RESTORE, OR SAVE AS CASE MAY BE.
039023,000061: 
039024,000062: 37,3520           57435                           VXV      VCOMP                                 
039025,000063: 37,3521           03542                                    UXA/2                                 #  FINISH OBTAINING TRAJECTORY TRIAD.
039026,000064: 37,3522           77772                           VSL1                                           
039027,000065: 37,3523           03556                           STORE    UZA/2                                 #                                REF COORDS

Page 884

039029,000067: 37,3524           77751                           TLOAD                                          #  PICK UP CDUX, CDUY, CDUZ CORRESPONDING
039030,000068: 37,3525           03270                                    AOG/PIP                               #  TO PIPUP TIME IN 2S,C AND SAVE.
039031,000069: 37,3526           14031        CM/TRIO            STODL    24D                                   
039032,000070: 37,3527           00032                                    25D                                   #  AIG/PIP
039033,000071: 
039034,000072: 37,3530           41434                           RTB      PUSH                                  #  TO PDL0
039035,000073: 37,3531           45513                                    CDULOGIC                              
039036,000074: 37,3532           77746                           COS                                            
039037,000075: 37,3533           17564                           STODL    UBX/2                                 #  CI /2
039038,000076:                                                                                                  #  AIG/PIP FROM PDL 0
039039,000077: 37,3534           57556                           SIN      DCOMP                                 
039040,000078: 37,3535           17570                           STODL    UBX/2      +4                         #  -SI /2
039041,000079: 37,3536           00033                                    26D                                   #  AMG/PIP
039042,000080: 37,3537           41434                           RTB      PUSH                                  #  TO PDL 0
039043,000081: 37,3540           45513                                    CDULOGIC                              
039044,000082: 37,3541           65356                           SIN      PDDL                                  #  XCH PDL 0.  SAVE SM /2
039045,000083: 37,3542           65346                           COS      PDDL                                  #  CM /2 TO PDL 2
039046,000084: 37,3543           00001                                    0                                     #  SM /2
039047,000085: 37,3544           74276                           DCOMP    VXSC                                  
039048,000086: 37,3545           03564                                    UBX/2                                 
039049,000087: 37,3546           77772                           VSL1                                           #  NOISE WONT OVFL.
039050,000088: 37,3547           17572                           STODL    UBY/2                                 #  =(-SMCI, NOISE, SMSI)/2
039051,000089: 37,3550           00003                                    2                                     #  CM /2 REPLACES NOISE
039052,000090: 37,3551           17574                           STODL    UBY/2      +2                         #  UBY/2=(-SMCI, CM, SMSI)/2
039053,000091: 37,3552           00031                                    24D                                   #  AOG/PIP
039054,000092: 37,3553           41434                           RTB      PUSH                                  #  TO PDL 4
039055,000093: 37,3554           45513                                    CDULOGIC                              
039056,000094: 37,3555           65356                           SIN      PDDL                                  #  XCH PDL 4.  SAVE SO /2
039057,000095: 37,3556           74346                           COS      VXSC                                  #  CO /2
039058,000096: 37,3557           03572                                    UBY/2                                 
039059,000097: 37,3560           17572                           STODL    UBY/2                                 #  UBY/2=(-COSMCI, COCM, COSMSI)/4
039060,000098: 37,3561           00005                                    4D                                    #  SO /2
039061,000099: 37,3562           57405                           DMP      DCOMP                                 
039062,000100: 37,3563           03570                                    UBX/2      +4                         #  -SI /2
039063,000101: 37,3564           77615                           DAD                                            
039064,000102: 37,3565           03572                                    UBY/2                                 #  INCREMENT BY (SOSI /4)
039065,000103: 37,3566           17572                           STODL    UBY/2                                 
039066,000104:                                                                                                  #  SO /2 FROM PDL 4
039067,000105: 37,3567           43205                           DMP      DAD                                   
039068,000106: 37,3570           03564                                    UBX/2                                 #  CI /2
039069,000107: 37,3571           03576                                    UBY/2      +4                         
039070,000108: 37,3572           27576                           STOVL    UBY/2      +4                         #  YB/4                          PLATFORM COORDS
039071,000109: 
039072,000110:                                                                                                  #  YB = (-COSMCI + SOSI , COCM , COSMSI + SOCI )
039073,000111: 
039074,000112: 37,3573           03572                                    UBY/2                                 
039075,000113: 37,3574           72505                           VXM      VSL2                                  
039076,000114: 37,3575           01736                                    REFSMMAT                              #  .5 UNIT
039077,000115: 37,3576           17572                           STODL    UBY/2                                 #  YB/2 DONE                     REF COORDS

Page 885

039079,000117:                                                                                                  #  CM /2 FROM PDL 2
039080,000118: 37,3577           76561                           VXSC     VSL1                                  
039081,000119: 37,3600           03564                                    UBX/2                                 
039082,000120: 37,3601           17564                           STODL    UBX/2                                 #  =( CMCI, NOISE, -CMSI)/2
039083,000121: 37,3602           77626                           STADR                                          #  SM /2 FROM PDL 0
039084,000122: 37,3603           50211                           STOVL    UBX/2      +2                         #  SM /2 REPLACES NOISE
039085,000123: 37,3604           03564                                    UBX/2                                 #  XB/2                          PLATFORM COORDS
039086,000124: 
039087,000125:                                                                                                  #  XB = ( CMCI , SM , -CMSI )
039088,000126: 
039089,000127: 37,3605           76505                           VXM      VSL1                                  
039090,000128: 37,3606           01736                                    REFSMMAT                              #  .5 UNIT
039091,000129: 37,3607           03564                           STORE    UBX/2                                 #  XB/2 DONE                     REF COORDS
039092,000130: 
039093,000131: 37,3610           76435                           VXV      VSL1                                  
039094,000132: 37,3611           03572                                    UBY/2                                 
039095,000133: 37,3612           27600                           STOVL    UBZ/2                                 #  ZB/2 DONE                     REF COORDS
039096,000134: 
039097,000135:                                                                                                  #  EQUIVALENT TO
039098,000136:                                                                                                  #  ZB = ( SOSMCI + COSI , -SOCM , -SOSMSI + COCI )
039099,000137: 
039100,000138: 37,3613           03542                                    UXA/2                                 #  -UVREL/2 = -UVA/2
039101,000139: 37,3614           53435                           VXV      UNIT                                  #  GET UNIT(-UVREL*UBY)/2 = UL/2
039102,000140: 37,3615           03572                                    UBY/2                                 #  YB/2
039103,000141: 37,3616           50206                           PUSH     DOT                                   #  UL/2 TO PDL 0,5
039104,000142: 37,3617           03556                                    UZA/2                                 #  UNA/2
039105,000143: 37,3620           24021                           STOVL    COSTH                                 #  COS(ROLL)/4
039106,000144: 37,3621           00001                                    0                                     #  UL/2
039107,000145: 
039108,000146: 37,3622           77641                           DOT                                            
039109,000147: 37,3623           03550                                    UYA/2                                 
039110,000148: 37,3624           34023                           STCALL   SINTH                                 #  -SIN(ROLL)/4
039111,000149: 37,3625           47256                                    ARCTRIG                               
039112,000150: 37,3626           24007                           STOVL    6D                                    #  -(ROLL/180) /2
039113,000151: 37,3627           03572                                    UBY/2                                 
039114,000152: 37,3630           72441                           DOT      SL1                                   #  -UVA.UBY = -SIN(BETA)
039115,000153: 37,3631           03542                                    UXA/2                                 #  -UVREL/2
039116,000154: 37,3632           77736                           ARCSIN                                         
039117,000155: 37,3633           24010                           STOVL    7D                                    #  -(BETA/180) /2
039118,000156: 37,3634           03564                                    UBX/2                                 #  XB/2
039119,000157: 37,3635           77641                           DOT                                            #  UL.UBX = -SIN(ALFA)
039120,000158: 37,3636           00001                                    0                                     #  UL/2
039121,000159: 37,3637           24023                           STOVL    SINTH                                 #  -SIN(ALFA)/4
039122,000160: 37,3640           77641                           DOT                                            #  UL/2 FROM PDL 0
039123,000161: 37,3641           03600                                    UBZ/2                                 
039124,000162: 37,3642           34021                           STCALL   COSTH                                 #  COS(ALFA)/4
039125,000163: 37,3643           47256                                    ARCTRIG                               
039126,000164: 37,3644           24011                           STOVL    8D                                    #  -(ALFA/180) /2
039127,000165: 37,3645           01760                                    UNITR                                 #  UR/2                          REF COORDS
039128,000166: 37,3646           72441                           DOT      SL1                                   

Page 886

039130,000168: 37,3647           03556                                    UZA/2                                 #  MORE ACCURATE AT LARGE ARG.
039131,000169: 37,3650           77726                           ARCCOS                                         
039132,000170: 37,3651           00013                           STORE    10D                                   #  (-GAMA/180)/2
039133,000171: 
039134,000172: 37,3652           77551                           TLOAD    EXIT                                  #  ANGLES IN MPAC IN THE ORDER
039135,000173:                                                                                                  #  -( (ROLL, BETA, ALFA) /180)/2
039136,000174: 37,3653           00007                                    6D                                    #  THESE VALUES CORRECT AT PIPUP TIME.
039137,000175: 
039138,000176:                                                                                                  #  SPACER

Page 887

039140,000178:                                                                                                  #  BASIC SUBROUTINE TO UPDATE ATTITUDE ANGLES
039141,000179: 
039142,000180: 37,3654  E6,1661                                  EBANK=   AOG                                   
039143,000181: 
039144,000182: 37,3654           35057        CM/ATUP            CA       EBAOG                                 
039145,000183: 37,3655           54003                           TS       EBANK                                 
039146,000184: 37,3656           50120        CMTR1              INDEX    FIXLOC                                
039147,000185: 37,3657           40012                           CS       10D                                   #  (GAMA/180)/2
039148,000186: 37,3660           57722                           XCH      GAMA                                  
039149,000187: 37,3661           54001                           TS       L                                     
039150,000188: 
039151,000189: 37,3662           00004                           INHINT                                         
039152,000190:                                                                                                  #  MUST REMAIN INHINTED UNTIL UPDATE OF BODY
039153,000191:                                                                                                  #  ANGLES, SO THAT GAMDIFSW IS VALID FIRST PASS
039154,000192:                                                                                                  #  INDICATOR.
039155,000193: 
039156,000194: 37,3663           40102                           CS       CM/FLAGS                              
039157,000195: 37,3664           75005                           MASK     BIT11                                 #  GAMDIFSW=94D BIT11    INITLY=0
039158,000196: 37,3665           00006                           EXTEND                                         #  DONT CALC GAMA DOT UNTIL HAVE FORMD
039159,000197:                                                                                                  #  ONE DIFFERENCE.
039160,000198: 37,3666           13671                           BZF      DOGAMDOT                              #  IS OK, GO ON.
039161,000199: 37,3667           26102                           ADS      CM/FLAGS                              #  KNOW BIT IS 0
039162,000200: 37,3670           03704                           TC       NOGAMDOT                              #  SET GAMDOT = 0
039163,000201: 
039164,000202: 37,3671           40001        DOGAMDOT           CS       L                                     
039165,000203: 37,3672           61722                           AD       GAMA                                  #  DEL GAMA/360= T GAMDOT/360
039166,000204: 37,3673           00006                           EXTEND                                         
039167,000205: 37,3674           73767                           MP       TCDU                                  #  TCDU = .1 SEC, T = 2 SEC.
039168,000206: 37,3675           55723                           TS       GAMDOT                                #  GAMA DOT TCDU / 180
039169,000207: 
039170,000208: 37,3676           00006                           EXTEND                                         #  IGNORE GAMDOT IF LEQ .5 DEG/SEC
039171,000209: 37,3677           63701                           BZMF     +2                                    
039172,000210: 37,3700           40000                           COM                                            
039173,000211: 37,3701           65022                           AD       FIVE                                  
039174,000212: 37,3702           00006                           EXTEND                                         
039175,000213: 37,3703           63706                           BZMF     +3                                    #  SET GAMDOT=+0 AS TAG IF TOO SMALL.
039176,000214: 
039177,000215: 37,3704           35021        NOGAMDOT           CA       ZERO                                  #  COME HERE INHINTED.
039178,000216: 37,3705           55723                           TS       GAMDOT                                
039179,000217:                                                                                                  #  FOR NOW LEAVE IN 2S,C
039180,000218:                                                                                                  #  UPDATE ANGLES BY CORRECTING EUILER ANG
039181,000219:                                                                                                  #  FOR ACCRUED INCREMENT SINCE PIPUP
039182,000220:                                                                                                  #  R = R EUIL + R(NOW) - R(PIPUP)
039183,000221: 37,3706           40154                           CS       MPAC                                  #  GET (R EUL/180) /2
039184,000222: 37,3707           60000                           DOUBLE                                         #  POSSIBLE OVERFLOW
039185,000223: 37,3710           03757                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY
039186,000224: 37,3711           00006                           EXTEND                                         
039187,000225: 37,3712           61672                           SU       ROLL/PIP                              #  GET INCR SINCE PIPUP
039188,000226: 37,3713           61664                           AD       ROLL/180                              #  ONLY SINGLE OVFL POSSIBLE.
039189,000227: 37,3714           03757                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY

Page 888

039191,000229: 37,3715           55770                           TS       TEMPROLL                              
039192,000230: 
039193,000231: 37,3716           40156                           CS       MPAC       +2                         #  GET (ALFA EUL/180) /2
039194,000232: 37,3717           60000                           DOUBLE                                         #  SAME AS FOR ROLL.  NEEDED FOR EXT ATM DAP
039195,000233: 37,3720           03757                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY
039196,000234: 37,3721           00006                           EXTEND                                         
039197,000235: 37,3722           61673                           SU       ALFA/PIP                              
039198,000236: 37,3723           61665                           AD       ALFA/180                              
039199,000237: 37,3724           03757                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY
039200,000238: 37,3725           55771                           TS       TEMPALFA                              
039201,000239: 
039202,000240: 37,3726           40155                           CS       MPAC       +1                         #  GET (BETA EUL/180) /2
039203,000241: 37,3727           60000        CMTR2              DOUBLE                                         
039204,000242: 37,3730           00006                           EXTEND                                         
039205,000243: 37,3731           61674                           SU       BETA/PIP                              
039206,000244: 37,3732           61666                           AD       BETA/180                              
039207,000245: 37,3733           57772                           XCH      TEMPBETA                              #  OVFL NOT EXPECTED.
039208,000246: 
039209,000247: 37,3734           35051                           CA       EBANK3                                
039210,000248: 37,3735           54003                           TS       EBANK                                 
039211,000249: 
039212,000250: 37,3736  E3,1446                                  EBANK=   PHSNAME5                              
039213,000251: 37,3736           00006                           EXTEND                                         
039214,000252: 37,3737           33771                           DCA      REPOSADR                              #  THIS ASSUMES THAT THE         TC  PHASCHNG
039215,000253: 37,3740           53447                           DXCH     PHSNAME5                              #  IS NOT CHANGED IN             OCT 10035
039216,000254:                                                                                                  #  SERVICER.
039217,000255: 
039218,000256: 37,3741           35057                           CA       EBAOG                                 
039219,000257: 37,3742           54003                           TS       EBANK                                 
039220,000258: 
039221,000259: 37,3743  E6,1661                                  EBANK=   AOG                                   
039222,000260: 37,3743           00006        REDOPOSE           EXTEND                                         #  RE-STARTS COME HERE
039223,000261: 37,3744           31771                           DCA      TEMPROLL                              
039224,000262: 37,3745           53665                           DXCH     ROLL/180                              
039225,000263: 37,3746           31772                           CA       TEMPBETA                              
039226,000264: 37,3747           55666                           TS       BETA/180                              
039227,000265: 
039228,000266: 37,3750           00003                           RELINT                                         
039229,000267: 
039230,000268: 37,3751           06006                           TC       INTPRET                               #  CANT TC DANZIG AFTER PHASCHNG.
039231,000269: 37,3752           51575        CM/POSE3           VLOAD    ABVAL                                 #  RETURN FROM CM/ATUP.  (RESTART)
039232,000270: 37,3753           01177                                    VN                                    #  2(-7) M/CS
039233,000271: 37,3754           03723                           STORE    VMAGI                                 #  FOR DISPLAY ON CALL.
039234,000272: 
039235,000273: 37,3755           77650                           GOTO                                           
039236,000274: 37,3756           03324                                    POSEXIT                               #  ENDEXIT, STARTENT, OR SCALEPOP.
039237,000275: 
039238,000276: 37,3757           54001        CORANGOV           TS       L                                     
039239,000277: 37,3760           00002                           TC       Q                                     
039240,000278: 37,3761           50000                           INDEX    A                                     

Page 889

039242,000280: 37,3762           35000                           CA       LIMITS                                
039243,000281: 37,3763           26001                           ADS      L                                     
039244,000282: 37,3764           00002                           TC       Q                                     #  COSTS 2 MCT TO USE.  SEE ANGOVCOR.
039245,000283: 
039246,000284: 37,3765           45730 53410  -KVSCALE           2DEC     -.81491944                            #  -12800/(2 VS .3048)
039247,000285: 
039248,000286: 37,3767           03146        TCDU               DEC      .1                                    #  TCDU = .1 SEC.
039249,000287: 
039250,000288: 37,3770  E6,1661                                  EBANK=   AOG                                   
039251,000289: 37,3770           03743 76066  REPOSADR           2CADR    REDOPOSE                              
039252,000290: 

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