Source Code

These source-code files were transcribed from scans made from Don Eyles's personal copy of Luminary 069. They were scanned at archive.org's Boston facility, and the scanning was sponsored by Onno Hommes. The code was transcribed from these scans by a team of volunteers who are referenced in the program comments. Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". In some cases, where similar code blocks exist in previously-transcribed AGC programs (primarily Luminary 99, from Apollo 11) those code blocks were used as a starting point and then corrected to agree with the Luminary 69 scans. The full scans are available at the Virtual AGC project's collection at archive.org, while more-convenient reduced-size (but reduced-quality) images are available at the main Virtual AGC website. Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository. Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 069 OF AGC PROGRAM LUMINARY BY NASA 2021112-011
	19:02 NOV. 25,1968
Note that the date is the date of the printout, not the date of the program revision.

060353,000002:                                                                                                  ## Copyright:   Public domain.
060354,000003:                                                                                                  ## Filename:    RTB_OP_CODES.agc
060355,000004:                                                                                                  ## Purpose:     The main source file for Luminary revision 069.
060356,000005:                                                                                                  ##              It is part of the source code for the original release
060357,000006:                                                                                                  ##              of the flight software for the Lunar Module's (LM) Apollo
060358,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 10. The actual flown
060359,000008:                                                                                                  ##              version was Luminary 69 revision 2, which included a
060360,000009:                                                                                                  ##              newer lunar gravity model and only affected module 2.
060361,000010:                                                                                                  ##              This file is intended to be a faithful transcription, except
060362,000011:                                                                                                  ##              that the code format has been changed to conform to the
060363,000012:                                                                                                  ##              requirements of the yaYUL assembler rather than the
060364,000013:                                                                                                  ##              original YUL assembler.
060365,000014:                                                                                                  ## Reference:   pp. 1390-1397
060366,000015:                                                                                                  ## Assembler:   yaYUL
060367,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
060368,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
060369,000018:                                                                                                  ## Mod history: 2016-12-13 MAS  Created from Luminary 99.
060370,000019:                                                                                                  ##              2016-12-18 MAS  Updated from comment-proofed Luminary 99 version.
060371,000020:                                                                                                  ##              2017-01-04 RRB  Updated for Luminary 69.
060372,000021:                                                                                                  ##              2017-01-21 HG   Fix opcode RELINS -> RELINT
060373,000022:                                                                                                  ##                                         DXVH   -> DXCH
060374,000023:                                                                                                  ##              2017-01-22 HG   Fix operand modifier 10d -> 10D
060375,000024:                                                                                                  ##              2017-01-28 RSB  Proofed comment text using octopus/prooferComments
060376,000025:                                                                                                  ##                              and fixed errors found.
060377,000026: 

Page 1390

060379,000028: 22,3731                                           BANK     22                                    
060380,000029: 10,2000                                           SETLOC   RTBCODES                              
060381,000030: 10,2000                                           BANK                                           
060382,000031: 
060383,000032: 10,3462  E5,1664                                  EBANK=   XNB                                   
060384,000033: 10,3462                                           COUNT*   $$/RTB                                
060385,000034: 
060386,000035:                                                                                                  #  LOAD TIME2, TIME1 INTO MPAC:
060387,000036: 
060388,000037: 10,3462           00006        LOADTIME           EXTEND                                         
060389,000038: 10,3463           30025                           DCA      TIME2                                 
060390,000039: 10,3464           16054                           TCF      SLOAD2                                
060391,000040: 
060392,000041:                                                                                                  #  CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
060393,000042:                                                                                                  #  DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
060394,000043: 
060395,000044: 10,3465           10154        CDULOGIC           CCS      MPAC                                  
060396,000045: 10,3466           34755                           CAF      ZERO                                  
060397,000046: 10,3467           13472                           TCF      +3                                    
060398,000047: 10,3470           13471                           NOOP                                           
060399,000048: 10,3471           44736                           CS       HALF                                  
060400,000049: 
060401,000050: 10,3472           54155                           TS       MPAC       +1                         
060402,000051: 10,3473           34755                           CAF      ZERO                                  
060403,000052: 10,3474           56154                           XCH      MPAC                                  
060404,000053: 10,3475           00006                           EXTEND                                         
060405,000054: 10,3476           74736                           MP       HALF                                  
060406,000055: 10,3477           20155                           DAS      MPAC                                  
060407,000056: 10,3500           16060                           TCF      DANZIG                                #  MODE IS ALREADY AT DOUBLE-PRECISION
060408,000057: 
060409,000058:                                                                                                  #  READ THE PIPS INTO MPAC WITHOUT CHANGING THEM:
060410,000059: 
060411,000060: 10,3501           00004        READPIPS           INHINT                                         
060412,000061: 10,3502           30037                           CA       PIPAX                                 
060413,000062: 10,3503           54154                           TS       MPAC                                  
060414,000063: 10,3504           30040                           CA       PIPAY                                 
060415,000064: 10,3505           54157                           TS       MPAC       +3                         
060416,000065: 10,3506           30041                           CA       PIPAZ                                 
060417,000066: 10,3507           00003                           RELINT                                         
060418,000067: 10,3510           54161                           TS       MPAC       +5                         
060419,000068: 
060420,000069: 10,3511           34755                           CAF      ZERO                                  
060421,000070: 10,3512           54155                           TS       MPAC       +1                         
060422,000071: 10,3513           54160                           TS       MPAC       +4                         
060423,000072: 10,3514           54162                           TS       MPAC       +6                         
060424,000073: 
060425,000074: 10,3515           16520        VECMODE            TCF      VMODE                                 
060426,000075: 
060427,000076:                                                                                                  #  FORCE TP SIGN AGREEMENT IN MPAC:
060428,000077: 
060429,000078: 10,3516           07256        SGNAGREE           TC       TPAGREE                               

