Source Code

These source-code files are part of a reconstructed copy of Comanche 51, the initial release (though not the final mission release) of the Apollo 11 Command Module (CM) Apollo Guidance Computer (AGC) software. The flown, final release was Comanche 55. The reconstruction is believed to be exactly accurate, but in the absence of an actual Apollo-era listing of Comanche 51, some explanation of the reconstruction process is needed to insure confidence in that accuracy.

The starting point was the source code of Comanche 55, whose original source code is available. Comanche 55 source code was then modified by undoing changes known to have been made between revisions 51 and 55. The most-significant steps involved reverting changes related to the R-2 lunar potential model, the details of which were known from the previous, separate, independent reconstruction of the Apollo 10 Lunar Module software Luminary 69/2. The now-reconstructed Comanche 51 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 or Luminary 69 printouts, although the source code would likely have different page numbers in a contemporary Comanche 51 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 55. Here's a guide to some of the Apollo documentation relevant to those annotations:
Among documentation not actually referenced in the annotations, there is a short writeup about the reconstruction process in our software repository that may be helpful in understanding it from a different perspective. There's also a handy table that lists what the number of memory-words should be for each routine in Comanche 51, which could make a nice double-check; however, we've not performed that double-check ourselves.

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.

021763,000002:                                                                                                  ## Copyright:   Public domain.
021764,000003:                                                                                                  ## Filename:    P76.agc
021765,000004:                                                                                                  ## Purpose:     A section of Comanche revision 051.
021766,000005:                                                                                                  ##              It is part of the reconstructed source code for the
021767,000006:                                                                                                  ##              original release of the flight software for the Command
021768,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 11.
021769,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
021770,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
021771,000010:                                                                                                  ##              exactly match those specified for Comanche 51 in NASA drawing
021772,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
021773,000012:                                                                                                  ##              reconstruction is correct.
021774,000013:                                                                                                  ## Reference:   pp. 511-513
021775,000014:                                                                                                  ## Assembler:   yaYUL
021776,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
021777,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
021778,000017:                                                                                                  ## Mod history: 2019-07-30 MAS  Created from Comanche 55.
021779,000018: 

Page 511

