Block I Apollo Guidance Computer (AGC) : How To Build One in Your Basement
Block I Apollo Guidance Computer (AGC) : How To Build One in Your Basement
John Pultorak
December, 2004
Abstract
This report describes my successful project to build a working reproduction of the 1964
prototype for the Block I Apollo Guidance Computer. The AGC is the flight computer for the
Ap ollo m oon lan din gs, and is the wo rld’s first in tegra ted c ircuit com pu ter.
If you like, you can build one too. It will take you less time, and yours will be better than
mine.
Part 3 PROC M odule: Design and construction of the processing (CPU) modu le.
Part 4 MEM Module: Design and construction of the mem ory module.
Part 6 Assem bler: A cross-a ssem bler for AG C softw are dev elopm ent.
Part 7 C+ + S imu lator: A low-level simulator that runs assemb led AGC code.
Part 9 Test & Che ckou t: A suite of test programs in AG C assembly langu age.
Overview
A suite of test and checkout programs were coded to verify the operation of the AGC
simulators and the hardware AGC.
TECO1
First test and checkout program for the Block 1 AGC. Tests basic instructions: TC, CCS,
INDEX, XCH, CS, TS, AD, MA SK. Enters an infinite loop at the end of the test. The A register
contains the cod e for the test that failed, or the PAS S code if all tests succeeded. See test
codes (in octal) below.
Code Interpretation
01 TC check failed
02 CCS check failed
03 INDEX check failed
04 XCH check failed
05 CS check failed
06 TS check failed
07 AD check failed
10 MAS K check failed
12345 PASSED all checks
TECO2
Second test and checkout program for the Block 1 AGC. Tests extracode instructions: MP,
DV, SU. Enters an infinite loop at the end of the test. The A register contains the code for
the test that failed, or the PASS code if all tests succeeded. See test codes (in octal) below.
Code Interpretation
01 MP check failed
02 DV check failed
03 SU check failed
12345 PASSED all checks
TECO3
Third test and checkout program for the Block 1 AGC. Tests editing registers: CYR, SR, CYL,
SL. Enters an infinite loop at the end of the test. The A register contains the code for the
test that failed, or the PASS code if all tests succeeded. See test codes (in octal) below.
Code Interpretation
01 CYR check failed
02 SR check failed
03 CYL check failed
04 SL check failed
12345 PASSED all checks
TECO5
Exercises AGC interrupts by initializing 4 counters, and then entering into a loop that
increments the first counter on each iteration. Each of the other 3 counters is assigned to an
interrupt and is incremented in the interrupt service routine for that interrupt: KEYRUPT,
T3R UPT , and D SR UPT . Interrupts a re inhib ited an d en abled durin g each iteration o f the m ain
loop with INHINT and RELINT instructions, and are automatically inhibited during part of
each iteration by an overflow condition in register A.
TECO_STBY
An extrem ely sim ple p rogra m for testin g th e ST AN DB Y fun ction . STA ND BY is disabled fo r 2
NOOP instructions and then is enabled. After that, the program infinitely loops (TC TRAP)
with STANDBY enabled.
TECO1 assembler listing
Block I Apollo Guidance Computer (AGC4) assembler version 1.6 for EPROM
; TECO1 (file:teco1.asm)
;
; Version: 1.0
; Author: John Pultorak
; Date: 9/14/2001
;
; PURPOSE:
; Test and checkout program for the Block 1 Apollo Guidance Computer.
; Tests basic instructions: TC, CCS, INDEX, XCH, CS, TS, AD, MASK.
;
; OPERATION:
; Enters an infinite loop at the end of the test. The A register
; contains the code for the test that failed, or the PASS code if all
; tests succeeded. See test codes below.
;
; ERRATA:
; - Written for the AGC4R assembler. The assembler directives and
; syntax differ somewhat from the original AGC assembler.
; - The tests attempt to check all threads, but are not exhaustive.
;
; SOURCES:
; Information on the Block 1 architecture: instruction set, instruction
; sequences, registers, register transfers, control pulses, memory and
; memory addressing, I/O assignments, interrupts, and involuntary
; counters was obtained from:
;
; A. Hopkins, R. Alonso, and H. Blair-Smith, "Logical Description
; for the Apollo Guidance Computer (AGC4)", R-393,
; MIT Instrumentation Laboratory, Cambridge, MA, Mar. 1963.
;
; Supplementary information was obtained from:
;
; R. Alonso, J. H. Laning, Jr. and H. Blair-Smith, "Preliminary
; MOD 3C Programmer's Manual", E-1077, MIT Instrumentation
; Laboratory, Cambridge, MA, Nov. 1961.
;
; B. I. Savage and A. Drake, "AGC4 Basic Training Manual, Volume I",
; E-2052, MIT Instrumentation Laboratory, Cambridge,
; MA, Jan. 1967.
;
; E. C. Hall, "MIT's Role in Project Apollo, Volume III, Computer
; Subsystem", R-700, MIT Charles Stark Draper Laboratory,
; Cambridge, MA, Aug. 1972.
;
; A. Hopkins, "Guidance Computer Design, Part VI", source unknown.
;
; A. I. Green and J. J. Rocchio, "Keyboard and Display System Program
; for AGC (Program Sunrise)", E-1574, MIT Instrumentation
; Laboratory, Cambridge, MA, Aug. 1964.
;
; E, C. Hall, "Journey to the Moon: The History of the Apollo
; Guidance Computer", AIAA, Reston VA, 1996.
;
; ----------------------------------------------
; ERASEABLE MEMORY -- DATA SEGMENT
; CCS test
00102 0102 00000 1 CCSk DS %0
; INDEX test
00103 0103 00000 1 INDXval DS 0
; XCH test
; pre-set in erasable memory because we don't
; want to use XCH to initialize them prior to testing XCH.
00104 0104 00000 1 XCHkP0 DS +0
00105 0105 77777 0 XCHkM0 DS -0
00106 0106 52525 1 XCHkalt1 DS %52525 ; alternating bit pattern 1
00107 0107 25252 0 XCHkalt2 DS %25252 ; alternating bit pattern 2
; TS test
00110 0110 77777 0 TSk DS -0
; AD test
00111 0111 77777 0 ADk DS -0
; ----------------------------------------------
; ENTRY POINTS
; program (re)start
ORG GOPROG
02000 2000 0 1,2030 0 TC goMAIN
ORG ERRUPT
02010 2010 5 0,0026 0 TS ARUPT
02011 2011 3 0,0001 0 XCH Q
02012 2012 5 0,0027 1 TS QRUPT
02013 2013 0 1,2717 1 TC goER
ORG DSRUPT
02014 2014 5 0,0026 0 TS ARUPT
02015 2015 3 0,0001 0 XCH Q
02016 2016 5 0,0027 1 TS QRUPT
02017 2017 0 1,2717 1 TC goDS
ORG KEYRUPT
02020 2020 5 0,0026 0 TS ARUPT
02021 2021 3 0,0001 0 XCH Q
02022 2022 5 0,0027 1 TS QRUPT
02023 2023 0 1,2717 1 TC goKEY
ORG UPRUPT
02024 2024 5 0,0026 0 TS ARUPT
02025 2025 3 0,0001 0 XCH Q
02026 2026 5 0,0027 1 TS QRUPT
02027 2027 0 1,2717 1 TC goUP
; ----------------------------------------------
; FIXED MEMORY -- SHARED DATA SEGMENT
; ----------------------------------------------
; MAIN PROGRAM
goMAIN EQU *
02030 2030 2 0,0000 0 INHINT ; disable interrupts
fail EQU *
02043 2043 3 0,0100 0 XCH curtest ; load last passed test into A
02044 2044 5 0,0100 0 TS curtest
end EQU *
02045 2045 0 1,2045 1 TC end ; finished, TC trap
; ----------------------------------------------
; INITIALIZE FOR START OF TESTING
begin EQU *
02047 2047 3 1,2046 1 XCH STRTcode
02050 2050 5 0,0100 0 TS curtest ; set current test code to START
02051 2051 0 0,0000 0 RETURN
; ----------------------------------------------
; TEST TC INSTRUCTION SUBROUTINE
; L: TC K
; Verifies the following:
; - Set C(Q) = TC L+1
; - Take next instruction from K, and proceed from there.
chkTC EQU *
02054 2054 3 0,0001 0 XCH Q
02055 2055 5 0,0101 1 TS savQ ; save return address
; attempt a jump
02060 2060 0 1,2062 1 TC *+2 ; make test jump
02061 2061 0 1,2043 1 TCret1 TC fail ; failed to jump
chkCCS EQU *
02110 2110 3 0,0001 0 XCH Q
02111 2111 5 0,0101 1 TS savQ ; save return address
; Decrementing loop
; - always executes at least once (tests at end of loop)
; - loops 'INDXst+1' times; decrements INDXval
INDXlop EQU *
02251 2251 5 0,0103 0 TS INDXval
chkXCH EQU *
02274 2274 3 0,0001 0 XCH Q
02275 2275 5 0,0101 1 TS savQ ; save return address
; ----------------------------------------------
; TEST CS INSTRUCTION SUBROUTINE
; L: CS K
; Verifies the following:
; - Set C(A) = -C(K)
; - Take next instruction from L+1
chkCS EQU *
02400 2400 3 0,0001 0 XCH Q
02401 2401 5 0,0101 1 TS savQ ; save return address
chkTS EQU *
02446 2446 3 0,0001 0 XCH Q
02447 2447 5 0,0101 1 TS savQ ; save return address
; initialize TSk to -0
02452 2452 3 1,2442 1 CAF TSmzero
02453 2453 3 0,0110 1 XCH TSk
chkAD EQU *
02573 2573 3 0,0001 0 XCH Q
02574 2574 5 0,0101 1 TS savQ ; save return address
chkMASK EQU *
02674 2674 3 0,0001 0 XCH Q
02675 2675 5 0,0101 1 TS savQ ; save return address
finish EQU *
02714 2714 3 1,2713 0 CAF PASScode
02715 2715 5 0,0100 0 TS curtest ; set current test code to PASS
02716 2716 0 0,0000 0 RETURN
; ----------------------------------------------
; INTERRUPT SERVICE ROUTINE
goT3 EQU *
goER EQU *
goDS EQU *
goKEY EQU *
goUP EQU *
endRUPT EQU *
02717 2717 3 0,0027 1 XCH QRUPT ; restore Q
02720 2720 5 0,0001 0 TS Q
02721 2721 3 0,0026 0 XCH ARUPT ; restore A
02722 2722 2 0,0000 1 RESUME ; finished, go back
Symbol table:
START 000000 TCtst 000001 CCStst 000002
INDEXtst 000003 XCHtst 000004 CStst 000005
TStst 000006 ADtst 000007 MASKtst 000010
PASS 012345 EXTENDER 005777 OVFCNTR 000034
curtest 000100 savQ 000101 CCSk 000102
INDXval 000103 XCHkP0 000104 XCHkM0 000105
XCHkalt1 000106 XCHkalt2 000107 TSk 000110
ADk 000111 GOPROG 002000 T3RUPT 002004
ERRUPT 002010 DSRUPT 002014 KEYRUPT 002020
UPRUPT 002024 goMAIN 002030 fail 002043
end 002045 STRTcode 002046 begin 002047
TCcode 002052 Qtest 002053 chkTC 002054
TCret1 002061 CCScode 002073 CCSkM2 002074
CCSkM1 002075 CCSkM0 002076 CCSkP0 002077
CCSkP1 002100 CCSkP2 002101 CCSdM2 002102
CCSdM1 002103 CCSdM0 002104 CCSdP0 002105
CCSdP1 002106 CCSdP2 002107 chkCCS 002110
INDXcode 002234 INDXst 002235 INDXbas 002236
chkINDEX 002244 INDXlop 002251 XCHcode 002267
XCHfP0 002270 XCHfM0 002271 XCHfalt1 002272
XCHfalt2 002273 chkXCH 002274 CScode 002373
CSkP0 002374 CSkM0 002375 CSkalt1 002376
CSkalt2 002377 chkCS 002400 TScode 002437
TSone 002440 TSzero 002441 TSmzero 002442
TSmone 002443 TSkP1 002444 TSkM1 002445
chkTS 002446 ADcode 002557 ADplus0 002560
ADplus1 002561 ADmin1 002562 AD25252 002563
AD12525 002564 AD37777 002565 AD12524 002566
AD52525 002567 AD65252 002570 AD40000 002571
AD65253 002572 chkAD 002573 MASKcode 002670
MASK1 002671 MASK2 002672 MASKval 002673
chkMASK 002674 PASScode 002713 finish 002714
goT3 002717 goER 002717 goDS 002717
goKEY 002717 goUP 002717 endRUPT 002717
ARUPT 000026 Q 000001 QRUPT 000027
A 000000
TECO2 assembler listing
Block I Apollo Guidance Computer (AGC4) assembler version 1.6 for EPROM
; TECO2 (file:teco2.asm)
;
; Version: 1.0
; Author: John Pultorak
; Date: 9/14/2001
;
; PURPOSE:
; Test and checkout program for the Block 1 Apollo Guidance Computer.
; Tests extracode instructions: MP, DV, SU
;
; OPERATION:
; Enters an infinite loop at the end of the test. The A register
; contains the code for the test that failed, or the PASS code if all
; tests succeeded. See test codes below.
;
; ERRATA:
; - Written for the AGC4R assembler. The assembler directives and
; syntax differ somewhat from the original AGC assembler.
; - The tests attempt to check all threads, but are not exhaustive.
;
; SOURCES:
; Information on the Block 1 architecture: instruction set, instruction
; sequences, registers, register transfers, control pulses, memory and
; memory addressing, I/O assignments, interrupts, and involuntary
; counters was obtained from:
;
; A. Hopkins, R. Alonso, and H. Blair-Smith, "Logical Description
; for the Apollo Guidance Computer (AGC4)", R-393,
; MIT Instrumentation Laboratory, Cambridge, MA, Mar. 1963.
;
; Supplementary information was obtained from:
;
; R. Alonso, J. H. Laning, Jr. and H. Blair-Smith, "Preliminary
; MOD 3C Programmer's Manual", E-1077, MIT Instrumentation
; Laboratory, Cambridge, MA, Nov. 1961.
;
; B. I. Savage and A. Drake, "AGC4 Basic Training Manual, Volume I",
; E-2052, MIT Instrumentation Laboratory, Cambridge,
; MA, Jan. 1967.
;
; E. C. Hall, "MIT's Role in Project Apollo, Volume III, Computer
; Subsystem", R-700, MIT Charles Stark Draper Laboratory,
; Cambridge, MA, Aug. 1972.
;
; A. Hopkins, "Guidance Computer Design, Part VI", source unknown.
;
; A. I. Green and J. J. Rocchio, "Keyboard and Display System Program
; for AGC (Program Sunrise)", E-1574, MIT Instrumentation
; Laboratory, Cambridge, MA, Aug. 1964.
;
; E, C. Hall, "Journey to the Moon: The History of the Apollo
; Guidance Computer", AIAA, Reston VA, 1996.
;
ORG EXTENDER
05777 5777 47777 0 DS %47777 ; needed for EXTEND
OVFCNTR EQU %00034 ; overflow counter
; ----------------------------------------------
; ERASEABLE MEMORY -- DATA SEGMENT
; MP test
00102 0102 00000 1 MPindex DS %0
00103 0103 00000 1 MPXTND DS %0 ; indexed extend
; DV test
00104 0104 00000 1 DVsavA DS %0
00105 0105 00000 1 DVindex DS %0
00106 0106 00000 1 DVXTND DS %0 ; indexed extend
; SU test
00107 0107 77777 0 SUk DS -0
; ----------------------------------------------
; ENTRY POINTS
; program (re)start
ORG GOPROG
02000 2000 0 1,2030 0 TC goMAIN
ORG ERRUPT
02010 2010 5 0,0026 0 TS ARUPT
02011 2011 3 0,0001 0 XCH Q
02012 2012 5 0,0027 1 TS QRUPT
02013 2013 0 1,2742 1 TC goER
ORG DSRUPT
02014 2014 5 0,0026 0 TS ARUPT
02015 2015 3 0,0001 0 XCH Q
02016 2016 5 0,0027 1 TS QRUPT
02017 2017 0 1,2742 1 TC goDS
ORG KEYRUPT
02020 2020 5 0,0026 0 TS ARUPT
02021 2021 3 0,0001 0 XCH Q
02022 2022 5 0,0027 1 TS QRUPT
02023 2023 0 1,2742 1 TC goKEY
ORG UPRUPT
02024 2024 5 0,0026 0 TS ARUPT
02025 2025 3 0,0001 0 XCH Q
02026 2026 5 0,0027 1 TS QRUPT
02027 2027 0 1,2742 1 TC goUP
; ----------------------------------------------
; FIXED MEMORY -- SHARED DATA SEGMENT
; ----------------------------------------------
; MAIN PROGRAM
goMAIN EQU *
02030 2030 2 0,0000 0 INHINT ; disable interrupts
fail EQU *
02036 2036 3 0,0100 0 XCH curtest ; load last passed test into A
02037 2037 5 0,0100 0 TS curtest
end EQU *
02040 2040 0 1,2040 1 TC end ; finished, TC trap
; ----------------------------------------------
; INITIALIZE FOR START OF TESTING
begin EQU *
02042 2042 3 1,2041 0 XCH STRTcode
02043 2043 5 0,0100 0 TS curtest ; set current test code to START
02044 2044 0 0,0000 0 RETURN
; ----------------------------------------------
; TEST MP INSTRUCTION SUBROUTINE
; L: MP K
; Verifies the following
; - Set C(A,LP) = b(A) * C(K)
; - Take next instruction from L+1
; MP test values
;
02046 2046 00037 0 MPstart DS 31 ; loop MPstart+1 times
; A = upper product
MPchkA EQU *
; check boundary conditions
02147 2147 37776 0 DS %37776 ; check #00
02150 2150 40001 1 DS %40001 ; check #01
02151 2151 40001 1 DS %40001 ; check #02
02152 2152 37776 0 DS %37776 ; check #03
02153 2153 00000 1 DS %00000 ; check #04
02154 2154 77777 0 DS %77777 ; check #05
02155 2155 77777 0 DS %77777 ; check #06
02156 2156 00000 1 DS %00000 ; check #07
; randomly selected checks
02157 2157 00000 1 DS %00000 ; check #08 (7 * 17)
02160 2160 00000 1 DS %00000 ; check #09 (17 * 7)
02161 2161 00000 1 DS %00000 ; check #10 (29 * 41)
02162 2162 00000 1 DS %00000 ; check #11 (41 * 29)
02163 2163 00000 1 DS %00000 ; check #12 (53 * 67)
02164 2164 00000 1 DS %00000 ; check #13 (67 * 53)
02165 2165 00000 1 DS %00000 ; check #14 (79 * 97)
02166 2166 00000 1 DS %00000 ; check #15 (97 * 79)
02167 2167 00000 1 DS %00000 ; check #16 (107 * 127)
02170 2170 00000 1 DS %00000 ; check #17 (127 * 107)
; randomly selected checks (two word product)
02171 2171 00003 1 DS %00003 ; check #18 (253 * 197)
02172 2172 00003 1 DS %00003 ; check #19 (197 * 253)
02173 2173 00011 1 DS %00011 ; check #20 (429 * 351)
02174 2174 00011 1 DS %00011 ; check #21 (351 * 429)
02175 2175 00126 1 DS %00126 ; check #22 (1325 * 1067)
02176 2176 00126 1 DS %00126 ; check #23 (1067 * 1325)
02177 2177 02015 1 DS %02015 ; check #24 (4713 * 3605)
02200 2200 02015 1 DS %02015 ; check #25 (3605 * 4713)
02201 2201 07446 0 DS %07446 ; check #26 (8218 * 7733)
02202 2202 07446 0 DS %07446 ; check #27 (7733 * 8218)
02203 2203 21065 1 DS %21065 ; check #28 (12475 * 11501)
02204 2204 21065 1 DS %21065 ; check #29 (11501 * 12475)
02205 2205 35600 1 DS %35600 ; check #30 (16235 * 15372)
02206 2206 35600 1 DS %35600 ; check #31 (15372 * 16235)
; LP = lower product
MPchkLP EQU *
; check boundary conditions
02207 2207 00001 0 DS %00001 ; check #00
02210 2210 77776 1 DS %77776 ; check #01
02211 2211 77776 1 DS %77776 ; check #02
02212 2212 00001 0 DS %00001 ; check #03
02213 2213 00000 1 DS %00000 ; check #04
02214 2214 77777 0 DS %77777 ; check #05
02215 2215 77777 0 DS %77777 ; check #06
02216 2216 00000 1 DS %00000 ; check #07
; randomly selected checks
02217 2217 00167 1 DS %00167 ; check #08 (7 * 17)
02220 2220 00167 1 DS %00167 ; check #09 (17 * 7)
02221 2221 02245 0 DS %02245 ; check #10 (29 * 41)
02222 2222 02245 0 DS %02245 ; check #11 (41 * 29)
02223 2223 06737 1 DS %06737 ; check #12 (53 * 67)
02224 2224 06737 1 DS %06737 ; check #13 (67 * 53)
02225 2225 16757 0 DS %16757 ; check #14 (79 * 97)
02226 2226 16757 0 DS %16757 ; check #15 (97 * 79)
02227 2227 32425 0 DS %32425 ; check #16 (107 * 127)
02230 2230 32425 0 DS %32425 ; check #17 (127 * 107)
; randomly selected checks (two word product)
02231 2231 01261 0 DS %01261 ; check #18 (253 * 197)
02232 2232 01261 0 DS %01261 ; check #19 (197 * 253)
02233 2233 06063 1 DS %06063 ; check #20 (429 * 351)
02234 2234 06063 1 DS %06063 ; check #21 (351 * 429)
02235 2235 11217 0 DS %11217 ; check #22 (1325 * 1067)
02236 2236 11217 0 DS %11217 ; check #23 (1067 * 1325)
02237 2237 00235 0 DS %00235 ; check #24 (4713 * 3605)
02240 2240 00235 0 DS %00235 ; check #24 (3605 * 4713)
02241 2241 30542 1 DS %30542 ; check #26 (8218 * 7733)
02242 2242 30542 1 DS %30542 ; check #27 (7733 * 8218)
02243 2243 00437 1 DS %00437 ; check #28 (12475 * 11501)
02244 2244 00437 1 DS %00437 ; check #29 (11501 * 12475)
02245 2245 06404 1 DS %06404 ; check #30 (16235 * 15372)
02246 2246 06404 1 DS %06404 ; check #31 (15372 * 16235)
chkMP EQU *
02247 2247 3 0,0001 0 XCH Q
02250 2250 5 0,0101 1 TS savQ ; save return address
; Decrementing loop
; - always executes at least once (tests at end of loop)
;------------------------------
; MP check starts here
; uses MPindex to access test values
MPloop EQU *
02254 2254 5 0,0102 1 TS MPindex ; save new index
; verify C(A)
02264 2264 4 0,0000 0 COM ; get -A
02265 2265 2 0,0102 0 INDEX MPindex
02266 2266 6 1,2147 1 AD MPchkA ; put (-A) + expected value in A
02267 2267 1 0,0000 0 CCS A ; compare
02270 2270 0 1,2036 0 TC fail ; >0 (A < expected value)
02271 2271 0 1,2036 0 TC fail ; +0
02272 2272 0 1,2036 0 TC fail ; <0 (A > expected value)
; verify C(LP)
02273 2273 4 0,0003 0 CS LP ; get -A
02274 2274 2 0,0102 0 INDEX MPindex
02275 2275 6 1,2207 0 AD MPchkLP ; put (-A) + expected value in A
02276 2276 1 0,0000 0 CCS A ; compare
02277 2277 0 1,2036 0 TC fail ; >0 (A < expected value)
02300 2300 0 1,2036 0 TC fail ; +0
02301 2301 0 1,2036 0 TC fail ; <0 (A > expected value)
; end of MP check
;------------------------------
; DV test values
;
02310 2310 00037 0 DVstart DS 31 ; loop DVstart+1 times
; A = quotient
DVchkA EQU *
02411 2411 37777 1 DS %37777 ; check #00 (+0/+0)
02412 2412 40000 0 DS %40000 ; check #01 (+0/-0)
02413 2413 40000 0 DS %40000 ; check #02 (-0/+0)
02414 2414 37777 1 DS %37777 ; check #03 (-0/-0)
; LP = sign
DVchkLP EQU *
02511 2511 00001 0 DS %00001 ; check #00 (+0/+0)
02512 2512 40000 0 DS %40000 ; check #01 (+0/-0)
02513 2513 40001 1 DS %40001 ; check #02 (-0/+0)
02514 2514 00001 0 DS %00001 ; check #03 (-0/-0)
chkDV EQU *
02551 2551 3 0,0001 0 XCH Q
02552 2552 5 0,0101 1 TS savQ ; save return address
; Decrementing loop
; - always executes at least once (tests at end of loop)
;------------------------------
; verify C(Q)
02567 2567 4 0,0001 1 CS Q ; get -A
02570 2570 2 0,0105 1 INDEX DVindex
02571 2571 6 1,2451 0 AD DVchkQ ; put (-A) + expected value in A
02572 2572 1 0,0000 0 CCS A ; compare
02573 2573 0 1,2036 0 TC fail ; >0 (A < expected value)
02574 2574 0 1,2036 0 TC fail ; +0
02575 2575 0 1,2036 0 TC fail ; <0 (A > expected value)
; verify C(A)
02576 2576 4 0,0104 0 CS DVsavA ; get -A
02577 2577 2 0,0105 1 INDEX DVindex
02600 2600 6 1,2411 1 AD DVchkA ; put (-A) + expected value in A
02601 2601 1 0,0000 0 CCS A ; compare
02602 2602 0 1,2036 0 TC fail ; >0 (A < expected value)
02603 2603 0 1,2036 0 TC fail ; +0
02604 2604 0 1,2036 0 TC fail ; <0 (A > expected value)
; verify C(LP)
02605 2605 4 0,0003 0 CS LP ; get -A
02606 2606 2 0,0105 1 INDEX DVindex
02607 2607 6 1,2511 0 AD DVchkLP ; put (-A) + expected value in A
02610 2610 1 0,0000 0 CCS A ; compare
02611 2611 0 1,2036 0 TC fail ; >0 (A < expected value)
02612 2612 0 1,2036 0 TC fail ; +0
02613 2613 0 1,2036 0 TC fail ; <0 (A > expected value)
; end of DV check
;------------------------------
chkSU EQU *
02635 2635 3 0,0001 0 XCH Q
02636 2636 5 0,0101 1 TS savQ ; save return address
; NOTE: these test are similar to the checks for AD, but
; the AD augend value has been changed to negative and AD has
; been changed to SU. The results produced by this change
; are identical to AD, and so the checks are the same.
finish EQU *
02737 2737 3 1,2736 1 CAF PASScode
02740 2740 5 0,0100 0 TS curtest ; set current test code to PASS
02741 2741 0 0,0000 0 RETURN
; ----------------------------------------------
; INTERRUPT SERVICE ROUTINE
goT3 EQU *
goER EQU *
goDS EQU *
goKEY EQU *
goUP EQU *
endRUPT EQU *
02742 2742 3 0,0027 1 XCH QRUPT ; restore Q
02743 2743 5 0,0001 0 TS Q
02744 2744 3 0,0026 0 XCH ARUPT ; restore A
02745 2745 2 0,0000 1 RESUME ; finished, go back
Symbol table:
START 000000 MPtst 000001 DVtst 000002
SUtst 000003 PASS 012345 EXTENDER 005777
OVFCNTR 000034 curtest 000100 savQ 000101
MPindex 000102 MPXTND 000103 DVsavA 000104
DVindex 000105 DVXTND 000106 SUk 000107
GOPROG 002000 T3RUPT 002004 ERRUPT 002010
DSRUPT 002014 KEYRUPT 002020 UPRUPT 002024
goMAIN 002030 fail 002036 end 002040
STRTcode 002041 begin 002042 MPcode 002045
MPstart 002046 mp1 002047 mp2 002107
MPchkA 002147 MPchkLP 002207 chkMP 002247
MPloop 002254 DVcode 002307 DVstart 002310
div1 002311 div2 002351 DVchkA 002411
DVchkQ 002451 DVchkLP 002511 chkDV 002551
DVloop 002556 SUcode 002621 SUplus0 002622
SUplus1 002623 SUmin1 002624 SU25252 002625
SU12525 002626 SU37777 002627 SU12524 002630
SU52525 002631 SU65252 002632 SU40000 002633
SU65253 002634 chkSU 002635 PASScode 002736
finish 002737 goT3 002742 goER 002742
goDS 002742 goKEY 002742 goUP 002742
endRUPT 002742 ARUPT 000026 Q 000001
QRUPT 000027 A 000000 LP 000003
TECO3 assembler listing
Block I Apollo Guidance Computer (AGC4) assembler version 1.6 for EPROM
; TECO3 (file:teco3.asm)
;
; Version: 1.0
; Author: John Pultorak
; Date: 9/14/2001
;
; PURPOSE:
; Test and checkout program for the Block 1 Apollo Guidance Computer.
; Tests editing registers: CYR, SR, CYL, SL.
;
; OPERATION:
; Enters an infinite loop at the end of the test. The A register
; contains the code for the test that failed, or the PASS code if all
; tests succeeded. See test codes below.
;
; ERRATA:
; - Written for the AGC4R assembler. The assembler directives and
; syntax differ somewhat from the original AGC assembler.
; - The tests attempt to check all threads, but are not exhaustive.
;
; SOURCES:
; Information on the Block 1 architecture: instruction set, instruction
; sequences, registers, register transfers, control pulses, memory and
; memory addressing, I/O assignments, interrupts, and involuntary
; counters was obtained from:
;
; A. Hopkins, R. Alonso, and H. Blair-Smith, "Logical Description
; for the Apollo Guidance Computer (AGC4)", R-393,
; MIT Instrumentation Laboratory, Cambridge, MA, Mar. 1963.
;
; Supplementary information was obtained from:
;
; R. Alonso, J. H. Laning, Jr. and H. Blair-Smith, "Preliminary
; MOD 3C Programmer's Manual", E-1077, MIT Instrumentation
; Laboratory, Cambridge, MA, Nov. 1961.
;
; B. I. Savage and A. Drake, "AGC4 Basic Training Manual, Volume I",
; E-2052, MIT Instrumentation Laboratory, Cambridge,
; MA, Jan. 1967.
;
; E. C. Hall, "MIT's Role in Project Apollo, Volume III, Computer
; Subsystem", R-700, MIT Charles Stark Draper Laboratory,
; Cambridge, MA, Aug. 1972.
;
; A. Hopkins, "Guidance Computer Design, Part VI", source unknown.
;
; A. I. Green and J. J. Rocchio, "Keyboard and Display System Program
; for AGC (Program Sunrise)", E-1574, MIT Instrumentation
; Laboratory, Cambridge, MA, Aug. 1964.
;
; E, C. Hall, "Journey to the Moon: The History of the Apollo
; Guidance Computer", AIAA, Reston VA, 1996.
;
ORG EXTENDER
05777 5777 47777 0 DS %47777 ; needed for EXTEND
; ----------------------------------------------
; ERASEABLE MEMORY -- DATA SEGMENT
; SR test values
00104 0104 00000 1 SRval DS %0 ; current test value
00105 0105 00000 1 iSR DS %0 ; current index
; SL test values
00110 0110 00000 1 SLval DS %0 ; current test value
00111 0111 00000 1 iSL DS %0 ; current index
; ----------------------------------------------
; ENTRY POINTS
; program (re)start
ORG GOPROG
02000 2000 0 1,2030 0 TC goMAIN
ORG ERRUPT
02010 2010 5 0,0026 0 TS ARUPT
02011 2011 3 0,0001 0 XCH Q
02012 2012 5 0,0027 1 TS QRUPT
02013 2013 0 1,2424 1 TC goER
ORG DSRUPT
02014 2014 5 0,0026 0 TS ARUPT
02015 2015 3 0,0001 0 XCH Q
02016 2016 5 0,0027 1 TS QRUPT
02017 2017 0 1,2424 1 TC goDS
ORG KEYRUPT
02020 2020 5 0,0026 0 TS ARUPT
02021 2021 3 0,0001 0 XCH Q
02022 2022 5 0,0027 1 TS QRUPT
02023 2023 0 1,2424 1 TC goKEY
ORG UPRUPT
02024 2024 5 0,0026 0 TS ARUPT
02025 2025 3 0,0001 0 XCH Q
02026 2026 5 0,0027 1 TS QRUPT
02027 2027 0 1,2424 1 TC goUP
; ----------------------------------------------
; FIXED MEMORY -- SHARED DATA SEGMENT
; ----------------------------------------------
; MAIN PROGRAM
goMAIN EQU *
02030 2030 2 0,0000 0 INHINT ; disable interrupts
fail EQU *
02037 2037 3 0,0100 0 XCH curtest ; load last passed test into A
02040 2040 5 0,0100 0 TS curtest
end EQU *
02041 2041 0 1,2041 0 TC end ; finished, TC trap
; ----------------------------------------------
; INITIALIZE FOR START OF TESTING
begin EQU *
02043 2043 3 1,2042 0 XCH STRTcode
02044 2044 5 0,0100 0 TS curtest ; set current test code to START
02045 2045 0 0,0000 0 RETURN
; ----------------------------------------------
; TEST CYR EDITING FUNCTION SUBROUTINE
; Rotate a test value right through CYR 15 times.
; Test the value against an expected value for each time.
; After 15 rotations, the value should equal the initial
; value.
chkCYR EQU *
02070 2070 3 0,0001 0 XCH Q
02071 2071 5 0,0101 1 TS savQ ; save return address
CYRloop EQU *
02077 2077 5 0,0103 0 TS iCYR ; save index
; ----------------------------------------------
; TEST SR EDITING FUNCTION SUBROUTINE
; Shift a test value right through SR 15 times.
; Test the value against an expected value for each time.
; After 15 shifts, the value should equal the sign (SG).
; SR test values
02121 2121 03431 1 SRinitP DS %03431 ; positive init test value
02122 2122 44346 0 SRinitN DS %44346 ; negative init test value
02123 2123 00016 0 SRindx DS 14 ; loop SRindx+1 times
chkSR EQU *
02162 2162 3 0,0001 0 XCH Q
02163 2163 5 0,0101 1 TS savQ ; save return address
SRloopP EQU *
02171 2171 5 0,0105 0 TS iSR ; save index
; verify C(A)
02176 2176 4 0,0000 0 COM ; get -A
02177 2177 2 0,0105 1 INDEX iSR
02200 2200 6 1,2124 1 AD SRbaseP ; put (-A) + expected value in A
02201 2201 1 0,0000 0 CCS A ; compare
02202 2202 0 1,2037 1 TC fail ; >0 (A < expected value)
02203 2203 0 1,2037 1 TC fail ; +0
02204 2204 0 1,2037 1 TC fail ; <0 (A > expected value)
SRloopN EQU *
02212 2212 5 0,0105 0 TS iSR ; save index
; verify C(A)
02217 2217 4 0,0000 0 COM ; get -A
02220 2220 2 0,0105 1 INDEX iSR
02221 2221 6 1,2143 0 AD SRbaseN ; put (-A) + expected value in A
02222 2222 1 0,0000 0 CCS A ; compare
02223 2223 0 1,2037 1 TC fail ; >0 (A < expected value)
02224 2224 0 1,2037 1 TC fail ; +0
02225 2225 0 1,2037 1 TC fail ; <0 (A > expected value)
; ----------------------------------------------
; TEST CYL EDITING FUNCTION SUBROUTINE
; Rotate a test value left through CYL 15 times.
; Test the value against an expected value for each time.
; After 15 rotations, the value should equal the initial
; value.
chkCYL EQU *
02255 2255 3 0,0001 0 XCH Q
02256 2256 5 0,0101 1 TS savQ ; save return address
CYLloop EQU *
02264 2264 5 0,0107 1 TS iCYL ; save index
; verify C(A)
02271 2271 4 0,0000 0 COM ; get -A
02272 2272 2 0,0107 0 INDEX iCYL
02273 2273 6 1,2236 1 AD CYLbase ; put (-A) + expected value in A
02274 2274 1 0,0000 0 CCS A ; compare
02275 2275 0 1,2037 1 TC fail ; >0 (A < expected value)
02276 2276 0 1,2037 1 TC fail ; +0
02277 2277 0 1,2037 1 TC fail ; <0 (A > expected value)
; ----------------------------------------------
; TEST SL EDITING FUNCTION SUBROUTINE
; Shift a test value left through SL 15 times.
; Test the value against an expected value for each time.
; After 15 shifts, the value should equal the sign (SG).
; SL test values
02306 2306 03431 1 SLinitP DS %03431 ; positive init test value
02307 2307 44346 0 SLinitN DS %44346 ; negative init test value
02310 2310 00016 0 SLindx DS 14 ; loop SLindx+1 times
chkSL EQU *
02347 2347 3 0,0001 0 XCH Q
02350 2350 5 0,0101 1 TS savQ ; save return address
SLloopP EQU *
02356 2356 5 0,0111 0 TS iSL ; save index
; verify C(A)
02363 2363 4 0,0000 0 COM ; get -A
02364 2364 2 0,0111 1 INDEX iSL
02365 2365 6 1,2311 0 AD SLbaseP ; put (-A) + expected value in A
02366 2366 1 0,0000 0 CCS A ; compare
02367 2367 0 1,2037 1 TC fail ; >0 (A < expected value)
02370 2370 0 1,2037 1 TC fail ; +0
02371 2371 0 1,2037 1 TC fail ; <0 (A > expected value)
SLloopN EQU *
02377 2377 5 0,0111 0 TS iSL ; save index
; ----------------------------------------------
; PASSED ALL TESTS!
finish EQU *
02421 2421 3 1,2420 0 CAF PASScode
02422 2422 5 0,0100 0 TS curtest ; set current test code to PASS
02423 2423 0 0,0000 0 RETURN
; ----------------------------------------------
; INTERRUPT SERVICE ROUTINE
goT3 EQU *
goER EQU *
goDS EQU *
goKEY EQU *
goUP EQU *
endRUPT EQU *
02424 2424 3 0,0027 1 XCH QRUPT ; restore Q
02425 2425 5 0,0001 0 TS Q
02426 2426 3 0,0026 0 XCH ARUPT ; restore A
02427 2427 2 0,0000 1 RESUME ; finished, go back
Symbol table:
START 000000 CYRtst 000001 SRtst 000002
CYLtst 000003 SLtst 000004 PASS 012345
EXTENDER 005777 curtest 000100 savQ 000101
CYRval 000102 iCYR 000103 SRval 000104
iSR 000105 CYLval 000106 iCYL 000107
SLval 000110 iSL 000111 GOPROG 002000
T3RUPT 002004 ERRUPT 002010 DSRUPT 002014
KEYRUPT 002020 UPRUPT 002024 goMAIN 002030
fail 002037 end 002041 STRTcode 002042
begin 002043 CYRcode 002046 CYRinit 002047
CYRindx 002050 CYRbase 002051 chkCYR 002070
CYRloop 002077 SRcode 002120 SRinitP 002121
SRinitN 002122 SRindx 002123 SRbaseP 002124
SRbaseN 002143 chkSR 002162 SRloopP 002171
SRloopN 002212 CYLcode 002233 CYLinit 002234
CYLindx 002235 CYLbase 002236 chkCYL 002255
CYLloop 002264 SLcode 002305 SLinitP 002306
SLinitN 002307 SLindx 002310 SLbaseP 002311
SLbaseN 002330 chkSL 002347 SLloopP 002356
SLloopN 002377 PASScode 002420 finish 002421
goT3 002424 goER 002424 goDS 002424
goKEY 002424 goUP 002424 endRUPT 002424
ARUPT 000026 Q 000001 QRUPT 000027
CYR 000020 A 000000 SR 000021
CYL 000022 SL 000023
TECO5 assembler listing
Block I Apollo Guidance Computer (AGC4) assembler version 1.6 for EPROM
; TECO5 (file:teco5.asm)
;
; Version: 1.0
; Author: John Pultorak
; Date: 9/14/2001
;
; PURPOSE:
; Test and checkout program for the Block 1 Apollo Guidance Computer.
; Tests interrupts.
;
; OPERATION:
; Tests the interrupts by initializing 4 counters to zero and then
; entering a loop where the 1st counter (mainCtr) is incremented on
; each iteration of the loop.
;
; Interrupts are disabled and enabled during each iteration by INHINT
; and RELINT instructions.
;
; Interrupts are automatically inhibited during part of each iteration
; by an overflow condition in register A.
;
; Interrupt service routines for T3RUPT, DSRUPT (aka T4RUPT) and
; KEYRUPT increment their own counters upon each interrupt.
;
; ERRATA:
; - Written for the AGC4R assembler. The assembler directives and
; syntax differ somewhat from the original AGC assembler.
; - The tests attempt to check all threads, but are not exhaustive.
;
; SOURCES:
; Information on the Block 1 architecture: instruction set, instruction
; sequences, registers, register transfers, control pulses, memory and
; memory addressing, I/O assignments, interrupts, and involuntary
; counters was obtained from:
;
; A. Hopkins, R. Alonso, and H. Blair-Smith, "Logical Description
; for the Apollo Guidance Computer (AGC4)", R-393,
; MIT Instrumentation Laboratory, Cambridge, MA, Mar. 1963.
;
; Supplementary information was obtained from:
;
; R. Alonso, J. H. Laning, Jr. and H. Blair-Smith, "Preliminary
; MOD 3C Programmer's Manual", E-1077, MIT Instrumentation
; Laboratory, Cambridge, MA, Nov. 1961.
;
; B. I. Savage and A. Drake, "AGC4 Basic Training Manual, Volume I",
; E-2052, MIT Instrumentation Laboratory, Cambridge,
; MA, Jan. 1967.
;
; E. C. Hall, "MIT's Role in Project Apollo, Volume III, Computer
; Subsystem", R-700, MIT Charles Stark Draper Laboratory,
; Cambridge, MA, Aug. 1972.
;
; A. Hopkins, "Guidance Computer Design, Part VI", source unknown.
;
; A. I. Green and J. J. Rocchio, "Keyboard and Display System Program
; for AGC (Program Sunrise)", E-1574, MIT Instrumentation
; Laboratory, Cambridge, MA, Aug. 1964.
;
; E, C. Hall, "Journey to the Moon: The History of the Apollo
; Guidance Computer", AIAA, Reston VA, 1996.
;
; ----------------------------------------------
; ----------------------------------------------
; ERASEABLE MEMORY -- DATA SEGMENT
ORG %47 ; start of data area
00047 0047 00000 1 mainCtr DS %0
; ----------------------------------------------
; ENTRY POINTS
; program (re)start
ORG GOPROG
02000 2000 0 1,2030 0 TC goMAIN
ORG KEYRUPT
02020 2020 5 0,0026 0 TS ARUPT
02021 2021 3 0,0001 0 XCH Q
02022 2022 5 0,0027 1 TS QRUPT
02023 2023 0 1,2076 1 TC goKEY
; ----------------------------------------------
; FIXED MEMORY -- SHARED DATA SEGMENT
; ----------------------------------------------
; MAIN PROGRAM
goMAIN EQU *
02030 2030 2 0,0000 0 INHINT ; disable interrupts
infLoop EQU *
; ----------------------------------------------
; INTERRUPT SERVICE ROUTINE
goT3 EQU *
02064 2064 3 1,2024 0 CAF ZERO
02065 2065 6 0,0050 1 AD T3Ctr ; load T3Ctr into A
02066 2066 6 1,2025 1 AD ONE ; incr
02067 2067 5 0,0050 1 TS T3Ctr ; store
02070 2070 0 1,2103 1 TC endRUPT
goDS EQU *
02071 2071 3 1,2024 0 CAF ZERO
02072 2072 6 0,0051 0 AD DSCtr ; load DSCtr into A
02073 2073 6 1,2025 1 AD ONE ; incr
02074 2074 5 0,0051 0 TS DSCtr ; store
02075 2075 0 1,2103 1 TC endRUPT
goKEY EQU *
02076 2076 3 1,2024 0 CAF ZERO
02077 2077 6 0,0052 0 AD KYCtr ; load KYCtr into A
02100 2100 6 1,2025 1 AD ONE ; incr
02101 2101 5 0,0052 0 TS KYCtr ; store
02102 2102 0 1,2103 1 TC endRUPT
endRUPT EQU *
02103 2103 3 0,0027 1 XCH QRUPT ; restore Q
02104 2104 5 0,0001 0 TS Q
02105 2105 3 0,0026 0 XCH ARUPT ; restore A
02106 2106 2 0,0000 1 RESUME ; finished, go back
Symbol table:
mainCtr 000047 T3Ctr 000050 DSCtr 000051
KYCtr 000052 GOPROG 002000 T3RUPT 002004
DSRUPT 002014 KEYRUPT 002020 ZERO 002024
ONE 002025 AD25252 002026 AD52525 002027
goMAIN 002030 infLoop 002036 goT3 002064
goDS 002071 goKEY 002076 endRUPT 002103
ARUPT 000026 Q 000001 QRUPT 000027
TECO_STBY assembler listing
Block I Apollo Guidance Computer (AGC4) assembler version 1.6
; TECO_STBY (file:stby.asm)
;
; Tests the standby operation.
; program (re)start
ORG GOPROG
02000 2000 0 1,2002 1 TC goMAIN
; MAIN PROGRAM
goMAIN EQU *
; standby is disabled
02002 2002 3 0,0000 1 NOOP
02003 2003 3 0,0000 1 NOOP
; enable standby
02004 2004 3 1,2001 1 XCH ofbit
02005 2005 5 0,0011 1 TS OUT1
infLoop EQU *
02006 2006 0 1,2006 0 TC infLoop
Symbol table:
GOPROG 002000 ofbit 002001 goMAIN 002002
infLoop 002006 OUT1 000011