Page 1391

060431,000080: 10,3517           16060                           TCF      DANZIG                                
060432,000081: 
060433,000082:                                                                                                  #  CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
060434,000083:                                                                                                  #  SCALED IN HALF-REVOLUTIONS.
060435,000084: 
060436,000085: 10,3520           03550        1STO2S             TC       1TO2SUB                               
060437,000086: 10,3521           34755                           CAF      ZERO                                  
060438,000087: 10,3522           54155                           TS       MPAC       +1                         
060439,000088: 10,3523           16057                           TCF      NEWMODE                               
060440,000089: 
060441,000090:                                                                                                  #  DO 1STO2S ON A VECTOR OF ANGLES:
060442,000091: 
060443,000092: 10,3524           03550        V1STO2S            TC       1TO2SUB                               #  ANSWER ARRIVES IN A AND MPAC.
060444,000093: 
060445,000094: 10,3525           52162                           DXCH     MPAC       +5                         
060446,000095: 10,3526           52155                           DXCH     MPAC                                  
060447,000096: 10,3527           03550                           TC       1TO2SUB                               
060448,000097: 10,3530           54156                           TS       MPAC       +2                         
060449,000098: 
060450,000099: 10,3531           52160                           DXCH     MPAC       +3                         
060451,000100: 10,3532           52155                           DXCH     MPAC                                  
060452,000101: 10,3533           03550                           TC       1TO2SUB                               
060453,000102: 10,3534           54155                           TS       MPAC       +1                         
060454,000103: 
060455,000104: 10,3535           30161                           CA       MPAC       +5                         
060456,000105: 10,3536           54154                           TS       MPAC                                  
060457,000106: 
060458,000107: 10,3537           34753        TPMODE             CAF      ONE                                   #  MODE IS TP.
060459,000108: 10,3540           16057                           TCF      NEWMODE                               
060460,000109: 
060461,000110:                                                                                                  #  V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
060462,000111: 
060463,000112: 10,3541           03550        2V1STO2S           TC       1TO2SUB                               
060464,000113: 10,3542           52160                           DXCH     MPAC       +3                         
060465,000114: 10,3543           52155                           DXCH     MPAC                                  
060466,000115: 10,3544           03550                           TC       1TO2SUB                               
060467,000116: 10,3545           54001                           TS       L                                     
060468,000117: 10,3546           30157                           CA       MPAC       +3                         
060469,000118: 10,3547           16054                           TCF      SLOAD2                                
060470,000119: 
060471,000120:                                                                                                  #  SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
060472,000121: 
060473,000122: 10,3550           52155        1TO2SUB            DXCH     MPAC                                  #  FINAL MPAC +1 UNSPECIFIED.
060474,000123: 10,3551           20001                           DDOUBL                                         
060475,000124: 10,3552           10000                           CCS      A                                     
060476,000125: 10,3553           64753                           AD       ONE                                   
060477,000126: 10,3554           13556                           TCF      +2                                    
060478,000127: 10,3555           40000                           COM                                            #  THIS WAS REVERSE OF MSU.
060479,000128: 
060480,000129: 10,3556           54154                           TS       MPAC                                  #  AND SKIP ON OVERFLOW.

