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.

013648,000002:                                                                                                  ## Copyright:   Public domain.
013649,000003:                                                                                                  ## Filename:    SYSTEM_TEST_STANDARD_LEAD_INS.agc
013650,000004:                                                                                                  ## Purpose:     A section of a reconstructed, mixed version of Sundance
013651,000005:                                                                                                  ##              It is part of the reconstructed source code for the Lunar
013652,000006:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 9.
013653,000007:                                                                                                  ##              No original listings of this program are available;
013654,000008:                                                                                                  ##              instead, this file was created via disassembly of dumps
013655,000009:                                                                                                  ##              of various revisions of Sundance core rope modules.
013656,000010:                                                                                                  ## Assembler:   yaYUL
013657,000011:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
013658,000012:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
013659,000013:                                                                                                  ## Mod history: 2020-06-17 MAS  Created from Luminary 69.
013660,000014: 
013661,000015:                                                                                                  ## Sundance 292
013662,000016: 22,3236  E5,1642                                  EBANK=   XSM                                   
013663,000017: 
013664,000018: 33,2000                                           BANK     33                                    
013665,000019: 04,2000                                           SETLOC   E/PROG                                
013666,000020: 04,2000                                           BANK                                           
013667,000021: 
013668,000022: 04,2450                                           COUNT*   $$/P07                                
013669,000023: 
013670,000024:                                                                                                  #  SPECIAL PROGRAMS TO EASE THE PANGS OF ERASABLE MEMORY PROGRAMS.
013671,000025: 
013672,000026:                                                                                                  #  E/BKCALL      FOR DOING BANKCALLS FROM AND RETURNING TO ERASABLE.
013673,000027: 
013674,000028:                                                                                                  #  THIS ROUTINE IS CALLABLE FROM ERASABLE OR FIXED.  LIKE BANKCALL, HOWEVER, SWITCHING BETWEEN S3 AND S4
013675,000029:                                                                                                  #  IS NOT POSSIBLE.
013676,000030: 
013677,000031:                                                                                                  #  THE CALLING SEQUENCE IS:
013678,000032: 
013679,000033:                                                                                                  #        TC      BANKCALL
013680,000034:                                                                                                  #        CADR    E/BKCALL
013681,000035:                                                                                                  #        CADR    ROUTINE         WHERE YOU WANT TO GO IN FIXED.
013682,000036:                                                                                                  #        RETURN HERE FROM DISPLAY TERMINATE, BAD STALL OR TC Q.
013683,000037:                                                                                                  #        RETURN HERE FROM DISPLAY PROCEED OR GOOD RETURN FROM STALL.
013684,000038:                                                                                                  #        RETURN HERE FROM DISPLAY ENTER OR RECYCLE.
013685,000039: 
013686,000040:                                                                                                  #  THIS ROUTINE REQUIRES TWO ERASABLES (EBUF2, +1) IN UNSWITCHED WHICH ARE UNSHARED BY INTERRUPTS AND
013687,000041:                                                                                                  #  OTHER EMEMORY PROGRAMS.
013688,000042: 
013689,000043:                                                                                                  #  A + L ARE PRESERVED THROUGH BANKCALL AND E/BKCALL.
013690,000044: 
013691,000045: 04,2450           52134        E/BKCALL           DXCH     BUF2                                  #  SAVE A,L AND GET DP RETURN.
013692,000046: 04,2451           52302                           DXCH     EBUF2                                 #  SAVE DP RETURN.
013693,000047: 04,2452           24301                           INCR     EBUF2                                 #  RETURN +1 BECAUSE DOUBLE CADR.
013694,000048: 04,2453           30006                           CA       BBANK                                 
013695,000049: 04,2454           75062                           MASK     LOW10                                 #  GET CURRENT EBANK.  (SBANK SOMEDAY)
013696,000050: 04,2455           26302                           ADS      EBUF2      +1                         #  FORM BBCON.  (WAS FBANK)
013697,000051: 04,2456           50301                           NDX      EBUF2                                 
013698,000052: 04,2457           27777                           CA       0          -1                         #  GET CADR OF ROUTINE.
013699,000053: 04,2460           04661                           TC       SWCALL                                #  GO TO ROUTINE, SETTING Q TO SWRETURN
013700,000054:                                                                                                  #  AND RESTORING A + L.
013701,000055: 04,2461           02465                           TC       +4                                    #  TX Q, V34, OR BAD STALL RETURN.
013702,000056: 04,2462           02464                           TC       +2                                    #  PROCEED OR GOOD STALL RETURN.
013703,000057: 04,2463           24301                           INCR     EBUF2                                 #  ENTER OR RECYCLE RETURN.
013704,000058: 04,2464           24301                           INCR     EBUF2                                 
013705,000059: 04,2465           52302        E/SWITCH           DXCH     EBUF2                                 
013706,000060: 04,2466           52006                           DTCB                                           
013707,000061: 
013708,000062:                                                                                                  #  E/CALL        FOR CALLING A FIXED MEMORY INTERPRETIVE SUBROUTINE FROM ERASABLE AND RETURNING TO ERASABLE.
013709,000063: 
013710,000064:                                                                                                  #  THE CALLING SEQUENCE IS...
013711,000065: 
013712,000066:                                                                                                  #        RTB
013713,000067:                                                                                                  #                E/CALL
013714,000068:                                                                                                  #        CADR    ROUTINE                 THE INTERPRETIVE SUBROUTINE YOU WANT.
013715,000069:                                                                                                  #                                        RETURNS HERE IN INTERPRETIVE.
013716,000070: 
013717,000071: 04,2467           22164        E/CALL             LXCH     LOC                                   #  ADRES -1 OF CADR.
013718,000072: 04,2470           50001                           INDEX    L                                     
013719,000073: 04,2471           30001                           CA       L                                     #  CADR IN A.
013720,000074: 04,2472           24001                           INCR     L                                     
013721,000075: 04,2473           24001                           INCR     L                                     #  RETURN ADRES IN L.
013722,000076: 04,2474           52302                           DXCH     EBUF2                                 #  STORE CADR AND RETURN.
013723,000077: 04,2475           06014                           TC       INTPRET                               
013724,000078: 04,2476           77624                           CALL                                           
013725,000079: 04,2477           00301                                    EBUF2                                 #  INDIRECTLY EXECUTE ROUTINE.  IT MUST
013726,000080: 04,2500           77776                           EXIT                                           #  LEAVE VIA RVQ OR EQUIVALENT.
013727,000081: 04,2501           22302                           LXCH     EBUF2      +1                         #  PICK UP RETURN.
013728,000082: 04,2502           16015                           TCF      INTPRET    +1                         #  SET LOC AND RETURN TO CALLER.
013729,000083: 
013730,000084:                                                                                                  #  E/JOBWAK      FOR WAKING UP ERASABLE MEMORY JOBS.
013731,000085: 
013732,000086:                                                                                                  #  THIS ROUTINE MUST BE CALLED IN INTERRUPT OR WITH INTERRUPTS INHIBITED.
013733,000087: 
013734,000088:                                                                                                  #  THE CALLING SEQUENCE IS:
013735,000089: 
013736,000090:                                                                                                  #        INHINT
013737,000091:                                                                                                  #          .
013738,000092:                                                                                                  #          .
013739,000093:                                                                                                  #        CA      WAKEADR         ADDRESS OF SLEEPING JOB
013740,000094:                                                                                                  #        TC      IBNKCALL
013741,000095:                                                                                                  #        CADR    E/JOBWAK
013742,000096:                                                                                                  #          .                     RETURNS HERE
013743,000097:                                                                                                  #          .
013744,000098:                                                                                                  #          .
013745,000099:                                                                                                  #        RELINT                  IF YOU DID AN INHINT.
013746,000100: 
013747,000101: 33,2000                                           BANK     33                                    
013748,000102: 04,2000                                           SETLOC   E/PROG                                
013749,000103: 04,2000                                           BANK                                           
013750,000104: 
013751,000105: 04,2503                                           COUNT*   $$/P07                                
013752,000106: 
013753,000107: 04,2503           05207        E/JOBWAK           TC       JOBWAKE                               #  ARRIVE IWTH ADRES IN A.
013754,000108: 04,2504           45014                           CS       BIT11                                 
013755,000109: 04,2505           50064                           NDX      LOCCTR                                
013756,000110: 04,2506           26164                           ADS      LOC                                   #  KNOCK FIXED MEMORY BIT OUT OF ADRES.
013757,000111: 04,2507           00072                           TC       RUPTREG3                              #  RETURN
013758,000112: 

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