; Run the 7970B/E nine-track magnetic tape diagnostic (D433A).
;
; Test with one 7970E, manual test 15.
;
; Reports "E223 ACT.  DS 0 000 000 101 101 010  STEP 1520
;               EXPEC.DS D DD0 0DD 1DD D11 110
;          E238 SAME STEP -  TAPE  ERROR   - IN READ DS"
; Cause is diagnostic attempts to write a single record of full-tape size.


; Set up the log(s).

set -n console log=zmt15.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=000001~m
set -i console halt=CHANGE?(YES/NO)
go


; Respond to "D015 PRESENT SECTION REGISTER:%000001 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 15.
; ================

set ms realtime

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


; Respond to "P054 WRITE1520TEST   (TESTA)  (YES/NO)"

set console response=YES~m
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 -a console halt=P010 PAUSE AT PASS 01
go


; Prints "E223 ACT.  DS 0 000 000 101 101 010  STEP 1520
;              EXPEC.DS D DD0 0DD 1DD D11 110
;         E238 SAME STEP -  TAPE  ERROR   - IN READ DS"

set console nohalt