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.

054209,000002:                                                                                                  ## Copyright:   Public domain.
054210,000003:                                                                                                  ## Filename:    ALARM_AND_ABORT.agc
054211,000004:                                                                                                  ## Purpose:     A section of a reconstructed, mixed version of Sundance
054212,000005:                                                                                                  ##              It is part of the reconstructed source code for the Lunar
054213,000006:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
054214,000007:                                                                                                  ##              No original listings of this program are available;
054215,000008:                                                                                                  ##              instead, this file was created via disassembly of dumps
054216,000009:                                                                                                  ##              of various revisions of Sundance core rope modules.
054217,000010:                                                                                                  ## Assembler:   yaYUL
054218,000011:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
054219,000012:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
054220,000013:                                                                                                  ## Mod history: 2020-06-17 MAS  Created from Luminary 69.
054221,000014: 
054222,000015:                                                                                                  ## Sundance 292
054223,000016: 
054224,000017:                                                                                                  #           THE FOLLOWING SUBROUTINE MAY BE CALLED TO DISPLAY A NON-ABORTIVE ALARM CONDITION. IT MAY BE CALLED
054225,000018:                                                                                                  #  EITHER IN INTERRUPT OR UNDER EXECUTIVE CONTROL.
054226,000019: 
054227,000020:                                                                                                  #  CALLING SEQUENCE IS AS FOLLOWS:
054228,000021:                                                                                                  #                TC      ALARM
054229,000022:                                                                                                  #                OCT     AAANN           ALARM NO. NN IN GENERAL AREA AAA.
054230,000023:                                                                                                  #                                        (RETURNS HERE)
054231,000024: 
054232,000025:    5646                                           BLOCK    02                                    
054233,000026:    4000                                           SETLOC   FFTAG7                                
054234,000027:    4000                                           BANK                                           
054235,000028: 
054236,000029:    5646     0375                                  EBANK=   FAILREG                               
054237,000030: 
054238,000031:    5646                                           COUNT*   $$/ALARM                              
054239,000032:                                                                                                  #  ALARM TURNS ON THE PROGRAM ALARM LIGHT, BUT DOES NOT DISPLAY.
054240,000033: 
054241,000034:    5646           00004        ALARM              INHINT                                         
054242,000035: 
054243,000036:    5647           30002                           CA       Q                                     
054244,000037:    5650           55363                           TS       ALMCADR                               
054245,000038:    5651           50002        ALARM2             INDEX    Q                                     
054246,000039:    5652           30000                           CA       0                                     
054247,000040:    5653           54001        BORTENT            TS       L                                     
054248,000041: 
054249,000042:    5654           30006        PRIOENT            CA       BBANK                                 
054250,000043:    5655           00006                 +1        EXTEND                                         
054251,000044:    5656           04007                           ROR      SUPERBNK                              #  ADD SUPER BITS.
054252,000045:    5657           55364                           TS       ALMCADR    +1                         
054253,000046: 
054254,000047:    5660           30002        LARMENT            CA       Q                                     #  STORE RETURN FOR ALARM
054255,000048:    5661           54061                           TS       ITEMP1                                
054256,000049: 
054257,000050:    5662           10375        CHKFAIL1           CCS      FAILREG                               #  IS ANYTHING IN FAILREG
054258,000051:    5663           15666                           TCF      CHKFAIL2                              #  YES TRY NEXT REG
054259,000052:    5664           22375                           LXCH     FAILREG                               
054260,000053:    5665           15700                           TCF      PROGLARM                              #  TURN ALARM LIGHT ON FOR FIRST ALARM
054261,000054: 
054262,000055:    5666           10376        CHKFAIL2           CCS      FAILREG    +1                         
054263,000056:    5667           15672                           TCF      FAIL3                                 
054264,000057:    5670           22376                           LXCH     FAILREG    +1                         
054265,000058:    5671           15703                           TCF      MULTEXIT                              
054266,000059: 
054267,000060:    5672           30377        FAIL3              CA       FAILREG    +2                         
054268,000061:    5673           75006                           MASK     POSMAX                                
054269,000062:    5674           10000                           CCS      A                                     
054270,000063:    5675           15707                           TCF      MULTFAIL                              
054271,000064:    5676           22377                           LXCH     FAILREG    +2                         
054272,000065:    5677           15703                           TCF      MULTEXIT                              
054273,000066: 
054274,000067: 
054275,000068:    5700           41037        PROGLARM           CS       DSPTAB     +11D                       
054276,000069:    5701           75721                           MASK     OCT40400                              
054277,000070:    5702           27037                           ADS      DSPTAB     +11D                       
054278,000071: 
054279,000072:    5703           56061        MULTEXIT           XCH      ITEMP1                                #  OBTAIN RETURN ADDRESS IN A
054280,000073:    5704           00003                           RELINT                                         
054281,000074:    5705           50000                           INDEX    A                                     
054282,000075:    5706           00001                           TC       1                                     
054283,000076: 
054284,000077:    5707           30001        MULTFAIL           CA       L                                     
054285,000078:    5710           65010                           AD       BIT15                                 
054286,000079:    5711           54377                           TS       FAILREG    +2                         
054287,000080: 
054288,000081:    5712           15703                           TCF      MULTEXIT                              
054289,000082: 

