Source Code

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

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

Since no contemporary listings of Comanche 72 are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing.

021440,000002:                                                                                                  ## Copyright:   Public domain.
021441,000003:                                                                                                  ## Filename:    P76.agc
021442,000004:                                                                                                  ## Purpose:     A section of Comanche revision 072.
021443,000005:                                                                                                  ##              It is part of the reconstructed source code for the first
021444,000006:                                                                                                  ##              release of the software for the Command Module's (CM) Apollo
021445,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 13. No original listings
021446,000008:                                                                                                  ##              of this program are available; instead, this file was recreated
021447,000009:                                                                                                  ##              from a printout of Comanche 055, binary dumps of a set of
021448,000010:                                                                                                  ##              Comanche 067 rope modules, and changelogs between Comanche 067
021449,000011:                                                                                                  ##              and 072. It has been adapted such that the resulting bugger words
021450,000012:                                                                                                  ##              exactly match those specified for Comanche 072 in NASA drawing
021451,000013:                                                                                                  ##              2021153G, which gives relatively high confidence that the
021452,000014:                                                                                                  ##              reconstruction is correct.
021453,000015:                                                                                                  ## Assembler:   yaYUL
021454,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
021455,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
021456,000018:                                                                                                  ## Mod history: 2024-05-13 MAS  Created from Comanche 067.
021457,000019:                                                                                                  ##              2024-05-14 MAS  Implemented PCR-863.1, "Make P76 set NODO flag".
021458,000020: 
021459,000021:                                                                                                  #  1)    PROGRAM NAME - TARGET DELTA V PROGRAM (P76).
021460,000022:                                                                                                  #  2)    FUNCTIONAL DESCRIPTION - UPON ENTRY BY ASTRONAUT ACTION, P76 FLASHES DSKY REQUESTS TO THE ASTRONAUT
021461,000023:                                                                                                  #        TO PROVIDE VIA DSKY (1) THE DELTA V TO BE APPLIED TO THE OTHER VEHICLE STATE VECTOR AND (2) THE
021462,000024:                                                                                                  #        TIME (TIG) AT WHICH THE OTHER VEHICLE VELOCITY WAS CHANGED BY EXECUTION OF A THRUSTING MANEUVER. THE
021463,000025:                                                                                                  #        OTHER VEHICLE STATE VECTOR IS INTEGRATED TO TIG AND UPDATED BY THE ADDITION OF DELTA V (DELTA V HAVING
021464,000026:                                                                                                  #        BEEN TRANSFORMED FROM LV TO REF COSYS).  USING INTEGRVS, THE PROGRAM THEN INTEGRATES THE OTHER
021465,000027:                                                                                                  #        VEHICLE STATE VECTOR TO THE STATE VECTOR OF THIS VEHICLE, THUS INSURING THAT THE W-MATRIX AND BOTH VEHICLE
021466,000028:                                                                                                  #        STATES CORRESPOND TO THE SAME TIME.
021467,000029:                                                                                                  #  3)    ERASABLE INITIALIZATION REQUIRED - NONE.
021468,000030:                                                                                                  #  4)    CALLING SEQUENCES AND EXIT MODES - CALLED BY ASTRONAUT REQUEST THRU DSKY V 37 E 76E.
021469,000031:                                                                                                  #        EXITS BY TCF ENDOFJOB.
021470,000032:                                                                                                  #  5)    OUTPUT - OTHER VEHICLE STATE VECTOR INTEGRATED TO TIG AND INCREMENTED BY DELTA V IN REF COSYS.
021471,000033:                                                                                                  #        THE PUSHLIST CONTAINS THE MATRIX BY WHICH THE INPUT DELTA V MUST BE POST-MULTIPLIED TO CONVERT FROM LV
021472,000034:                                                                                                  #        TO REF COSYS.
021473,000035:                                                                                                  #  6)    DEBRIS - OTHER VEHICLE STATE VECTOR.
021474,000036:                                                                                                  #  7)    SUBROUTINES CALLED - BANKCALL, GOXDSPF, CSMPREC (OR LEMPREC), ATOPCSM (OR ATOPLEM), INTSTALL, INTWAKE, PHASCHNG
021475,000037:                                                                                                  #        INTPRET, INTEGRVS, AND MINIRECT.
021476,000038:                                                                                                  #  8)    FLAG USE - MOONFLAG, CMOONFLAG, INTYPFLG, RASFLAG, AND MARKCTR.
021477,000039: 
021478,000040: 30,2000                                           BANK     30                                    
021479,000041: 13,2000                                           SETLOC   P76LOC                                
021480,000042: 13,2000                                           BANK                                           
021481,000043: 
021482,000044: 13,2071                                           COUNT*   $$/P76                                
021483,000045: 
021484,000046: 13,2071  E7,1412                                  EBANK=   TIG                                   
021485,000047: 
021486,000048: 13,2071           05562        P76                TC       UPFLAG                                
021487,000049: 13,2072           00031                           ADRES    TRACKFLG                              
021488,000050: 
021489,000051: 13,2073           32217                           CAF      V06N84     +1                         #  FLASH VERB 06 NOUN 33, DISPLAY LAST TIG,
021490,000052: 13,2074           04676                           TC       BANKCALL                              #  AND WAIT FOR KEYBOARD ACTION.
021491,000053: 13,2075           20720                           CADR     GOFLASH                               
021492,000054: 13,2076           12210                           TCF      ENDP76                                
021493,000055: 13,2077           02101                           TC       +2                                    #  PROCEED
021494,000056: 13,2100           02073                           TC       -5                                    #  STORE DATA AND REPEAT FLASHING
021495,000057: 13,2101           32216                           CAF      V06N84                                #  FLASH LAST DELTA V,
021496,000058: 13,2102           04676                           TC       BANKCALL                              #  AND WAIT FOR KEYBOARD ACTION.
021497,000059: 13,2103           20720                           CADR     GOFLASH                               
021498,000060: 13,2104           12210                           TCF      ENDP76                                
021499,000061: 13,2105           02107                           TC       +2                                    
021500,000062: 13,2106           02101                           TC       -5                                    
021501,000063: 13,2107           06006                           TC       INTPRET                               #  RETURN TO INTERPRETIVE CODE

