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.

060326,000002:                                                                                                  ## Copyright:   Public domain.
060327,000003:                                                                                                  ## Filename:    RTB_OP_CODES.agc
060328,000004:                                                                                                  ## Purpose:     The main source file for Luminary revision 069.
060329,000005:                                                                                                  ##              It is part of the source code for the original release
060330,000006:                                                                                                  ##              of the flight software for the Lunar Module's (LM) Apollo
060331,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 10. The actual flown
060332,000008:                                                                                                  ##              version was Luminary 69 revision 2, which included a
060333,000009:                                                                                                  ##              newer lunar gravity model and only affected module 2.
060334,000010:                                                                                                  ##              This file is intended to be a faithful transcription, except
060335,000011:                                                                                                  ##              that the code format has been changed to conform to the
060336,000012:                                                                                                  ##              requirements of the yaYUL assembler rather than the
060337,000013:                                                                                                  ##              original YUL assembler.
060338,000014:                                                                                                  ## Reference:   pp. 1390-1397
060339,000015:                                                                                                  ## Assembler:   yaYUL
060340,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
060341,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
060342,000018:                                                                                                  ## Mod history: 2016-12-13 MAS  Created from Luminary 99.
060343,000019:                                                                                                  ##              2016-12-18 MAS  Updated from comment-proofed Luminary 99 version.
060344,000020:                                                                                                  ##              2017-01-04 RRB  Updated for Luminary 69.
060345,000021:                                                                                                  ##              2017-01-21 HG   Fix opcode RELINS -> RELINT
060346,000022:                                                                                                  ##                                         DXVH   -> DXCH
060347,000023:                                                                                                  ##              2017-01-22 HG   Fix operand modifier 10d -> 10D
060348,000024:                                                                                                  ##              2017-01-28 RSB  Proofed comment text using octopus/prooferComments
060349,000025:                                                                                                  ##                              and fixed errors found.
060350,000026: 

Page 1390

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

Page 1391

060404,000080: 10,3517           16060                           TCF      DANZIG                                
060405,000081: 
060406,000082:                                                                                                  #  CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
060407,000083:                                                                                                  #  SCALED IN HALF-REVOLUTIONS.
060408,000084: 
060409,000085: 10,3520           03550        1STO2S             TC       1TO2SUB                               
060410,000086: 10,3521           34755                           CAF      ZERO                                  
060411,000087: 10,3522           54155                           TS       MPAC       +1                         
060412,000088: 10,3523           16057                           TCF      NEWMODE                               
060413,000089: 
060414,000090:                                                                                                  #  DO 1STO2S ON A VECTOR OF ANGLES:
060415,000091: 
060416,000092: 10,3524           03550        V1STO2S            TC       1TO2SUB                               #  ANSWER ARRIVES IN A AND MPAC.
060417,000093: 
060418,000094: 10,3525           52162                           DXCH     MPAC       +5                         
060419,000095: 10,3526           52155                           DXCH     MPAC                                  
060420,000096: 10,3527           03550                           TC       1TO2SUB                               
060421,000097: 10,3530           54156                           TS       MPAC       +2                         
060422,000098: 
060423,000099: 10,3531           52160                           DXCH     MPAC       +3                         
060424,000100: 10,3532           52155                           DXCH     MPAC                                  
060425,000101: 10,3533           03550                           TC       1TO2SUB                               
060426,000102: 10,3534           54155                           TS       MPAC       +1                         
060427,000103: 
060428,000104: 10,3535           30161                           CA       MPAC       +5                         
060429,000105: 10,3536           54154                           TS       MPAC                                  
060430,000106: 
060431,000107: 10,3537           34753        TPMODE             CAF      ONE                                   #  MODE IS TP.
060432,000108: 10,3540           16057                           TCF      NEWMODE                               
060433,000109: 
060434,000110:                                                                                                  #  V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
060435,000111: 
060436,000112: 10,3541           03550        2V1STO2S           TC       1TO2SUB                               
060437,000113: 10,3542           52160                           DXCH     MPAC       +3                         
060438,000114: 10,3543           52155                           DXCH     MPAC                                  
060439,000115: 10,3544           03550                           TC       1TO2SUB                               
060440,000116: 10,3545           54001                           TS       L                                     
060441,000117: 10,3546           30157                           CA       MPAC       +3                         
060442,000118: 10,3547           16054                           TCF      SLOAD2                                
060443,000119: 
060444,000120:                                                                                                  #  SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
060445,000121: 
060446,000122: 10,3550           52155        1TO2SUB            DXCH     MPAC                                  #  FINAL MPAC +1 UNSPECIFIED.
060447,000123: 10,3551           20001                           DDOUBL                                         
060448,000124: 10,3552           10000                           CCS      A                                     
060449,000125: 10,3553           64753                           AD       ONE                                   
060450,000126: 10,3554           13556                           TCF      +2                                    
060451,000127: 10,3555           40000                           COM                                            #  THIS WAS REVERSE OF MSU.
060452,000128: 
060453,000129: 10,3556           54154                           TS       MPAC                                  #  AND SKIP ON OVERFLOW.

Page 1392

060455,000131: 10,3557           00002                           TC       Q                                     
060456,000132: 
060457,000133: 10,3560           50000                           INDEX    A                                     #  OVERFLOW UNCORRECT AND IN MSU.
060458,000134: 10,3561           34734                           CAF      LIMITS                                
060459,000135: 10,3562           26154                           ADS      MPAC                                  
060460,000136: 10,3563           00002                           TC       Q                                     