Page 1392

060482,000131: 10,3557           00002                           TC       Q                                     
060483,000132: 
060484,000133: 10,3560           50000                           INDEX    A                                     #  OVERFLOW UNCORRECT AND IN MSU.
060485,000134: 10,3561           34734                           CAF      LIMITS                                
060486,000135: 10,3562           26154                           ADS      MPAC                                  
060487,000136: 10,3563           00002                           TC       Q                                     

Page 1393

060489,000138:                                                                                                  #  SUBROUTINE TO INCREMENT CDUS
060490,000139: 10,3564           33577        INCRCDUS           CAF      LOCTHETA                              
060491,000140: 10,3565           54130                           TS       BUF                                   #  PLACE ADRES(THETA) IN BUF.
060492,000141: 10,3566           30154                           CAE      MPAC                                  #  INCREMENT IN 1S COMPL.
060493,000142: 10,3567           03600                           TC       CDUINC                                
060494,000143: 
060495,000144: 10,3570           24130                           INCR     BUF                                   
060496,000145: 10,3571           30157                           CAE      MPAC       +3                         
060497,000146: 10,3572           03600                           TC       CDUINC                                
060498,000147: 
060499,000148: 10,3573           24130                           INCR     BUF                                   
060500,000149: 10,3574           30161                           CAE      MPAC       +5                         
060501,000150: 10,3575           03600                           TC       CDUINC                                
060502,000151: 
060503,000152: 10,3576           13515                           TCF      VECMODE                               
060504,000153: 
060505,000154: 10,3577           00321        LOCTHETA           ADRES    THETAD                                
060506,000155: 
060507,000156:                                                                                                  #  THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
060508,000157:                                                                                                  #  QUANTITY FOUND IN TEM2.  THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
060509,000158:                                                                                                  #  (+0 UNEQUAL TO -0) QUANTITY.  MAY BE CALLED BY BANKCALL/SWCALL.
060510,000159: 
060511,000160: 10,3600           54142        CDUINC             TS       TEM2                                  #  1S COMPL.QUANT. ARRIVES IN ACC.  STORE IT
060512,000161: 10,3601           50130                           INDEX    BUF                                   
060513,000162: 10,3602           10000                           CCS      0                                     #  CHANGE 2S COMPL. ANGLE(IN BUF)INTO 1S
060514,000163: 10,3603           64753                           AD       ONE                                   
060515,000164: 10,3604           13610                           TCF      +4                                    
060516,000165: 10,3605           64753                           AD       ONE                                   
060517,000166: 10,3606           64753                           AD       ONE                                   #  OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
060518,000167: 10,3607           40000                           COM                                            
060519,000168: 
060520,000169: 10,3610           60142                           AD       TEM2                                  #  SULT MOVES FROM 2ND TO 3D QUAD.(OR BACK)
060521,000170: 10,3611           10000                           CCS      A                                     #  BACK TO 2S COMPL.
060522,000171: 10,3612           64753                           AD       ONE                                   
060523,000172: 10,3613           13615                           TCF      +2                                    
060524,000173: 10,3614           40000                           COM                                            
060525,000174: 10,3615           54142                           TS       TEM2                                  #  STORE 14BIT QUANTITY WITH PRESENT SIGN
060526,000175: 10,3616           13622                           TCF      +4                                    
060527,000176: 10,3617           50000                           INDEX    A                                     #   SIGN.
060528,000177: 10,3620           34734                           CAF      LIMITS                                #  FIX IT, BY ADDING IN 37777 OR 40000
060529,000178: 10,3621           60142                           AD       TEM2                                  
060530,000179: 
060531,000180: 10,3622           50130                           INDEX    BUF                                   
060532,000181: 10,3623           54000                           TS       0                                     #  STORE NEW ANGLE IN 2S COMPLEMENT.
060533,000182: 10,3624           00002                           TC       Q                                     
060534,000183: 

Page 1394

060536,000185:                                                                                                  #  RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL. ECADR OF COMMANDS ARRIVES IN X1.
060537,000186: 
060538,000187: 10,3625           50120        PULSEIMU           INDEX    FIXLOC                                #  ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
060539,000188: 10,3626           30046                           CA       X1                                    
060540,000189: 10,3627           04616                           TC       BANKCALL                              
060541,000190: 10,3630           17276                           CADR     IMUPULSE                              
060542,000191: 10,3631           16060                           TCF      DANZIG                                
060543,000192: 