Reconstruction: The setting of NODOFLAG here was added to Comanche 72 as part of PCR-863.1, "Make P76 set NODO flag".

021504,000066: 13,2110           43145                           DLOAD    SET                                   #  SET D(MPAC)=TIG IN CSEC B28
021505,000067: 13,2111           03413                                    TIG                                   
021506,000068: 13,2112           01076                                    NODOFLAG                              #  DISALLOW V37
021507,000069: 13,2113           34041                           STCALL   TDEC1                                 #  SET TDEC1=TIG FOR ORBITAL INTEGRATION
021508,000070: 13,2114           27114                                    OTHPREC                               
021509,000071: 13,2115           53575        COMPMAT            VLOAD    UNIT                                  
021510,000072: 13,2116           00001                                    RATT                                  
021511,000073: 13,2117           77676                           VCOMP                                          #  U(-R)
021512,000074: 13,2120           00031                           STORE    24D                                   #  U(-R) TO 24D
021513,000075: 13,2121           53435                           VXV      UNIT                                  #  U(-R) X V = U(V X R)
021514,000076: 13,2122           00007                                    VATT                                  
021515,000077: 13,2123           00023                           STORE    18D                                   
021516,000078: 13,2124           53435                           VXV      UNIT                                  #  U(V X R) X U(-R) = U((R X V) X R)
021517,000079: 13,2125           00031                                    24D                                   
021518,000080: 13,2126           24015                           STOVL    12D                                   
021519,000081: 13,2127           03540                                    DELVOV                                
021520,000082: 13,2130           76505                           VXM      VSL1                                  #  V(MPAC)=DELTA V IN REFCOSYS
021521,000083: 13,2131           00015                                    12D                                   
021522,000084: 13,2132           77655                           VAD                                            
021523,000085: 13,2133           00007                                    VATT                                  
021524,000086: 13,2134           00007                           STORE    6                                     #  V(PD6)=VATT + DELTA V
021525,000087: 13,2135           77624                           CALL                                           #  PREVENT WOULD-BE USER OF ORBITAL
021526,000088: 13,2136           27446                                    INTSTALL                              #  INTEG FROM INTERFERING WITH UPDATING
021527,000089: 13,2137           77624                           CALL                                           
021528,000090: 13,2140           26220                                    P76SUB1                               
021529,000091: 13,2141           53775                           VLOAD    VSR*                                  
021530,000092: 13,2142           00007                                    6                                     
021531,000093: 13,2143           57176                                    0,2                                   
021532,000094: 13,2144           25543                           STOVL    VCV                                   
021533,000095: 13,2145           00001                                    RATT                                  
021534,000096: 13,2146           77657                           VSR*                                           
021535,000097: 13,2147           57176                                    0,2                                   
021536,000098: 13,2150           15535                           STODL    RCV                                   
021537,000099: 13,2151           03413                                    TIG                                   
021538,000100: 13,2152           01517                           STORE    TET                                   
021539,000101: 13,2153           71214                           CLEAR    DLOAD                                 
021540,000102: 13,2154           01673                                    INTYPFLG                              
021541,000103: 13,2155           01571                                    TETTHIS                               
021542,000104: 13,2156           34041        INTOTHIS           STCALL   TDEC1                                 
021543,000105: 13,2157           27144                                    INTEGRVS                              
021544,000106: 13,2160           77624                           CALL                                           
021545,000107: 13,2161           27446                                    INTSTALL                              
021546,000108: 13,2162           77624                           CALL                                           
021547,000109: 13,2163           26220                                    P76SUB1                               #  SET/CLEAR MOONFLAG
021548,000110: 13,2164           77775                           VLOAD                                          
021549,000111: 13,2165           00017                                    RATT1                                 
021550,000112: 13,2166           01503                           STORE    RRECT                                 
021551,000113: 13,2167           15535                           STODL    RCV                                   
021552,000114: 13,2170           00015                                    TAT                                   
021553,000115: 13,2171           25517                           STOVL    TET                                   
021554,000116: 13,2172           00025                                    VATT1                                 
021555,000117: 13,2173           77624                           CALL                                           
021556,000118: 13,2174           23417                                    MINIRECT                              
021557,000119: 13,2175           77776                           EXIT                                           
021558,000120: 13,2176           05426                           TC       PHASCHNG                              
021559,000121: 13,2177           04024                           OCT      04024                                 

