Source Code

These source-code files are part of a reconstructed copy of Artemis 071, the first release of the Apollo 15 through 17 Command Module (CM) Apollo Guidance Computer (AGC) software.

The reconstruction began with source code of Artemis 072 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes between the two versions. The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021154-. Note that page numbers in the reconstructed code match those on the Artemis 072 printout, although the changed code would likely have changed page numbers for a real Artemis 071 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.

039085,000002:                                                                                                  ## Copyright:   Public domain.
039086,000003:                                                                                                  ## Filename:    CM_BODY_ATTITUDE.agc
039087,000004:                                                                                                  ## Purpose:     A section of Artemis revision 071.
039088,000005:                                                                                                  ##              It is part of the reconstructed source code for the first
039089,000006:                                                                                                  ##              release of the flight software for the Command Module's
039090,000007:                                                                                                  ##              (CM) Apollo Guidance Computer (AGC) for Apollo 15 through
039091,000008:                                                                                                  ##              17. The code has been recreated from a copy of Artemis 072.
039092,000009:                                                                                                  ##              It has been adapted such that the resulting bugger words
039093,000010:                                                                                                  ##              exactly match those specified for Artemis 071 in NASA
039094,000011:                                                                                                  ##              drawing 2021154-, which gives relatively high confidence
039095,000012:                                                                                                  ##              that the reconstruction is correct.
039096,000013:                                                                                                  ## Reference:   890
039097,000014:                                                                                                  ## Assembler:   yaYUL
039098,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
039099,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
039100,000017:                                                                                                  ## Mod history: 2019-08-14 MAS  Created from Artemis 072.
039101,000018: 

Page 890

039103,000020: 37,2000                                           SETLOC   BODYATT                               
039104,000021: 37,2000                                           BANK                                           
039105,000022: 
039106,000023: 37,3404                                           COUNT*   $$/CMBAT                              
039107,000024:                                                                                                  #                PDL 12D - 15D SAFE.
039108,000025: 
039109,000026:                                                                                                  #    VALUES OF GIMBAL AND BODY ANGLES VALID AT PIP TIME ARE SAVED DURING    READACCS.
039110,000027: 
039111,000028: 37,3404  E7,1451                                  EBANK=   RTINIT                                #  LET INTERPRETER SET EB
039112,000029: 
039113,000030: 37,3404           06006        CM/POSE            TC       INTPRET                               #  COME HERE VIA AVEGEXIT.
039114,000031: 
039115,000032: 37,3405           77201                           SETPD    VLOAD                                 
039116,000033: 37,3406           00001                                    0                                     
039117,000034: 37,3407           01036                                    VN                                    #  KVSCALE = (12800/ .3048) /2VS
039118,000035: 37,3410           63361                           VXSC     PDVL                                  
039119,000036: 37,3411           37700                                    -KVSCALE                              #  KVSCALE = .81491944
039120,000037: 37,3412           01712                                    UNITW                                 #  FULL UNIT VECTOR
039121,000038: 37,3413           74235                           VXV      VXSC                                  #  VREL = V - WE*R
039122,000039: 37,3414           01756                                    UNITR                                 
039123,000040: 37,3415           15246                                    KWE                                   
039124,000041: 37,3416           45455                           VAD      STADR                                 
039125,000042: 37,3417           74251                           STORE    -VREL                                 #  SAVE FOR ENTRY GUIDANCE.      REF COORDS
039126,000043: 
039127,000044: 37,3420           72056                           UNIT     LXA,1                                 
039128,000045: 37,3421           00044                                    36D                                   #  ABVAL( -VREL) TO X1
039129,000046: 37,3422           03542                           STORE    UXA/2                                 #  -UVREL                        REF COORDS
039130,000047: 
039131,000048: 37,3423           57435                           VXV      VCOMP                                 
039132,000049: 37,3424           01756                                    UNITR                                 #  .5 UNIT                       REF COORDS
039133,000050: 37,3425           66256                           UNIT     SSP                                   #  THE FOLLOWING IS TO PROVIDE A STABLE
039134,000051: 37,3426           00051                                    S1                                    #  UN FOR THE END OF THE TERMINAL PHASE.
039135,000052: 37,3427           00476        SPVQUIT            DEC      .019405                               #  1000/ 2 VS
039136,000053: 37,3430           77300                           TIX,1    VLOAD                                 #  IF V-VQUIT POS, BRANCH.
039137,000054: 37,3431           77433                                    CM/POSE2                              #  SAVE UYA IN OLDUYA
039138,000055: 37,3432           03534                                    OLDUYA                                #  OTHERWISE CONTINUE TO USE OLDUYA.
039139,000056: 37,3433           03550        CM/POSE2           STORE    UYA/2                                 #                                REF COORDS
039140,000057: 
039141,000058: 37,3434           03534                           STORE    OLDUYA                                #  RESTORE, OR SAVE AS CASE MAY BE.
039142,000059: 
039143,000060: 37,3435           57435                           VXV      VCOMP                                 
039144,000061: 37,3436           03542                                    UXA/2                                 #  FINISH OBTAINING TRAJECTORY TRIAD.
039145,000062: 37,3437           77772                           VSL1                                           
039146,000063: 37,3440           03556                           STORE    UZA/2                                 #                                REF COORDS
039147,000064: 
039148,000065: 37,3441           77751                           TLOAD                                          #  PICK UP CDUX, CDUY, CDUZ CORRESPONDING
039149,000066: 37,3442           03270                                    AOG/PIP                               #  TO PIPUP TIME IN 2S,C AND SAVE.
039150,000067: 37,3443           14031        CM/TRIO            STODL    24D                                   

