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.

017834,000002:                                                                                                  ## Copyright:   Public domain.
017835,000003:                                                                                                  ## Filename:    GIMBAL_LOCK_AVOIDANCE.agc
017836,000004:                                                                                                  ## Purpose:     A section of Comanche revision 044.
017837,000005:                                                                                                  ##              It is part of the reconstructed source code for the
017838,000006:                                                                                                  ##              original release of the flight software for the Command
017839,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 10.
017840,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
017841,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
017842,000010:                                                                                                  ##              exactly match those specified for Comanche 44 in NASA drawing
017843,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
017844,000012:                                                                                                  ##              reconstruction is correct.
017845,000013:                                                                                                  ## Assembler:   yaYUL
017846,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
017847,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
017848,000016:                                                                                                  ## Mod history: 2020-12-03 MAS  Created from Comanche 51.
017849,000017:                                                                                                  ##              2020-12-04 MAS  Changed the last ARATE entry back to 4 deg/s.
017850,000018:                                                                                                  ##              2020-12-11 RSB  Added justifying annotations for Mike's 
017851,000019:                                                                                                  ##                              reconstruction steps.
017852,000020: 

Page 412

017854,000022: 15,2000                                           BANK     15                                    
017855,000023: 22,2000                                           SETLOC   KALCMON1                              
017856,000024: 22,2000                                           BANK                                           
017857,000025: 
017858,000026: 22,2737  E6,1661                                  EBANK=   BCDU                                  
017859,000027: 
017860,000028:                                                                                                  #  DETECTING GIMBAL LOCK
017861,000029: 22,2737  22,2737               LOCSKIRT           EQUALS   WCALC                                 
017862,000030: 22,2737           70740        WCALC              LXC,1    DLOAD*                                
017863,000031: 22,2740           01130                                    RATEINDX                              
017864,000032: 22,2741           04771                                    ARATE,1                               
017865,000033: 22,2742           45002                           SR4      CALL                                  #  COMPUTE THE INCREMENTAL ROTATION MATRIX
017866,000034: 22,2743           44530                                    DELCOMP                               #  DEL CORRESPONDING TO A 1 SEC ROTATION
017867,000035:                                                                                                  #  ABOUT COF
017868,000036: 22,2744           74343                           DLOAD*   VXSC                                  
017869,000037: 22,2745           04771                                    ARATE,1                               
017870,000038: 22,2746           03343                                    COF                                   
017871,000039: 22,2747           77721                           MXV                                            
017872,000040: 22,2750           05003                                    QUADROT                               
017873,000041: 22,2751           17311                           STODL    BRATE                                 
017874,000042: 22,2752           03365                                    AM                                    
017875,000043: 22,2753           55605                           DMP      DDV*                                  
017876,000044: 22,2754           05001                                    ANGLTIME                              
017877,000045: 22,2755           04771                                    ARATE,1                               
017878,000046: 22,2756           77661                           SR                                             
017879,000047: 22,2757           20606                                    5                                     
017880,000048: 22,2760           27317                           STOVL    TM                                    
017881,000049: 22,2761           03311                                    BRATE                                 
017882,000050: 22,2762           77761                           VXSC                                           
017883,000051: 22,2763           05025                                    BIASCALE                              
017884,000052: 22,2764           03275                           STORE    BIASTEMP                              #  ATTITUDE ERROR BIAS TO PREVENT OVERSHOOT
017885,000053:                                                                                                  #  IN SYSTEM
017886,000054: 22,2765           77614                           SETGO                                          #  STATE SWITCH CALCMAN2 (43D)
017887,000055: 22,2766           01035                                    CALCMAN2                              #  0(OFF) = BYPASS STARTING PROCEDURE
017888,000056: 22,2767           45032                                    NEWANGL    +1                         #  1(ON) = START MANEUVER
017889,000057: 
017890,000058: 
017891,000059: 22,2770           00044 15053  ARATE              2DEC     .0022222222                            #  = .05 DEG/SEC
017892,000060: 
017893,000061: 22,2772           00221 24255                     2DEC     .0088888889                            #  = .2 DEG/SEC
017894,000062: 
017895,000063: 22,2774           00554 02660                     2DEC     .0222222222                            #  = .5 DEG/SEC
017896,000064: 

Reconstruction: The following value has been changed from its Comanche 51 value (2 degrees per seconds) to its Colossus 249 (Apollo 9) value. This is justified by Programmed Guidance Equations for Colossus 2, p. ATTM-14

017902,000070: 22,2776           05540 26603                     2DEC     .1777777777                            #  = 4 DEG/SEC           $ 22.5 DEG/SEC
017903,000071: 
017904,000072: 22,3000           00003 04000  ANGLTIME           2DEC     .000190735                            #  = 100B - 19
017905,000073: 
017906,000074:                                                                                                  #  MANEUVER ANGLE TO MANEUVER TIME
017907,000075: 22,3002           03146 14632  QUADROT            2DEC     .1                                    #  ROTATION MATRIX FROM S/C AXES TO CONTROL
017908,000076: 

Page 413

017910,000078: 22,3004           00000 00000                     2DEC     0          B-28                       #  AXES (X ROT = -7.25 DEG)
017911,000079: 
017912,000080: 22,3006           00000 00000                     2DEC     0          B-28                       
017913,000081: 
017914,000082: 22,3010           00000 00000                     2DEC     0          B-28                       
017915,000083: 
017916,000084: 22,3012           03131 11275                     2DEC     .099200                               #  =(.1)COS7.25
017917,000085: 
017918,000086: 22,3014           77461 47370                     2DEC     -.012620                              #  =-(.1)SIN7.25
017919,000087: 
017920,000088: 22,3016           00000 00000                     2DEC     0          B-28                       
017921,000089: 
017922,000090: 22,3020           00316 30407                     2DEC     .012620                               #  (.1)SIN7.25
017923,000091: 
017924,000092: 22,3022           03131 11275                     2DEC     .099200                               #  (.1)COS7.25
017925,000093: 
017926,000094: 22,3024           00004 05253  BIASCALE           2DEC     .0002543132                            #  = (450/180)(1/0.6)(1/16384)

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