Source Code

These source-code files are part of a reconstructed copy of Luminary 69/2, the flown, final release of the Apollo 10 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction is based on the source code of Luminary 69 — i.e., the initial, unflown version, "revision 0" — of which a contemporary listing was available. The code was then updated by incorporating the differences between Luminary 69 and Luminary 69/2, known from other contemporary documentation. The only such difference is the implementation in Luminary 69/2 of the "R-2 Lunar Potential Model", the source code for which was taken from program Luminary 99/1 (Apollo 11 LM), of which a contemporary listing was also available. Finally, the now-reconstructed Luminary 69/2 was then validated by assembling it to executable form and verifying that its memory banks had the correct checksums, known from still other contemporary documentation.

Note that page numbers in the reconstructed code match those in the original Luminary 69 program listing, or in the ORBITAL INTEGRATION log section, in Luminary 99/1. Page numbers would certainly differ somewhat in a contemporary Luminary 69/2 listing. Moreover, annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change in Luminary 69/2 relative to Luminary 69. Here's a guide to the Apollo documentation referenced in those annotations:
Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

060066,000002:                                                                                                  ## Copyright:   Public domain.
060067,000003:                                                                                                  ## Filename:    RTB_OP_CODES.agc
060068,000004:                                                                                                  ## Purpose:     A section of LUM69 revision 2.
060069,000005:                                                                                                  ##              It is part of the reconstructed source code for the flown
060070,000006:                                                                                                  ##              version of the flight software for the Lunar Module's (LM)
060071,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 10. The code has
060072,000008:                                                                                                  ##              been recreated from a copy of Luminary revsion 069, using
060073,000009:                                                                                                  ##              changes present in Luminary 099 which were described in
060074,000010:                                                                                                  ##              Luminary memos 75 and 78. The code has been adapted such
060075,000011:                                                                                                  ##              that the resulting bugger words exactly match those specified
060076,000012:                                                                                                  ##              for LUM69 revision 2 in NASA drawing 2021152B, which gives
060077,000013:                                                                                                  ##              relatively high confidence that the reconstruction is correct.
060078,000014:                                                                                                  ## Reference:   pp. 1390-1397
060079,000015:                                                                                                  ## Assembler:   yaYUL
060080,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
060081,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
060082,000018:                                                                                                  ## Mod history: 2019-07-27 MAS  Created from Luminary 69.
060083,000019: 

Page 1390

060085,000021: 22,3731                                           BANK     22                                    
060086,000022: 10,2000                                           SETLOC   RTBCODES                              
060087,000023: 10,2000                                           BANK                                           
060088,000024: 
060089,000025: 10,3462  E5,1664                                  EBANK=   XNB                                   
060090,000026: 10,3462                                           COUNT*   $$/RTB                                
060091,000027: 
060092,000028:                                                                                                  #  LOAD TIME2, TIME1 INTO MPAC:
060093,000029: 
060094,000030: 10,3462           00006        LOADTIME           EXTEND                                         
060095,000031: 10,3463           30025                           DCA      TIME2                                 
060096,000032: 10,3464           16054                           TCF      SLOAD2                                
060097,000033: 
060098,000034:                                                                                                  #  CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
060099,000035:                                                                                                  #  DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
060100,000036: 
060101,000037: 10,3465           10154        CDULOGIC           CCS      MPAC                                  
060102,000038: 10,3466           34755                           CAF      ZERO                                  
060103,000039: 10,3467           13472                           TCF      +3                                    
060104,000040: 10,3470           13471                           NOOP                                           
060105,000041: 10,3471           44736                           CS       HALF                                  
060106,000042: 
060107,000043: 10,3472           54155                           TS       MPAC       +1                         
060108,000044: 10,3473           34755                           CAF      ZERO                                  
060109,000045: 10,3474           56154                           XCH      MPAC                                  
060110,000046: 10,3475           00006                           EXTEND                                         
060111,000047: 10,3476           74736                           MP       HALF                                  
060112,000048: 10,3477           20155                           DAS      MPAC                                  
060113,000049: 10,3500           16060                           TCF      DANZIG                                #  MODE IS ALREADY AT DOUBLE-PRECISION
060114,000050: 
060115,000051:                                                                                                  #  READ THE PIPS INTO MPAC WITHOUT CHANGING THEM:
060116,000052: 
060117,000053: 10,3501           00004        READPIPS           INHINT                                         
060118,000054: 10,3502           30037                           CA       PIPAX                                 
060119,000055: 10,3503           54154                           TS       MPAC                                  
060120,000056: 10,3504           30040                           CA       PIPAY                                 
060121,000057: 10,3505           54157                           TS       MPAC       +3                         
060122,000058: 10,3506           30041                           CA       PIPAZ                                 
060123,000059: 10,3507           00003                           RELINT                                         
060124,000060: 10,3510           54161                           TS       MPAC       +5                         
060125,000061: 
060126,000062: 10,3511           34755                           CAF      ZERO                                  
060127,000063: 10,3512           54155                           TS       MPAC       +1                         
060128,000064: 10,3513           54160                           TS       MPAC       +4                         
060129,000065: 10,3514           54162                           TS       MPAC       +6                         
060130,000066: 
060131,000067: 10,3515           16520        VECMODE            TCF      VMODE                                 
060132,000068: 
060133,000069:                                                                                                  #  FORCE TP SIGN AGREEMENT IN MPAC:
060134,000070: 
060135,000071: 10,3516           07256        SGNAGREE           TC       TPAGREE                               