Page 1395

060545,000194:                                                                                                  #  EACH ROUTINE TAKES A 3X3 MATRIX STORED IN DOUBLE PRECISION IN A FIXED AREA OF ERASABLE MEMORY AND REPLACES IT
060546,000195:                                                                                                  #  WITH THE TRANSPOSE MATRIX. TRANSP1 USES LOCATIONS XNB+0,+1 THROUGH XNB+16D, 17D AND TRANSP2 USES LOCATIONS
060547,000196:                                                                                                  #  XNB1+0,+1 THROUGH XNB1+16D, 17D. EACH MATRIX IS STORED BY ROWS.
060548,000197: 
060549,000198: 10,3632           02664        XNBEB              ECADR    XNB                                   
060550,000199: 10,3633           03467        XNB1EB             ECADR    XNB1                                  
060551,000200: 
060552,000201: 10,3634  E5,1664                                  EBANK=   XNB                                   
060553,000202: 
060554,000203: 10,3634           33632        TRANSP1            CAF      XNBEB                                 
060555,000204: 10,3635           54003                           TS       EBANK                                 
060556,000205: 10,3636           53667                           DXCH     XNB        +2                         
060557,000206: 10,3637           53673                           DXCH     XNB        +6                         
060558,000207: 10,3640           53667                           DXCH     XNB        +2                         
060559,000208: 
060560,000209: 10,3641           53671                           DXCH     XNB        +4                         
060561,000210: 10,3642           53701                           DXCH     XNB        +12D                       
060562,000211: 10,3643           53671                           DXCH     XNB        +4                         
060563,000212: 
060564,000213: 10,3644           53677                           DXCH     XNB        +10D                       
060565,000214: 10,3645           53703                           DXCH     XNB        +14D                       
060566,000215: 10,3646           53677                           DXCH     XNB        +10D                       
060567,000216: 10,3647           16060                           TCF      DANZIG                                
060568,000217: 
060569,000218: 10,3650  E7,1467                                  EBANK=   XNB1                                  
060570,000219: 
060571,000220: 10,3650           33633        TRANSP2            CAF      XNB1EB                                
060572,000221: 10,3651           54003                           TS       EBANK                                 
060573,000222: 10,3652           53472                           DXCH     XNB1       +2                         
060574,000223: 10,3653           53476                           DXCH     XNB1       +6                         
060575,000224: 10,3654           53472                           DXCH     XNB1       +2                         
060576,000225: 
060577,000226: 10,3655           53474                           DXCH     XNB1       +4                         
060578,000227: 10,3656           53504                           DXCH     XNB1       +12D                       
060579,000228: 10,3657           53474                           DXCH     XNB1       +4                         
060580,000229: 
060581,000230: 10,3660           53502                           DXCH     XNB1       +10D                       
060582,000231: 10,3661           53506                           DXCH     XNB1       +14D                       
060583,000232: 10,3662           53502                           DXCH     XNB1       +10D                       
060584,000233: 10,3663           16060                           TCF      DANZIG                                
060585,000234: 

Page 1396

