	.TITLE	DKCK
/
/   5 FEB 74 (PDH) MAKE MORE DIAGNOSTIC OUTPUT
/   1 FEB 74 - PAUL HENDERSON
/
/  PROGRAM TO TRY TO ILLUSTRATE A POSSIBLE DISK DATA TRANSFER PROBLEM
/
TTO=-12
DK=2
.SCOM=100
/
	.IODEV	TTO,DK
/
	.GLOBL	PACK
/
	.DEFIN	PUT,ARG
	LLS!1000 3		/SHIFT NEXT CHARACTER FROM MQ
	XOR	(60		/GENERATE ASCII
	DAC	ARG
	.ENDM
/
DKCK	.INIT	TTO,1,DKCK
	LAC*	(.SCOM+3
	CMA
	TAD	(1
	TAD*	(.SCOM+2	/ (.SCOM+2) - (.SCOM+3) = - (FREE CORE)
	DAC	WC1		/ 2'S COMPLEMENT OF SIZE OF FREE CORE
	DAC	WC2		/USE AS WORD COUNT FOR .TRAN'S
	LAC*	(.SCOM+2	/GET 1ST FREE ADDRESS
	DAC	CA1
	DAC	CA2		/USE AS BUFFER START ADDRESS
/
NEWPAT	LAC	(222202
/	TAD	PATERN
B1	DAC	PATERN		/SAVE IT
	LAC	CA1
	DAC	PNT		/POINT TO START OF BUFFER
	LAC	WC1
	DAC	COUNT		/INITIALIZE COUNTER
	LAC	PATERN
FILL	DAC*	PNT		/FILL BUFFER WITH PATTERN
	ISZ	PNT
	ISZ	COUNT
	JMP	FILL
/
B2	NOP
	.INIT	DK,1,DKCK
TR1	.TRAN	DK,1,101,0,0	/WRITE OUT BUFFER
CA1=TR1+3
WC1=TR1+4
	JMS	SHOW		/DISPLAY PATTERN IN REGISTER LIGHTS
	.WAITR	DK,SHOW+1
	LAC	CA1
	DAC	PNT		/INITIALIZE POINTER & COUNTER
	LAC	WC1
	DAC	COUNT
	LAC	PATERN		/INITIALIZE WITH COMPLEMENT OF PATERN
	CMA
REFILL	DAC*	PNT		/NOW INITIALIZE BUFFER BEFORE READING
	ISZ	PNT
	ISZ	COUNT
	JMP	REFILL
/
B3	NOP
	.INIT	DK,0,DKCK
TR2	.TRAN	DK,0,101,0,0
CA2=TR2+3
WC2=TR2+4
	JMS	SHOW
	.WAITR	DK,SHOW+1
/
	LAC	CA1
	DAC	PNT
	LAC	WC1
	DAC	COUNT
	LAC	(HEAD		/POINT ERROR ROUTINE AT HEADER ANNOUNCEMENT
	DAC	ERROR
CHECK	LAC*	PNT		/NOW CHECK READ IN VALUES AGAINST
	SAD	PATERN		/WHAT WAS WRITTEN OUT
	SKP
	JMP*	ERROR
RETURN	ISZ	PNT
	ISZ	COUNT
	JMP	CHECK
B4	NOP
	JMP	NEWPAT		/DATA CHECKS OUT.  TRY NEW PATTERN
/
ERROR	XX
/
HEAD	LAC	PATERN
	LMQ
	PUT	P1
	PUT	P2		/CONVERT PATTERN TO IMAGE ASCII
	PUT	P3
	PUT	P4
	PUT	P5
	PUT	P6
	LAC	(P1
	DAC	PCK1+1
	LAC	(TELPAT		/INITIALIZE PACK ROUTINE
	DAC	PCK1+2
PCK1	JMS*	PACK
	0; 0
	SMA
	JMP	PCK1
	.WRITE	TTO,2,HDR,0
	LAC	(BODY		/NOW SET UP FOR ERROR ANNOUNCEMENT
	DAC	ERROR
/
BODY	LAC	PNT		/GET ADDRESS
	LMQ
	LLS	3
	PUT	A1
	PUT	A2
	PUT	A3		/CONVERT ADDRESS
	PUT	A4
	PUT	A5
	LAC*	PNT		/GET BAD DATA
	LMQ
	PUT	D1
	PUT	D2
	PUT	D3
	PUT	D4		/CONVERT BAD DATA
	PUT	D5
	PUT	D6
	LAC	(A1
	DAC	PCK2+1
	LAC	(ERRS+2
	DAC	PCK2+2
PCK2	JMS*	PACK
	0; 0
	SMA
	JMP	PCK2
	.WAIT	TTO		/WAIT FOR LINE BUFFER TO BE FREE
	.WRITE	TTO,2,ERRS,0	/WRITE OUT ADDRESS & BAD DATA
	JMP	RETURN
/
HDR	HD-.*400+2; 0; .ASCII ' LOC     BAD  PATTERN='
TELPAT	.BLOCK	4
HD=.
/
ERRS	ER-.*400+2; 0
	.BLOCK	6
ER=.
/
P1;P2;P3;P4;P5;P6; 15
A1;A2;A3;A4;A5; 40; 40;D1;D2;D3;D4;D5;D6; 15
/
SHOW	XX
	LAW	-10
	DAC	COUNT
	LAC	PATERN
	.REPT	200
SHOW2	IOT
	ISZ	COUNT
	JMP	SHOW2
	JMP*	SHOW
/
PATERN;PNT;COUNT
	.END	DKCK