Page 891

039152,000069: 37,3444           00032                                    25D                                   #  AIG/PIP
039153,000070: 
039154,000071: 37,3445           41434                           RTB      PUSH                                  #  TO PDL0
039155,000072: 37,3446           51754                                    CDULOGIC                              
039156,000073: 37,3447           77746                           COS                                            
039157,000074: 37,3450           17564                           STODL    UBX/2                                 #  CI /2
039158,000075:                                                                                                  #  AIG/PIP FROM PDL 0
039159,000076: 37,3451           57556                           SIN      DCOMP                                 
039160,000077: 37,3452           17570                           STODL    UBX/2      +4                         #  -SI /2
039161,000078: 37,3453           00033                                    26D                                   #  AMG/PIP
039162,000079: 37,3454           41434                           RTB      PUSH                                  #  TO PDL 0
039163,000080: 37,3455           51754                                    CDULOGIC                              
039164,000081: 37,3456           65356                           SIN      PDDL                                  #  XCH PDL 0. SAVE SM /2
039165,000082: 37,3457           65346                           COS      PDDL                                  #  CM /2 TO PDL 2
039166,000083: 37,3460           00001                                    0                                     #  SM /2
039167,000084: 37,3461           74276                           DCOMP    VXSC                                  
039168,000085: 37,3462           03564                                    UBX/2                                 
039169,000086: 37,3463           77772                           VSL1                                           #  NOISE WONT OVFL.
039170,000087: 37,3464           17572                           STODL    UBY/2                                 #  =(-SMCI, NOISE, SMSI)/2
039171,000088: 37,3465           00003                                    2                                     #  CM /2 REPLACES NOISE
039172,000089: 37,3466           17574                           STODL    UBY/2      +2                         #  UBY/2=(-SMCI, CM, SMSI)/2
039173,000090: 37,3467           00031                                    24D                                   #  AOG/PIP
039174,000091: 37,3470           41434                           RTB      PUSH                                  #  TO PDL 4
039175,000092: 37,3471           51754                                    CDULOGIC                              
039176,000093: 37,3472           65356                           SIN      PDDL                                  #  XCH PDL 4. SAVE SO /2
039177,000094: 37,3473           74346                           COS      VXSC                                  #  CO /2
039178,000095: 37,3474           03572                                    UBY/2                                 
039179,000096: 37,3475           17572                           STODL    UBY/2                                 #  UBY/2=(-COSMCI, COCM, COSMSI)/4
039180,000097: 37,3476           00005                                    4D                                    #  SO /2
039181,000098: 37,3477           57405                           DMP      DCOMP                                 
039182,000099: 37,3500           03570                                    UBX/2      +4                         #  -SI /2
039183,000100: 37,3501           77615                           DAD                                            
039184,000101: 37,3502           03572                                    UBY/2                                 #   INCREMENT BY (SOSI /4)
039185,000102: 37,3503           17572                           STODL    UBY/2                                 
039186,000103:                                                                                                  #  SO /2 FROM PDL 4
039187,000104: 37,3504           43205                           DMP      DAD                                   
039188,000105: 37,3505           03564                                    UBX/2                                 #  CI /2
039189,000106: 37,3506           03576                                    UBY/2      +4                         
039190,000107: 37,3507           27576                           STOVL    UBY/2      +4                         #  YB/4                          PLATFORM COORDS
039191,000108: 
039192,000109:                                                                                                  #  YB = (-COSMCI + SOSI , COCM , COSMSI + SOCI )
039193,000110: 
039194,000111: 37,3510           03572                                    UBY/2                                 
039195,000112: 37,3511           72505                           VXM      VSL2                                  
039196,000113: 37,3512           01734                                    REFSMMAT                              #  .5 UNIT
039197,000114: 37,3513           17572                           STODL    UBY/2                                 #  YB/2  DONE                    REF COORDS
039198,000115: 
039199,000116:                                                                                                  #  CM /2 FROM PDL 2
039200,000117: 37,3514           76561                           VXSC     VSL1                                  
039201,000118: 37,3515           03564                                    UBX/2                                 

