Source Code

These source-code files are part of a reconstructed copy of LM131 revision 1, the final release of the Apollo 13 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The source reconstruction began with source code of Luminary 131 previously transcribed from a digitized copy of that program. A dump of the flight spare core rope memory module B5, part number 2010802-171, serial number RAY 411, was obtained. This module is the only module different between Luminary 131 and LM131 revision 1. The dump was disassembled and all changes were incorporated into these source files. Note that page numbers in the reconstructed code match those on the Luminary 131 printout, although the changed code would likely have changed page numbers for a real LM131 revision 1 listing.

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.

027679,000002:                                                                                                  ## Copyright:   Public domain.
027680,000003:                                                                                                  ## Filename:    GROUND_TRACKING_DETERMINATION_PROGRAM_-_P21.agc
027681,000004:                                                                                                  ## Purpose:     A section of LM131 revision 1.
027682,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
027683,000006:                                                                                                  ##              release of the flight software for the Lunar Module's (LM)
027684,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13. The code has
027685,000008:                                                                                                  ##              been reconstructed from a listing of Luminary 131 and a dump
027686,000009:                                                                                                  ##              of a core rope memory module B5, part number 2010802-171,
027687,000010:                                                                                                  ##              which is the only module different between LM131 revision 1
027688,000011:                                                                                                  ##              and Luminary 131. The executable generated from this source
027689,000012:                                                                                                  ##              has been verified against the module dump, so while the names,
027690,000013:                                                                                                  ##              comments, and ordering may not be exactly correct, the
027691,000014:                                                                                                  ##              resulting binary is.
027692,000015:                                                                                                  ## Reference:   pp. 656-659
027693,000016:                                                                                                  ## Assembler:   yaYUL
027694,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
027695,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
027696,000019:                                                                                                  ## Mod history: 2022-10-28 MAS  Created from Luminary 131.
027697,000020: 

Page 656

027699,000022:                                                                                                  #  GROUND TRACKING DETERMINATION PROGRAM P21
027700,000023: 
027701,000024:                                                                                                  #  PROGRAM DESCRIPTION
027702,000025:                                                                                                  #        MOD NO - 1
027703,000026:                                                                                                  #        MOD BY - N. M. NEVILLE
027704,000027: 
027705,000028:                                                                                                  #  FUNCTIONAL DECRIPTION -
027706,000029:                                                                                                  #        TO PROVIDE THE ASTRONAUT DETAILS OF THE LM OR CSM GROUND TRACK WITHOUT
027707,000030:                                                                                                  #        THE NEED FOR GROUND COMMUNICATION (REQUESTED BY DSKY).
027708,000031: 
027709,000032:                                                                                                  #  CALLING SEQUENCE -
027710,000033:                                                                                                  #        ASTRONAUT REQUEST THROUGH DSKY V37E21E
027711,000034: 
027712,000035:                                                                                                  #  SUBROUTINES CALLED -
027713,000036:                                                                                                  #        GOPERF4
027714,000037:                                                                                                  #        GOFLASH
027715,000038:                                                                                                  #        THISPREC
027716,000039:                                                                                                  #        OTHPREC
027717,000040:                                                                                                  #        LAT-LONG
027718,000041: 
027719,000042:                                                                                                  #  NORMAL EXIT MODES -
027720,000043:                                                                                                  #        ASTRONAUT REQUEST TROUGH DSKY TO TERMINATE PROGRAM V34E
027721,000044: 
027722,000045:                                                                                                  #  ALARM OR ABORT EXIT MODES -
027723,000046:                                                                                                  #        NONE
027724,000047: 
027725,000048:                                                                                                  #  OUTPUT -
027726,000049:                                                                                                  #        OCTAL DISPLAY OF OPTION CODE AND VEHICLE WHOSE GROUND TRACK IS TO BE
027727,000050:                                                                                                  #        COMPUTED
027728,000051:                                                                                                  #                OPTION CODE     00002
027729,000052:                                                                                                  #                THIS            00001
027730,000053:                                                                                                  #                OTHER           00002
027731,000054:                                                                                                  #        DECIMAL DISPLAY OF TIME TO BE INTEGRATED TO HOURS, MINUTES, SECONDS
027732,000055:                                                                                                  #        DECIMAL DISPLAY OF LAT,LONG,ALT
027733,000056: 
027734,000057:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
027735,000058:                                                                                                  #        AX0     2DEC    4.652459653 E-5 RADIANS         %68-69 CONSTANTS"
027736,000059:                                                                                                  #        -AY0    2DEC    2.147535898 E-5 RADIANS
027737,000060:                                                                                                  #        AZ0     2DEC    .7753206164     REVOLUTIONS
027738,000061:                                                                                                  #  FOR LUNAR ORBITS 504LM VECTOR IS NEEDED
027739,000062:                                                                                                  #        504LM           2DEC    -2.700340600 E-5 RADIANS
027740,000063:                                                                                                  #        504LM _2        2DEC    -7.514128400 E-4 RADIANS
027741,000064:                                                                                                  #        504LM _4        2DEC    _2.553198641 E-4 RADIANS
027742,000065: 
027743,000066:                                                                                                  #  NONE
027744,000067:                                                                                                  #  DEBRIS

