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.

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

Page 890

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

Page 891

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

Page 892

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

Page 893

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

Page 894

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

Page 895

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

Page 896

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

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