Source Code

These source-code files were derived from scans of the Colossus 237 (Apollo 8 Command Module) program listing from the private collection of original AGC developer Fred Martin. Scanning was by Ron Burkey. Pre-existing Colossus 249 (Apollo 9 CM) source files were used as a template, and changes between Colossus 249 and Colossus 237 were manually transcribed by a team of volunteers. Note that the page images presented online are of reduced quality, and that additional 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:

	GAP: ASSEMBLE REVISION 237 OF AGC PROGRAM COLOSSUS 
	BY NASA 2021111-031  1:17 AUG. 24, 1968
Note that the date is the date of the printout, not the date of the program revision.

021447,000002:                                                                                                  ## Copyright:   Public domain.
021448,000003:                                                                                                  ## Filename:    R31.agc
021449,000004:                                                                                                  ## Purpose:     Part of the source code for Colossus build 237.
021450,000005:                                                                                                  ##              This is for the Command Module's (CM) Apollo Guidance
021451,000006:                                                                                                  ##              Computer (AGC), for Apollo 8.
021452,000007:                                                                                                  ## Assembler:   yaYUL
021453,000008:                                                                                                  ## Contact:     Jim Lawton <jim DOT lawton AT gmail DOT com>
021454,000009:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
021455,000010:                                                                                                  ## Page Scans:  www.ibiblio.org/apollo/ScansForConversion/Colossus237/
021456,000011:                                                                                                  ## Mod history: 2011-02-05 JL   Adapted from corresponding Colossus 249 file.
021457,000012:                                                                                                  ##              2016-12-31 RSB  Proofed comment text using octopus/ProoferComments,
021458,000013:                                                                                                  ##                              and corrected errors found.
021459,000014: 

Page 494

021461,000016: 34,2002                                           BANK     34                                    
021462,000017: 35,2000                                           SETLOC   R31                                   
021463,000018: 35,2000                                           BANK                                           
021464,000019: 
021465,000020: 35,3150                                           COUNT*   $$/R31                                
021466,000021: 
021467,000022: 35,3150           34752        R31CALL            CAF      PRIO3                                 
021468,000023: 35,3151           05042                           TC       FINDVAC                               
021469,000024: 35,3152  E4,1770                                  EBANK=   SUBEXIT                               
021470,000025: 35,3152           03204 72064                     2CADR    V83CALL                               
021471,000026: 
021472,000027: 35,3154           34734        DSPDELAY           CAF      1SEC                                  
021473,000028: 35,3155           04555                           TC       BANKCALL                              
021474,000029: 35,3156           01730                           CADR     DELAYJOB                              
021475,000030: 35,3157           31044                           CA       EXTVBACT                              
021476,000031: 35,3160           74677                           MASK     BIT12                                 
021477,000032: 35,3161           00006                           EXTEND                                         
021478,000033: 35,3162           13154                           BZF      DSPDELAY                              
021479,000034: 
021480,000035: 35,3163           30105        DISPN5X            CA       FLAGWRD9                              #  TEST R31FLAG (IN SUNDANCE R31FLAG WILL
021481,000036: 35,3164           74707                           MASK     BIT4                                  #      ALWAYS BE SET AS R34 DOES NOT EXIST)
021482,000037: 35,3165           00006                           EXTEND                                         
021483,000038: 35,3166           13171                           BZF      +3                                    
021484,000039: 35,3167           33310                           CAF      V16N54                                #  R31    USE NOUN 54
021485,000040: 35,3170           03172                           TC       +2                                    
021486,000041: 35,3171           33311                           CAF      V16N53                                #  R34    USE NOUN 53
021487,000042: 35,3172           04555                           TC       BANKCALL                              
021488,000043: 35,3173           20465                           CADR     GOMARKF                               
021489,000044: 35,3174           05514                           TC       B5OFF                                 
021490,000045: 35,3175           05514                           TC       B5OFF                                 
021491,000046: 35,3176           13163                           TCF      DISPN5X                               
021492,000047: 
021493,000048: 35,3177           06006        V83                TC       INTPRET                               
021494,000049: 35,3200           77624                           CALL                                           
021495,000050: 35,3201           73426                                    REDOEXTP                              
021496,000051: 35,3202           77650                           GOTO                                           
021497,000052: 35,3203           73207                                    COMPDISP                              
021498,000053: 35,3204           06006        V83CALL            TC       INTPRET                               
021499,000054: 35,3205           77624                           CALL                                           
021500,000055: 35,3206           73312                                    STATEXTP                              #  EXTRAPOLATE STATE VECTORS
021501,000056: 35,3207           52375        COMPDISP           VLOAD    VSU                                   
021502,000057: 35,3210           00001                                    RATT                                  
021503,000058: 35,3211           02327                                    RONE                                  
021504,000059: 35,3212           51406                           PUSH     ABVAL                                 #  RATT-RONE TO 0D              PD= 6
021505,000060: 35,3213           02321                           STORE    RANGE                                 #  METERS B-29
021506,000061: 35,3214           77301                           NORM     VLOAD                                 
021507,000062: 35,3215           00047                                    X1                                    #  RATT-RONE                    PD= 0
021508,000063: 35,3216           77762                           VSR1                                           
021509,000064: 35,3217           53457                           VSL*     UNIT                                  