Page 657

027746,000069:                                                                                                  #        CENTRALS - A,Q,L
027747,000070:                                                                                                  #        OTHER - THOSE USED BY THE ABOVE LISTED SUBROUTINES
027748,000071:                                                                                                  #        SEE LEMPREC, LAT-LONG
027749,000072: 
027750,000073: 35,2455  30,2000                                  SBANK=   LOWSUPER                              #  FOR LOW 2CADR'S.
027751,000074: 
027752,000075: 33,2200                                           BANK     33                                    
027753,000076: 24,2000                                           SETLOC   P20S                                  
027754,000077: 24,2000                                           BANK                                           
027755,000078: 
027756,000079: 24,3506  E7,1762                                  EBANK=   P21TIME                               
027757,000080: 24,3506                                           COUNT*   $$/P21                                
027758,000081: 24,3506           34753        PROG21             CAF      ONE                                   
027759,000082: 24,3507           55144                           TS       OPTION2                               #  ASSUMED VEHICLE IS LM, R2 = 00001
027760,000083: 24,3510           34752                           CAF      BIT2                                  #  OPTION 2
027761,000084: 24,3511           04616                           TC       BANKCALL                              
027762,000085: 24,3512           20634                           CADR     GOPERF4                               
027763,000086: 24,3513           06001                           TC       GOTOPOOH                              #  TERMINATE
027764,000087: 24,3514           03516                           TC       +2                                    #  PROCEED VALUE OF ASSUMED VEHICLE OK
027765,000088: 24,3515           03510                           TC       -5                                    #  R2 LOADED THROUGH DSKY
027766,000089: 24,3516           34755                           CAF      ZERO                                  #  INITIAL TIME = PRESENT TIME
027767,000090: 24,3517           55044                           TS       DSPTEM1                               
027768,000091: 24,3520           55045                           TS       DSPTEM1    +1                         
027769,000092: 24,3521           33675        P21PROG1           CAF      V6N34                                 #  LOAD DESIRED TIME OF LAT-LONG.
027770,000093: 24,3522           04616                           TC       BANKCALL                              
027771,000094: 24,3523           20477                           CADR     GOFLASH                               
027772,000095: 24,3524           06001                           TC       GOTOPOOH                              #  TERM
027773,000096: 24,3525           03527                           TC       +2                                    #  PROCEED VALUES OK
027774,000097: 24,3526           03521                           TC       -5                                    #  TIME LOADED THROUGH DSKY
027775,000098: 24,3527           06042                           TC       INTPRET                               
027776,000099: 24,3530           53145                           DLOAD    BZE                                   
027777,000100: 24,3531           01045                                    DSPTEM1                               
027778,000101: 24,3532           51667                                    P21PRTM                               
027779,000102: 24,3533           34041        P21PROG2           STCALL   TDEC1                                 #  INTEG TO TIME SPECIFIED IN TDEC1
027780,000103: 24,3534           27410                                    INTSTALL                              
027781,000104: 24,3535           43014                           BON      CLEAR                                 
027782,000105: 24,3536           00304                                    P21FLAG                               
027783,000106: 24,3537           51555                                    P21CONT                               #  ON---RECYCLE USING BASE VECTOR
027784,000107: 24,3540           01674                                    VINTFLAG                              #  OFF--1ST PASS CALL BASE VECTOR
027785,000108: 24,3541           70535                           SLOAD    SR1                                   
027786,000109: 24,3542           01145                                    OPTION2                               
027787,000110: 24,3543           43030                           BHIZ     SET                                   
027788,000111: 24,3544           51546                                    +2                                    #  ZERO--THIS VEHICLE (LM)
027789,000112: 24,3545           01474                                    VINTFLAG                              #  ONE--OTHER VEHICLE (CM)
027790,000113: 24,3546           43014                           CLEAR    CLEAR                                 
027791,000114: 24,3547           01676                                    DIM0FLAG                              
027792,000115: 24,3550           01673                                    INTYPFLG                              #  PRECISION
027793,000116: 24,3551           77624                           CALL                                           
027794,000117: 24,3552           27133                                    INTEGRV                               #  CALCULATE
027795,000118: 24,3553           77650                           GOTO                                           #  -AND

