Source Code

These source-code files were obtained by digitally photographing an Artemis 72 (Apollo 15-17 Command Module) program listing from a private collection and then modifying pre-existing Comanche 55 (Apollo 11) source files to incorporate changes. Photography was by Ron Burkey, and transcription was performed by a team of volunteers. Note that the page images presented online are of reduced quality, and that additional images may be available. Report any conversion errors or legibility problems in page images to info@sandroid.org. Notations on the program listing read, in part:

	GAP: ASSEMBLE REVISION 072 OF AGC PROGRAM ARTEMIS 
	BY NASA 2021114-011 11:40 FEB. 26, 1971
Note that the date is the date of the printout, not the date of the program revision.

039222,000002:                                                                                                  ## Copyright:   Public domain.
039223,000003:                                                                                                  ## Filename:    CM_BODY_ATTITUDE.agc
039224,000004:                                                                                                  ## Purpose:     Part of the source code for Artemis (i.e., Colossus 3),
039225,000005:                                                                                                  ##              build 072.  This is for the Command Module's (CM)
039226,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for
039227,000007:                                                                                                  ##              Apollo 15-17.
039228,000008:                                                                                                  ## Assembler:   yaYUL
039229,000009:                                                                                                  ## Contact:     Steve Case <case.steve@gmail.com>
039230,000010:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
039231,000011:                                                                                                  ## Page Scans:  www.ibiblio.org/apollo/ScansForConversion/Artemis072/
039232,000012:                                                                                                  ## Mod history: 2009-08-20 SMC  Adapted from Comanche055 files.
039233,000013:                                                                                                  ##              2009-09-14 JL   Fix typos. Fix page numbers. Remove change comments. 
039234,000014:                                                                                                  ##                              Remove RELINT. Restore hard tabs.
039235,000015:                                                                                                  ##              2010-02-20 RSB  Un-##'d this header.
039236,000016:                                                                                                  ##              2017-01-21 RSB  Proofed comment text by diff'ing vs Comanche 55
039237,000017:                                                                                                  ##                              and corrected errors found.
039238,000018:                                                                                                  ##              2017-03-16 RSB  Comment-text fixes identified in 4-way side-by-side
039239,000019:                                                                                                  ##                              diff of Colossus237/249/Comanche55/Artemis72.
039240,000020: 

Page 890