Page 1391

060137,000073: 10,3517           16060                           TCF      DANZIG                                
060138,000074: 
060139,000075:                                                                                                  #  CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
060140,000076:                                                                                                  #  SCALED IN HALF-REVOLUTIONS.
060141,000077: 
060142,000078: 10,3520           03550        1STO2S             TC       1TO2SUB                               
060143,000079: 10,3521           34755                           CAF      ZERO                                  
060144,000080: 10,3522           54155                           TS       MPAC       +1                         
060145,000081: 10,3523           16057                           TCF      NEWMODE                               
060146,000082: 
060147,000083:                                                                                                  #  DO 1STO2S ON A VECTOR OF ANGLES:
060148,000084: 
060149,000085: 10,3524           03550        V1STO2S            TC       1TO2SUB                               #  ANSWER ARRIVES IN A AND MPAC.
060150,000086: 
060151,000087: 10,3525           52162                           DXCH     MPAC       +5                         
060152,000088: 10,3526           52155                           DXCH     MPAC                                  
060153,000089: 10,3527           03550                           TC       1TO2SUB                               
060154,000090: 10,3530           54156                           TS       MPAC       +2                         
060155,000091: 
060156,000092: 10,3531           52160                           DXCH     MPAC       +3                         
060157,000093: 10,3532           52155                           DXCH     MPAC                                  
060158,000094: 10,3533           03550                           TC       1TO2SUB                               
060159,000095: 10,3534           54155                           TS       MPAC       +1                         
060160,000096: 
060161,000097: 10,3535           30161                           CA       MPAC       +5                         
060162,000098: 10,3536           54154                           TS       MPAC                                  
060163,000099: 
060164,000100: 10,3537           34753        TPMODE             CAF      ONE                                   #  MODE IS TP.
060165,000101: 10,3540           16057                           TCF      NEWMODE                               
060166,000102: 
060167,000103:                                                                                                  #  V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
060168,000104: 
060169,000105: 10,3541           03550        2V1STO2S           TC       1TO2SUB                               
060170,000106: 10,3542           52160                           DXCH     MPAC       +3                         
060171,000107: 10,3543           52155                           DXCH     MPAC                                  
060172,000108: 10,3544           03550                           TC       1TO2SUB                               
060173,000109: 10,3545           54001                           TS       L                                     
060174,000110: 10,3546           30157                           CA       MPAC       +3                         
060175,000111: 10,3547           16054                           TCF      SLOAD2                                
060176,000112: 
060177,000113:                                                                                                  #  SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
060178,000114: 
060179,000115: 10,3550           52155        1TO2SUB            DXCH     MPAC                                  #  FINAL MPAC +1 UNSPECIFIED.
060180,000116: 10,3551           20001                           DDOUBL                                         
060181,000117: 10,3552           10000                           CCS      A                                     
060182,000118: 10,3553           64753                           AD       ONE                                   
060183,000119: 10,3554           13556                           TCF      +2                                    
060184,000120: 10,3555           40000                           COM                                            #  THIS WAS REVERSE OF MSU.
060185,000121: 
060186,000122: 10,3556           54154                           TS       MPAC                                  #  AND SKIP ON OVERFLOW.

Page 1392

060188,000124: 10,3557           00002                           TC       Q                                     
060189,000125: 
060190,000126: 10,3560           50000                           INDEX    A                                     #  OVERFLOW UNCORRECT AND IN MSU.
060191,000127: 10,3561           34734                           CAF      LIMITS                                
060192,000128: 10,3562           26154                           ADS      MPAC                                  
060193,000129: 10,3563           00002                           TC       Q                                     