Reconstruction: The code below, down to ENDP76, was rewritten for Comanche 72 as part of PCR-863.1, "Make P76 set NODO flag". The setting of REINTFLG was moved from basic to interpretive, the basic call to INTWAKE1 was changed to an interpretive call to INTWAKE0, and OUT was changed to clear NODOFLAG.

021565,000127: 13,2200           06006                           TC       INTPRET                               
021566,000128: 13,2201           45014                           SET      CALL                                  
021567,000129: 13,2202           05070                                    REINTFLG                              
021568,000130: 13,2203           26767                                    ATOPOTH                               
021569,000131: 13,2204           77624                           CALL                                           
021570,000132: 13,2205           27461                                    INTWAKE0                              #  PERMIT USE OF ORBITAL INTEGRATION
021571,000133: 13,2206           77414        OUT                CLEAR    EXIT                                  #  ALLOW V37, NO NEED TO CLEAR NODOFLAG AT
021572,000134: 13,2207           01276                                    NODOFLAG                              #   ENDP76 SINCE FLAG NOT SET WHEN DISPLAY
021573,000135:                                                                                                  #   RESPONSES TRANSFER THERE FROM P76+.
021574,000136: 13,2210           35035        ENDP76             CAF      ZERO                                  
021575,000137: 13,2211           55126                           TS       MARKCTR                               #  CLEAR RR TRACKING MARK COUNTER
021576,000138: 13,2212           55125                           TS       VHFCNT                                
021577,000139: 
021578,000140: 13,2213           37716                           CAF      NEGONE                                
021579,000141: 13,2214           55734                           TS       MRKBUF2                               #  INVALIDATE MARK BUFFER
021580,000142: 
021581,000143: 13,2215           14106                           TCF      GOTOPOOH                              
021582,000144: 
021583,000145: 13,2216           01524        V06N84             NV       0684                                  
021584,000146: 13,2217           01441                           NV       0633                                  
021585,000147: 13,2220           67214        P76SUB1            CLEAR    SLOAD                                 
021586,000148: 13,2221           00263                                    MOONFLAG                              
021587,000149: 13,2222           00050                                    X2                                    
021588,000150: 13,2223           43030                           BHIZ     SET                                   #  X2=0...CLEAR MOONFLAG
021589,000151: 13,2224           26226                                    +2                                    #    =2.....SET MOONFLAG
021590,000152: 13,2225           00063                                    MOONFLAG                              
021591,000153: 13,2226           77616                           RVQ                                            
021592,000154: 

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