; Run the 7970B/E nine-track magnetic tape diagnostic (D433A).
;
; Test with one 7970E, manual tests 12 and 13.


; Set up the log(s).

set -n console log=zmtem.log


; Configuration locations:
;
;     Location     Default Value  Contents
;   -------------  -------------  ---------------------------------------------------
;   DB+0   047574  000000         Switch Register setting
;   DB+1   047575  077414         Section Select Register setting
;   DB+2   047576  000014         Version and update level
;   DB+3   047577  000000      0  Magnetic tape DRT number
;   DB+4   047600  000143     99  Maximum error print count
;   DB+5   047601  000000         Section number
;   DB+6   047602  000000         Step number
;   DB+7   047603  000000         Device status


; Boot the I/O diagnostics tape.

attach -r ms0 30000-11017_Rev-2640_IO.tape
boot ms0


; Load the tape file containing the diagnostic.
;
; The I/O tape contains these files:
;
;   DIAGNOSTIC             FILE    REV   %FILE
;   -------------------   ------  -----   ----
;   SLEUTH                PD411A  01.05   (01)
;   CART DISC-7905A       PD419A  01.04   (02)
;   MEMORY PATTERN        PD421A  01.00   (03)
;   MULTIPLEXOR CHAN      PD422A  01.02   (04)
;   DISC FILE-2888A       PD423A  01.00   (05)
;   CART DISC-7900A       PD424A  01.00   (06)
;   SYSTEM CLOCK  II/III  PD425A  01.00   (07)
;   SYS CLK/FLI   III-LC  PD426A  00.00   (10)
;   TERMINAL DATA         PD427A  01.01   (11)
;   FIXED HEAD DISC       PD428A  01.00   (12)
;   SELECTOR CHAN         PD429A  01.01   (13)
;   FLT.CORR.MEM  SER-II  PD430A  01.01   (14)
;   FLT.CORR.MEM  SER-III PD430B  00.00   (15)
;   EXTEND INSTRUC SET    PD431A  01.00   (16)
;   HSI DIAG.             PD432A  01.00   (17)
;   MAGNETIC TAPE         PD433A  01.04   (20)
;   SSLC INTERFACE        PD434A  01.03   (21)
;   ASLC INTERFACE        PD434B  01.04   (22)
;   UI DIAG               PD435A  01.01   (23)
;   TERMINAL CONTROL      PD438A  01.00   (24)
;   CALCOMP PLOTTER       PD439A  01.01   (25)
;   COBOLII A F/W DIAG    PD441A  00.00   (26)
;   COBOLII B F/W DIAG    PD442A  00.00   (27)
;   STAND ALONE DISC      SADUTIL 01.00   (30)

deposit SWCH 20


; Set the tape unit modes.

set ms0 7970E,reel=600


; Set the CLK into diagnostic mode.

set clk realtime


; Run the diagnostic.

set console delay=10000
set -a -i console halt=Q010 TAPE DEVICE NUMBER?

echo
echo Press <CR> to start the diagnostic.
go


; Respond to "Q010 TAPE DEVICE NUMBER?"

set console response=6~m
set -a -i console halt=Q011 TIMER DEVICE NUMBER?
go


; Respond to "Q011 TIMER DEVICE NUMBER?"

set console response=3~m
set -a -i console halt=Q012 MAXIMUM ERROR PRINT COUNT?
go


; Respond to "Q012 MAXIMUM ERROR PRINT COUNT?"

set console response=100~m
set -i console halt=YOUR CODE?
go


; Respond to "P005 TYPE FOLLOWING CONTROL
;                   A'CR'-AUTO,  R'CR'-RESTART,
;                   M'CR'-MANU,  'CR'-RESUME,   YOUR CODE?"

set console response=M~m
set -i console halt=CHANGE?(YES/NO)
go


; Respond to "D015 PRESENT SECTION REGISTER:%077414 DO YOU WISH TO CHANGE?(YES/NO)"

set console response=YES~m
set -a -i console halt=D015 UPDATE  SECTION REGISTER:%
go