Page 892

039203,000120: 37,3516           17564                           STODL    UBX/2                                 #  =( CMCI, NOISE, -CMSI)/2
039204,000121: 37,3517           77626                           STADR                                          #  SM /2 FROM PDL 0
039205,000122: 37,3520           50211                           STOVL    UBX/2      +2                         #  SM /2 REPLACES NOISE
039206,000123: 37,3521           03564                                    UBX/2                                 #  XB/2                          PLATFORM COORDS
039207,000124: 
039208,000125:                                                                                                  #  XB = ( CMCI , SM , -CMSI )
039209,000126: 
039210,000127: 37,3522           76505                           VXM      VSL1                                  
039211,000128: 37,3523           01734                                    REFSMMAT                              #  .5 UNIT
039212,000129: 37,3524           03564                           STORE    UBX/2                                 #  XB/2 DONE                     REF COORDS
039213,000130: 
039214,000131: 37,3525           76435                           VXV      VSL1                                  
039215,000132: 37,3526           03572                                    UBY/2                                 
039216,000133: 37,3527           27600                           STOVL    UBZ/2                                 #  ZB/2 DONE                     REF COORDS
039217,000134: 
039218,000135:                                                                                                  #  EQUIVALENT TO
039219,000136:                                                                                                  #  ZB = ( SOSMCI + COSI , -SOCM , -SOSMSI + COCI)
039220,000137: 
039221,000138: 37,3530           03542                                    UXA/2                                 #  -UVREL/2 = -UVA/2
039222,000139: 37,3531           53435                           VXV      UNIT                                  #  GET UNIT(-UVREL*UBY)/2  = UL/2
039223,000140: 37,3532           03572                                    UBY/2                                 #  YB/2
039224,000141: 37,3533           50206                           PUSH     DOT                                   #  UL/2  TO PDL 0,5
039225,000142: 37,3534           03556                                    UZA/2                                 #  UNA/2
039226,000143: 37,3535           24021                           STOVL    COSTH                                 #  COS(ROLL)/4
039227,000144: 37,3536           00001                                    0                                     #  UL/2
039228,000145: 
039229,000146: 37,3537           77641                           DOT                                            
039230,000147: 37,3540           03550                                    UYA/2                                 
039231,000148: 37,3541           34023                           STCALL   SINTH                                 #  -SIN(ROLL)/4
039232,000149: 37,3542           47311                                    ARCTRIG                               
039233,000150: 37,3543           24007                           STOVL    6D                                    #  -(ROLL/180) /2
039234,000151: 37,3544           03572                                    UBY/2                                 
039235,000152: 37,3545           72441                           DOT      SL1                                   #  -UVA.UBY = -SIN(BETA)
039236,000153: 37,3546           03542                                    UXA/2                                 #  -UVREL/2
039237,000154: 37,3547           77736                           ARCSIN                                         
039238,000155: 37,3550           24010                           STOVL    7D                                    #  -(BETA/180) /2
039239,000156: 37,3551           03564                                    UBX/2                                 #  XB/2
039240,000157: 37,3552           77641                           DOT                                            #  UL.UBX = -SIN(ALFA)
039241,000158: 37,3553           00001                                    0                                     #  UL/2
039242,000159: 37,3554           24023                           STOVL    SINTH                                 #  -SIN(ALFA)/4
039243,000160: 37,3555           77641                           DOT                                            #  UL/2 FROM PDL 0
039244,000161: 37,3556           03600                                    UBZ/2                                 
039245,000162: 37,3557           34021                           STCALL   COSTH                                 #  COS(ALFA)/4
039246,000163: 37,3560           47311                                    ARCTRIG                               
039247,000164: 37,3561           24011                           STOVL    8D                                    #  -(ALFA/180) /2
039248,000165: 37,3562           01756                                    UNITR                                 #  UR/2                          REF COORDS
039249,000166: 37,3563           72441                           DOT      SL1                                   
039250,000167: 37,3564           03556                                    UZA/2                                 #  MORE ACCURATE AT LARGE ARG.
039251,000168: 37,3565           77726                           ARCCOS                                         
039252,000169: 37,3566           00013                           STORE    10D                                   #  (-GAMA/180)/2

