Source Code

This is the source-code for the Apollo 9 Command Module's Guidance Computer. These files were derived originally from the scan from MIT's Dibner Institute's now-discontinued website titled "History of Recent Science and Technology", which in turn was originally created by Gary Neff, though his high-quality scans were unfortunately reduced in legibility when presented online. The markings on the front of the printout imply that it was the original AGC developer Norm Brodeur's copy. A scan by Ron Burkey has superceded it, made from a more-legible copy from the collection of original AGC developer Fred Martin. The source code was transcribed from those images by Ron Burkey. Note that the page images presented online are of reduced quality, and that higher-quality images are available. Report any conversion errors or legibility problems in page images to info@sandroid.org. Notations on the program listing read, in part:

	ASSEMBLE REVISION 249 OF AGC PROGRAM COLOSSUS BY NASA 2021111-041
	20'35 OCT. 28,1968
Note that the date is the date of the printout, not the date of the program revision.

018232,000002:                                                                                                  ## Copyright:   Public domain.
018233,000003:                                                                                                  ## Filename:    SYSTEM_TEST_STANDARD_LEAD_INS.agc
018234,000004:                                                                                                  ## Purpose:     Part of the source code for Colossus, build 249.
018235,000005:                                                                                                  ##              It is part of the source code for the Command Module's (CM)
018236,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for Apollo 9.
018237,000007:                                                                                                  ## Assembler:   yaYUL
018238,000008:                                                                                                  ## Reference:   pp. 413-415.
018239,000009:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
018240,000010:                                                                                                  ## Website:     www.ibiblio.org/apollo.
018241,000011:                                                                                                  ## Mod history: 08/07/04 RSB.   Adapted from similar Luminary 131 file.
018242,000012:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
018243,000013:                                                                                                  ##                              original harcopy, as opposed to the PDF page
018244,000014:                                                                                                  ##                              numbers in 1701.pdf.
018245,000015:                                                                                                  ##              2017-01-20 RSB  Cross-diff'd comment text (not whitespace)
018246,000016:                                                                                                  ##                              vs the already-proofed corresponding Colossus
018247,000017:                                                                                                  ##                              237 and Comanche 55 source-code files
018248,000018:                                                                                                  ##                              and corrected errors found.
018249,000019:                                                                                                  ##
018250,000020:                                                                                                  ## The contents of the "Colossus249" files, in general, are transcribed 
018251,000021:                                                                                                  ## from a scanned copy of the program listing.  Notations on this
018252,000022:                                                                                                  ## document read, in part:
018253,000023:                                                                                                  ##
018254,000024:                                                                                                  ##      Assemble revision 249 of AGC program Colossus by NASA
018255,000025:                                                                                                  ##      2021111-041.  October 28, 1968.  
018256,000026:                                                                                                  ##
018257,000027:                                                                                                  ##      This AGC program shall also be referred to as
018258,000028:                                                                                                  ##                              Colossus 1A
018259,000029:                                                                                                  ##
018260,000030:                                                                                                  ##      Prepared by
018261,000031:                                                                                                  ##                      Massachusetts Institute of Technology
018262,000032:                                                                                                  ##                      75 Cambridge Parkway
018263,000033:                                                                                                  ##                      Cambridge, Massachusetts
018264,000034:                                                                                                  ##      under NASA contract NAS 9-4065.
018265,000035:                                                                                                  ##
018266,000036:                                                                                                  ## Refer directly to the online document mentioned above for further information.
018267,000037:                                                                                                  ## Please report any errors (relative to the scanned pages) to info@sandroid.org.
018268,000038:                                                                                                  ##
018269,000039:                                                                                                  ## In some cases, where the source code for Luminary 131 overlaps that of 
018270,000040:                                                                                                  ## Colossus 249, this code is instead copied from the corresponding Luminary 131
018271,000041:                                                                                                  ## source file, and then is proofed to incorporate any changes.
018272,000042: 

Page 413

