//**************************************************************************************
//RDC.tst
//Main Test Program and Subroutines for RDC Controller Module, Revision D
//By J. F. Cameron
June 27, 1978
//Last modified by J. F. Cameron
June 13, 1980
//**************************************************************************************
//**************************************************************************************
//To include the following definition files in the compilation
get "tester.d"
get "RDC.d"

//**************************************************************************************
//To define the global variabes
static
[
pass = 0
BPLevel = 9
cont = false
looping = false
testno = 11
failures = nil
]

//**************************************************************************************
//Main program for RDC Controller module test
//Add new tests to TRun()
let main() be
[
//Heading
L1: pass = pass + 1
DisplayString(FORMATN("*nRDC Module Test for MULTIWIRE REV. Gb: pass <D>*nOn BREAKPOINT, press any key to continue.",pass))
DisplayString("*nSET-UP INSTRUCTIONS are Breakpoint Level 9.")
SetBPLevel()
SpaceDisplay()

//Set up instructions
if pass eq 1 do
[
failures = 0
DisplayString("*nRemove PROMs from the following locations: a3, a6, b3, b5, b7, c3, c5, c7, d3, d5, and d7.*nAttach 1K pull-up resistors to S38 @ a18 for WakeP[0:2]’ and IOAttn’.")
SpaceDisplay(3)
Breakpoint(9)
DisplayString("*nInstall connector with 1K pull-up resistors for Drive interface drivers @ J1.*nInstall headers with 1K pull-up resistors on pins 9, 10, 11, & 12 @ c3, d3, and d7.")
DisplayString("*nRemove 74S08 @ i4. Install test 74S08 (has pin 13 connected to pin 12) @ i4.")
SpaceDisplay(2)
Breakpoint(9)
DisplayString("*nConnect Test Probes as follows:")
DisplayString("*n B.01 to a3.12 B.02 to a3.11 B.03 to a3.10 B.04 to a3.09")
DisplayString("*n B.05 to a6.01 B.06 to a6.02 B.07 to a6.03 B.08 to a6.04")
DisplayString("*n B.09 to a6.05 B.10 to a6.06 B.11 to a6.07 B.12 to a6.09")
DisplayString("*n B.13 to a6.10 B.14 to a6.11 B.15 to a6.12 B.16 to a6.15")
Breakpoint(9)
DisplayString("*nConnect MORE Test Probes as follows:")
DisplayString("*n C.01 to b3.12 C.02 to b3.11 C.03 to b3.10 C.04 to b3.09")
DisplayString("*n C.05 to b5.01 C.06 to b5.02 C.07 to b5.03 C.08 to b5.04")
DisplayString("*n C.09 to b5.05 C.10 to b5.06 C.11 to b5.07 C.12 to b5.09")
DisplayString("*n C.13 to b5.11 C.14 to b5.12 C.15 to b5.13 C.16 to b5.15")
Breakpoint(9)
DisplayString("*nConnect MORE Test Probes as follows:")
DisplayString("*n D.01 to b7.12 D.02 to b7.11 D.03 to b7.10 D.04 to b7.09")
DisplayString("*n D.05 to c7.12 D.06 to c7.11 D.07 to c7.10 D.08 to c7.09")
DisplayString("*n D.09 to c5.12 D.10 to c5.11 D.11 to c5.10 D.12 to c5.09")
DisplayString("*n D.13 to d5.12 D.14 to d5.11 D.15 to d5.10 D.16 to d5.09")
Breakpoint(9)
DisplayString("*nConnect MORE Test Probes as follows:")
DisplayString("*n E.01 to d16.06 E.02 to d16.08 E.03 to b12.13 E.04 to a14.13")
DisplayString("*n E.05 to a13.04 E.06 to e15.04 E.07 to e15.03 E.08 to e15.02")
DisplayString("*n E.09 to e15.01 E.10 to e15.21 E.11 to e15.05 E.12 to e15.06")
DisplayString("*n E.13 to e6.09 E.14 to e6.06 E.15 to e6.05 E.16 to e6.02")
Breakpoint(9)
]

testno = 11
if cont eq false do
[
SelectTest()
]
L2: TRun()
testno = testno + 1
test testno le 99
ifso [ goto L2 ]
ifnot
[
DisplayString(FORMATN("*nRDC Module Test: <D> passes completed. Number of FAILURES = <D>", pass, failures))
RepeatSelect()
goto L1
]
]

//Subroutines

//Operating Functions

and Breakpoint(level, x, y, z, ch; numargs na) be
unless cont do
[
[
DefaultArgs(lv na, -1, 0, 0, 0, 0)
if level eq BPLevel do
[
test na eq 1
ifso
[
DisplayString(FORMATN(" BREAKPOINT <D>!", level))
while Endofs(keys) do [ ]
Gets(keys)
]
ifnot
[
test ch eq 0
ifso
[
DisplayString(FORMATN("*nBREAKPOINT <D> <B> <B> <B>", level, x, y, z))
while Endofs(keys) do [ ]
Gets(keys)
]
ifnot
[
DisplayString(FORMATN("*nBREAKPOINT <D> <B> <B> <B>", level, x, y, z))
SetBPLevel()
]
]
]
]
]

