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.

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

Page 494

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

Page 495

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

Page 496

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

Page 497

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

Page 498

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

Page 499

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

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