Page 1393

060195,000131:                                                                                                  #  SUBROUTINE TO INCREMENT CDUS
060196,000132: 10,3564           33577        INCRCDUS           CAF      LOCTHETA                              
060197,000133: 10,3565           54130                           TS       BUF                                   #  PLACE ADRES(THETA) IN BUF.
060198,000134: 10,3566           30154                           CAE      MPAC                                  #  INCREMENT IN 1S COMPL.
060199,000135: 10,3567           03600                           TC       CDUINC                                
060200,000136: 
060201,000137: 10,3570           24130                           INCR     BUF                                   
060202,000138: 10,3571           30157                           CAE      MPAC       +3                         
060203,000139: 10,3572           03600                           TC       CDUINC                                
060204,000140: 
060205,000141: 10,3573           24130                           INCR     BUF                                   
060206,000142: 10,3574           30161                           CAE      MPAC       +5                         
060207,000143: 10,3575           03600                           TC       CDUINC                                
060208,000144: 
060209,000145: 10,3576           13515                           TCF      VECMODE                               
060210,000146: 
060211,000147: 10,3577           00321        LOCTHETA           ADRES    THETAD                                
060212,000148: 
060213,000149:                                                                                                  #  THE FOLLOWING ROUTINE INCREMENTS IN 2S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1S COMPL.
060214,000150:                                                                                                  #  QUANTITY FOUND IN TEM2.  THIS MAY BE USED TO INCREMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2S COMPL.
060215,000151:                                                                                                  #  (+0 UNEQUAL TO -0) QUANTITY.  MAY BE CALLED BY BANKCALL/SWCALL.
060216,000152: 
060217,000153: 10,3600           54142        CDUINC             TS       TEM2                                  #  1S COMPL.QUANT. ARRIVES IN ACC.  STORE IT
060218,000154: 10,3601           50130                           INDEX    BUF                                   
060219,000155: 10,3602           10000                           CCS      0                                     #  CHANGE 2S COMPL. ANGLE(IN BUF)INTO 1S
060220,000156: 10,3603           64753                           AD       ONE                                   
060221,000157: 10,3604           13610                           TCF      +4                                    
060222,000158: 10,3605           64753                           AD       ONE                                   
060223,000159: 10,3606           64753                           AD       ONE                                   #  OVERFLOW HERE IF 2S COMPL. IS 180 DEG.
060224,000160: 10,3607           40000                           COM                                            
060225,000161: 
060226,000162: 10,3610           60142                           AD       TEM2                                  #  SULT MOVES FROM 2ND TO 3D QUAD.(OR BACK)
060227,000163: 10,3611           10000                           CCS      A                                     #  BACK TO 2S COMPL.
060228,000164: 10,3612           64753                           AD       ONE                                   
060229,000165: 10,3613           13615                           TCF      +2                                    
060230,000166: 10,3614           40000                           COM                                            
060231,000167: 10,3615           54142                           TS       TEM2                                  #  STORE 14BIT QUANTITY WITH PRESENT SIGN
060232,000168: 10,3616           13622                           TCF      +4                                    
060233,000169: 10,3617           50000                           INDEX    A                                     #   SIGN.
060234,000170: 10,3620           34734                           CAF      LIMITS                                #  FIX IT, BY ADDING IN 37777 OR 40000
060235,000171: 10,3621           60142                           AD       TEM2                                  
060236,000172: 
060237,000173: 10,3622           50130                           INDEX    BUF                                   
060238,000174: 10,3623           54000                           TS       0                                     #  STORE NEW ANGLE IN 2S COMPLEMENT.
060239,000175: 10,3624           00002                           TC       Q                                     
060240,000176: 

Page 1394

060242,000178:                                                                                                  #  RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL. ECADR OF COMMANDS ARRIVES IN X1.
060243,000179: 
060244,000180: 10,3625           50120        PULSEIMU           INDEX    FIXLOC                                #  ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
060245,000181: 10,3626           30046                           CA       X1                                    
060246,000182: 10,3627           04616                           TC       BANKCALL                              
060247,000183: 10,3630           17276                           CADR     IMUPULSE                              
060248,000184: 10,3631           16060                           TCF      DANZIG                                
060249,000185: 

Page 1395

