Source Code
These source-code files derive from a printout of Luminary 210 (Apollo 15-17
Lunar Module guidance computer program), from the personal library of
original AGC developer Don Eyles, digitally photographed at archive.org,
financially sponsored by Jim Lawton, and transcribed to source code by a
team of volunteers. This colorized, syntax-highlighted form was created
by assembling that transcribed source code. Note that the full page images
are available on the
Virtual AGC project page at archive.org, while reduced-size images
are presented at the VirtualAGC project website. Report or fix any
transcription errors at
the Virtual AGC project code repository. Notations on the program listing read, in part: GAP: ASSEMBLE REVISION 210 OF AGC PROGRAM LUMINARY BY NASA 2021112-161 17:11 MAR. 19,1971Note that the date is the date of the printout, not the date of the program revision. |
030791,000002: ## Copyright: Public domain.
030792,000003: ## Filename: R31.agc
030793,000004: ## Purpose: A section of Luminary revision 210.
030794,000005: ## It is part of the source code for the Lunar Module's (LM)
030795,000006: ## Apollo Guidance Computer (AGC) for Apollo 15-17.
030796,000007: ## This file is intended to be a faithful transcription, except
030797,000008: ## that the code format has been changed to conform to the
030798,000009: ## requirements of the yaYUL assembler rather than the
030799,000010: ## original YUL assembler.
030800,000011: ## Reference: pp. 706-710
030801,000012: ## Assembler: yaYUL
030802,000013: ## Contact: Ron Burkey <info@sandroid.org>.
030803,000014: ## Website: www.ibiblio.org/apollo/index.html
030804,000015: ## Mod history: 2016-11-17 JL Created from Luminary131 version.
030805,000016: ## 2016-12-01 RSB Completed. Other than correction of typos
030806,000017: ## in comments and change in the positioning
030807,000018: ## of the constant V16N54, there were no changes.
030808,000019: ## 2016-12-01 HG fix operand V15N54 -> V16N54
030809,000020: ## remove V16N54 from its old location
030810,000021: ## 2016-12-25 RSB Comment-text proofed using ProoferComments
030811,000022: ## and corrected errors found.
030812,000023:
Page 706 |
030814,000025: 40,3741 BANK 40
030815,000026: 40,2000 SETLOC R31LOC
030816,000027: 40,2000 BANK
030817,000028:
030818,000029: 40,3741 COUNT* $$/R31
030819,000030:
030820,000031: 40,3741 35006 R31CALL CAF PRIO3
030821,000032: 40,3742 05076 TC FINDVAC
030822,000033: 40,3743 E7,1470 EBANK= SUBEXIT
030823,000034: 40,3743 03113 76067 2CADR V83CALL
030824,000035:
030825,000036: 40,3745 05223 DSPDELAY TC FIXDELAY
030826,000037: 40,3746 00144 DEC 100 B-14
030827,000038: 40,3747 31043 CA EXTVBACT
030828,000039: 40,3750 74731 MASK BIT12
030829,000040: 40,3751 00006 EXTEND
030830,000041: 40,3752 13745 BZF DSPDELAY
030831,000042:
030832,000043: 40,3753 35010 CAF PRIO5
030833,000044: 40,3754 05063 TC NOVAC
030834,000045: 40,3755 E7,1611 EBANK= TSTRT
030835,000046: 40,3755 03761 60107 2CADR DISPN5X
030836,000047:
030837,000048: 40,3757 15263 TCF TASKOVER
030838,000049:
030839,000050: 40,3760 04066 V16N54 VN 1654
030840,000051: 40,3761 33760 DISPN5X CAF V16N54
030841,000052: 40,3762 04607 TC BANKCALL
030842,000053: 40,3763 20323 CADR GOMARKF
030843,000054: 40,3764 05565 TC B5OFF
030844,000055: 40,3765 05565 TC B5OFF
030845,000056: 40,3766 13761 TCF DISPN5X
030846,000057:
030847,000058: 37,3113 BANK 37
030848,000059: 37,2000 SETLOC R31
030849,000060: 37,2000 BANK
030850,000061:
030851,000062: 37,3113 40103 V83CALL CS FLAGWRD7 # TEST AVERAGE G FLAG
030852,000063: 37,3114 74740 MASK AVEGFBIT
030853,000064: 37,3115 00006 EXTEND
030854,000065: 37,3116 13371 BZF MUNG? # ON - TEST MUNFLAG
030855,000066:
030856,000067: 37,3117 40104 CS FLAGWRD8
030857,000068: 37,3120 74735 MASK SURFFBIT
030858,000069: 37,3121 00006 EXTEND
030859,000070: 37,3122 13375 BZF ONEBASE # ON SURFACE - BYPASS LEMPREC
030860,000071:
030861,000072: 37,3123 06060 TC INTPRET # EXTRAPOLATE BOTH STATE VECTORS
030862,000073: 37,3124 77634 RTB
Page 707 |
030864,000075: 37,3125 21603 LOADTIME
030865,000076: 37,3126 34041 STCALL TDEC1
030866,000077: 37,3127 27115 LEMPREC # PRECISION BASE VECTOR FOR LM
030867,000078: 37,3130 77775 VLOAD
030868,000079: 37,3131 00017 RATT1
030869,000080: 37,3132 26161 STOVL BASETHP
030870,000081: 37,3133 00025 VATT1
030871,000082: 37,3134 16104 STODL BASETHV
030872,000083: 37,3135 00015 TAT
030873,000084: 37,3136 02113 DOCMBASE STORE BASETIME # PRECISION BASE VECTOR FOR CM
030874,000085: 37,3137 34041 STCALL TDEC1
030875,000086: 37,3140 27101 CSMPREC
030876,000087: 37,3141 77775 VLOAD
030877,000088: 37,3142 00017 RATT1
030878,000089: 37,3143 26131 STOVL BASEOTP
030879,000090: 37,3144 00025 VATT1
030880,000091: 37,3145 02172 STORE BASEOTV
030881,000092: 37,3146 77776 EXIT
030882,000093:
030883,000094: 37,3147 40103 REV83 CS FLAGWRD7
030884,000095: 37,3150 74740 MASK AVEGFBIT
030885,000096: 37,3151 00006 EXTEND
030886,000097: 37,3152 13320 BZF GETRVN # IF AVEGFLAG SET, USE RN,VN
030887,000098:
030888,000099: 37,3153 40104 CS FLAGWRD8
030889,000100: 37,3154 74735 MASK SURFFBIT
030890,000101: 37,3155 00006 EXTEND
030891,000102: 37,3156 13362 BZF R31SURF # IF ON SURFACE, USE LEMAREC
030892,000103:
030893,000104: 37,3157 06060 TC INTPRET # DO CONIC EXTRAPOLATION FOR BOTH VEHICLES
030894,000105: 37,3160 77634 RTB
030895,000106: 37,3161 21603 LOADTIME
030896,000107: 37,3162 34041 STCALL TDEC1
030897,000108: 37,3163 27447 INTSTALL
030898,000109: 37,3164 43175 VLOAD CLEAR
030899,000110: 37,3165 02161 BASETHP
030900,000111: 37,3166 00263 MOONFLAG
030901,000112: 37,3167 25535 STOVL RCV
030902,000113: 37,3170 02104 BASETHV
030903,000114: 37,3171 15543 STODL VCV
030904,000115: 37,3172 02113 BASETIME
030905,000116: 37,3173 43014 BOF SET # GET APPROPRIATE MOONFLAG SETTING
030906,000117: 37,3174 04344 MOONTHIS
030907,000118: 37,3175 77177 +2
030908,000119: 37,3176 00063 MOONFLAG
030909,000120: 37,3177 77614 SET
030910,000121: 37,3200 01473 INTYPFLG # CONIC EXTRAP.
030911,000122: 37,3201 35517 STCALL TET
030912,000123: 37,3202 27145 INTEGRVS # INTEGRATION --- AT LAST---
030913,000124: 37,3203 77775 OTHCONIC VLOAD
Page 708 |
030915,000126: 37,3204 00001 RATT
030916,000127: 37,3205 26200 STOVL RONE
030917,000128: 37,3206 00007 VATT
030918,000129: 37,3207 36206 STCALL VONE # GET SET FOR CONIC EXTRAP.,OTHER.
030919,000130: 37,3210 27447 INTSTALL
030920,000131: 37,3211 71214 SET DLOAD
030921,000132: 37,3212 01473 INTYPFLG
030922,000133: 37,3213 00015 TAT
030923,000134: 37,3214 00041 OTHINT STORE TDEC1
030924,000135: 37,3215 43175 VLOAD CLEAR
030925,000136: 37,3216 02131 BASEOTP
030926,000137: 37,3217 00263 MOONFLAG
030927,000138: 37,3220 25535 STOVL RCV
030928,000139: 37,3221 02172 BASEOTV
030929,000140: 37,3222 15543 STODL VCV
030930,000141: 37,3223 02113 BASETIME
030931,000142: 37,3224 43014 BOF SET
030932,000143: 37,3225 04344 MOONTHIS
030933,000144: 37,3226 77230 +2
030934,000145: 37,3227 00063 MOONFLAG
030935,000146: 37,3230 35517 STCALL TET
030936,000147: 37,3231 27145 INTEGRVS
030937,000148: 37,3232 52375 COMPDISP VLOAD VSU
030938,000149: 37,3233 00001 RATT
030939,000150: 37,3234 02200 RONE
030940,000151: 37,3235 65234 RTB PDDL
030941,000152: 37,3236 21722 NORMUNX1 # UNIT(RANGE) TO PD 0-5
030942,000153: 37,3237 00045 36D
030943,000154: 37,3240 77657 SL* # RESCALE AFTER NORMUNIT
030944,000155: 37,3241 20201 0,1
030945,000156: 37,3242 26214 STOVL RANGE # SCALED 2(29)M
030946,000157: 37,3243 00007 VATT
030947,000158: 37,3244 50251 VSU DOT # (VCM-VLM).UNIT(LOS), PD=0
030948,000159: 37,3245 02206 VONE
030949,000160: 37,3246 77752 SL1 # SCALED 2(7)M/CS
030950,000161: 37,3247 26216 STOVL RRATE
030951,000162: 37,3250 02200 RONE
030952,000163: 37,3251 63256 UNIT PDVL # UNIT(R) TO PD 0-5
030953,000164: 37,3252 06477 UNITZ
030954,000165: 37,3253 77624 CALL
030955,000166: 37,3254 47653 CDU*NBSM
030956,000167: 37,3255 41505 VXM PUSH # UNIT(Z)/4 TO PD 6-11
030957,000168: 37,3256 01732 REFSMMAT
030958,000169: 37,3257 72431 VPROJ VSL2 # UNIT(P)=UNIT(UZ-(UZ)PROJ(UR))
030959,000170: 37,3260 00001 0D
030960,000171: 37,3261 53445 BVSU UNIT
030961,000172: 37,3262 00007 6D
030962,000173: 37,3263 47315 PDVL VXV # UNIT(P) TO PD 12-17
030963,000174: 37,3264 00001 0D # UNIT(RL)
030964,000175: 37,3265 02206 VONE
Page 709 |
030966,000177: 37,3266 50235 VXV DOT # (UR * VL)*UR . U(P)
030967,000178: 37,3267 00001 0D
030968,000179: 37,3270 00015 12D
030969,000180: 37,3271 77715 PDVL # SIGN TO 12-13 , LOAD U(P)
030970,000181: 37,3272 75241 DOT SIGN
030971,000182: 37,3273 00007 6D
030972,000183: 37,3274 00015 12D
030973,000184: 37,3275 65512 SL2 ACOS # ARCCOS(UP.UZ(SIGN))
030974,000185: 37,3276 26220 STOVL RTHETA
030975,000186: 37,3277 00001 0D
030976,000187: 37,3300 51041 DOT BPL # IF UR.UZ NEG,
030977,000188: 37,3301 00007 6D # RTHETA = 1 - RTHETA
030978,000189: 37,3302 77307 +5
030979,000190: 37,3303 45345 DLOAD DSU
030980,000191: 37,3304 06513 DPPOSMAX
030981,000192: 37,3305 02220 RTHETA
030982,000193: 37,3306 02220 STORE RTHETA
030983,000194: 37,3307 77776 EXIT
030984,000195:
030985,000196: 37,3310 34740 CA BIT5
030986,000197: 37,3311 71043 MASK EXTVBACT
030987,000198: 37,3312 00006 EXTEND # IF ANSWERED,
030988,000199: 37,3313 15474 BZF ENDEXT # TERMINATE
030989,000200:
030990,000201: 37,3314 41043 CS EXTVBACT
030991,000202: 37,3315 74731 MASK BIT12
030992,000203: 37,3316 27043 ADS EXTVBACT # SET BIT 12
030993,000204: 37,3317 13147 TCF REV83 # AND START AGAIN.
030994,000205:
030995,000206: 37,3320 37731 GETRVN CA PRIO22 # INHIBIT SERVICER
030996,000207: 37,3321 05137 TC PRIOCHNG
030997,000208: 37,3322 06060 TC INTPRET
030998,000209: 37,3323 40375 VLOAD SETPD
030999,000210: 37,3324 01220 RN # LM STATE VECTOR IN RN,VN
031000,000211: 37,3325 00001 0
031001,000212: 37,3326 26200 STOVL RONE
031002,000213: 37,3327 01226 VN
031003,000214: 37,3330 26206 STOVL VONE # LOAD R(CSM),V(CSM) IN CASE MUNFLAG SET
031004,000215: 37,3331 01724 V(CSM) # (TO INSURE TIME COMPATABILITY)
031005,000216: 37,3332 65315 PDVL PDDL
031006,000217: 37,3333 01716 R(CSM)
031007,000218: 37,3334 01234 PIPTIME
031008,000219: 37,3335 77776 EXIT
031009,000220: 37,3336 35006 CA PRIO3
031010,000221: 37,3337 05137 TC PRIOCHNG
031011,000222: 37,3340 06060 TC INTPRET
031012,000223: 37,3341 77214 BOFF VLOAD
031013,000224: 37,3342 03347 MUNFLAG
031014,000225: 37,3343 77355 GETRVN2 # IF MUNFLAG RESET, DO CM DELTA PRECISION
Page 710 |
031016,000227: 37,3344 60505 VXM VSR4 # CHANGE TO REFERENCE SYSTEM AND RESCALE
031017,000228: 37,3345 01732 REFSMMAT
031018,000229: 37,3346 77715 PDVL # R TO PD 0-5
031019,000230: 37,3347 76505 VXM VSL1
031020,000231: 37,3350 01732 REFSMMAT
031021,000232: 37,3351 40206 PUSH SETPD # V TO PD 5-11
031022,000233: 37,3352 00001 0
031023,000234: 37,3353 77650 GOTO
031024,000235: 37,3354 77232 COMPDISP
031025,000236:
031026,000237: 37,3355 77624 GETRVN2 CALL
031027,000238: 37,3356 27447 INTSTALL
031028,000239: 37,3357 52014 CLEAR GOTO
031029,000240: 37,3360 01673 INTYPFLG # PREC EXTRAP FOR OTHER
031030,000241: 37,3361 77214 OTHINT
031031,000242: 37,3362 06060 R31SURF TC INTPRET
031032,000243: 37,3363 77634 RTB # LM IS ON SURFACE, SO PRECISION
031033,000244: 37,3364 21603 LOADTIME # INTEGRATION USES PLANETARY INERTIAL
031034,000245: 37,3365 34041 STCALL TDEC1 # ORIENTATION SUBROUTINE
031035,000246: 37,3366 27115 LEMPREC
031036,000247: 37,3367 77650 GOTO # DO CSM CONIC
031037,000248: 37,3370 77203 OTHCONIC
031038,000249: 37,3371 40102 MUNG? CS FLAGWRD6
031039,000250: 37,3372 74735 MASK MUNFLBIT
031040,000251: 37,3373 00006 EXTEND
031041,000252: 37,3374 13320 BZF GETRVN # IF MUNFLAG SET, CSM BASE NOT NEEDED
031042,000253:
031043,000254: 37,3375 06060 ONEBASE TC INTPRET # GET CSM BASE VECTOR
031044,000255: 37,3376 52034 RTB GOTO
031045,000256: 37,3377 21603 LOADTIME
031046,000257: 37,3400 77136 DOCMBASE
031047,000258:
End of include-file R31.agc. Parent file is MAIN.agc