Page 495

021511,000066: 35,3220           20201                                    0,1                                   
021512,000067: 35,3221           52315                           PDVL     VSU                                   #  UNIT(LOS) TO 0D              PD= 6
021513,000068: 35,3222           00007                                    VATT                                  
021514,000069: 35,3223           02335                                    VONE                                  
021515,000070: 35,3224           77641                           DOT                                            #  (VATT-VONE).UNIT(LOS)        PD= 0
021516,000071: 35,3225           77752                           SL1                                            
021517,000072: 35,3226           36323                           STCALL   RRATE                                 #  RANGE RATE M/CS B-7
021518,000073: 35,3227           47432                                    CDUTRIG                               #  TO INITIALIZE FOR *NBSM*
021519,000074: 35,3230           77624                           CALL                                           
021520,000075: 35,3231           62000                                    R34LOS                                #  NOTE. PDL MUST = 0.
021521,000076: 35,3232           53575        R34ANG             VLOAD    UNIT                                  
021522,000077: 35,3233           02327                                    RONE                                  
021523,000078: 35,3234           77715                           PDVL                                           #  UR TO 0D                    PD= 6
021524,000079: 35,3235           15330                                    THISAXIS                              #  UNITX FOR CM, UNITZ FOR LM
021525,000080: 35,3236           77214                           BON      VLOAD                                 #  CHK R31FLAG. ON=R31 THETA, OFF=R34 PHI
021526,000081: 35,3237           04713                                    R31FLAG                               
021527,000082: 35,3240           73242                                    +2                                    #      R31-THETA
021528,000083: 35,3241           00015                                    12D                                   
021529,000084: 35,3242           77624                           CALL                                           
021530,000085: 35,3243           47601                                    *NBSM*                                
021531,000086: 35,3244           41505                           VXM      PUSH                                  #  UXORZ TO 6D                  PD=12D
021532,000087: 35,3245           01736                                    REFSMMAT                              
021533,000088: 35,3246           72431                           VPROJ    VSL2                                  
021534,000089: 35,3247           00001                                    0D                                    
021535,000090: 35,3250           53445                           BVSU     UNIT                                  
021536,000091: 35,3251           00007                                    6D                                    
021537,000092: 35,3252           47315                           PDVL     VXV                                   #  UP/2 TO 12D                  PD=18D
021538,000093: 35,3253           02327                                    RONE                                  
021539,000094: 35,3254           02335                                    VONE                                  
021540,000095: 35,3255           47256                           UNIT     VXV                                   
021541,000096: 35,3256           02327                                    RONE                                  
021542,000097: 35,3257           63241                           DOT      PDVL                                  #  SIGN TO 12D, UP/2 TO MPAC    PD=18D
021543,000098: 35,3260           00015                                    12D                                   
021544,000099: 35,3261           50372                           VSL1     DOT                                   #  UP.UXORZ
021545,000100: 35,3262           00007                                    6D                                    
021546,000101: 35,3263           72565                           SIGN     SL1                                   
021547,000102: 35,3264           00015                                    12D                                   
021548,000103: 35,3265           77726                           ACOS                                           
021549,000104: 35,3266           26325                           STOVL    RTHETA                                
021550,000105: 35,3267           02327                                    RONE                                  
021551,000106: 35,3270           51041                           DOT      BPL                                   
021552,000107: 35,3271           00007                                    6D                                    
021553,000108: 35,3272           73277                                    +5                                    
021554,000109: 35,3273           44345                           DLOAD    BDSU                                  #  IF UXORZ.R NEG, RTHETA = 1 - RTHETA
021555,000110: 35,3274           02325                                    RTHETA                                
021556,000111: 35,3275           15340                                    DPPOSMAX                              
021557,000112: 35,3276           02325                           STORE    RTHETA                                #  RTHETA BETWEEN 0 AND 1 REV.
021558,000113: 35,3277           77776                           EXIT                                           
021559,000114: 35,3300           34706                           CAF      BIT5                                  #  HAVE WE BEEN ANSWERED
021560,000115: 35,3301           71044                           MASK     EXTVBACT                              