039242,000022: 37,2000                                           SETLOC   BODYATT                               
039243,000023: 37,2000                                           BANK                                           
039244,000024: 
039245,000025: 37,3404                                           COUNT*   $$/CMBAT                              
039246,000026:                                                                                                  #                PDL 12D - 15D SAFE.
039247,000027: 
039248,000028:                                                                                                  #    VALUES OF GIMBAL AND BODY ANGLES VALID AT PIP TIME ARE SAVED DURING    READACCS.
039249,000029: 
039250,000030: 37,3404  E7,1451                                  EBANK=   RTINIT                                #  LET INTERPRETER SET EB
039251,000031: 
039252,000032: 37,3404           06006        CM/POSE            TC       INTPRET                               #  COME HERE VIA AVEGEXIT.
039253,000033: 
039254,000034: 37,3405           77201                           SETPD    VLOAD                                 
039255,000035: 37,3406           00001                                    0                                     
039256,000036: 37,3407           01036                                    VN                                    #  KVSCALE = (12800/ .3048) /2VS
039257,000037: 37,3410           63361                           VXSC     PDVL                                  
039258,000038: 37,3411           37700                                    -KVSCALE                              #  KVSCALE = .81491944
039259,000039: 37,3412           01712                                    UNITW                                 #  FULL UNIT VECTOR
039260,000040: 37,3413           74235                           VXV      VXSC                                  #  VREL = V - WE*R
039261,000041: 37,3414           01756                                    UNITR                                 
039262,000042: 37,3415           15246                                    KWE                                   
039263,000043: 37,3416           45455                           VAD      STADR                                 
039264,000044: 37,3417           74251                           STORE    -VREL                                 #  SAVE FOR ENTRY GUIDANCE.      REF COORDS
039265,000045: 
039266,000046: 37,3420           72056                           UNIT     LXA,1                                 
039267,000047: 37,3421           00044                                    36D                                   #  ABVAL( -VREL) TO X1
039268,000048: 37,3422           03542                           STORE    UXA/2                                 #  -UVREL                        REF COORDS
039269,000049: 
039270,000050: 37,3423           57435                           VXV      VCOMP                                 
039271,000051: 37,3424           01756                                    UNITR                                 #  .5 UNIT                       REF COORDS
039272,000052: 37,3425           66256                           UNIT     SSP                                   #  THE FOLLOWING IS TO PROVIDE A STABLE
039273,000053: 37,3426           00051                                    S1                                    #  UN FOR THE END OF THE TERMINAL PHASE.
039274,000054: 37,3427           00476        SPVQUIT            DEC      .019405                               #  1000/ 2 VS
039275,000055: 37,3430           77300                           TIX,1    VLOAD                                 #  IF V-VQUIT POS, BRANCH.
039276,000056: 37,3431           77433                                    CM/POSE2                              #  SAVE UYA IN OLDUYA
039277,000057: 37,3432           03534                                    OLDUYA                                #  OTHERWISE CONTINUE TO USE OLDUYA.
039278,000058: 37,3433           03550        CM/POSE2           STORE    UYA/2                                 #                                REF COORDS
039279,000059: 
039280,000060: 37,3434           03534                           STORE    OLDUYA                                #  RESTORE, OR SAVE AS CASE MAY BE.
039281,000061: 
039282,000062: 37,3435           57435                           VXV      VCOMP                                 
039283,000063: 37,3436           03542                                    UXA/2                                 #  FINISH OBTAINING TRAJECTORY TRIAD.
039284,000064: 37,3437           77772                           VSL1                                           
039285,000065: 37,3440           03556                           STORE    UZA/2                                 #                                REF COORDS
039286,000066: 
039287,000067: 37,3441           77751                           TLOAD                                          #  PICK UP CDUX, CDUY, CDUZ CORRESPONDING
039288,000068: 37,3442           03270                                    AOG/PIP                               #  TO PIPUP TIME IN 2S,C AND SAVE.
039289,000069: 37,3443           14031        CM/TRIO            STODL    24D                                   

Page 891