Sundance 302

054291,000084: 
054292,000085:                                                                                                  #  PRIOLARM DISPLAYS V05N09 VIA PRIODSPR WITH 3 RETURNS TO THE USER FROM THE ASTRONAUT AT CALL LOC +1,+2,+3 AND
054293,000086:                                                                                                  #  AN IMMEDIATE RETURN TO THE USER AT CALL LOC +4.  EXAMPLE FOLLOWS,
054294,000087:                                                                                                  #                CAF     OCTXX           ALARM CODE
054295,000088:                                                                                                  #                TC      BANKCALL
054296,000089:                                                                                                  #                CADR    PRIOLARM
054297,000090: 
054298,000091:                                                                                                  #                ...     ...
054299,000092:                                                                                                  #                ...     ...
054300,000093:                                                                                                  #                ...     ...             ASTRONAUT RETURN
054301,000094:                                                                                                  #                TC      PHASCHNG        IMMEDIATE RETURN TO USER.  RESTART
054302,000095:                                                                                                  #                OCT     X.1             PHASE CHANGE FOR PRIO DISPLAY
054303,000096: 
054304,000097: 10,3443                                           BANK     10                                    
054305,000098: 10,2000                                           SETLOC   DISPLAYS                              
054306,000099: 10,2000                                           BANK                                           
054307,000100: 
054308,000101: 10,3443                                           COUNT*   $$/DSPLA                              
054309,000102: 10,3443           00004        PRIOLARM           INHINT                                         #  * * * KEEP IN DISPLAY ROUTINES BANK
054310,000103: 10,3444           54001                           TS       L                                     #  SAVE ALARM CODE
054311,000104: 
054312,000105: 10,3445           30133                           CA       BUF2                                  #  2 CADR OF PRIOLARM USER
054313,000106: 10,3446           55363                           TS       ALMCADR                               
054314,000107: 10,3447           30134                           CA       BUF2       +1                         
054315,000108: 10,3450           05655                           TC       PRIOENT    +1                         #  * LEAVE L ALONE
054316,000109: 10,3451           77013        -5SEC              DEC      -500       B-14                       #  *** DONT MOVE
054317,000110: 10,3452           35056                           CAF      V05N09                                
054318,000111: 10,3453           12414                           TCF      PRIODSPR                              
054319,000112: 

Sundance 292

054321,000114: 
054322,000115:    5713                                           BLOCK    02                                    
054323,000116:    4000                                           SETLOC   FFTAG7                                
054324,000117:    4000                                           BANK                                           
054325,000118: 
054326,000119:    5713                                           COUNT*   $$/ALARM                              
054327,000120:    5713           00004        ABORT              INHINT                                         
054328,000121:    5714           30002                           CA       Q                                     
054329,000122:    5715           55363                           TS       ALMCADR                               
054330,000123: 
054331,000124:    5716           50002        ABORT2             INDEX    Q                                     
054332,000125:    5717           30000                           CAF      0                                     
054333,000126:    5720           05653                           TC       BORTENT                               
054334,000127:    5721           40400        OCT40400           OCT      40400                                 
054335,000128:    5722           05722        WHIMPER            TC       WHIMPER                               
054336,000129: 
054337,000130:    5723           00004        CCSHOLE            INHINT                                         
054338,000131:    5724           30002                           CA       Q                                     
054339,000132:    5725           55363                           TS       ALMCADR                               
054340,000133: 
054341,000134:    5726           05716                           TC       ABORT2                                
054342,000135:    5727           01103                           OCT      1103                                  
054343,000136: 
054344,000137:    5730           00004        CURTAINS           INHINT                                         
054345,000138:    5731           30002                           CA       Q                                     
054346,000139:    5732           55363                           TS       ALMCADR                               
054347,000140:    5733           05651                           TC       ALARM2                                
054348,000141:    5734           00217        OCT217             OCT      00217                                 
054349,000142:    5735           01363                           TC       ALMCADR                               #  RETURN TO USER
054350,000143: 
054351,000144:                                                                                                  #  CALLING SEQUENCE FOR VARALARM
054352,000145:                                                                                                  #                CAF     (ALARM)
054353,000146:                                                                                                  #                TC      VARALARM
054354,000147: 
054355,000148:                                                                                                  #  VARALARM TURNS ON PROGRAM ALARM LIGHT BUT DOES NOT DISPLAY
054356,000149: 
054357,000150:    5736           00004        VARALARM           INHINT                                         
054358,000151: 
054359,000152:    5737           54001                           TS       L                                     #  SAVE USERS ALARM CODE
054360,000153: 
054361,000154:    5740           30002                           CA       Q                                     #  SAVE USERS Q
054362,000155:    5741           55363                           TS       ALMCADR                               
054363,000156: 
054364,000157:    5742           05654                           TC       PRIOENT                               
054365,000158:    5743           00014        OCT14              OCT      14                                    #  DONT MOVE
054366,000159: 
054367,000160:    5744           01363                           TC       ALMCADR                               #  RETURN TO USER

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