Page 658

027797,000120: 24,3554           51576                                    P21VSAVE                              #  -SAVE BASE VECTOR
027798,000121: 24,3555           77775        P21CONT            VLOAD                                          
027799,000122: 24,3556           03676                                    P21BASER                              #  RECYCLE--INTEG FROM BASE VECTOR
027800,000123: 24,3557           25535                           STOVL    RCV                                   #  --POS
027801,000124: 24,3560           03704                                    P21BASEV                              
027802,000125: 24,3561           15543                           STODL    VCV                                   #  --VEL
027803,000126: 24,3562           03763                                    P21TIME                               
027804,000127: 24,3563           01517                           STORE    TET                                   #  --TIME
027805,000128: 24,3564           43014                           CLEAR    CLEAR                                 
027806,000129: 24,3565           01676                                    DIM0FLAG                              
027807,000130: 24,3566           00263                                    MOONFLAG                              
027808,000131: 24,3567           53135                           SLOAD    BZE                                   
027809,000132: 24,3570           01163                                    P21ORIG                               
027810,000133: 24,3571           51574                                    +3                                    #  ZERO = EARTH
027811,000134: 24,3572           77614                           SET                                            #  ---2 = MOON
027812,000135: 24,3573           00063                                    MOONFLAG                              
027813,000136: 24,3574           77624                 +3        CALL                                           
027814,000137: 24,3575           27106                                    INTEGRVS                              
027815,000138: 24,3576           77745        P21VSAVE           DLOAD                                          #  SAVE CURRENT BASE VECTOR
027816,000139: 24,3577           00015                                    TAT                                   
027817,000140: 24,3600           27763                           STOVL    P21TIME                               #  --TIME
027818,000141: 24,3601           00017                                    RATT1                                 
027819,000142: 24,3602           27676                           STOVL    P21BASER                              #  --POS B-29 OR B-27
027820,000143: 24,3603           00025                                    VATT1                                 
027821,000144: 24,3604           03704                           STORE    P21BASEV                              #  --VEL B-07 OR B-05
027822,000145: 24,3605           53646                           ABVAL    SL*                                   
027823,000146: 24,3606           57576                                    0,2                                   
027824,000147: 24,3607           27712                           STOVL    P21VEL                                #  VEL/ FOR N91 DISP
027825,000148: 24,3610           00001                                    RATT                                  
027826,000149: 24,3611           50256                           UNIT     DOT                                   
027827,000150: 24,3612           00007                                    VATT                                  #  U(R).V
027828,000151: 24,3613           67471                           DDV      ASIN                                  #  U(R).U(V)
027829,000152: 24,3614           03712                                    P21VEL                                
027830,000153: 24,3615           03714                           STORE    P21GAM                                #  SIN-1 U(R).U(V) , -90 TO &90
027831,000154: 24,3616           67334                           SXA,2    SLOAD                                 
027832,000155: 24,3617           01162                                    P21ORIG                               #  0 = EARTH
027833,000156: 24,3620           01145                                    OPTION2                               
027834,000157: 24,3621           46142                           SR1      BHIZ                                  
027835,000158: 24,3622           51625                                    +3                                    
027836,000159: 24,3623           77650                           GOTO                                           
027837,000160: 24,3624           51630                                    +4                                    
027838,000161: 24,3625           77614                 +3        BON                                            
027839,000162: 24,3626           04307                                    SURFFLAG                              
027840,000163: 24,3627           51632                                    P21DSP                                
027841,000164: 24,3630           77614                 +4        SET                                            
027842,000165: 24,3631           00064                                    P21FLAG                               
027843,000166: 24,3632           67214        P21DSP             CLEAR    SLOAD                                 #  GENERATE DISPLAY DATA
027844,000167: 24,3633           01663                                    LUNAFLAG                              
027845,000168: 24,3634           00050                                    X2                                    
027846,000169: 24,3635           43054                           BZE      SET                                   