039291,000071: 37,3444           00032                                    25D                                   #  AIG/PIP
039292,000072: 
039293,000073: 37,3445           41434                           RTB      PUSH                                  #  TO PDL0
039294,000074: 37,3446           51754                                    CDULOGIC                              
039295,000075: 37,3447           77746                           COS                                            
039296,000076: 37,3450           17564                           STODL    UBX/2                                 #  CI /2
039297,000077:                                                                                                  #  AIG/PIP FROM PDL 0
039298,000078: 37,3451           57556                           SIN      DCOMP                                 
039299,000079: 37,3452           17570                           STODL    UBX/2      +4                         #  -SI /2
039300,000080: 37,3453           00033                                    26D                                   #  AMG/PIP
039301,000081: 37,3454           41434                           RTB      PUSH                                  #  TO PDL 0
039302,000082: 37,3455           51754                                    CDULOGIC                              
039303,000083: 37,3456           65356                           SIN      PDDL                                  #  XCH PDL 0. SAVE SM /2
039304,000084: 37,3457           65346                           COS      PDDL                                  #  CM /2 TO PDL 2
039305,000085: 37,3460           00001                                    0                                     #  SM /2
039306,000086: 37,3461           74276                           DCOMP    VXSC                                  
039307,000087: 37,3462           03564                                    UBX/2                                 
039308,000088: 37,3463           77772                           VSL1                                           #  NOISE WONT OVFL.
039309,000089: 37,3464           17572                           STODL    UBY/2                                 #  =(-SMCI, NOISE, SMSI)/2
039310,000090: 37,3465           00003                                    2                                     #  CM /2 REPLACES NOISE
039311,000091: 37,3466           17574                           STODL    UBY/2      +2                         #  UBY/2=(-SMCI, CM, SMSI)/2
039312,000092: 37,3467           00031                                    24D                                   #  AOG/PIP
039313,000093: 37,3470           41434                           RTB      PUSH                                  #  TO PDL 4
039314,000094: 37,3471           51754                                    CDULOGIC                              
039315,000095: 37,3472           65356                           SIN      PDDL                                  #  XCH PDL 4. SAVE SO /2
039316,000096: 37,3473           74346                           COS      VXSC                                  #  CO /2
039317,000097: 37,3474           03572                                    UBY/2                                 
039318,000098: 37,3475           17572                           STODL    UBY/2                                 #  UBY/2=(-COSMCI, COCM, COSMSI)/4
039319,000099: 37,3476           00005                                    4D                                    #  SO /2
039320,000100: 37,3477           57405                           DMP      DCOMP                                 
039321,000101: 37,3500           03570                                    UBX/2      +4                         #  -SI /2
039322,000102: 37,3501           77615                           DAD                                            
039323,000103: 37,3502           03572                                    UBY/2                                 #   INCREMENT BY (SOSI /4)
039324,000104: 37,3503           17572                           STODL    UBY/2                                 
039325,000105:                                                                                                  #  SO /2 FROM PDL 4
039326,000106: 37,3504           43205                           DMP      DAD                                   
039327,000107: 37,3505           03564                                    UBX/2                                 #  CI /2
039328,000108: 37,3506           03576                                    UBY/2      +4                         
039329,000109: 37,3507           27576                           STOVL    UBY/2      +4                         #  YB/4                          PLATFORM COORDS
039330,000110: 
039331,000111:                                                                                                  #  YB = (-COSMCI + SOSI , COCM , COSMSI + SOCI )
039332,000112: 
039333,000113: 37,3510           03572                                    UBY/2                                 
039334,000114: 37,3511           72505                           VXM      VSL2                                  
039335,000115: 37,3512           01734                                    REFSMMAT                              #  .5 UNIT
039336,000116: 37,3513           17572                           STODL    UBY/2                                 #  YB/2  DONE                    REF COORDS
039337,000117: 
039338,000118:                                                                                                  #  CM /2 FROM PDL 2
039339,000119: 37,3514           76561                           VXSC     VSL1                                  
039340,000120: 37,3515           03564                                    UBX/2                                 

Page 892