Page 496

021562,000117: 35,3302           00006                           EXTEND                                         
021563,000118: 35,3303           15423                           BZF      ENDEXT                                #  YES, DIE
021564,000119: 
021565,000120: 35,3304           41044                           CS       EXTVBACT                              
021566,000121: 35,3305           74677                           MASK     BIT12                                 
021567,000122: 35,3306           27044                           ADS      EXTVBACT                              
021568,000123: 
021569,000124: 35,3307           13177                           TCF      V83                                   
021570,000125: 35,3310           04066        V16N54             VN       1654                                  
021571,000126: 35,3311           04065        V16N53             VN       1653                                  
021572,000127: 

Page 497

021574,000129:                                                                                                  #  THE STATEXTP SUBROUTINE DOES A PRECISION EXTRAPOLATION OF BOTH VEHICLES
021575,000130:                                                                                                  #  STATE VECTORS TO PRESENT TIME AND SAVES THEM AS BASE VECTORS.
021576,000131:                                                                                                  #  IF SERVICER IS OFF ---
021577,000132:                                                                                                  #                  THIS VEHICLES BASE VECTOR IS CONIC EXTRAPOLATED TO
021578,000133:                                                                                                  #                  PRESENT TIME AND SAVED AS RONE, VONE.
021579,000134:                                                                                                  #                  THE OTHER VEHICLES BASE VECTOR IS CONIC EXTRAPOLATED
021580,000135:                                                                                                  #                  TO THE SAME TIME, THE OUTPUT BEING LEFT IN RATT, VATT.
021581,000136:                                                                                                  #  IF SERVICER IS ON  ---
021582,000137:                                                                                                  #                  RONE, VONE ARE SET EQUAL TO RN, VN AND THE OTHER
021583,000138:                                                                                                  #                  VEHICLES STATE VECTOR IS PREC. EXTRAPOLATED TO PIPTIME.
021584,000139: 35,3312           47020        STATEXTP           STQ      RTB                                   
021585,000140: 35,3313           02274                                    STATEXIT                              
021586,000141: 35,3314           45505                                    LOADTIME                              
021587,000142: 35,3315           34041                           STCALL   TDEC1                                 
021588,000143: 35,3316           27036                                    OTHPREC                               #  GET BASE VECTORS
021589,000144: 35,3317           77775                           VLOAD                                          
021590,000145: 35,3320           00017                                    RATT1                                 
021591,000146: 35,3321           26225                           STOVL    BASEOTP                               #  OTHER POS.
021592,000147: 35,3322           00025                                    VATT1                                 
021593,000148: 35,3323           16241                           STODL    BASEOTV                               #  OTHER VEL.
021594,000149: 35,3324           00015                                    TAT                                   
021595,000150: 35,3325           02272                           STORE    BASETIME                              
021596,000151: 35,3326           34041                           STCALL   TDEC1                                 
021597,000152: 35,3327           27022                                    THISPREC                              
021598,000153: 35,3330           77775                           VLOAD                                          
021599,000154: 35,3331           00017                                    RATT1                                 
021600,000155: 35,3332           26255                           STOVL    BASETHP                               #  THIS POS.
021601,000156: 35,3333           00025                                    VATT1                                 
021602,000157: 35,3334           02263                           STORE    BASETHV                               #  THIS VEL
021603,000158: 35,3335           47014        HAVEBASE           BON      RTB                                   
021604,000159: 35,3336           03711                                    V37FLAG                               
021605,000160: 35,3337           73413                                    GETRVN                                #  IF AVG ON ,GET RN ETC.
021606,000161: 35,3340           45505                                    LOADTIME                              
021607,000162: 35,3341           34041                           STCALL   TDEC1                                 #  BEGIN SET UP FOR CONIC EXTRAP. FOR THIS.
021608,000163: 35,3342           27371                                    INTSTALL                              
021609,000164: 35,3343           43175                           VLOAD    CLEAR                                 
021610,000165: 35,3344           02255                                    BASETHP                               
021611,000166: 35,3345           00263                                    MOONFLAG                              
021612,000167: 35,3346           25535                           STOVL    RCV                                   
021613,000168: 35,3347           02263                                    BASETHV                               
021614,000169: 35,3350           15543                           STODL    VCV                                   
021615,000170: 35,3351           02272                                    BASETIME                              
021616,000171: 35,3352           43014                           BOF      SET                                   #  GET APPROPRIATE MOONFLAG SETTING
021617,000172: 35,3353           04343                                    MOONTHIS                              
021618,000173: 35,3354           73356                                    +2                                    
021619,000174: 35,3355           00063                                    MOONFLAG                              
021620,000175: 35,3356           77614                           SET                                            
021621,000176: 35,3357           01473                                    INTYPFLG                              #  CONIC EXTRAP.
021622,000177: 35,3360           35517                           STCALL   TET                                   
021623,000178: 35,3361           27066                                    INTEGRVS                              #  INTEGRATION --- AT LAST ---