; Respond to "D015 UPDATE  SECTION REGISTER:%"
;
; Section Select options:
;
;   bit  0 = not used
;   bit  1 = execute section 1 (auto - basic control)
;   bit  2 = execute section 2 (auto - control, dev, status, space)
;   bit  3 = execute section 3 (auto - file mark, 800 cpi only)
;   bit  4 = execute section 4 (auto - CRCC, dropout)
;   bit  5 = execute section 5 (auto - timing)
;   bit  6 = execute section 6 (auto - BOT, EOT, creeping)
;   bit  7 = execute section 7 (auto - read/write)
;   bit  8 = not used
;   bit  9 = not used
;   bit 10 = not used
;   bit 11 = execute section 11 (manual - head test)
; + bit 12 = execute section 12 (manual - start/stop)
; + bit 13 = execute section 13 (manual - reel protection)
;   bit 14 = execute section 14 (manual - tape test)
;   bit 15 = execute section 15 (manual - write/read)
;
; The default section select setting is 077414.

set console response=000014~m
set -i console halt=CHANGE?(YES/NO)
go


; Respond to "D015 PRESENT SECTION REGISTER:%000014 DO YOU WISH TO CHANGE?(YES/NO)"

set console response=NO~m
set -i console halt=(CR)
go


; Respond to "P015 MANU PROCES:  UPDATE SWITCH REGISTER (CR)"

; Set the Switch Register options:
;
; + bit  0 = select the external switch register
;   bit  1 = modify the Section Select Register
;   bit  2 = not used
;   bit  3 = not used
;   bit  4 = not used
;   bit  5 = not used
;   bit  6 = not used
;   bit  7 = output D,E-class messages to the line printer (if configured)
;   bit  8 = not used
;   bit  9 = suppress E-class messages
;   bit 10 = suppress D-class messages
;   bit 11 = loop on the current step
; + bit 12 = halt on error
;   bit 13 = halt at the end of each step
;   bit 14 = halt at the end of each section
; + bit 15 = halt at the end of each diagnostic pass

deposit SWCH 100011


; ================
; Test section 12.
; ================

set ms realtime

set console response=~m
set -i console halt='CR'
go


; Respond to "P019 ON-LINE/RESET TEST
;             P026 LOAD TAPE(RING),  PUSH RESET, OFF AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> attach -n ms0 scratch.tape
echo sim> set ms0 offline
echo sim> go

attach -n ms0 scratch.tape
set ms0 offline

set console response=~m
go


; Respond to "P027 PUSH DRIVE 0, ON-LINE AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> set ms0 online
echo sim> go

set ms0 online
set console response=~m
go


; Respond to "P028 PUSH RESET, OFF AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> set ms0 offline
echo sim> go

set ms0 offline

set console response=~m
go


; Respond to "P027 PUSH DRIVE 1, ON-LINE AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> detach ms0
echo sim> attach ms1 scratch.tape
echo sim> go

detach ms0
attach ms1 scratch.tape

set console response=~m
go


; Respond to "P028 PUSH RESET, OFF AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> set ms1 offline
echo sim> go

set ms1 offline

set console response=~m
go


; Respond to "P027 PUSH DRIVE 2, ON-LINE AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> detach ms1
echo sim> attach ms2 scratch.tape
echo sim> go

detach ms1
attach ms2 scratch.tape

set console response=~m
go


; Respond to "P028 PUSH RESET, OFF AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> set ms2 offline
echo sim> go

set ms2 offline

set console response=~m
go


; Respond to "P027 PUSH DRIVE 3, ON-LINE AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> detach ms2
echo sim> attach ms3 scratch.tape
echo sim> go

detach ms2
attach ms3 scratch.tape

set console response=~m
go


; Respond to "P028 PUSH RESET, OFF AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> set ms3 offline
echo sim> go

set ms3 offline

set console response=~m
set -i console halt=DRIVE ?
go


; Respond to "P029 LOAD TAPE(RING), PUSH OFF,RESET, ON-LINE AND"
;             P056 TYPE SELECTED DRIVE ?"