039342,000122: 37,3516           17564                           STODL    UBX/2                                 #  =( CMCI, NOISE, -CMSI)/2
039343,000123: 37,3517           77626                           STADR                                          #  SM /2 FROM PDL 0
039344,000124: 37,3520           50211                           STOVL    UBX/2      +2                         #  SM /2 REPLACES NOISE
039345,000125: 37,3521           03564                                    UBX/2                                 #  XB/2                          PLATFORM COORDS
039346,000126: 
039347,000127:                                                                                                  #  XB = ( CMCI , SM , -CMSI )
039348,000128: 
039349,000129: 37,3522           76505                           VXM      VSL1                                  
039350,000130: 37,3523           01734                                    REFSMMAT                              #  .5 UNIT
039351,000131: 37,3524           03564                           STORE    UBX/2                                 #  XB/2 DONE                     REF COORDS
039352,000132: 
039353,000133: 37,3525           76435                           VXV      VSL1                                  
039354,000134: 37,3526           03572                                    UBY/2                                 
039355,000135: 37,3527           27600                           STOVL    UBZ/2                                 #  ZB/2 DONE                     REF COORDS
039356,000136: 
039357,000137:                                                                                                  #  EQUIVALENT TO
039358,000138:                                                                                                  #  ZB = ( SOSMCI + COSI , -SOCM , -SOSMSI + COCI)
039359,000139: 
039360,000140: 37,3530           03542                                    UXA/2                                 #  -UVREL/2 = -UVA/2
039361,000141: 37,3531           53435                           VXV      UNIT                                  #  GET UNIT(-UVREL*UBY)/2  = UL/2
039362,000142: 37,3532           03572                                    UBY/2                                 #  YB/2
039363,000143: 37,3533           50206                           PUSH     DOT                                   #  UL/2  TO PDL 0,5
039364,000144: 37,3534           03556                                    UZA/2                                 #  UNA/2
039365,000145: 37,3535           24021                           STOVL    COSTH                                 #  COS(ROLL)/4
039366,000146: 37,3536           00001                                    0                                     #  UL/2
039367,000147: 
039368,000148: 37,3537           77641                           DOT                                            
039369,000149: 37,3540           03550                                    UYA/2                                 
039370,000150: 37,3541           34023                           STCALL   SINTH                                 #  -SIN(ROLL)/4
039371,000151: 37,3542           47311                                    ARCTRIG                               
039372,000152: 37,3543           24007                           STOVL    6D                                    #  -(ROLL/180) /2
039373,000153: 37,3544           03572                                    UBY/2                                 
039374,000154: 37,3545           72441                           DOT      SL1                                   #  -UVA.UBY = -SIN(BETA)
039375,000155: 37,3546           03542                                    UXA/2                                 #  -UVREL/2
039376,000156: 37,3547           77736                           ARCSIN                                         
039377,000157: 37,3550           24010                           STOVL    7D                                    #  -(BETA/180) /2
039378,000158: 37,3551           03564                                    UBX/2                                 #  XB/2
039379,000159: 37,3552           77641                           DOT                                            #  UL.UBX = -SIN(ALFA)
039380,000160: 37,3553           00001                                    0                                     #  UL/2
039381,000161: 37,3554           24023                           STOVL    SINTH                                 #  -SIN(ALFA)/4
039382,000162: 37,3555           77641                           DOT                                            #  UL/2 FROM PDL 0
039383,000163: 37,3556           03600                                    UBZ/2                                 
039384,000164: 37,3557           34021                           STCALL   COSTH                                 #  COS(ALFA)/4
039385,000165: 37,3560           47311                                    ARCTRIG                               
039386,000166: 37,3561           24011                           STOVL    8D                                    #  -(ALFA/180) /2
039387,000167: 37,3562           01756                                    UNITR                                 #  UR/2                          REF COORDS
039388,000168: 37,3563           72441                           DOT      SL1                                   
039389,000169: 37,3564           03556                                    UZA/2                                 #  MORE ACCURATE AT LARGE ARG.
039390,000170: 37,3565           77726                           ARCCOS                                         
039391,000171: 37,3566           00013                           STORE    10D                                   #  (-GAMA/180)/2

Page 893

039393,000173: 37,3567           77551                           TLOAD    EXIT                                  #  ANGLES IN MPAC IN THE ORDER
039394,000174:                                                                                                  #  -( (ROLL, BETA, ALFA) /180)/2
039395,000175: 37,3570           00007                                    6D                                    #  THESE VALUES CORRECT AT PIPUP TIME.
039396,000176:                                                                                                  #  SPACER

Page 894

