set fha disable
set dpa disable
set dpb disable
set mta disable
set tua disable
set rpa disable
set rpb disable
set env C=%1
set env CPU=KA
set env DISK=%2
set env TAPE=mta0
if "%DISK%" == "rp" set env TAPE=tua0 ; set rpa enable ; set rpb enable ; set tua enable ; set env T=/tm03
if "%DISK%" == "dp" set dpa enable ; set mta enable ; set mta type=b  ; set env T=
if "%C%" == "ki" set env CPU=KI 
if "%C%" == "kv" set env CPU=KI 
if "%C%" == "kl" set env CPU=KL 
if "%DISK%" == "dp" at -n dpa0 rdsk/%C%_dskb0.rp3
if "%DISK%" == "dp" at -n dpa1 rdsk/%C%_dskb1.rp3
if "%DISK%" == "dp" at -n dpa2 rdsk/%C%_dskb2.rp3
if "%DISK%" == "dp" at -n dpa3 rdsk/%C%_dskb3.rp3
if "%DISK%" == "rp" at -n rpa0 rdsk/%C%_dskb0.rp6
if "%DISK%" == "rp" at -n rpa1 rdsk/%C%_dskb1.rp6
at %TAPE -r tapes/%1%DISK%_system.tap
set cpu 256k 
expect "BTM>" send  "system.exe[1,4]%T%\r" ; continue
expect "RELOAD:" send  "hard\r"; continue
expect "DATE:" send  "04-21-78\r"; continue
expect "TIME:" send  "1000\r"; continue
expect "STARTUP OPTION:" send  "refresh\r"; continue
do refresh.do
expect "STARTUP OPTION:" send "quick\r"; continue
; Restore base system.
expect "\r\n." send "LOGIN 1,2\r"; continue
expect "\r\n." send "ASSIGN MTA0 BACKUP\r"; continue
expect "\r\n." send "SET DENS MTA0 800\r";  continue
expect "\r\n." send "GET MTA0:BACKUP.EXE\r"; continue
expect "\r\n." send "SAVE BACKUP\r"; continue
expect "\r\n." send "RUN BACKUP\r"; continue
expect "\r\n/" send "DEN 800\r"; continue
expect "\r\n/" send "FILES\r"; continue
expect "\r\n/" send "RESTORE\r"; continue
expect "\r\n/" send "REWIND\r";continue
expect "\r\n/" send "EXIT\r"; continue
; Install disk boot blocks.
if "%CPU%" == "KA" 'expect "\r\n." send "RUN WABOOT[10,7]\r"; continue'
if "%CPU%" == "KI" 'expect "\r\n." send "RUN WIBOOT[10,7]\r"; continue'
if "%CPU%" == "KL" 'expect "\r\n." send "RUN WLBOOT[10,7]\r"; continue'
expect "SELECT UNITS?" send "NO\r"; continue
expect "\r\n." send "KJOB/F\r"; continue
expect "\n\n." set cty stop; continue
expect "\r\n/" continue
expect "\r\nBOOTS\r\n" send -t after=100000 "system\r"; continue
expect "RELOAD:" send  "hard\r"; continue
expect "DATE:" send  "04-21-78\r"; continue
expect "TIME:" send  "1100\r"; continue
expect "STARTUP OPTION:" send  "no ini\r"; continue
bo %TAPE%
