; Test single-byte transfers.
;
; Plan:
;   - Set Unit 0 (single-byte write, left byte)
;   - QSTAT reporting (single-byte read, left byte)
;   - Set Unit 15 (single-byte write,right byte)
;   - QSTAT reporting (single-byte read, right byte)
;   - 
;   - 
;   - 
;   - 
;   - 
;   - 
;   - 
;   - 
;   - 
;   - 


; Load DUS-III from the tape.


; Set up the log(s).

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

set imba debug=csrw;data
set gic  debug
set cpp  debug
set dc   debug=cmd;inco


; 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

attach DC0 scratch.7933.disc


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"


; do single-byte reads and writes on device 0 unit 0
;
; CC( 0) = --0DH (Request Status opcode)
; CC( 1) = 202FH (Set Unit 0, 15 opcodes)
;
; Line 10
go until "\r\n> " ; reply "DB BB,10,0         . STATUS ARRAY\r"
go until "\r\n> " ; reply "DB CC,2,0          . COMMAND ARRAY\r"
go until "\r\n> " ; reply "DB EE,2,!FFFF      . BUFFER ARRAY\r"
go until "\r\n> " ; reply "ASSIGN CC(0),!0D,!202F\r"
go until "\r\n> " ; reply "LET CHANNEL:=11,DEVICE:=0\r"
go until "\r\n> " ; reply "BSIO ZZ\r"
; Line 70 Set Unit 0
go until "\r\n> " ; reply "WB !5,CC(1),1,1      . SET UNIT 0 COMMAND\r"
go until "\r\n> " ; reply "WAIT\r"
go until "\r\n> " ; reply "RB !10,EE(0),1,1     . QSTAT REPORTING COMMAND\r"
; Line 100
go until "\r\n> " ; reply "WR !5,CC(0),1,,R     . REQUEST STATUS COMMAND\r"
go until "\r\n> " ; reply "WAIT\r"
go until "\r\n> " ; reply "RR !E,BB(0),20       . REQUEST STATUS EXECUTION\r"
go until "\r\n> " ; reply "WAIT\r"
go until "\r\n> " ; reply "DSJ 150\r            . QSTAT REPORTING\r"
; Line 150 Set Unit 15
go until "\r\n> " ; reply "WB !5,CC(1),1,,,R    . SET UNIT 15 COMMAND\r"
go until "\r\n> " ; reply "WAIT\r"
go until "\r\n> " ; reply "RB !10,EE(1),1,,,R   . QSTAT REPORTING COMMAND\r"
; Line 180
go until "\r\n> " ; reply "WR !5,CC(0),1,,R     . REQUEST STATUS COMMAND\r"
go until "\r\n> " ; reply "WAIT\r"
go until "\r\n> " ; reply "RR !E,BB(0),20       . REQUEST STATUS EXECUTION\r"
go until "\r\n> " ; reply "WAIT\r"
go until "\r\n> " ; reply "DSJ 230\r            . QSTAT REPORTING\r"
; Line 230
go until "\r\n> " ; reply "IN H\r"
go until "\r\n> " ; reply "RSIO\r"
go until "\r\n> " ; reply "ZEROESON\r"
go until "\r\n> " ; reply "PRINT \"QSTAT BUFFER IS \";!EE(0);\" AND \";!EE(1)\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