060251,000187:                                                                                                  #  EACH ROUTINE TAKES A 3X3 MATRIX STORED IN DOUBLE PRECISION IN A FIXED AREA OF ERASABLE MEMORY AND REPLACES IT
060252,000188:                                                                                                  #  WITH THE TRANSPOSE MATRIX. TRANSP1 USES LOCATIONS XNB+0,+1 THROUGH XNB+16D, 17D AND TRANSP2 USES LOCATIONS
060253,000189:                                                                                                  #  XNB1+0,+1 THROUGH XNB1+16D, 17D. EACH MATRIX IS STORED BY ROWS.
060254,000190: 
060255,000191: 10,3632           02664        XNBEB              ECADR    XNB                                   
060256,000192: 10,3633           03467        XNB1EB             ECADR    XNB1                                  
060257,000193: 
060258,000194: 10,3634  E5,1664                                  EBANK=   XNB                                   
060259,000195: 
060260,000196: 10,3634           33632        TRANSP1            CAF      XNBEB                                 
060261,000197: 10,3635           54003                           TS       EBANK                                 
060262,000198: 10,3636           53667                           DXCH     XNB        +2                         
060263,000199: 10,3637           53673                           DXCH     XNB        +6                         
060264,000200: 10,3640           53667                           DXCH     XNB        +2                         
060265,000201: 
060266,000202: 10,3641           53671                           DXCH     XNB        +4                         
060267,000203: 10,3642           53701                           DXCH     XNB        +12D                       
060268,000204: 10,3643           53671                           DXCH     XNB        +4                         
060269,000205: 
060270,000206: 10,3644           53677                           DXCH     XNB        +10D                       
060271,000207: 10,3645           53703                           DXCH     XNB        +14D                       
060272,000208: 10,3646           53677                           DXCH     XNB        +10D                       
060273,000209: 10,3647           16060                           TCF      DANZIG                                
060274,000210: 
060275,000211: 10,3650  E7,1467                                  EBANK=   XNB1                                  
060276,000212: 
060277,000213: 10,3650           33633        TRANSP2            CAF      XNB1EB                                
060278,000214: 10,3651           54003                           TS       EBANK                                 
060279,000215: 10,3652           53472                           DXCH     XNB1       +2                         
060280,000216: 10,3653           53476                           DXCH     XNB1       +6                         
060281,000217: 10,3654           53472                           DXCH     XNB1       +2                         
060282,000218: 
060283,000219: 10,3655           53474                           DXCH     XNB1       +4                         
060284,000220: 10,3656           53504                           DXCH     XNB1       +12D                       
060285,000221: 10,3657           53474                           DXCH     XNB1       +4                         
060286,000222: 
060287,000223: 10,3660           53502                           DXCH     XNB1       +10D                       
060288,000224: 10,3661           53506                           DXCH     XNB1       +14D                       
060289,000225: 10,3662           53502                           DXCH     XNB1       +10D                       
060290,000226: 10,3663           16060                           TCF      DANZIG                                
060291,000227: 

Page 1396