echo
echo
echo sim> detach ms3
echo sim> attach ms0 scratch.tape
echo sim> set ms0 offline
echo sim> go

detach ms3
attach ms0 scratch.tape
set ms0 offline

set console response=0~m
set -i console halt='CR'
go


; Respond to "P038 PUSH  DRIVE 0 BUTTON & TYPE RESPONSE 'CR'"
;
; After replying, the diagnostic executes a Rewind Offline and expects the user
; to wait until the rewind is complete before pushing ONLINE.  So we must
; increase the halt delay to allow the rewind to complete.  Otherwise, a NOT
; READY status error occurs in step 1232.

echo
echo
echo sim> set ms0 online
echo sim> go

set ms0 online

set console response=~m
set console delay=1000000
set -i console halt=RESPOND
go


; Respond to "P039 CHECK LIGHT RESET, PUSH ON-LINE AND RESPOND"

echo
echo
echo sim> set ms0 online
echo sim> go

set ms0 online

set console response=~m
set console delay=10000
set -i console halt='CR'
go


; Respond to "P029 LOAD TAPE(RING), PUSH OFF,RESET, ON-LINE AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> set ms0 offline
echo sim> go

set ms0 offline

set console response=~m
go


; Respond to "P030 CHECK LIGHT WRITE-ENABLE, PUSH DRIVE 0 AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> set ms0 online
echo sim> go

set ms0 online

set console response=~m
go


; Respond to "P030 CHECK LIGHT WRITE-ENABLE, PUSH DRIVE 1 AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> detach ms0
echo sim> attach ms1 scratch.tape
echo sim> go

detach ms0
attach ms1 scratch.tape

set console response=~m
go


; Respond to "P030 CHECK LIGHT WRITE-ENABLE, PUSH DRIVE 2 AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> detach ms1
echo sim> attach ms2 scratch.tape
echo sim> go

detach ms1
attach ms2 scratch.tape

set console response=~m
go


; Respond to "P030 CHECK LIGHT WRITE-ENABLE, PUSH DRIVE 3 AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> detach ms2
echo sim> attach ms3 scratch.tape
echo sim> go

detach ms2
attach ms3 scratch.tape

set console response=~m
go


; Respond to "P029 LOAD TAPE(RING), PUSH OFF,RESET, ON-LINE AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> detach ms3
echo sim> attach ms0 scratch.tape
echo sim> set ms0 offline
echo sim> go

detach ms3
attach ms0 scratch.tape
set ms0 offline

set console response=~m
go


; Respond to "P032 PUSH DRIVE 0 AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> set ms0 online
echo sim> go

set ms0 online

set console response=~m
go


; Respond to "P033 PUSH RESET, ON-LINE AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> set ms0 offline
echo sim> set ms0 online
echo sim> go

set ms0 offline
set ms0 online

set console response=~m
go


; Respond to "P032 PUSH DRIVE 1 AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> detach ms0
echo sim> attach ms1 scratch.tape
echo sim> go

detach ms0
attach ms1 scratch.tape

set console response=~m
go


; Respond to "P033 PUSH RESET, ON-LINE AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> set ms1 offline
echo sim> set ms1 online
echo sim> go

set ms1 offline
set ms1 online

set console response=~m
go


; Respond to "P032 PUSH DRIVE 2 AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> detach ms1
echo sim> attach ms2 scratch.tape
echo sim> go

detach ms1
attach ms2 scratch.tape

set console response=~m
go


; Respond to "P033 PUSH RESET, ON-LINE AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> set ms2 offline
echo sim> set ms2 online
echo sim> go

set ms2 offline
set ms2 online

set console response=~m
go


; Respond to "P032 PUSH DRIVE 3 AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> detach ms2
echo sim> attach ms3 scratch.tape
echo sim> go

detach ms2
attach ms3 scratch.tape

set console response=~m
go


; Respond to "P033 PUSH RESET, ON-LINE AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> set ms3 offline
echo sim> set ms3 online
echo sim> go

set ms3 offline
set ms3 online

set console response=~m
go