Page 659

027848,000171: 24,3636           51640                                    +2                                    #  0 = EARTH
027849,000172: 24,3637           01463                                    LUNAFLAG                              
027850,000173: 24,3640           77775                           VLOAD                                          
027851,000174: 24,3641           00001                                    RATT                                  
027852,000175: 24,3642           16032                           STODL    ALPHAV                                
027853,000176: 24,3643           00015                                    TAT                                   
027854,000177: 24,3644           45014                           CLEAR    CALL                                  
027855,000178: 24,3645           00662                                    ERADFLAG                              
027856,000179: 24,3646           26347                                    LAT-LONG                              
027857,000180: 24,3647           77605                           DMP                                            #  MPAC = ALT, METERS B-29
027858,000181: 24,3650           11677                                    K.01                                  
027859,000182: 24,3651           03716                           STORE    P21ALT                                #  ALT/100 FOR N91 DISP
027860,000183: 24,3652           77776                           EXIT                                           
027861,000184: 24,3653           33674                           CAF      V06N43                                #  DISPLAY LAT, LONG, ALT
027862,000185: 24,3654           04616                           TC       BANKCALL                              #  LAT, LONG = 1/2 REVS B0
027863,000186: 24,3655           20477                           CADR     GOFLASH                               #  ALT = KM B14
027864,000187: 24,3656           06001                           TC       GOTOPOOH                              #  TERM
027865,000188: 24,3657           06001                           TC       GOTOPOOH                              
027866,000189: 24,3660           06042                           TC       INTPRET                               #  V32E RECYCLE
027867,000190: 24,3661           43345                           DLOAD    DAD                                   
027868,000191: 24,3662           03763                                    P21TIME                               
027869,000192: 24,3663           11673                                    600SEC                                #  600 SECONDS OR 10 MIN
027870,000193: 24,3664           01045                           STORE    DSPTEM1                               
027871,000194: 24,3665           77634                           RTB                                            
027872,000195: 24,3666           51521                                    P21PROG1                              
027873,000196: 24,3667           52034        P21PRTM            RTB      GOTO                                  
027874,000197: 24,3670           21574                                    LOADTIME                              
027875,000198: 24,3671           51533                                    P21PROG2                              
027876,000199: 24,3672           00003 25140  600SEC             2DEC     60000      B-28                       #  10 MIN
027877,000200: 
027878,000201: 24,3674           01453        V06N43             VN       00643                                 
027879,000202: 24,3675           01442        V6N34              VN       00634                                 
027880,000203: 24,3676           00243 32703  K.01               2DEC     .01                                   
027881,000204: 

End of include-file GROUND_TRACKING_DETERMINATION_PROGRAM_-_P21.agc.  Parent file is MAIN.agc