021781,000020:                                                                                                  #  1)    PROGRAM NAME - TARGET DELTA V PROGRAM (P76).
021782,000021:                                                                                                  #  2)    FUNCTIONAL DESCRIPTION - UPON ENTRY BY ASTRONAUT ACTION, P76 FLASHES DSKY REQUESTS TO THE ASTRONAUT
021783,000022:                                                                                                  #        TO PROVIDE VIA DSKY (1) THE DELTA V TO BE APPLIED TO THE OTHER VEHICLE STATE VECTOR AND (2) THE
021784,000023:                                                                                                  #        TIME (TIG) AT WHICH THE OTHER VEHICLE VELOCITY WAS CHANGED BY EXECUTION OF A THRUSTING MANEUVER. THE
021785,000024:                                                                                                  #        OTHER VEHICLE STATE VECTOR IS INTEGRATED TO TIG AND UPDATED BY THE ADDITION OF DELTA V (DELTA V HAVING
021786,000025:                                                                                                  #        BEEN TRANSFORMED FROM LV TO REF COSYS).  USING INTEGRVS, THE PROGRAM THEN INTEGRATES THE OTHER
021787,000026:                                                                                                  #        VEHICLE STATE VECTOR TO THE STATE VECTOR OF THIS VEHICLE, THUS INSURING THAT THE W-MATRIX AND BOTH VEHICLE
021788,000027:                                                                                                  #        STATES CORRESPOND TO THE SAME TIME.
021789,000028:                                                                                                  #  3)    ERASABLE INITIALIZATION REQUIRED - NONE.
021790,000029:                                                                                                  #  4)    CALLING SEQUENCES AND EXIT MODES - CALLED BY ASTRONAUT REQUEST THRU DSKY V 37 E 76E.
021791,000030:                                                                                                  #        EXITS BY TCF ENDOFJOB.
021792,000031:                                                                                                  #  5)    OUTPUT - OTHER VEHICLE STATE VECTOR INTEGRATED TO TIG AND INCREMENTED BY DELTA V IN REF COSYS.
021793,000032:                                                                                                  #        THE PUSHLIST CONTAINS THE MATRIX BY WHICH THE INPUT DELTA V MUST BE POST-MULTIPLIED TO CONVERT FROM LV
021794,000033:                                                                                                  #        TO REF COSYS.
021795,000034:                                                                                                  #  6)    DEBRIS - OTHER VEHICLE STATE VECTOR.
021796,000035:                                                                                                  #  7)    SUBROUTINES CALLED - BANKCALL, GOXDSPF, CSMPREC (OR LEMPREC), ATOPCSM (OR ATOPLEM), INTSTALL, INTWAKE, PHASCHNG
021797,000036:                                                                                                  #        INTPRET, INTEGRVS, AND MINIRECT.
021798,000037:                                                                                                  #  8)    FLAG USE - MOONFLAG, CMOONFLAG, INTYPFLG, RASFLAG, AND MARKCTR.
021799,000038: 
021800,000039: 30,2000                                           BANK     30                                    
021801,000040: 13,2000                                           SETLOC   P76LOC                                
021802,000041: 13,2000                                           BANK                                           
021803,000042: 
021804,000043: 13,2071                                           COUNT*   $$/P76                                
021805,000044: 
021806,000045: 13,2071  E7,1412                                  EBANK=   TIG                                   
021807,000046: 
021808,000047: 13,2071           05546        P76                TC       UPFLAG                                
021809,000048: 13,2072           00031                           ADRES    TRACKFLG                              
021810,000049: 
021811,000050: 13,2073           32220                           CAF      V06N84                                #  FLASH LAST DELTA V,
021812,000051: 13,2074           04662                           TC       BANKCALL                              #  AND WAIT FOR KEYBOARD ACTION.
021813,000052: 13,2075           20720                           CADR     GOFLASH                               
021814,000053: 13,2076           12212                           TCF      ENDP76                                
021815,000054: 13,2077           02101                           TC       +2                                    #  PROCEED
021816,000055: 13,2100           02073                           TC       -5                                    #  STORE DATA AND REPEAT FLASHING
021817,000056: 13,2101           32221                           CAF      V06N84     +1                         #  FLASH VERB 06 NOUN 33, DISPLAY LAST TIG,
021818,000057: 13,2102           04662                           TC       BANKCALL                              #  AND WAIT FOR KEYBOARD ACTION.
021819,000058: 13,2103           20720                           CADR     GOFLASH                               
021820,000059: 13,2104           12212                           TCF      ENDP76                                
021821,000060: 13,2105           02107                           TC       +2                                    
021822,000061: 13,2106           02101                           TC       -5                                    
021823,000062: 13,2107           06006                           TC       INTPRET                               #  RETURN TO INTERPRETIVE CODE
021824,000063: 13,2110           77745                           DLOAD                                          #  SET D(MPAC)=TIG IN CSEC B28
021825,000064: 13,2111           03413                                    TIG                                   
021826,000065: 13,2112           34041                           STCALL   TDEC1                                 #  SET TDEC1=TIG FOR ORBITAL INTEGRATION
021827,000066: 13,2113           27105                                    OTHPREC                               
021828,000067: 13,2114           53575        COMPMAT            VLOAD    UNIT                                  
021829,000068: 13,2115           00001                                    RATT                                  

Page 512

