;               Load and execute a diagnostic from magnetic tape.
;
; Calling sequence:
;
;   diag-mtload-2114 <diag-cmdfile> [ <path-to-diagnostics> ]
;
; If <path-to-diagnostics> is null, the current directory is assumed.  The path
; must end with a backslash if it is specified and must not contain embedded
; spaces, even if it is quoted.


; Capture the diagnostic execution console log.

set -n console log=DIAG-MTLOAD-2114.log


;  *****************************
;  *                           *
;  *  Diagnostic Configurator  *
;  *                           *
;  *****************************

echo
echo
echo -------------------------------
echo Loading Diagnostic Configurator
echo -------------------------------


; Establish the initial environment.
;
; Note that the tape drive select code must be <= 17 to work on a 2114; this is
; a limitation of the 12607B DMA controller.

set -f CPU 2114,8K
set MSC DEV=16

if "%SIM_MAJOR%" != "3" set env reply=send


; Enable normally disabled I/O devices, so that the full complement is available.

echo
echo Configuring the simulation environment.

set LPS enabled
set MTC enabled
set IPL enabled


; Load the diagnostic configurator.

attach -e -r MSC0 %224396-13601_Rev-1713.abin.tape

echo
echo Loading the diagnostic configurator from magnetic tape.
echo Expect halt 102077 if successful.

deposit S 000000
boot MSC0

assert T=102077


; Verify the Diagnostic Serial Number.

echo
echo Verifying DSN 000200.

deposit M 126
assert T=000200


; Establish the standard break time for diagnostic responses.

if "%SIM_MAJOR%" == "3" break after=425000
if "%SIM_MAJOR%" != "3" expect haltafter=425000


; Prepare for automatic configuration with program load from magnetic tape.

echo
echo Configuring the diagnostic configurator for magnetic tape loading.
echo Expect halt 102077 if successful.

deposit S 011611
reset
go 100

assert T=102077


; Run the selected diagnostic

do %2%1.inc 24396-13601_Rev-1713.abin.tape %2