; Respond to "P034 PUT TAPE(RING), PUSH OFF, RESET AND RESPOND  'CR'"

echo
echo
echo sim> detach ms3
echo sim> attach ms0 scratch.tape
echo sim> set ms0 offline
echo sim> go

detach ms3
attach ms0 scratch.tape
set ms0 offline

set console response=~m
go


; Respond to "P035 PUSH ON-LINE, DRIVE 0 AND TAPE RESPONSE 'CR'"

echo
echo
echo sim> set ms0 online
echo sim> go

set ms0 online

set console response=~m
go


; Respond to "P036 PUSH RESET AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> set ms0 offline
echo sim> go

set ms0 offline

set console response=~m
go


; Respond to "P035 PUSH ON-LINE, DRIVE 1 AND TAPE RESPONSE 'CR'"

echo
echo
echo sim> detach ms0
echo sim> attach ms1 scratch.tape
echo sim> go

detach ms0
attach ms1 scratch.tape

set console response=~m
go


; Respond to "P036 PUSH RESET AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> set ms1 offline
echo sim> go

set ms1 offline

set console response=~m
go


; Respond to "P035 PUSH ON-LINE, DRIVE 2 AND TAPE RESPONSE 'CR'"

echo
echo
echo sim> detach ms1
echo sim> attach ms2 scratch.tape
echo sim> go

detach ms1
attach ms2 scratch.tape

set console response=~m
go


; Respond to "P036 PUSH RESET AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> set ms2 offline
echo sim> go

set ms2 offline

set console response=~m
go


; Respond to "P035 PUSH ON-LINE, DRIVE 3 AND TAPE RESPONSE 'CR'"

echo
echo
echo sim> detach ms2
echo sim> attach ms3 scratch.tape
echo sim> go

detach ms2
attach ms3 scratch.tape

set console response=~m
go


; Respond to "P036 PUSH RESET AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> set ms3 offline
echo sim> go

set ms3 offline

set console response=~m
set -i console halt=(EXIT)
go


; Respond to "P037 FSR/BSR-TEST: TYPE DRIVE NUMBER AND 'CR'(EXECUTE) OR 'CR'(EXIT)"

set console response=0~m
set -i console halt='CR'
go


; Respond to "P029 LOAD TAPE(RING), PUSH OFF,RESET, ON-LINE AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> detach ms3
echo sim> attach ms0 scratch.tape
echo sim> set ms0 offline
echo sim> go

detach ms3
attach ms0 scratch.tape
set ms0 offline

set console response=~m
go


; Respond to "P035 PUSH ON-LINE, DRIVE 0 AND TAPE RESPONSE 'CR'"

echo
echo
echo sim> set ms0 online
echo sim> go
echo
echo [This test takes a long time.]
echo

set ms0 online

set console response=~m


; ================
; Test section 13.
; ================

set -i console halt=DRIVE ?
go


; Respond to "P056 TYPE SELECTED DRIVE ?"

set console response=0~m
set -i console halt='CR
go


; Respond to "P041 LOAD TAPE(RING), PUSH DRIVE 0 AND TYPE RESPONSE 'CR"

echo
echo
echo sim> attach -n ms0 scratch.tape
echo sim> go

attach -n ms0 scratch.tape

set console response=~m
set -i console halt='CR'
go


; Respond to "P042 REMOVE RING FROM REEL, PUT IT BACK  AND TYPE RESPONSE 'CR'"

echo
echo
echo sim> detach ms0
echo sim> attach -r ms0 scratch.tape
echo sim> go

detach ms0
attach -r ms0 scratch.tape

set console response=~m
set -i console halt='CR'(RESPONSE)
go


; Respond to "P043 PUT RING BACK TO REEL, LOAD IT AND TYPE 'CR'(RESPONSE)"

echo
echo
echo sim> detach ms0
echo sim> attach ms0 scratch.tape
echo sim> go

detach ms0
attach ms0 scratch.tape

set console response=~m
set -a console halt=P010 PAUSE AT PASS 01
go


; End the of diagnostic.

set console nohalt