Source Code

These source code files are a reconstruction of Sundance, the Apollo 9 LM (Lunar Module) AGC (Apollo Guidance Computer) flight software, created from binary dumps of original core rope program modules, as follows:
  • B1 — Revision 292
  • B2 — Revision 302
  • B3 — Revision 302
  • B4 — Revision 302
  • B5 — Revision 292
  • B6 — Revision 306
This means that source code does not represent a specific historical revision of Sundance, but rather a mixture of the three released versions. Nonetheless, it is capable of flying the whole Apollo 9 mission. This source code matches the binary dumps, as closely as feasible, but 100% match is not possible, due mostly to changes in memory addresses at which code and variables were allocated in different revisions of Sundance. Refer to this list of explanations for each binary mismatch.

Since only binary dumps (rather than listings) of Sundance 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.

023683,000002:                                                                                                  ## Copyright:   Public domain.
023684,000003:                                                                                                  ## Filename:    P30,P37.agc
023685,000004:                                                                                                  ## Purpose:     A section of a reconstructed, mixed version of Sundance
023686,000005:                                                                                                  ##              It is part of the reconstructed source code for the Lunar
023687,000006:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
023688,000007:                                                                                                  ##              No original listings of this program are available;
023689,000008:                                                                                                  ##              instead, this file was created via disassembly of dumps
023690,000009:                                                                                                  ##              of various revisions of Sundance core rope modules.
023691,000010:                                                                                                  ## Assembler:   yaYUL
023692,000011:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
023693,000012:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
023694,000013:                                                                                                  ## Mod history: 2020-06-17 MAS  Created from Luminary 69.
023695,000014: 
023696,000015:                                                                                                  ## Sundance 292
023697,000016: 
023698,000017:                                                                                                  #  PROGRAM DESCRIPTION P30       DATE 3-6-67
023699,000018: 
023700,000019:                                                                                                  #  MOD.1 BY RAMA AIYAWAR
023701,000020:                                                                                                  #  FUNCTIONAL DESCRIPTION
023702,000021:                                                                                                  #        ACCEPT ASTRONAUT INPUTS OF TIG,DELV(LV)
023703,000022:                                                                                                  #        CALL IMU STATUS CHECK ROUTINE (R02)
023704,000023:                                                                                                  #        DISPLAY TIME TO GO, APOGEE, PERIGEE, DELV(MAG), MGA AT IGN
023705,000024:                                                                                                  #        REQUEST BURN PROGRAM
023706,000025: 
023707,000026:                                                                                                  #  CALLING SEQUENCE VIA JOB FROM V37
023708,000027: 
023709,000028:                                                                                                  #  EXIT VIA V37 CALL OR TO GOTOPOOH (V34E)
023710,000029: 
023711,000030:                                                                                                  #  SUBROUTINE CALLS -    FLAGUP, PHASCHNG, BANKCALL, ENDOFJOB, GOFLASH, GOFLASHR
023712,000031:                                                                                                  #                        GOPERF3R, INTPRET, BLANKET, GOTOPOOH, R02BOTH, S30.1,
023713,000032:                                                                                                  #                        TTG/N35, MIDGIM, DISPMGA
023714,000033: 
023715,000034:                                                                                                  #  ERASABLE INITIALIZATION - STATE VECTOR
023716,000035: 
023717,000036:                                                                                                  #  OUTPUT-RINIT, VINIT, +MGA, VTIG, RTIG, DELVSIN, DELVSAB, DELVSLV, HAPO,
023718,000037:                                                                                                  #         HPER, TTOGO
023719,000038: 
023720,000039:                                                                                                  #  DEBRIS- A,L, MPAC, PUSHLIST
023721,000040: 
023722,000041: 32,2671                                           BANK     32                                    
023723,000042: 35,2000                                           SETLOC   P30S                                  
023724,000043: 35,2000                                           BANK                                           
023725,000044: 35,2000  E4,1660                                  EBANK=   +MGA                                  
023726,000045: 35,2000                                           COUNT*   $$/P30                                
023727,000046: 
023728,000047: 35,2000           77420        REVN1645           STQ      EXIT                                  #  TRKMKCNT, TTOGO, +MGA
023729,000048: 35,2001           03652                                    QTEMP1                                
023730,000049: 
023731,000050: 35,2002           02465                           TC       COMPTGO                               
023732,000051: 35,2003           33632                           CAF      V16N45                                
023733,000052: 35,2004           04655                           TC       BANKCALL                              
023734,000053: 35,2005           20544                           CADR     GOFLASHR                              
023735,000054: 35,2006           04106                           TC       GOTOPOOH                              
023736,000055: 35,2007           02014                           TC       +5                                    
023737,000056: 35,2010           02003                           TC       -5                                    
023738,000057: 35,2011           05413                           TC       PHASCHNG                              
023739,000058: 35,2012           00014                           OCT      00014                                 
023740,000059: 35,2013           05225                           TC       ENDOFJOB                              
023741,000060: 
023742,000061: 35,2014           35026                           CAF      ONE                                   
023743,000062: 35,2015           55175                           TS       DISPDEX                               
023744,000063: 35,2016           06014                           TC       INTPRET                               
023745,000064: 35,2017           77650                           GOTO                                           
023746,000065: 35,2020           03652                                    QTEMP1                                
023747,000066: 
023748,000067: 35,2021           05563        P30                TC       UPFLAG                                #  SET UPDATE FLAG
023749,000068: 35,2022           00027                           ADRES    UPDATFLG                              
023750,000069: 35,2023           05563                           TC       UPFLAG                                #  SET TRACK FLAG
023751,000070: 35,2024           00031                           ADRES    TRACKFLG                              
023752,000071: 
023753,000072: 35,2025           32114        P30N33             CAF      V06N33                                #  T OF IGN
023754,000073: 35,2026           04655                           TC       BANKCALL                              
023755,000074: 35,2027           20544                           CADR     GOFLASHR                              
023756,000075: 35,2030           14106                           TCF      GOTOPOOH                              
023757,000076: 35,2031           12036                           TCF      +5                                    
023758,000077: 35,2032           12025                           TCF      -5                                    
023759,000078: 35,2033           05413                           TC       PHASCHNG                              
023760,000079: 35,2034           00014                           OCT      00014                                 
023761,000080: 35,2035           05225                           TC       ENDOFJOB                              
023762,000081: 
023763,000082: 35,2036           32115                           CAF      V06N82                                #  DISPLAY DELTA V (LV)
023764,000083: 35,2037           04655                           TC       BANKCALL                              
023765,000084: 35,2040           20406                           CADR     GOFLASH                               
023766,000085: 35,2041           14106                           TCF      GOTOPOOH                              
023767,000086: 35,2042           12044                           TCF      +2                                    
023768,000087: 35,2043           12036                           TCF      -5                                    
023769,000088: 
023770,000089: 35,2044           05575                           TC       DOWNFLAG                              #  RESET UPDATE FLAG
023771,000090: 35,2045           00027                           ADRES    UPDATFLG                              
023772,000091: 35,2046           06014                           TC       INTPRET                               
023773,000092: 35,2047           77624                           CALL                                           
023774,000093: 35,2050           70000                                    S30.1                                 
023775,000094: 35,2051           77745                           DLOAD                                          
023776,000095: 35,2052           00005                                    4D                                    
023777,000096: 35,2053           16261                           STODL    HAPO                                  
023778,000097: 35,2054           00011                                    8D                                    
023779,000098: 35,2055           02263                           STORE    HPER                                  
023780,000099: 35,2056           77414                           SET      EXIT                                  
023781,000100: 35,2057           00470                                    UPDATFLG                              
023782,000101: 35,2060           32116        PARAM30            CAF      V06N42                                #  DISPLAY APOGEE,PERIGEE ,DELTA V
023783,000102: 35,2061           04655                           TC       BANKCALL                              
023784,000103: 35,2062           20406                           CADR     GOFLASH                               
023785,000104: 35,2063           04106                           TC       GOTOPOOH                              
023786,000105: 35,2064           12066                           TCF      +2                                    
023787,000106: 35,2065           12060                           TCF      PARAM30                               
023788,000107: 
023789,000108: 35,2066           35012                           CAF      REFSMBIT                              
023790,000109: 35,2067           70077                           MASK     FLAGWRD3                              
023791,000110: 35,2070           00006                           EXTEND                                         
023792,000111: 35,2071           12102                           BZF      MINMGA                                
023793,000112: 
023794,000113: 35,2072           06014                           TC       INTPRET                               
023795,000114: 35,2073           77214                           SET      VLOAD                                 
023796,000115: 35,2074           01072                                    AVFLAG                                
023797,000116: 35,2075           03643                                    DELVSIN                               
023798,000117: 35,2076           45006                           PUSH     CALL                                  
023799,000118: 35,2077           20002                                    MIDGIM                                
023800,000119: 35,2100           77650                           GOTO                                           
023801,000120: 35,2101           72107                                    DISPMANV                              
023802,000121: 
023803,000122: 35,2102           06014        MINMGA             TC       INTPRET                               
023804,000123: 35,2103           43345                           DLOAD    DAD                                   
023805,000124: 35,2104           33645                                    DP-.01                                
023806,000125: 35,2105           33645                                    DP-.01                                
023807,000126: 35,2106           02261                           STORE    +MGA                                  
023808,000127: 35,2107           77624        DISPMANV           CALL                                           
023809,000128: 35,2110           72000                                    REVN1645                              
023810,000129: 35,2111           77414                           SET      EXIT                                  
023811,000130: 35,2112           01067                                    XDELVFLG                              
023812,000131: 
023813,000132: 35,2113           04106                           TC       GOTOPOOH                              
023814,000133: 
023815,000134: 35,2114           01441        V06N33             VN       0633                                  
023816,000135: 35,2115           01522        V06N82             VN       0682                                  
023817,000136: 35,2116           01452        V06N42             VN       0642                                  
023818,000137: 35,2117           01455        V06N45             VN       0645                                  
023819,000138: 
023820,000139:                                                                                                  #  PROGRAM DESCRIPTION S30.1     DATE 9NOV66
023821,000140: 
023822,000141:                                                                                                  #  MOD NO 1                      LOG SECTION P30,P37
023823,000142:                                                                                                  #  MOD BY RAMA AIYAWAR **
023824,000143: 
023825,000144:                                                                                                  #  FUNCTIONAL DESCRIPTION
023826,000145:                                                                                                  #        BASED ON STORED TARGET PARAMETERS(R OF IGNITION (RTIG), V OF
023827,000146:                                                                                                  #        IGNITION(VTIG), TIME OF IGNITION (TIG)),COMPUTE PERIGEE ALTITUDE
023828,000147:                                                                                                  #        APOGEE ALTITUDE AND DELTAV REQUIRED(DELVSIN).
023829,000148: 
023830,000149:                                                                                                  #  CALLING SEQUENCE
023831,000150:                                                                                                  #        L       CALL
023832,000151:                                                                                                  #        L+1             S30.1
023833,000152: 
023834,000153:                                                                                                  #  NORMAL EXIT MODE
023835,000154:                                                                                                  #        AT L+2 OR CALLING SEQUENCE (GOTO L+2)
023836,000155: 
023837,000156:                                                                                                  #  SUBROUTINES CALLED
023838,000157:                                                                                                  #        LEMPREC
023839,000158:                                                                                                  #        PERIAPO
023840,000159: 
023841,000160:                                                                                                  #  ALARM OR ABORT EXIT MODES
023842,000161:                                                                                                  #                NONE
023843,000162: 
023844,000163:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
023845,000164:                                                                                                  #        TIG             TIME OF IGNITION                DP B28CS
023846,000165:                                                                                                  #        DELVSLV         SPECIFIED DELTA-V IN LOCAL VERT.
023847,000166:                                                                                                  #                        COORDS. OF ACTIVE VEHICLE AT
023848,000167:                                                                                                  #                TIME OF IGNITION        VECTOR B+7 METERS/CS
023849,000168: 
023850,000169:                                                                                                  #  OUTPUT
023851,000170:                                                                                                  #        RTIG    POSITION AT TIG         VECTOR  B+29 METERS
023852,000171:                                                                                                  #        VTIG    VELOCITY AT TIG         VECTOR  B+29 METERS/CS
023853,000172:                                                                                                  #        PDL 4D  APOGEE ALTITUDE         DP      B+29 M ,  B+27 METERS.
023854,000173:                                                                                                  #        HAPO    APOGEE ALTITUDE         DP      B+29 METERS
023855,000174:                                                                                                  #        PDL 8D  PERIGEE ALTITUDE        DP      B+29 M ,  B+27 METERS.
023856,000175:                                                                                                  #        HPER    PERIGEE ALTITUDE        DP      B+29 METERS
023857,000176:                                                                                                  #        DELVSIN    SPECIFIED DELTA-V IN INERTIAL
023858,000177:                                                                                                  #                   COORD. OF ACTIVE VEHICLE AT
023859,000178:                                                                                                  #                TIME OF IGNITION        VECTOR  B+7 METERS/CS
023860,000179:                                                                                                  #        DELVSAB MAG. OF DELVSIN         VECTOR  B+7 METERS/CS
023861,000180: 
023862,000181:                                                                                                  #  DEBRIS        QTEMP   TEMP.ERASABLE
023863,000182:                                                                                                  #                QPRET, MPAC
023864,000183:                                                                                                  #                PUSHLIST
023865,000184: 
023866,000185: 34,2000                                           SETLOC   P30S1                                 
023867,000186: 34,2000                                           BANK                                           
023868,000187: 
023869,000188: 34,2000                                           COUNT*   $$/S30S                               
023870,000189: 
023871,000190: 34,2000           71220        S30.1              STQ      DLOAD                                 
023872,000191: 34,2001           03617                                    QTEMP                                 
023873,000192: 34,2002           03425                                    TIG                                   #  TIME IGNITION SCALED AT 2(+28)CS
023874,000193: 34,2003           34041                           STCALL   TDEC1                                 
023875,000194: 34,2004           27030                                    LEMPREC                               #  ENCKE ROUTINE FOR LEM
023876,000195: 
023877,000196: 34,2005           77775                           VLOAD                                          
023878,000197: 34,2006           00017                                    RATT1                                 
023879,000198: 34,2007           02655                           STORE    RVEC                                  
023880,000199: 34,2010           03627                           STORE    RTIG                                  #  RADIUS VECTOR AT IGNITION TIME
023881,000200: 34,2011           57456                           UNIT     VCOMP                                 
023882,000201: 34,2012           27643                           STOVL    DELVSIN                               #  ZRF/LV IN DELVSIN SCALED AT 2
023883,000202: 34,2013           00025                                    VATT1                                 #  VELOCITY VECTOR AT TIG, SCALED 2(7) M/CS
023884,000203: 34,2014           03635                           STORE    VTIG                                  
023885,000204: 34,2015           53435                           VXV      UNIT                                  
023886,000205: 34,2016           03627                                    RTIG                                  
023887,000206: 34,2017           77601                           SETPD                                          
023888,000207: 34,2020           00001                                    0                                     
023889,000208: 34,2021           47206                           PUSH     VXV                                   #  YRF/LV PDL 0 SCALED AT 2
023890,000209: 34,2022           03643                                    DELVSIN                               
023891,000210: 34,2023           63372                           VSL1     PDVL                                  
023892,000211: 34,2024           63315                           PDVL     PDVL                                  #  YRF/LV PDL 6 SCALED AT 2
023893,000212: 34,2025           03643                                    DELVSIN                               #  ZRF/LV PDL 12D SCALED AT 2
023894,000213: 34,2026           02267                                    DELVSLV                               
023895,000214: 34,2027           76505                           VXM      VSL1                                  
023896,000215: 34,2030           00001                                    0                                     
023897,000216: 34,2031           03643                           STORE    DELVSIN                               #  DELTAV IN INERT. COOR. SCALED TO B+7M/CS
023898,000217: 34,2032           77646                           ABVAL                                          
023899,000218: 34,2033           27651                           STOVL    DELVSAB                               #  DELTA V MAG.
023900,000219: 34,2034           03635                                    VTIG                                  #  (FOR PERIAPO)
023901,000220: 34,2035           77655                           VAD                                            #  VREQUIRED = VTIG + DELVSIN (FOR PERIAPO)
023902,000221: 34,2036           03643                                    DELVSIN                               
023903,000222: 34,2037           36744                           STCALL   VVEC                                  
023904,000223: 34,2040           46116                                    PERIAPO                               
023905,000224: 34,2041           77650                           GOTO                                           
023906,000225: 34,2042           03617                                    QTEMP                                 
023907,000226: 
023908,000227: 

End of include-file P30,P37.agc.  Parent file is MAIN.agc