and SetBPLevel() be
[
unless cont do
[
DisplayString(FORMATN("*nSET BREAKPOINT LEVEL to 0 thru 9; any other key keeps present level.*nPRESENT LEVEL = <D>.", BPLevel))
while Endofs(keys) do [ ]
let ch = Gets(keys)
switchon (ch & #177) into
[
case $0: BPLevel = 0; endcase;
case $1: BPLevel = 1; endcase;
case $2: BPLevel = 2; endcase;
case $3: BPLevel = 3; endcase;
case $4: BPLevel = 4; endcase;
case $5: BPLevel = 5; endcase;
case $6: BPLevel = 6; endcase;
case $7: BPLevel = 7; endcase;
case $8: BPLevel = 8; endcase;
case $9: BPLevel = 9; endcase;
]
]
]

and SelectTest() be
[
DisplayString("*nType in desired starting Test Number.")
DisplayString("*nAny keys other than 1 thru 9 cause start at Test 11")
SpaceDisplay(3)
let x = false
while Endofs(keys) do [ ]
let ch = Gets(keys)
switchon (ch & #177) into
[
case $1: testno = 10; endcase;
case $2: testno = 20; endcase;
case $3: testno = 30; endcase;
case $4: testno = 40; endcase;
case $5: testno = 50; endcase;
case $6: testno = 60; endcase;
case $7: testno = 70; endcase;
case $8: testno = 80; endcase;
case $9: testno = 90; endcase;
default: x = true; endcase;
]
unless x do
[
while Endofs(keys) do [ ]
let ch = Gets(keys)
switchon (ch & #177) into
[
case $1: testno = testno + 1; endcase;
case $2: testno = testno + 2; endcase;
case $3: testno = testno + 3; endcase;
case $4: testno = testno + 4; endcase;
case $5: testno = testno + 5; endcase;
case $6: testno = testno + 6; endcase;
case $7: testno = testno + 7; endcase;
case $8: testno = testno + 8; endcase;
case $9: testno = testno + 9; endcase;
default: x = true; endcase;
]
]
if x do [ testno = 11 ]
DisplayString(FORMATN("*nStarting Test selected = <D>", testno))
DisplayString("*nDepress r to repeat selected test; any other key to continue to next test.")
SpaceDisplay(3)
while Endofs(keys) do [ ]
let ch = Gets(keys)
switchon (ch & #177) into
[
case $r:
case $R: again = true; endcase
]
]

and TRun() be
//Add new tests here
[
switchon testno into
[
case 11: Test11(); endcase;
case 12: Test12(); endcase;
case 13: Test13(); endcase;
case 14: Test14(); endcase;
case 15: Test15(); endcase;
case 21: Test21(); endcase;
case 22: Test22(); endcase;
case 23: Test23(); endcase;
case 24: Test24(); endcase;
case 25: Test25(); endcase;
case 26: Test26(); endcase;
case 27: Test27(); endcase;
case 28: Test28(); endcase;
case 31: Test31(); endcase;
case 32: Test32(); endcase;
case 41: Test41(); endcase;
case 42: Test42(); endcase;
case 43: Test43(); endcase;
case 51: Test51(); endcase;
case 52: Test52(); endcase;
case 53: Test53(); endcase;
case 54: Test54(); endcase;
case 61: Test61(); endcase;
case 62: Test62(); endcase;
case 71: Test71(); endcase;
case 72: Test72(); endcase;
case 73: Test73(); endcase;
case 81: Test81(); endcase;
case 82: Test82(); endcase;
case 83: Test83(); endcase;
case 84: Test84(); endcase;
case 91: Test91(); endcase;
case 92: Test92(); endcase;
]
]

and RepeatSelect() be
[
test cont
ifso
[
DisplayString("*nIN CONTINOUS*nDepress d to discontinue; q to quit.*n")
Delay(4)
]

ifnot
[
DisplayString("*nDepress q to quit;*n c to run continuously;*n any other key to repeat.")
while Endofs(keys) do [ ]
]

unless Endofs(keys) do
[
let ch = Gets(keys)
switchon (ch & #177) into
[
case $c:
case $C: cont = true; endcase;
case $d:
case $D: cont = false; endcase
case $q:
case $Q: finish
]
]
]

and Delay(m) be
[
for j = 0 to m do [ for i = 0 to #77777 do [ ] ]
]

and SpaceDisplay(lines) be
[
for i = 1 to lines do
[
DisplayString("*n")
]
]