021831,000070: 13,2116           77676                           VCOMP                                          #  U(-R)
021832,000071: 13,2117           00031                           STORE    24D                                   #  U(-R) TO 24D
021833,000072: 13,2120           53435                           VXV      UNIT                                  #  U(-R) X V = U(V X R)
021834,000073: 13,2121           00007                                    VATT                                  
021835,000074: 13,2122           00023                           STORE    18D                                   
021836,000075: 13,2123           53435                           VXV      UNIT                                  #  U(V X R) X U(-R) = U((R X V) X R)
021837,000076: 13,2124           00031                                    24D                                   
021838,000077: 13,2125           24015                           STOVL    12D                                   
021839,000078: 13,2126           03540                                    DELVOV                                
021840,000079: 13,2127           76505                           VXM      VSL1                                  #  V(MPAC)=DELTA V IN REFCOSYS
021841,000080: 13,2130           00015                                    12D                                   
021842,000081: 13,2131           77655                           VAD                                            
021843,000082: 13,2132           00007                                    VATT                                  
021844,000083: 13,2133           00007                           STORE    6                                     #  V(PD6)=VATT + DELTA V
021845,000084: 13,2134           77624                           CALL                                           #  PREVENT WOULD-BE USER OF ORBITAL
021846,000085: 13,2135           27442                                    INTSTALL                              #  INTEG FROM INTERFERING WITH UPDATING
021847,000086: 13,2136           77624                           CALL                                           
021848,000087: 13,2137           26222                                    P76SUB1                               
021849,000088: 13,2140           53775                           VLOAD    VSR*                                  
021850,000089: 13,2141           00007                                    6                                     
021851,000090: 13,2142           57176                                    0,2                                   
021852,000091: 13,2143           25543                           STOVL    VCV                                   
021853,000092: 13,2144           00001                                    RATT                                  
021854,000093: 13,2145           77657                           VSR*                                           
021855,000094: 13,2146           57176                                    0,2                                   
021856,000095: 13,2147           15535                           STODL    RCV                                   
021857,000096: 13,2150           03413                                    TIG                                   
021858,000097: 13,2151           01517                           STORE    TET                                   
021859,000098: 13,2152           71214                           CLEAR    DLOAD                                 
021860,000099: 13,2153           01673                                    INTYPFLG                              
021861,000100: 13,2154           01571                                    TETTHIS                               
021862,000101: 13,2155           34041        INTOTHIS           STCALL   TDEC1                                 
021863,000102: 13,2156           27135                                    INTEGRVS                              
021864,000103: 13,2157           77624                           CALL                                           
021865,000104: 13,2160           27442                                    INTSTALL                              
021866,000105: 13,2161           77624                           CALL                                           
021867,000106: 13,2162           26222                                    P76SUB1                               #  SET/CLEAR MOONFLAG
021868,000107: 13,2163           77775                           VLOAD                                          
021869,000108: 13,2164           00017                                    RATT1                                 
021870,000109: 13,2165           01503                           STORE    RRECT                                 
021871,000110: 13,2166           15535                           STODL    RCV                                   
021872,000111: 13,2167           00015                                    TAT                                   
021873,000112: 13,2170           25517                           STOVL    TET                                   
021874,000113: 13,2171           00025                                    VATT1                                 
021875,000114: 13,2172           77624                           CALL                                           
021876,000115: 13,2173           23435                                    MINIRECT                              
021877,000116: 13,2174           77776                           EXIT                                           
021878,000117: 13,2175           05412                           TC       PHASCHNG                              
021879,000118: 13,2176           04024                           OCT      04024                                 

Page 513

021881,000120: 13,2177           05546                           TC       UPFLAG                                
021882,000121: 13,2200           00236                           ADRES    REINTFLG                              
021883,000122: 
021884,000123: 13,2201           06006                           TC       INTPRET                               
021885,000124: 13,2202           77624                           CALL                                           
021886,000125: 13,2203           26760                                    ATOPOTH                               
021887,000126: 13,2204           77531                           SSP      EXIT                                  
021888,000127: 13,2205           00053                                    QPRET                                 
021889,000128: 13,2206           26211                                    OUT                                   
021890,000129: 13,2207           04662                           TC       BANKCALL                              #  PERMIT USE OF ORBITAL INTEGRATION
021891,000130: 13,2210           27477                           CADR     INTWAKE1                              
021892,000131: 13,2211           77776        OUT                EXIT                                           
021893,000132: 13,2212           35021        ENDP76             CAF      ZERO                                  
021894,000133: 13,2213           55126                           TS       MARKCTR                               #  CLEAR RR TRACKING MARK COUNTER
021895,000134: 13,2214           55125                           TS       VHFCNT                                
021896,000135: 
021897,000136: 13,2215           37716                           CAF      NEGONE                                
021898,000137: 13,2216           55734                           TS       MRKBUF2                               #  INVALIDATE MARK BUFFER
021899,000138: 
021900,000139: 13,2217           14106                           TCF      GOTOPOOH                              
021901,000140: 
021902,000141: 13,2220           01524        V06N84             NV       0684                                  
021903,000142: 13,2221           01441                           NV       0633                                  
021904,000143: 13,2222           67214        P76SUB1            CLEAR    SLOAD                                 
021905,000144: 13,2223           00263                                    MOONFLAG                              
021906,000145: 13,2224           00050                                    X2                                    
021907,000146: 13,2225           43030                           BHIZ     SET                                   #  X2=0...CLEAR MOONFLAG
021908,000147: 13,2226           26230                                    +2                                    #    =2.....SET MOONFLAG
021909,000148: 13,2227           00063                                    MOONFLAG                              
021910,000149: 13,2230           77616                           RVQ                                            
021911,000150: 

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