039398,000178: 
039399,000179:                                                                                                  #  BASIC SUBROUTINE TO UPDATE ATTITUDE ANGLES
039400,000180: 
039401,000181: 37,3571  E6,1661                                  EBANK=   AOG                                   
039402,000182: 
039403,000183: 37,3571           04611        CM/ATUP            TC       E6SETTER                              
039404,000184: 
039405,000185: 37,3572           50120        CMTR1              INDEX    FIXLOC                                
039406,000186: 37,3573           40012                           CS       10D                                   #  (GAMA/180)/2
039407,000187: 37,3574           57722                           XCH      GAMA                                  
039408,000188: 37,3575           54001                           TS       L                                     
039409,000189: 
039410,000190: 37,3576           00004                           INHINT                                         
039411,000191:                                                                                                  #  MUST REMAIN INHINTED UNTIL UPDATE OF BODY
039412,000192:                                                                                                  #  ANGLES, SO THAT GAMDIFSW IS VALID FIRST PASS
039413,000193:                                                                                                  #  INDICATOR.
039414,000194: 
039415,000195: 37,3577           40102                           CS       CM/FLAGS                              
039416,000196: 37,3600           74756                           MASK     GMDIFBIT                              #  GAMDIFSW = 94D BIT11 INITLY=
039417,000197: 37,3601           00006                           EXTEND                                         #  DONT CALC GAMA DOT UNTIL HAVE FORMD
039418,000198:                                                                                                  #  ONE DIFFERENCE.
039419,000199: 37,3602           13605                           BZF      DOGAMDOT                              #  IS OK, GO ON.
039420,000200: 37,3603           26102                           ADS      CM/FLAGS                              #  KNOW BIT IS 0
039421,000201: 37,3604           03620                           TC       NOGAMDOT                              #  SET GAMDOT = 0
039422,000202: 
039423,000203: 37,3605           40001        DOGAMDOT           CS       L                                     
039424,000204: 37,3606           61722                           AD       GAMA                                  #  DEL GAMA/360= T GAMDOT/360
039425,000205: 37,3607           00006                           EXTEND                                         
039426,000206: 37,3610           73701                           MP       TCDU                                  #  TCDU = .1 SEC,   T = 2 SEC.
039427,000207: 37,3611           55723                           TS       GAMDOT                                #  GAMA DOT TCDU / 180
039428,000208: 
039429,000209: 37,3612           00006                           EXTEND                                         #  IGNORE GAMDOT IF LEQ  .5 DEG/SEC
039430,000210: 37,3613           63615                           BZMF     +2                                    
039431,000211: 37,3614           40000                           COM                                            
039432,000212: 37,3615           64773                           AD       FIVE                                  
039433,000213: 37,3616           00006                           EXTEND                                         
039434,000214: 37,3617           63622                           BZMF     +3                                    #  SET GAMDOT=+0 AS TAG IF TOO SMALL.
039435,000215: 
039436,000216: 37,3620           34772        NOGAMDOT           CA       ZERO                                  #  COME HERE INHINTED.
039437,000217: 37,3621           55723                           TS       GAMDOT                                
039438,000218:                                                                                                  #  FOR NOW LEAVE IN 2S,C
039439,000219:                                                                                                  #  UPDATE ANGLES BY CORRECTING EUILER ANG
039440,000220:                                                                                                  #  FOR ACCRUED INCREMENT SINCE PIPUP
039441,000221:                                                                                                  #  R = R EUIL + R(NOW) -R(PIPUP)
039442,000222: 37,3622           40154                           CS       MPAC                                  #  GET (R EUL/180) /2
039443,000223: 37,3623           60000                           DOUBLE                                         #  POSSIBLE OVERFLOW
039444,000224: 37,3624           03671                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY
039445,000225: 37,3625           00006                           EXTEND                                         
039446,000226: 37,3626           61672                           SU       ROLL/PIP                              #  GET INCR SINCE PIPUP
039447,000227: 37,3627           61664                           AD       ROLL/180                              #  ONLY SINGLE OVFL POSSIBLE.
039448,000228: 37,3630           03671                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY

Page 895

