Source Code

These source-code files derive from a printout of Luminary 210 (Apollo 15-17 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Jim Lawton, and transcribed to source code by a team of volunteers. This colorized, syntax-highlighted form was created by assembling that transcribed source code. Note that the full page images are available on the Virtual AGC project page at archive.org, while reduced-size images are presented at the VirtualAGC project website. Report or fix any transcription errors at the Virtual AGC project code repository.

Notations on the program listing read, in part:

	GAP: ASSEMBLE REVISION 210 OF AGC PROGRAM LUMINARY 
	BY NASA 2021112-161 17:11 MAR. 19,1971
Note that the date is the date of the printout, not the date of the program revision.

016452,000002:                                                                                                  ## Copyright:   Public domain.
016453,000003:                                                                                                  ## Filename:    KALCMANU_STEERING.agc
016454,000004:                                                                                                  ## Purpose:     A section of Luminary revision 210.
016455,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
016456,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 15-17.
016457,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
016458,000008:                                                                                                  ##              that the code format has been changed to conform to the
016459,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
016460,000010:                                                                                                  ##              original YUL assembler.
016461,000011:                                                                                                  ## Reference:   pp. 377-381
016462,000012:                                                                                                  ## Assembler:   yaYUL
016463,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
016464,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
016465,000015:                                                                                                  ## Mod history: 2016-11-17 JL   Created from Luminary131 version.
016466,000016:                                                                                                  ##              2016-11-25 HG   Transcribed
016467,000017:                                                                                                  ##              2016-12-23 RSB  Proofed comment text with octopus/ProoferComments
016468,000018:                                                                                                  ##                              and fixed all errors found.
016469,000019:                                                                                                  ##              2017-03-17 RSB  Comment-text fixes identified in diff'ing
016470,000020:                                                                                                  ##                              Luminary 99 vs Comanche 55.
016471,000021: 

Page 377

016473,000023:                                                                                                  #  GENERATION OF STEERING COMMANDS FOR DIGITAL AUTOPILOT FREE FALL MANEUVERS
016474,000024: 
016475,000025:                                                                                                  #  NEW COMMANDS WILL BE GENERATED EVERY ONE SECOND DURING THE MANEUVER
016476,000026: 
016477,000027: 22,3003  E6,1706                                  EBANK=   TTEMP                                 
016478,000028: 
016479,000029: 22,3003           04607        NEWDELHI           TC       BANKCALL                              #  CHECK FOR AUTO STABILIZATION
016480,000030: 22,3004           54274                           CADR     ISITAUTO                              #  ONLY
016481,000031: 22,3005           10000                           CCS      A                                     
016482,000032: 22,3006           12730                           TCF      NOGO       -2                         
016483,000033: 22,3007           06060        NEWANGL            TC       INTPRET                               
016484,000034: 22,3010           75160                           AXC,1    AXC,2                                 
016485,000035: 22,3011           03245                                    MIS                                   #  COMPUTE THE NEW MATRIX FROM S/C TO
016486,000036: 22,3012           02221                                    KEL                                   #  STABLE MEMBER AXES
016487,000037: 22,3013           77624                           CALL                                           
016488,000038: 22,3014           44312                                    MXM3                                  
016489,000039: 22,3015           45575                           VLOAD    STADR                                 
016490,000040: 22,3016           50515                           STOVL    MIS        +12D                       #  CALCULATE NEW DESIRED CDU ANGLES
016491,000041: 22,3017           77626                           STADR                                          
016492,000042: 22,3020           50523                           STOVL    MIS        +6D                        
016493,000043: 22,3021           77626                           STADR                                          
016494,000044: 22,3022           74531                           STORE    MIS                                   
016495,000045: 22,3023           45160                           AXC,1    CALL                                  
016496,000046: 22,3024           03245                                    MIS                                   
016497,000047: 22,3025           44654                                    DCMTOCDU                              #  PICK UP THE NEW CDU ANGLES FROM MATRIX
016498,000048: 22,3026           77634                           RTB                                            
016499,000049: 22,3027           21630                                    V1STO2S                               
016500,000050: 22,3030           03303                           STORE    NCDU                                  #  NEW CDU ANGLES
016501,000051: 22,3031           77414                           BONCLR   EXIT                                  
016502,000052: 22,3032           01215                                    CALCMAN2                              
016503,000053: 22,3033           45122                                    MANUSTAT                              #  TO START MANEUVER
016504,000054: 22,3034           34743                           CAF      TWO                                   #           +0 OTHERWISE
016505,000055: 22,3035           55261        INCRDCDU           TS       SPNDX                                 
016506,000056: 22,3036           51261                           INDEX    SPNDX                                 
016507,000057: 22,3037           31675                           CA       BCDU                                  #  INITIAL CDU ANGLES
016508,000058: 22,3040           00006                           EXTEND                                         #  OR PREVIOUS DESIRED CDU ANGLES
016509,000059: 22,3041           51261                           INDEX    SPNDX                                 
016510,000060: 22,3042           21702                           MSU      NCDU                                  
016511,000061: 22,3043           00006                           EXTEND                                         
016512,000062: 22,2000                                           SETLOC   KALCMON1                              
016513,000063: 22,2000                                           BANK                                           
016514,000064: 
016515,000065: 22,3044           73121                           MP       DT/TAU                                
016516,000066: 22,3045           10000                           CCS      A                                     #  CONVERT TO 2S COMPLEMENT
016517,000067: 22,3046           64744                           AD       ONE                                   
016518,000068: 22,3047           13051                           TCF      +2                                    
016519,000069: 22,3050           40000                           COM                                            
016520,000070: 22,3051           51261                           INDEX    SPNDX                                 
016521,000071: 22,3052           55637                           TS       DELDCDU                               #  ANGLE INCREMENTS TO BE ADDED TO
016522,000072: 22,3053           51261                           INDEX    SPNDX                                 #  CDUXD, CDUYD, CDUZD EVERY TENTH SECOND
016523,000073: 

Page 378

016525,000075: 22,3054           31702                           CA       NCDU                                  #  BY LEM DAP
016526,000076: 22,3055           51261                           INDEX    SPNDX                                 
016527,000077: 22,3056           57675                           XCH      BCDU                                  
016528,000078: 22,3057           51261                           INDEX    SPNDX                                 
016529,000079: 22,3060           55634                           TS       CDUXD                                 
016530,000080: 22,3061           11261                           CCS      SPNDX                                 
016531,000081: 22,3062           13035                           TCF      INCRDCDU                              #  LOOP FOR THREE AXES
016532,000082: 
016533,000083: 22,3063           00003                           RELINT                                         
016534,000084: 
016535,000085:                                                                                                  #  COMPARE PRESENT TIME WITH TIME TO TERMINATE MANEUVER
016536,000086: 
016537,000087: 22,3064           03075        TMANUCHK           TC       TIMECHK                               
016538,000088: 22,3065           13170                           TCF      CONTMANU                              
016539,000089: 22,3066           34744                           CAF      ONE                                   
016540,000090: 22,3067           00004        MANUSTAL           INHINT                                         #  END MAJOR PART OF MANEUVER WITHIN 1 SEC
016541,000091: 22,3070           05205                           TC       WAITLIST                              #  UNDER WAITLIST CALL TO MANUSTOP
016542,000092: 22,3071  E6,1706                                  EBANK=   TTEMP                                 
016543,000093: 22,3071           03213 44066                     2CADR    MANUSTOP                              
016544,000094: 
016545,000095: 22,3073           00003                           RELINT                                         
016546,000096: 22,3074           15146                           TCF      ENDOFJOB                              
016547,000097: 
016548,000098: 22,3075           00006        TIMECHK            EXTEND                                         
016549,000099: 22,3076           40025                           DCS      TIME2                                 
016550,000100: 22,3077           53707                           DXCH     TTEMP                                 
016551,000101: 22,3100           00006                           EXTEND                                         
016552,000102: 22,3101           31733                           DCA      TM                                    
016553,000103: 22,3102           21707                           DAS      TTEMP                                 
016554,000104: 22,3103           11706                           CCS      TTEMP                                 
016555,000105: 22,3104           00002                           TC       Q                                     
016556,000106: 22,3105           13107                           TCF      +2                                    
016557,000107: 22,3106           13117                           TCF      2NDRETRN                              
016558,000108: 22,3107           11707                           CCS      TTEMP      +1                         
016559,000109: 22,3110           00002                           TC       Q                                     
016560,000110: 22,3111           13113                           TCF      MANUOFF                               
016561,000111: 22,3112           40000                           COM                                            
016562,000112: 22,3113           63166        MANUOFF            AD       ONESEK     +1                         
016563,000113: 22,3114           00006                           EXTEND                                         
016564,000114: 22,3115           63117                           BZMF     2NDRETRN                              
016565,000115: 22,3116           24002                           INCR     Q                                     
016566,000116: 22,3117           24002        2NDRETRN           INCR     Q                                     
016567,000117: 22,3120           00002                           TC       Q                                     
016568,000118: 
016569,000119: 22,3121           03146        DT/TAU             DEC      .1                                    
016570,000120: 
016571,000121: 22,3122           77776        MANUSTAT           EXIT                                           #  INITIALIZATION ROUTINE
016572,000122: 22,3123           00006                           EXTEND                                         #  FOR AUTOMATIC MANEUVERS
016573,000123: 22,3124           30025                           DCA      TIME2                                 

Page 379

016575,000125: 22,3125           21733                           DAS      TM                                    #  TM+T0   MANEUVER COMPLETION TIME
016576,000126: 22,3126           00006                           EXTEND                                         
016577,000127: 22,3127           43166                           DCS      ONESEK                                
016578,000128: 22,3130           21733                           DAS      TM                                    #  (TM+T0)-1
016579,000129: 22,3131           00004                           INHINT                                         
016580,000130: 22,3132           34743                           CAF      TWO                                   
016581,000131: 22,3133           55700        RATEBIAS           TS       KSPNDX                                
016582,000132: 22,3134           60000                           DOUBLE                                         
016583,000133: 22,3135           55701                           TS       KDPNDX                                
016584,000134: 22,3136           50000                           INDEX    A                                     
016585,000135: 22,3137           31724                           CA       BRATE                                 
016586,000136: 22,3140           51700                           INDEX    KSPNDX                                #  STORE MANEUVER RATE IN
016587,000137: 22,3141           55642                           TS       OMEGAPD                               #  OMEGAPD, OMEGAQD, OMEGARD
016588,000138: 22,3142           00006                           EXTEND                                         
016589,000139: 22,3143           63145                           BZMF     +2                                    #  COMPUTE ATTITUDE ERROR
016590,000140: 22,3144           40000                           COM                                            #  OFFSET = (WX)ABS(WX)/2AJX
016591,000141: 22,3145           00006                           EXTEND                                         #  WHERE AJX= 2-JET ACCELERATION
016592,000142: 22,3146           73167                           MP       BIASCALE                              #  = -1/16
016593,000143: 22,3147           00006                           EXTEND                                         
016594,000144: 22,3150           51701                           INDEX    KDPNDX                                
016595,000145: 22,3151           71724                           MP       BRATE                                 
016596,000146: 22,3152           00006                           EXTEND                                         
016597,000147: 22,3153           51700                           INDEX    KSPNDX                                
016598,000148: 22,3154           11530                           DV       1JACC                                 #  =AJX   $ 90 DEG/SEC-SEC
016599,000149: 22,3155           51700                           INDEX    KSPNDX                                
016600,000150: 22,3156           55274                           TS       DELPEROR                              #       $ 180 DEG
016601,000151: 22,3157           11700                           CCS      KSPNDX                                
016602,000152: 22,3160           13133                           TCF      RATEBIAS                              
016603,000153: 
016604,000154: 22,3161           30025                           CA       TIME1                                 
016605,000155: 22,3162           63166                           AD       ONESEK     +1                         
016606,000156: 22,3163           57705                           XCH      NEXTIME                               
016607,000157: 22,3164           13034                           TCF      INCRDCDU   -1                         
016608,000158: 
016609,000159: 22,3165           00000        ONESEK             DEC      0          B-14                       
016610,000160: 22,3166           00144                           DEC      100        B-14                       
016611,000161: 
016612,000162: 22,3167           75777        BIASCALE           OCT      75777                                 #  = -1/16
016613,000163: 
016614,000164: 22,3170           40025        CONTMANU           CS       TIME1                                 #  RESET FOR NEXT DCDU UPDATE
016615,000165: 22,3171           61705                           AD       NEXTIME                               
016616,000166: 22,3172           10000                           CCS      A                                     
016617,000167: 22,3173           64744                           AD       ONE                                   
016618,000168: 22,3174           13177                           TCF      MANUCALL                              
016619,000169: 22,3175           64726                           AD       NEGMAX                                
016620,000170: 22,3176           40000                           COM                                            
016621,000171: 22,3177           00004        MANUCALL           INHINT                                         #  CALL FOR NEXT UPDATE VIA WAITLIST
016622,000172: 22,3200           05205                           TC       WAITLIST                              
016623,000173: 22,3201  E6,1706                                  EBANK=   TTEMP                                 
016624,000174: 22,3201           03206 44066                     2CADR    UPDTCALL                              
016625,000175: 

Page 380

016627,000177: 22,3203           33166                           CAF      ONESEK     +1                         #  INCREMENT TIME FOR NEXT UPDATE
016628,000178: 22,3204           27705                           ADS      NEXTIME                               
016629,000179: 22,3205           15146                           TCF      ENDOFJOB                              
016630,000180: 
016631,000181: 
016632,000182: 22,3206           37735        UPDTCALL           CAF      PRIO26                                #  SATELLITE PROGRAM TO CALL FOR UPDATE
016633,000183: 22,3207           05076                           TC       FINDVAC                               #  OF STEERING COMMANDS
016634,000184: 22,3210  E6,1706                                  EBANK=   TTEMP                                 
016635,000185: 22,3210           03003 44066                     2CADR    NEWDELHI                              
016636,000186: 
016637,000187: 22,3212           05263                           TC       TASKOVER                              
016638,000188: 

Page 381

016640,000190:                                                                                                  #  ROUTINE FOR TERMINATING AUTOMATIC MANEUVERS
016641,000191: 
016642,000192: 22,3213           34746        MANUSTOP           CAF      ZERO                                  #  ZERO MANEUVER RATES
016643,000193: 22,3214           55641                           TS       DELDCDU2                              
016644,000194: 22,3215           55644                           TS       OMEGARD                               
016645,000195: 22,3216           55276                           TS       DELREROR                              
016646,000196: 22,3217           55640                           TS       DELDCDU1                              
016647,000197: 22,3220           55643                           TS       OMEGAQD                               
016648,000198: 22,3221           55275                           TS       DELQEROR                              
016649,000199: 22,3222           30323                           CA       CPSI                                  #  SET DESIRED GIMBAL ANGLES TO
016650,000200: 22,3223           55636                           TS       CDUZD                                 #  DESIRED FINAL GIMBAL ANGLES
016651,000201: 22,3224           30322                           CA       CTHETA                                
016652,000202: 22,3225           55635                           TS       CDUYD                                 
016653,000203: 22,3226           30321        ENDROLL            CA       CPHI                                  #  NO FINAL YAW
016654,000204: 22,3227           55634                           TS       CDUXD                                 
016655,000205: 22,3230           34746                           CAF      ZERO                                  
016656,000206: 22,3231           55642                           TS       OMEGAPD                               #  I.E. MANEUVER DID NOT GO THRU
016657,000207: 22,3232           55637                           TS       DELDCDU                               #  GIMBAL LOCK ORIGINALLY
016658,000208: 22,3233           55274                           TS       DELPEROR                              
016659,000209: 22,3234           31306        GOODMANU           CA       ATTPRIO                               #  RESTORE USERS PRIO
016660,000210: 22,3235           54063                           TS       NEWPRIO                               
016661,000211: 
016662,000212: 22,3236           34746                           CA       ZERO                                  #  ZERO ATTCADR
016663,000213: 22,3237           53305                           DXCH     ATTCADR                               
016664,000214: 
016665,000215: 22,3240           05107                           TC       SPVAC                                 #  RETURN TO USER
016666,000216: 
016667,000217: 22,3241           05263                           TC       TASKOVER                              
016668,000218: 
016669,000219: 

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