; Do an ENQ/ACK handshake with the terminal on port 1.
; Default is LOCALACK.
; Invoke with any optional parameter to use REMOTEACK.


; Load DUS-III from the tape.


; Set up the log(s).

set -N console log=ADCCENQACK.log
set -N console debug=ADCCENQACK-debug.log

set imba debug=csrw;data
set adcc debug,nodebug=pserv
set cpp  debug


; Establish the initial environment.

echo
echo Configuring the simulation environment.

set CPU 512K,CIS

set console DEL=177

set IMBA ENABLED

break delay 30 milliseconds


; Set up the ADCC.

set ADCC REALTIME

if "%1" != "" set ADCC1 REMOTEACK

attach ADCC 1054

! start E:\Simulation\QCTerm\qcterm.exe F:\Simulation\HP 700\Config\mux.qct

set ADCC CONNECT


echo
echo
echo -----------------------------
echo Diagnostic Utility System III
echo -----------------------------
echo
echo Loading DUS-III.


; Cold load the DUS-III tape.

attach -e -r MS0 DUS-III.tape
boot MS0


echo
echo Configuring the diagnostic.

deposit SWCH 2


; Load and start the diagnostic.
;
; The diagnostic loads from tape and then waits for a <CR>.

echo
echo Starting the diagnostic.

reply "\r" delay 2 seconds

go until "\r\n:" ; reply "AID\r"


; write a text string to ADCC port 1
;
; CC(0) = 98--H (Secondary 1 = reset | 8 bit)
; CC(1) = 0818H (Secondary 6 = xmit 9600 baud | recv 9600 baud)
; CC(2) = 0400H (Secondary 3 = enable mask 0 | disable mask 0)
; CC(3) = 0602H (Secondary 3 = enable mask 2 | disable mask 2)
; CC(4) = 0506H (Secondary 0 = ENQ | ACK)
; CC(5) = input buffer

; Line 10
go until "\r\n> " ; reply 'ZEROESON\r'
go until "\r\n> " ; reply 'DB CC,10,0\r'
go until "\r\n> " ; reply 'ASSIGN CC(0),!980D,!0818,!0400,!0602,!0506\r'
go until "\r\n> " ; reply 'LET CHANNEL:=2,DEVICE:=1\r'
go until "\r\n> " ; reply 'BSIO II              . INITIALIZATION\r'
go until "\r\n> " ; reply 'WB !1,CC(0),1        . UART CONTROL\r'
go until "\r\n> " ; reply 'WB !6,CC(1),1        . XMIT BAUD RATE\r'
go until "\r\n> " ; reply 'WB !6,CC(1),1,,,R    . RECV BAUD RATE\r'
go until "\r\n> " ; reply 'IN H\r'
go until "\r\n> " ; reply 'RSIO\r'

go until "\r\n> " ; reply 'BSIO EE\r'
go until "\r\n> " ; reply 'WB !3,CC(3),1        . ENABLE SERVICE MASK 2\r'
go until "\r\n> " ; reply 'WB !0,CC(4),1        . WRITE UART ENQ\r'
go until "\r\n> " ; reply 'WAIT                 . WAIT UNTIL READY\r'
go until "\r\n> " ; reply 'RB !2,CC(5),1,,,R    . READ MODEM STATUS\r'
go until "\r\n> " ; reply 'RB !0,CC(5),1        . READ ACK\r'
go until "\r\n> " ; reply 'WB !3,CC(3),1,,,R    . DISABLE SERVICE MASK 2\r'
go until "\r\n> " ; reply 'IN H\r'

go until "\r\n> " ; reply 'ESIO\r'
go until "\r\n> " ; reply 'RSIO EE\r'
go until "\r\n> " ; reply 'PRINT "RETURN BYTE/STATUS ARE ";!CC(5)\r'
go until "\r\n> " ; reply 'END\r'

go until "\r\n> " ; reply "RUN\r"


; Exit

go until "\r\n> " ; reply "EXIT\r"
go until "?"      ; reply "YES\r"

go until "\r\n:"

exit