Page 498

021625,000180: 35,3362           77775                           VLOAD                                          
021626,000181: 35,3363           00001                                    RATT                                  
021627,000182: 35,3364           26327                           STOVL    RONE                                  
021628,000183: 35,3365           00007                                    VATT                                  
021629,000184: 35,3366           36335                           STCALL   VONE                                  #  GET SET FOR CONIC EXTRAP.,OTHER.
021630,000185: 35,3367           27371                                    INTSTALL                              
021631,000186: 35,3370           71214                           SET      DLOAD                                 
021632,000187: 35,3371           01473                                    INTYPFLG                              
021633,000188: 35,3372           00015                                    TAT                                   
021634,000189: 35,3373           00041        OTHINT             STORE    TDEC1                                 
021635,000190: 35,3374           43175                           VLOAD    CLEAR                                 
021636,000191: 35,3375           02225                                    BASEOTP                               
021637,000192: 35,3376           00263                                    MOONFLAG                              
021638,000193: 35,3377           25535                           STOVL    RCV                                   
021639,000194: 35,3400           02241                                    BASEOTV                               
021640,000195: 35,3401           15543                           STODL    VCV                                   
021641,000196: 35,3402           02272                                    BASETIME                              
021642,000197: 35,3403           43014                           BOF      SET                                   
021643,000198: 35,3404           04343                                    MOONTHIS                              
021644,000199: 35,3405           73407                                    +2                                    
021645,000200: 35,3406           00063                                    MOONFLAG                              
021646,000201: 35,3407           35517                           STCALL   TET                                   
021647,000202: 35,3410           27066                                    INTEGRVS                              
021648,000203: 35,3411           77650                           GOTO                                           
021649,000204: 35,3412           02274                                    STATEXIT                              #  THIS VEHICLES POS.,VEL. IN PUSHLIST.
021650,000205: 
021651,000206: 35,3413           77775        GETRVN             VLOAD                                          
021652,000207: 35,3414           01171                                    RN                                    
021653,000208: 35,3415           26327                           STOVL    RONE                                  
021654,000209: 35,3416           01177                                    VN                                    
021655,000210: 35,3417           16335                           STODL    VONE                                  
021656,000211: 35,3420           01205                                    PIPTIME                               
021657,000212: 35,3421           77624                           CALL                                           
021658,000213: 35,3422           27371                                    INTSTALL                              
021659,000214: 35,3423           52014                           CLEAR    GOTO                                  
021660,000215: 35,3424           01673                                    INTYPFLG                              #  PREC EXTRAP FOR OTHER
021661,000216: 35,3425           73373                                    OTHINT                                
021662,000217: 
021663,000218: 35,3426           52020        REDOEXTP           STQ      GOTO                                  
021664,000219: 35,3427           02274                                    STATEXIT                              
021665,000220: 35,3430           73335                                    HAVEBASE                              
021666,000221: 31,2000                                           SETLOC   R34                                   
021667,000222: 31,2000                                           BANK                                           
021668,000223: 31,2000           77776        R34LOS             EXIT                                           
021669,000224: 31,2001           30036                           CA       CDUS                                  
021670,000225: 31,2002           50120                           INDEX    FIXLOC                                
021671,000226: 31,2003           54011                           TS       9D                                    
021672,000227: 31,2004           30035                           CA       CDUT                                  
021673,000228: 31,2005           50120                           INDEX    FIXLOC                                
021674,000229: 31,2006           54013                           TS       11D                                   

Page 499

021676,000231: 31,2007           30120                           CA       FIXLOC                                
021677,000232: 31,2010           66211                           AD       SIX                                   
021678,000233: 31,2011           40000                           COM                                            
021679,000234: 31,2012           50120                           INDEX    FIXLOC                                
021680,000235: 31,2013           54046                           TS       X1                                    
021681,000236: 31,2014           06006                           TC       INTPRET                               
021682,000237: 31,2015           77624                           CALL                                           
021683,000238: 31,2016           46000                                    SXTNB                                 
021684,000239: 31,2017           34015                           STCALL   12D                                   
021685,000240: 31,2020           73232                                    R34ANG                                

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