060293,000229:                                                                                                  #  THE SUBROUTINE SIGNMPAC SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
060294,000230:                                                                                                  #  FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED.  ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
060295,000231: 
060296,000232:                                                                                                  #  ENTRY MAY BE BY EITHER OF THE FOLLOWING:
060297,000233:                                                                                                  #        1.      LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
060298,000234:                                                                                                  #                ENTRY:          BOVB
060299,000235:                                                                                                  #                                        SIGNMPAC
060300,000236:                                                                                                  #        2.      GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
060301,000237:                                                                                                  #                ENTRY:          RTB
060302,000238:                                                                                                  #                                        SIGNMPAC
060303,000239:                                                                                                  #  IN EITHER CASE, RETURN IS TO THE NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
060304,000240: 
060305,000241: 10,3664           00006        SIGNMPAC           EXTEND                                         
060306,000242: 10,3665           34733                           DCA      DPOSMAX                               
060307,000243: 10,3666           52155                           DXCH     MPAC                                  
060308,000244: 10,3667           10000                           CCS      A                                     
060309,000245: 10,3670           34755        DPMODE             CAF      ZERO                                  #  SETS MPAC +2 TO ZERO IN THE PROCESS
060310,000246: 10,3671           16056                           TCF      SLOAD2     +2                         
060311,000247: 10,3672           13673                           TCF      +1                                    
060312,000248: 10,3673           00006                           EXTEND                                         
060313,000249: 10,3674           44733                           DCS      DPOSMAX                               
060314,000250: 10,3675           16054                           TCF      SLOAD2                                
060315,000251: 
060316,000252:                                                                                                  #  RTB OP CODE NORMUNIT IS LIKE INTERPRETIVE INSTRUCTION UNIT, EXCEPT THAT IT CAN BE DEPENDED ON NOT TO BLOW
060317,000253:                                                                                                  #  UP WHEN THE VECTOR BEING UNITIZED IS VERY SMALL -- IT WILL BLOW UP WHEN ALL COMPONENTS ARE ZERO.  IF NORMUNIT
060318,000254:                                                                                                  #  IS USED AND THE UPPER ORDER HALVES OF ALL COMPONENTS ARE ZERO, THE MAGNITUDE RETURNED IN 36D WILL BE TOO LARGE
060319,000255:                                                                                                  #  BY A FACTOR OF 2(13) AND THE SQUARED MAGNITUDE RETURNED AT 34D WILL BE TOO BIG BY A FACTOR OF 2(26).
060320,000256: 
060321,000257: 10,3676           34753        NORMUNX1           CAF      ONE                                   
060322,000258: 10,3677           13701                           TCF      NORMUNIT   +1                         
060323,000259: 10,3700           34755        NORMUNIT           CAF      ZERO                                  
060324,000260: 10,3701           60120                           AD       FIXLOC                                
060325,000261: 10,3702           54156                           TS       MPAC       +2                         
060326,000262: 10,3703           04616                           TC       BANKCALL                              #  GET SIGN AGREEMENT IN ALL COMPONENTS
060327,000263: 10,3704           01010                           CADR     VECAGREE                              
060328,000264: 10,3705           10154                           CCS      MPAC                                  
060329,000265: 10,3706           13742                           TCF      NOSHIFT                               
060330,000266: 10,3707           13711                           TCF      +2                                    
060331,000267: 10,3710           13742                           TCF      NOSHIFT                               
060332,000268: 10,3711           10157                           CCS      MPAC       +3                         
060333,000269: 10,3712           13742                           TCF      NOSHIFT                               
060334,000270: 10,3713           13715                           TCF      +2                                    
060335,000271: 10,3714           13742                           TCF      NOSHIFT                               
060336,000272: 10,3715           10161                           CCS      MPAC       +5                         
060337,000273: 10,3716           13742                           TCF      NOSHIFT                               
060338,000274: 10,3717           13721                           TCF      +2                                    
060339,000275: 10,3720           13742                           TCF      NOSHIFT                               

Page 1397

060341,000277: 10,3721           30155                           CA       MPAC       +1                         #  SHIFT ALL COMPONENTS LEFT 13
060342,000278: 10,3722           00006                           EXTEND                                         
060343,000279: 10,3723           74736                           MP       BIT14                                 
060344,000280: 10,3724           20155                           DAS      MPAC                                  #  DAS GAINS A LITTLE ACCURACY
060345,000281: 10,3725           30160                           CA       MPAC       +4                         
060346,000282: 10,3726           00006                           EXTEND                                         
060347,000283: 10,3727           74736                           MP       BIT14                                 
060348,000284: 10,3730           20160                           DAS      MPAC       +3                         
060349,000285: 10,3731           30162                           CA       MPAC       +6                         
060350,000286: 10,3732           00006                           EXTEND                                         
060351,000287: 10,3733           74736                           MP       BIT14                                 
060352,000288: 10,3734           20162                           DAS      MPAC       +5                         
060353,000289: 10,3735           34761                           CAF      THIRTEEN                              
060354,000290: 10,3736           50156                           INDEX    MPAC       +2                         
060355,000291: 10,3737           54045                           TS       37D                                   
060356,000292: 10,3740           04635        OFFTUNIT           TC       POSTJUMP                              
060357,000293: 10,3741           01024                           CADR     UNIT       +1                         #  SKIP THE "TC VECAGREE" DONE AT UNIT
060358,000294: 
060359,000295: 10,3742           34755        NOSHIFT            CAF      ZERO                                  
060360,000296: 10,3743           13736                           TCF      OFFTUNIT   -2                         
060361,000297: 
060362,000298:                                                                                                  #  RTB VECSGNAG ... FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
060363,000299: 
060364,000300: 10,3744           04616        VECSGNAG           TC       BANKCALL                              
060365,000301: 10,3745           01010                           CADR     VECAGREE                              
060366,000302: 10,3746           06060                           TC       DANZIG                                

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