018274,000044: 22,3310  E5,1671                                  EBANK=   XSM                                   
018275,000045: 
018276,000046: 33,2000                                           BANK     33                                    
018277,000047: 04,2000                                           SETLOC   E/PROG                                
018278,000048: 04,2000                                           BANK                                           
018279,000049: 
018280,000050: 04,2557                                           COUNT*   $$/P07                                
018281,000051: 
018282,000052:                                                                                                  #  SPECIAL PROGRAMS TO EASE THE PANGS OF ERASABLE MEMORY PROGRAMS.
018283,000053: 
018284,000054:                                                                                                  #  E/BKCALL      FOR DOING BANKCALLS FROM AND RETURNING TO ERASABLE.
018285,000055: 
018286,000056:                                                                                                  #  THIS ROUTINE IS CALLABLE FROM ERASABLE OR FIXED.  LIKE BANKCALL, HOWEVER, SWITCHING BETWEEN S3 AND S4
018287,000057:                                                                                                  #  IS NOT POSSIBLE.
018288,000058: 
018289,000059:                                                                                                  #  THE CALLING SEQUENCE IS:
018290,000060: 
018291,000061:                                                                                                  #        TC      BANKCALL
018292,000062:                                                                                                  #        CADR    E/BKCALL
018293,000063:                                                                                                  #        CADR    ROUTINE         WHERE YOU WANT TO GO IN FIXED.
018294,000064:                                                                                                  #        RETURN HERE FROM DISPLAY TERMINATE, BAD STALL OR TC Q.
018295,000065:                                                                                                  #        RETURN HERE FROM DISPLAY PROCEED OR GOOD RETURN FROM STALL.
018296,000066:                                                                                                  #        RETURN HERE FROM DISPLAY ENTER OR RECYCLE.
018297,000067: 
018298,000068:                                                                                                  #  THIS ROUTINE REQUIRES TWO ERASABLES (EBUF2, +1) IN UNSWITCHED WHICH ARE UNSHARED BY INTERRUPTS AND
018299,000069:                                                                                                  #  OTHER EMEMORY PROGRAMS.
018300,000070: 
018301,000071:                                                                                                  #  A + L ARE PRESERVED THROUGH BANKCALL AND E/BKCALL.
018302,000072: 
018303,000073: 04,2557           52134        E/BKCALL           DXCH     BUF2                                  #  SAVE A,L AND GET DP RETURN.
018304,000074: 04,2560           52365                           DXCH     EBUF2                                 #  SAVE DP RETURN.
018305,000075: 04,2561           24364                           INCR     EBUF2                                 #  RETURN +1 BECAUSE DOUBLE CADR.
018306,000076: 04,2562           30006                           CA       BBANK                                 
018307,000077: 04,2563           74747                           MASK     LOW10                                 #  GET CURRENT EBANK.  (SBANK SOMEDAY)
018308,000078: 04,2564           26365                           ADS      EBUF2      +1                         #  FORM BBCON.  (WAS FBANK)
018309,000079: 04,2565           50364                           NDX      EBUF2                                 
018310,000080: 04,2566           27777                           CA       0          -1                         #  GET CADR OF ROUTINE.
018311,000081: 04,2567           04561                           TC       SWCALL                                #  GO TO ROUTINE, SETTING Q TO SWRETURN
018312,000082:                                                                                                  #  AND RESTORING A + L.
018313,000083: 04,2570           02574                           TC       +4                                    #  TX Q, V34, OR BAD STALL RETURN.
018314,000084: 04,2571           02573                           TC       +2                                    #  PROCEED OR GOOD STALL RETURN.
018315,000085: 04,2572           24364                           INCR     EBUF2                                 #  ENTER OR RECYCLE RETURN.
018316,000086: 04,2573           24364                           INCR     EBUF2                                 
018317,000087: 04,2574           52365        E/SWITCH           DXCH     EBUF2                                 
018318,000088: 04,2575           52006                           DTCB                                           
018319,000089: 

Page 414