Page 893

039254,000171: 37,3567           77551                           TLOAD    EXIT                                  #  ANGLES IN MPAC IN THE ORDER
039255,000172:                                                                                                  #  -( (ROLL, BETA, ALFA) /180)/2
039256,000173: 37,3570           00007                                    6D                                    #  THESE VALUES CORRECT AT PIPUP TIME.
039257,000174:                                                                                                  #  SPACER

Page 894

039259,000176: 
039260,000177:                                                                                                  #  BASIC SUBROUTINE TO UPDATE ATTITUDE ANGLES
039261,000178: 
039262,000179: 37,3571  E6,1661                                  EBANK=   AOG                                   
039263,000180: 
039264,000181: 37,3571           04611        CM/ATUP            TC       E6SETTER                              
039265,000182: 
039266,000183: 37,3572           50120        CMTR1              INDEX    FIXLOC                                
039267,000184: 37,3573           40012                           CS       10D                                   #  (GAMA/180)/2
039268,000185: 37,3574           57722                           XCH      GAMA                                  
039269,000186: 37,3575           54001                           TS       L                                     
039270,000187: 
039271,000188: 37,3576           00004                           INHINT                                         
039272,000189:                                                                                                  #  MUST REMAIN INHINTED UNTIL UPDATE OF BODY
039273,000190:                                                                                                  #  ANGLES, SO THAT GAMDIFSW IS VALID FIRST PASS
039274,000191:                                                                                                  #  INDICATOR.
039275,000192: 
039276,000193: 37,3577           40102                           CS       CM/FLAGS                              
039277,000194: 37,3600           74756                           MASK     GMDIFBIT                              #  GAMDIFSW = 94D BIT11 INITLY=
039278,000195: 37,3601           00006                           EXTEND                                         #  DONT CALC GAMA DOT UNTIL HAVE FORMD
039279,000196:                                                                                                  #  ONE DIFFERENCE.
039280,000197: 37,3602           13605                           BZF      DOGAMDOT                              #  IS OK, GO ON.
039281,000198: 37,3603           26102                           ADS      CM/FLAGS                              #  KNOW BIT IS 0
039282,000199: 37,3604           03620                           TC       NOGAMDOT                              #  SET GAMDOT = 0
039283,000200: 
039284,000201: 37,3605           40001        DOGAMDOT           CS       L                                     
039285,000202: 37,3606           61722                           AD       GAMA                                  #  DEL GAMA/360= T GAMDOT/360
039286,000203: 37,3607           00006                           EXTEND                                         
039287,000204: 37,3610           73701                           MP       TCDU                                  #  TCDU = .1 SEC,   T = 2 SEC.
039288,000205: 37,3611           55723                           TS       GAMDOT                                #  GAMA DOT TCDU / 180
039289,000206: 
039290,000207: 37,3612           00006                           EXTEND                                         #  IGNORE GAMDOT IF LEQ  .5 DEG/SEC
039291,000208: 37,3613           63615                           BZMF     +2                                    
039292,000209: 37,3614           40000                           COM                                            
039293,000210: 37,3615           64773                           AD       FIVE                                  
039294,000211: 37,3616           00006                           EXTEND                                         
039295,000212: 37,3617           63622                           BZMF     +3                                    #  SET GAMDOT=+0 AS TAG IF TOO SMALL.
039296,000213: 
039297,000214: 37,3620           34772        NOGAMDOT           CA       ZERO                                  #  COME HERE INHINTED.
039298,000215: 37,3621           55723                           TS       GAMDOT                                
039299,000216:                                                                                                  #  FOR NOW LEAVE IN 2S,C
039300,000217:                                                                                                  #  UPDATE ANGLES BY CORRECTING EUILER ANG
039301,000218:                                                                                                  #  FOR ACCRUED INCREMENT SINCE PIPUP
039302,000219:                                                                                                  #  R = R EUIL + R(NOW) -R(PIPUP)
039303,000220: 37,3622           40154                           CS       MPAC                                  #  GET (R EUL/180) /2
039304,000221: 37,3623           60000                           DOUBLE                                         #  POSSIBLE OVERFLOW
039305,000222: 37,3624           03671                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY
039306,000223: 37,3625           00006                           EXTEND                                         
039307,000224: 37,3626           61672                           SU       ROLL/PIP                              #  GET INCR SINCE PIPUP
039308,000225: 37,3627           61664                           AD       ROLL/180                              #  ONLY SINGLE OVFL POSSIBLE.
039309,000226: 37,3630           03671                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY

Page 895

039311,000228: 37,3631           55770                           TS       TEMPROLL                              
039312,000229: 
039313,000230: 37,3632           40156                           CS       MPAC       +2                         #  GET (ALFA EUL/180) /2
039314,000231: 37,3633           60000                           DOUBLE                                         #  SAME AS FOR ROLL. NEEDED FOR EXT ATM DAP
039315,000232: 37,3634           03671                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY
039316,000233: 37,3635           00006                           EXTEND                                         
039317,000234: 37,3636           61673                           SU       ALFA/PIP                              
039318,000235: 37,3637           61665                           AD       ALFA/180                              
039319,000236: 37,3640           03671                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY
039320,000237: 37,3641           55771                           TS       TEMPALFA                              
039321,000238: 
039322,000239: 37,3642           40155                           CS       MPAC       +1                         #  GET (BETA EUL/180) /2
039323,000240: 37,3643           60000        CMTR2              DOUBLE                                         
039324,000241: 37,3644           00006                           EXTEND                                         
039325,000242: 37,3645           61674                           SU       BETA/PIP                              
039326,000243: 37,3646           61666                           AD       BETA/180                              
039327,000244: 37,3647           57772                           XCH      TEMPBETA                              #  OVFL NOT EXPECTED.
039328,000245: 
039329,000246: 37,3650           35024                           CA       EBANK3                                
039330,000247: 37,3651           54003                           TS       EBANK                                 
039331,000248: 
039332,000249: 37,3652  E3,1446                                  EBANK=   PHSNAME5                              
039333,000250: 37,3652           00006                           EXTEND                                         
039334,000251: 37,3653           33703                           DCA      REPOSADR                              #  THIS ASSUMES THAT THE         TC   PHASCHNG
039335,000252: 37,3654           53447                           DXCH     PHSNAME5                              #  IS NOT CHANGED IN             OCT  10035
039336,000253:                                                                                                  #  SERVICER.
039337,000254: 
039338,000255: 37,3655           04611                           TC       E6SETTER                              
039339,000256: 
039340,000257: 37,3656  E6,1661                                  EBANK=   AOG                                   
039341,000258: 37,3656           00006        REDOPOSE           EXTEND                                         #  RE-STARTS COME HERE
039342,000259: 37,3657           31771                           DCA      TEMPROLL                              
039343,000260: 37,3660           53665                           DXCH     ROLL/180                              
039344,000261: 37,3661           31772                           CA       TEMPBETA                              
039345,000262: 37,3662           55666                           TS       BETA/180                              
039346,000263: 
039347,000264: 37,3663           06006                           TC       INTPRET                               #  CANT TC DANZIG AFTER PHASCHNG.
039348,000265: 37,3664           51575        CM/POSE3           VLOAD    ABVAL                                 #  RETURN FROM CM/ATUP.  (RESTART)
039349,000266: 37,3665           01036                                    VN                                    #  2(-7)  M/CS
039350,000267: 37,3666           03723                           STORE    VMAGI                                 #  FOR DISPLAY ON CALL.
039351,000268: 
039352,000269: 37,3667           77650                           GOTO                                           
039353,000270: 37,3670           03324                                    POSEXIT                               #  ENDEXIT, STARTENT, OR SCALEPOP.
039354,000271: 
039355,000272: 37,3671           54001        CORANGOV           TS       L                                     
039356,000273: 37,3672           00002                           TC       Q                                     
039357,000274: 37,3673           50000                           INDEX    A                                     
039358,000275: 37,3674           34751                           CA       LIMITS                                
039359,000276: 37,3675           26001                           ADS      L                                     
039360,000277: 37,3676           00002                           TC       Q                                     #  COSTS 2 MCT TO USE. SEE ANGOVCOR.
039361,000278: 

Page 896

039363,000280: 37,3677           45730 53410  -KVSCALE           2DEC     -.81491944                            #  -12800/(2 VS .3048)
039364,000281: 37,3701           03146        TCDU               DEC      .1                                    #  TCDU = .1 SEC.
039365,000282: 
039366,000283: 37,3702  E6,1661                                  EBANK=   AOG                                   
039367,000284: 37,3702           03656 76066  REPOSADR           2CADR    REDOPOSE                              

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