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.

025426,000002:                                                                                                  ## Copyright:   Public domain.
025427,000003:                                                                                                  ## Filename:    GROUND_TRACKING_DETERMINATION_PROGRAM_-_P21.agc
025428,000004:                                                                                                  ## Purpose:     A section of a reconstructed, mixed version of Sundance
025429,000005:                                                                                                  ##              It is part of the reconstructed source code for the Lunar
025430,000006:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
025431,000007:                                                                                                  ##              No original listings of this program are available;
025432,000008:                                                                                                  ##              instead, this file was created via disassembly of dumps
025433,000009:                                                                                                  ##              of various revisions of Sundance core rope modules.
025434,000010:                                                                                                  ## Assembler:   yaYUL
025435,000011:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
025436,000012:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
025437,000013:                                                                                                  ## Mod history: 2020-06-17 MAS  Created from Luminary 69.
025438,000014: 
025439,000015:                                                                                                  ## Sundance 302
025440,000016: 
025441,000017:                                                                                                  #  GROUND TRACKING DETERMINATION PROGRAM P21
025442,000018:                                                                                                  #  PROGRAM DESCRIPTION
025443,000019:                                                                                                  #  MOD NO - 1
025444,000020:                                                                                                  #  MOD BY - N. M. NEVILLE
025445,000021: 
025446,000022:                                                                                                  #  FUNCTIONAL DECRIPTION -
025447,000023: 
025448,000024:                                                                                                  #  TO PROVIDE THE ASTRONAUT DETAILS OF THE LM OR CSM GROUND TRACK WITHOUT
025449,000025:                                                                                                  #  THE NEED FOR GROUND COMMUNICATION (REQUESTED BY DSKY).
025450,000026:                                                                                                  #  CALLING SEQUENCE -
025451,000027: 
025452,000028:                                                                                                  #        ASTRONAUT REQUEST THROUGH DSKY V37E21E
025453,000029:                                                                                                  #  SUBROUTINES CALLED -
025454,000030: 
025455,000031:                                                                                                  #  GOPERF4
025456,000032:                                                                                                  #  GOFLASH
025457,000033:                                                                                                  #  THISPREC
025458,000034:                                                                                                  #  OTHPREC
025459,000035:                                                                                                  #  LAT-LONG
025460,000036: 
025461,000037:                                                                                                  #  NORMAL EXIT MODES -
025462,000038: 
025463,000039:                                                                                                  #  ASTRONAUT REQUEST TROUGH DSKY TO TERMINATE PROGRAM V34E
025464,000040:                                                                                                  #  ALARM OR ABORT EXIT MODES -
025465,000041: 
025466,000042:                                                                                                  #  NONE
025467,000043:                                                                                                  #  OUTPUT -
025468,000044: 
025469,000045:                                                                                                  #  OCTAL DISPLAY OF OPTION CODE AND VEHICLE WHOSE GROUND TRACK IS TO BE
025470,000046:                                                                                                  #  COMPUTED
025471,000047:                                                                                                  #        OPTION CODE     00002
025472,000048:                                                                                                  #        THIS            00001
025473,000049:                                                                                                  #        OTHER           00002
025474,000050:                                                                                                  #  DECIMAL DISPLAY OF TIME TO BE INTEGRATED TO HOURS , MINUTES , SECONDS
025475,000051:                                                                                                  #  DECIMAL DISPLAY OF LAT,LONG,ALT
025476,000052: 
025477,000053:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
025478,000054: 
025479,000055:                                                                                                  #  AX0           2DEC    4.652459653 E-5 RADIANS         %68-69 CONSTANTS"
025480,000056: 
025481,000057:                                                                                                  #  -AY0          2DEC    2.147535898 E-5 RADIANS
025482,000058: 
025483,000059:                                                                                                  #  AZ0           2DEC    .7753206164     REVOLUTIONS
025484,000060:                                                                                                  #  FOR LUNAR ORBITS 504LM VECTOR IS NEEDED
025485,000061: 
025486,000062:                                                                                                  #  504LM         2DEC    -2.700340600 E-5 RADIANS
025487,000063: 
025488,000064:                                                                                                  #  504LM _2      2DEC    -7.514128400 E-4 RADIANS
025489,000065: 
025490,000066:                                                                                                  #  504LM _4      2DEC    _2.553198641 E-4 RADIANS
025491,000067: 
025492,000068:                                                                                                  #  NONE
025493,000069:                                                                                                  #  DEBRIS
025494,000070: 
025495,000071:                                                                                                  #  CENTRALS-A,Q,L
025496,000072:                                                                                                  #  OTHER - THOSE USED BY THE ABOVE LISTED SUBROUTINES
025497,000073:                                                                                                  #  SEE LEMPREC, LAT-LONG
025498,000074: 
025499,000075: 34,3411  30,2000                                  SBANK=   LOWSUPER                              #  FOR LOW 2CADR'S.
025500,000076: 
025501,000077: 33,2000                                           BANK     33                                    
025502,000078: 24,2000                                           SETLOC   P20S                                  
025503,000079: 24,2000                                           BANK                                           
025504,000080: 
025505,000081: 24,3116  E7,1745                                  EBANK=   P21TIME                               
025506,000082: 24,3116                                           COUNT*   $$/P21                                
025507,000083: 24,3116           35026        PROG21             CAF      ONE                                   
025508,000084: 24,3117           55156                           TS       OPTION2                               #  ASSUMED VEHICLE IS LM, R2 = 00001
025509,000085: 24,3120           35025                           CAF      BIT2                                  #  OPTION 2
025510,000086: 24,3121           04655                           TC       BANKCALL                              
025511,000087: 24,3122           20542                           CADR     GOPERF4                               
025512,000088: 24,3123           04106                           TC       GOTOPOOH                              #  TERMINATE
025513,000089: 24,3124           03126                           TC       +2                                    #  PROCEED VALUE OF ASSUMED VEHICLE OK
025514,000090: 24,3125           03120                           TC       -5                                    #  R2 LOADED THROUGH DSKY
025515,000091: 24,3126           33217        P21PROG1           CAF      V6N34                                 #  LOAD DESIRED TIME OF LAT-LONG.
025516,000092: 24,3127           04655                           TC       BANKCALL                              
025517,000093: 24,3130           20406                           CADR     GOFLASH                               
025518,000094: 24,3131           04106                           TC       GOTOPOOH                              #  TERM
025519,000095: 24,3132           03134                           TC       +2                                    #  PROCEED VALUES OK
025520,000096: 24,3133           03126                           TC       -5                                    #  TIME LOADED THROUGH DSKY
025521,000097: 24,3134           06014                           TC       INTPRET                               
025522,000098: 24,3135           77745                           DLOAD                                          
025523,000099: 24,3136           01047                                    DSPTEM1                               
025524,000100: 24,3137           03746                           STORE    P21TIME                               
025525,000101: 24,3140           45335                           SLOAD    DSU                                   
025526,000102: 24,3141           01157                                    OPTION2                               
025527,000103: 24,3142           11215                                    P21ONENN                              
025528,000104: 24,3143           71230                           BHIZ     DLOAD                                 
025529,000105: 24,3144           51157                                    P21PROG2                              #  VEHICLE TO BE INTEGRATED IS LEM
025530,000106: 24,3145           03746                                    P21TIME                               #  VEHICLE TO BE INTEGRATED IS CSM
025531,000107: 24,3146           34041                           STCALL   TDEC1                                 #  INTEGRATE TO TIME SPECIFIED IN TDEC
025532,000108: 24,3147           27014                                    OTHPREC                               #  ADJUST UNITS FOR LAT-LONG ROUTINE
025533,000109: 24,3150           46135        P21PROGA           SLOAD    BHIZ                                  
025534,000110: 24,3151           00050                                    X2                                    
025535,000111: 24,3152           51165                                    P21PROG3                              
025536,000112: 24,3153           43175                           VLOAD    SETGO                                 
025537,000113: 24,3154           00001                                    RATT                                  
025538,000114: 24,3155           01423                                    LUNAFLAG                              
025539,000115: 24,3156           51170                                    P21PROG4                              
025540,000116: 24,3157           77745        P21PROG2           DLOAD                                          
025541,000117: 24,3160           03746                                    P21TIME                               
025542,000118: 24,3161           34041                           STCALL   TDEC1                                 
025543,000119: 24,3162           27030                                    THISPREC                              
025544,000120: 24,3163           77650                           GOTO                                           
025545,000121: 24,3164           51150                                    P21PROGA                              
025546,000122: 24,3165           43175        P21PROG3           VLOAD    CLEAR                                 
025547,000123: 24,3166           00001                                    RATT                                  
025548,000124: 24,3167           01663                                    LUNAFLAG                              
025549,000125: 24,3170           16034        P21PROG4           STODL    ALPHAV                                
025550,000126: 24,3171           00015                                    TAT                                   
025551,000127: 24,3172           45014                           CLEAR    CALL                                  
025552,000128: 24,3173           00662                                    ERADFLAG                              
025553,000129: 24,3174           26323                                    LAT-LONG                              
025554,000130: 24,3175           77776                           EXIT                                           
025555,000131: 24,3176           33216                           CAF      V06N43                                #  DISPLAY LAT,LONG,ALT
025556,000132: 24,3177           04655                           TC       BANKCALL                              #  LAT,LONG = 1/2 REVS B0
025557,000133: 24,3200           20406                           CADR     GOFLASH                               #  ALT = KM B14
025558,000134: 24,3201           04106                           TC       GOTOPOOH                              #  TERM
025559,000135: 24,3202           04106                           TC       GOTOPOOH                              
025560,000136: 24,3203           06014                           TC       INTPRET                               #  V32E RECYCLE
025561,000137: 24,3204           43345                           DLOAD    DAD                                   
025562,000138: 24,3205           03746                                    P21TIME                               
025563,000139: 24,3206           11213                                    600SEC                                #  600 SECONDS OR 10 MIN
025564,000140: 24,3207           01047                           STORE    DSPTEM1                               
025565,000141: 24,3210           77634                           RTB                                            
025566,000142: 24,3211           51126                                    P21PROG1                              
025567,000143: 24,3212           00003 25140  600SEC             2DEC     60000      B-28                       #  10 MIN
025568,000144: 
025569,000145: 24,3214           00001        P21ONENN           OCT      00001                                 #  NEEDED TO DETERMINE VEHICLE
025570,000146: 24,3215           00000                           OCT      00000                                 #  TO BE INTEGRATED
025571,000147: 24,3216           01453        V06N43             VN       00643                                 
025572,000148: 24,3217           01442        V6N34              VN       00634                                 
025573,000149: 
025574,000150: 

End of include-file GROUND_TRACKING_DETERMINATION_PROGRAM_-_P21.agc.  Parent file is MAIN.agc