018321,000091:                                                                                                  #  E/CALL        FOR CALLING A FIXED MEMORY INTERPRETIVE SUBROUTINE FROM ERASABLE AND RETURNING TO ERASABLE.
018322,000092: 
018323,000093:                                                                                                  #  THE CALLING SEQUENCE IS...
018324,000094: 
018325,000095:                                                                                                  #        RTB
018326,000096:                                                                                                  #                E/CALL
018327,000097:                                                                                                  #        CADR    ROUTINE                 THE INTERPRETIVE SUBROUTINE YOU WANT.
018328,000098:                                                                                                  #                                        RETURNS HERE IN INTERPRETIVE.
018329,000099: 
018330,000100: 04,2576           22164        E/CALL             LXCH     LOC                                   #  ADRES -1 OF CADR.
018331,000101: 04,2577           50001                           INDEX    L                                     
018332,000102: 04,2600           30001                           CA       L                                     #  CADR IN A.
018333,000103: 04,2601           24001                           INCR     L                                     
018334,000104: 04,2602           24001                           INCR     L                                     #  RETURN ADRES IN L.
018335,000105: 04,2603           52365                           DXCH     EBUF2                                 #  STORE CADR AND RETURN.
018336,000106: 04,2604           06006                           TC       INTPRET                               
018337,000107: 04,2605           77624                           CALL                                           
018338,000108: 04,2606           00364                                    EBUF2                                 #  INDIRECTLY EXECUTE ROUTINE.  IT MUST
018339,000109: 04,2607           77776                           EXIT                                           #  LEAVE VIA RVQ OR EQUIVALENT.
018340,000110: 04,2610           22365                           LXCH     EBUF2      +1                         #  PICK UP RETURN.
018341,000111: 04,2611           16010                           TCF      INTPRET    +2                         #  SET LOC AND RETURB TO CALLER
018342,000112: 

Page 415

018344,000114:                                                                                                  #  E/JOBWAK      FOR WAKING UP ERASABLE MEMORY JOBS.
018345,000115: 
018346,000116:                                                                                                  #  THIS ROUTINE MUST BE CALLED IN INTERRUPT OR WITH INTERRUPTS INHIBITED.
018347,000117: 
018348,000118:                                                                                                  #  THE CALLING SEQUENCE IS:
018349,000119: 
018350,000120:                                                                                                  #        INHINT
018351,000121:                                                                                                  #        .
018352,000122:                                                                                                  #        .
018353,000123:                                                                                                  #        CA      WAKEADR         ADDRESS OF SLEEPING JOB
018354,000124:                                                                                                  #        TC      IBNKCALL
018355,000125:                                                                                                  #        CADR    E/JOBWAK
018356,000126:                                                                                                  #        .                       RETURNS HERE
018357,000127:                                                                                                  #        .
018358,000128:                                                                                                  #        .
018359,000129:                                                                                                  #        RELINT                  IF YOU DID AN INHINT.
018360,000130: 
018361,000131: 33,2000                                           BANK     33                                    
018362,000132: 04,2000                                           SETLOC   E/PROG                                
018363,000133: 04,2000                                           BANK                                           
018364,000134: 
018365,000135: 04,2612                                           COUNT*   $$/P07                                
018366,000136: 
018367,000137: 04,2612           05074        E/JOBWAK           TC       JOBWAKE                               #  ARRIVE IWTH ADRES IN A.
018368,000138: 04,2613           44700                           CS       BIT11                                 
018369,000139: 04,2614           50064                           NDX      LOCCTR                                
018370,000140: 04,2615           26164                           ADS      LOC                                   #  KNOCK FIXED MEMORY BIT OUT OF ADRES.
018371,000141: 04,2616           00072                           TC       RUPTREG3                              #  RETURN
018372,000142: 
018373,000143:                                                                                                  #  THESE PROGRAMS ARE PROVIDED TO ALLOW OVERLAY OF BANKS 30 THRU 33 OF THE 205 VERSIONS OF SYSTEM TESTS AND
018374,000144:                                                                                                  #  PRELAUNCH ALIGN.  THE INTENT IS TO ALLOW THE STG AND HYBRID LABS TO RUN ALL THE TESTS WITH COLOSSUS.
018375,000145: 
018376,000146: 33,2000                                           BANK     33                                    
018377,000147: 33,2000                                           SETLOC   TESTLEAD                              
018378,000148: 33,2000                                           BANK                                           
018379,000149: 
018380,000150: 33,2000                                           COUNT    33/COMST                              
018381,000151: 
018382,000152: 33,2000  E5,1425                                  EBANK=   QPLACE                                
018383,000153: 
018384,000154: 33,2000           03425        COMPVER            TC       GCOMPVER                              #  MUST BE 33,2000.
018385,000155: 
018386,000156: 33,2001           03132        GTSCPSS1           TC       GTSCPSS                               #  MUST BE AT 33,2001
018387,000157: 
018388,000158: 33,2002           05243        REDO               TC       NEWMODEX                              #  DISPLAY MM 07.
018389,000159: 33,2003           00007                           MM       07         B-14                       #  FALL INTO IMUTEST
018390,000160: 

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