039450,000230: 37,3631           55770                           TS       TEMPROLL                              
039451,000231: 
039452,000232: 37,3632           40156                           CS       MPAC       +2                         #  GET (ALFA EUL/180) /2
039453,000233: 37,3633           60000                           DOUBLE                                         #  SAME AS FOR ROLL. NEEDED FOR EXT ATM DAP
039454,000234: 37,3634           03671                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY
039455,000235: 37,3635           00006                           EXTEND                                         
039456,000236: 37,3636           61673                           SU       ALFA/PIP                              
039457,000237: 37,3637           61665                           AD       ALFA/180                              
039458,000238: 37,3640           03671                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY
039459,000239: 37,3641           55771                           TS       TEMPALFA                              
039460,000240: 
039461,000241: 37,3642           40155                           CS       MPAC       +1                         #  GET (BETA EUL/180) /2
039462,000242: 37,3643           60000        CMTR2              DOUBLE                                         
039463,000243: 37,3644           00006                           EXTEND                                         
039464,000244: 37,3645           61674                           SU       BETA/PIP                              
039465,000245: 37,3646           61666                           AD       BETA/180                              
039466,000246: 37,3647           57772                           XCH      TEMPBETA                              #  OVFL NOT EXPECTED.
039467,000247: 
039468,000248: 37,3650           35024                           CA       EBANK3                                
039469,000249: 37,3651           54003                           TS       EBANK                                 
039470,000250: 
039471,000251: 37,3652  E3,1446                                  EBANK=   PHSNAME5                              
039472,000252: 37,3652           00006                           EXTEND                                         
039473,000253: 37,3653           33703                           DCA      REPOSADR                              #  THIS ASSUMES THAT THE         TC   PHASCHNG
039474,000254: 37,3654           53447                           DXCH     PHSNAME5                              #  IS NOT CHANGED IN             OCT  10035
039475,000255:                                                                                                  #  SERVICER.
039476,000256: 
039477,000257: 37,3655           04611                           TC       E6SETTER                              
039478,000258: 
039479,000259: 37,3656  E6,1661                                  EBANK=   AOG                                   
039480,000260: 37,3656           00006        REDOPOSE           EXTEND                                         #  RE-STARTS COME HERE
039481,000261: 37,3657           31771                           DCA      TEMPROLL                              
039482,000262: 37,3660           53665                           DXCH     ROLL/180                              
039483,000263: 37,3661           31772                           CA       TEMPBETA                              
039484,000264: 37,3662           55666                           TS       BETA/180                              
039485,000265: 
039486,000266: 37,3663           06006                           TC       INTPRET                               #  CANT TC DANZIG AFTER PHASCHNG.
039487,000267: 37,3664           51575        CM/POSE3           VLOAD    ABVAL                                 #  RETURN FROM CM/ATUP.  (RESTART)
039488,000268: 37,3665           01036                                    VN                                    #  2(-7)  M/CS
039489,000269: 37,3666           03723                           STORE    VMAGI                                 #  FOR DISPLAY ON CALL.
039490,000270: 
039491,000271: 37,3667           77650                           GOTO                                           
039492,000272: 37,3670           03324                                    POSEXIT                               #  ENDEXIT, STARTENT, OR SCALEPOP.
039493,000273: 
039494,000274: 37,3671           54001        CORANGOV           TS       L                                     
039495,000275: 37,3672           00002                           TC       Q                                     
039496,000276: 37,3673           50000                           INDEX    A                                     
039497,000277: 37,3674           34751                           CA       LIMITS                                
039498,000278: 37,3675           26001                           ADS      L                                     
039499,000279: 37,3676           00002                           TC       Q                                     #  COSTS 2 MCT TO USE. SEE ANGOVCOR.
039500,000280: 

Page 896

039502,000282: 37,3677           45730 53410  -KVSCALE           2DEC     -.81491944                            #  -12800/(2 VS .3048)
039503,000283: 37,3701           03146        TCDU               DEC      .1                                    #  TCDU = .1 SEC.
039504,000284: 
039505,000285: 37,3702  E6,1661                                  EBANK=   AOG                                   
039506,000286: 37,3702           03656 76066  REPOSADR           2CADR    REDOPOSE                              

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