060587,000236:                                                                                                  #  THE SUBROUTINE SIGNMPAC SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
060588,000237:                                                                                                  #  FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED.  ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
060589,000238: 
060590,000239:                                                                                                  #  ENTRY MAY BE BY EITHER OF THE FOLLOWING:
060591,000240:                                                                                                  #        1.      LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
060592,000241:                                                                                                  #                ENTRY:          BOVB
060593,000242:                                                                                                  #                                        SIGNMPAC
060594,000243:                                                                                                  #        2.      GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
060595,000244:                                                                                                  #                ENTRY:          RTB
060596,000245:                                                                                                  #                                        SIGNMPAC
060597,000246:                                                                                                  #  IN EITHER CASE, RETURN IS TO THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
060598,000247: 
060599,000248: 10,3664           00006        SIGNMPAC           EXTEND                                         
060600,000249: 10,3665           34733                           DCA      DPOSMAX                               
060601,000250: 10,3666           52155                           DXCH     MPAC                                  
060602,000251: 10,3667           10000                           CCS      A                                     
060603,000252: 10,3670           34755        DPMODE             CAF      ZERO                                  #  SETS MPAC +2 TO ZERO IN THE PROCESS
060604,000253: 10,3671           16056                           TCF      SLOAD2     +2                         
060605,000254: 10,3672           13673                           TCF      +1                                    
060606,000255: 10,3673           00006                           EXTEND                                         
060607,000256: 10,3674           44733                           DCS      DPOSMAX                               
060608,000257: 10,3675           16054                           TCF      SLOAD2                                
060609,000258: 
060610,000259:                                                                                                  #  RTB OP CODE NORMUNIT IS LIKE INTERPRETIVE INSTRUCTION UNIT, EXCEPT THAT IT CAN BE DEPENDED ON NOT TO BLOW
060611,000260:                                                                                                  #  UP WHEN THE VECTOR BEING UNITIZED IS VERY SMALL -- IT WILL BLOW UP WHEN ALL COMPONENTS ARE ZERO.  IF NORMUNIT
060612,000261:                                                                                                  #  IS USED AND THE UPPER ORDER HALVES OF ALL COMPONENTS ARE ZERO, THE MAGNITUDE RETURNED IN 36D WILL BE TOO LARGE
060613,000262:                                                                                                  #  BY A FACTOR OF 2(13) AND THE SQUARED MAGNITUDE RETURNED AT 34D WILL BE TOO BIG BY A FACTOR OF 2(26).
060614,000263: 
060615,000264: 10,3676           34753        NORMUNX1           CAF      ONE                                   
060616,000265: 10,3677           13701                           TCF      NORMUNIT   +1                         
060617,000266: 10,3700           34755        NORMUNIT           CAF      ZERO                                  
060618,000267: 10,3701           60120                           AD       FIXLOC                                
060619,000268: 10,3702           54156                           TS       MPAC       +2                         
060620,000269: 10,3703           04616                           TC       BANKCALL                              #  GET SIGN AGREEMENT IN ALL COMPONENTS
060621,000270: 10,3704           01010                           CADR     VECAGREE                              
060622,000271: 10,3705           10154                           CCS      MPAC                                  
060623,000272: 10,3706           13742                           TCF      NOSHIFT                               
060624,000273: 10,3707           13711                           TCF      +2                                    
060625,000274: 10,3710           13742                           TCF      NOSHIFT                               
060626,000275: 10,3711           10157                           CCS      MPAC       +3                         
060627,000276: 10,3712           13742                           TCF      NOSHIFT                               
060628,000277: 10,3713           13715                           TCF      +2                                    
060629,000278: 10,3714           13742                           TCF      NOSHIFT                               
060630,000279: 10,3715           10161                           CCS      MPAC       +5                         
060631,000280: 10,3716           13742                           TCF      NOSHIFT                               
060632,000281: 10,3717           13721                           TCF      +2                                    
060633,000282: 10,3720           13742                           TCF      NOSHIFT                               

Page 1397

060635,000284: 10,3721           30155                           CA       MPAC       +1                         #  SHIFT ALL COMPONENTS LEFT 13
060636,000285: 10,3722           00006                           EXTEND                                         
060637,000286: 10,3723           74736                           MP       BIT14                                 
060638,000287: 10,3724           20155                           DAS      MPAC                                  #  DAS GAINS A LITTLE ACCURACY
060639,000288: 10,3725           30160                           CA       MPAC       +4                         
060640,000289: 10,3726           00006                           EXTEND                                         
060641,000290: 10,3727           74736                           MP       BIT14                                 
060642,000291: 10,3730           20160                           DAS      MPAC       +3                         
060643,000292: 10,3731           30162                           CA       MPAC       +6                         
060644,000293: 10,3732           00006                           EXTEND                                         
060645,000294: 10,3733           74736                           MP       BIT14                                 
060646,000295: 10,3734           20162                           DAS      MPAC       +5                         
060647,000296: 10,3735           34761                           CAF      THIRTEEN                              
060648,000297: 10,3736           50156                           INDEX    MPAC       +2                         
060649,000298: 10,3737           54045                           TS       37D                                   
060650,000299: 10,3740           04635        OFFTUNIT           TC       POSTJUMP                              
060651,000300: 10,3741           01024                           CADR     UNIT       +1                         #  SKIP THE "TC VECAGREE" DONE AT UNIT
060652,000301: 
060653,000302: 10,3742           34755        NOSHIFT            CAF      ZERO                                  
060654,000303: 10,3743           13736                           TCF      OFFTUNIT   -2                         
060655,000304: 
060656,000305:                                                                                                  #  RTB VECSGNAG ... FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
060657,000306: 
060658,000307: 10,3744           04616        VECSGNAG           TC       BANKCALL                              
060659,000308: 10,3745           01010                           CADR     VECAGREE                              
060660,000309: 10,3746           06060                           TC       DANZIG                                

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