Page 1393

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

Page 1394

060509,000185:                                                                                                  #  RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL. ECADR OF COMMANDS ARRIVES IN X1.
060510,000186: 
060511,000187: 10,3625           50120        PULSEIMU           INDEX    FIXLOC                                #  ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
060512,000188: 10,3626           30046                           CA       X1                                    
060513,000189: 10,3627           04616                           TC       BANKCALL                              
060514,000190: 10,3630           17276                           CADR     IMUPULSE                              
060515,000191: 10,3631           16060                           TCF      DANZIG                                
060516,000192: 

Page 1395

060518,000194:                                                                                                  #  EACH ROUTINE TAKES A 3X3 MATRIX STORED IN DOUBLE PRECISION IN A FIXED AREA OF ERASABLE MEMORY AND REPLACES IT
060519,000195:                                                                                                  #  WITH THE TRANSPOSE MATRIX. TRANSP1 USES LOCATIONS XNB+0,+1 THROUGH XNB+16D, 17D AND TRANSP2 USES LOCATIONS
060520,000196:                                                                                                  #  XNB1+0,+1 THROUGH XNB1+16D, 17D. EACH MATRIX IS STORED BY ROWS.
060521,000197: 
060522,000198: 10,3632           02664        XNBEB              ECADR    XNB                                   
060523,000199: 10,3633           03467        XNB1EB             ECADR    XNB1                                  
060524,000200: 
060525,000201: 10,3634  E5,1664                                  EBANK=   XNB                                   
060526,000202: 
060527,000203: 10,3634           33632        TRANSP1            CAF      XNBEB                                 
060528,000204: 10,3635           54003                           TS       EBANK                                 
060529,000205: 10,3636           53667                           DXCH     XNB        +2                         
060530,000206: 10,3637           53673                           DXCH     XNB        +6                         
060531,000207: 10,3640           53667                           DXCH     XNB        +2                         
060532,000208: 
060533,000209: 10,3641           53671                           DXCH     XNB        +4                         
060534,000210: 10,3642           53701                           DXCH     XNB        +12D                       
060535,000211: 10,3643           53671                           DXCH     XNB        +4                         
060536,000212: 
060537,000213: 10,3644           53677                           DXCH     XNB        +10D                       
060538,000214: 10,3645           53703                           DXCH     XNB        +14D                       
060539,000215: 10,3646           53677                           DXCH     XNB        +10D                       
060540,000216: 10,3647           16060                           TCF      DANZIG                                
060541,000217: 
060542,000218: 10,3650  E7,1467                                  EBANK=   XNB1                                  
060543,000219: 
060544,000220: 10,3650           33633        TRANSP2            CAF      XNB1EB                                
060545,000221: 10,3651           54003                           TS       EBANK                                 
060546,000222: 10,3652           53472                           DXCH     XNB1       +2                         
060547,000223: 10,3653           53476                           DXCH     XNB1       +6                         
060548,000224: 10,3654           53472                           DXCH     XNB1       +2                         
060549,000225: 
060550,000226: 10,3655           53474                           DXCH     XNB1       +4                         
060551,000227: 10,3656           53504                           DXCH     XNB1       +12D                       
060552,000228: 10,3657           53474                           DXCH     XNB1       +4                         
060553,000229: 
060554,000230: 10,3660           53502                           DXCH     XNB1       +10D                       
060555,000231: 10,3661           53506                           DXCH     XNB1       +14D                       
060556,000232: 10,3662           53502                           DXCH     XNB1       +10D                       
060557,000233: 10,3663           16060                           TCF      DANZIG                                
060558,000234: 

Page 1396

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

Page 1397

060608,000284: 10,3721           30155                           CA       MPAC       +1                         #  SHIFT ALL COMPONENTS LEFT 13
060609,000285: 10,3722           00006                           EXTEND                                         
060610,000286: 10,3723           74736                           MP       BIT14                                 
060611,000287: 10,3724           20155                           DAS      MPAC                                  #  DAS GAINS A LITTLE ACCURACY
060612,000288: 10,3725           30160                           CA       MPAC       +4                         
060613,000289: 10,3726           00006                           EXTEND                                         
060614,000290: 10,3727           74736                           MP       BIT14                                 
060615,000291: 10,3730           20160                           DAS      MPAC       +3                         
060616,000292: 10,3731           30162                           CA       MPAC       +6                         
060617,000293: 10,3732           00006                           EXTEND                                         
060618,000294: 10,3733           74736                           MP       BIT14                                 
060619,000295: 10,3734           20162                           DAS      MPAC       +5                         
060620,000296: 10,3735           34761                           CAF      THIRTEEN                              
060621,000297: 10,3736           50156                           INDEX    MPAC       +2                         
060622,000298: 10,3737           54045                           TS       37D                                   
060623,000299: 10,3740           04635        OFFTUNIT           TC       POSTJUMP                              
060624,000300: 10,3741           01024                           CADR     UNIT       +1                         #  SKIP THE "TC VECAGREE" DONE AT UNIT
060625,000301: 
060626,000302: 10,3742           34755        NOSHIFT            CAF      ZERO                                  
060627,000303: 10,3743           13736                           TCF      OFFTUNIT   -2                         
060628,000304: 
060629,000305:                                                                                                  #  RTB VECSGNAG ... FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
060630,000306: 
060631,000307: 10,3744           04616        VECSGNAG           TC       BANKCALL                              
060632,000308: 10,3745           01010                           CADR     VECAGREE                              
060633,000309: 10,3746           06060                           TC       DANZIG                                

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