BADIO - I/O ROUTINES FOR ...BAD	MACRO M1110  22-AUG-78 02:07  PAGE 2





      1					.TITLE	BADIO - I/O ROUTINES FOR ...BAD

      2					.IDENT	/04/

      3					;

      4					;

      5					; COPYRIGHT (C) 1974,1975,1976,1977

      6					;

      7					;

      8					; THIS  SOFTWARE  IS  FURNISHED  UNDER A LICENSE FOR USE ONLY ON A

      9					; SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH THE INCLUSION

     10					; OF  THE  ABOVE COPYRIGHT  NOTICE.  THIS SOFTWARE, OR  ANY  OTHER

     11					; COPIES THEREOF, MAY NOT BE PROVIDED OR OTHERWISE  MADE AVAILABLE

     12					; TO  ANY  OTHER PERSON  EXCEPT  FOR USE ON SUCH SYSTEM AND TO ONE

     13					; WHO AGREES TO THESE LICENSE TERMS.  TITLE  TO  AND  OWNERSHIP OF

     14					; THE SOFTWARE SHALL AT ALL TIMES REMAIN IN DIGITAL.

     15					;

     16					; THE  INFORMATION  IN THIS DOCUMENT IS SUBJECT  TO CHANGE WITHOUT

     17					; NOTICE AND SHOULD NOT BE CONSTRUED AS A  COMMITMENT  BY  DIGITAL

     18					; EQUIPMENT CORPORATION.

     19					;

     20					; DIGITAL ASSUMES NO  RESPONSIBILITY FOR THE USE OR RELIABILITY OF

     21					; ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.

     22					;

     23					;

     24					; VERSION 04

     25					;

     26					; J. MASSE 01-JUL-74

     27					;

     28					;

     29					; MODIFIED BY:

     30					;

     31					;	P. J. BEZEREDI 01-NOV-76

     32					;

     33					;		PB010 -- BREAK BAD INTO SEPERATE MODULES.

     34					;

     35					;	P. J. BEZEREDI 11-APR-77

     36					;

     37					;		PB023 -- MODIFICATIONS TO RUN STAND-ALONE.

     38					;

     39					;

     40						.MCALL	DIR$, WTSE$S

BADIO - I/O ROUTINES FOR ...BAD	MACRO M1110  22-AUG-78 02:07  PAGE 3





     42					;+

     43					; **-$DSKIO-ISSUE QIO TO DISK

     44					;

     45					; SUBROUTINE TO ISSUE DISK QIO DIRECTIVE

     46					;

     47					;

     48					; INPUTS:

     49					;

     50					;	R3 -- I/O FUNCTION CODE

     51					;	R5 -- ADDRESS OF BUFFER (IF READ OR WRITE)

     52					;

     53					; OUTPUTS:

     54					;

     55					;	THE QIO DIRECTIVE IS ISSUED.  IF THERE WERE NO ERRORS, THE

     56					;	CARRY BIT WILL BE CLEARED.  IF THERE WAS A PARITY ERROR

     57					;	(IE.VER) OR A BAD BLOCK ERROR (IE.BBE) OR A WRITE CHECK

     58					;	ERROR (IE.WCK), CARRY WILL BE SET.  ALSO, SPECIFIC ERROR

     59					;	MESSAGES WILL BE PRINTED WHEN THE FOLLOWING ERRORS ARE DETECTED:

     60					;

     61					;		1. IE.HWR

     62					;		2. IE.DNR

     63					;		3. IE.WLK

     64					;		4. IE.DAA

     65					;		5. IE.FHE

     66					;

     67					;	ANY OTHER ERROR CODE WILL BE REPORTED AS A "DISK ERROR".

     68					;

     69					;-

     70

     71	000000	012700 	000000G		$DSKIO::MOV	#$DSKPB,R0	;PUT DISK DPB ADDRESS IN R0

     72	000004	010360 	000000G			MOV	R3,Q.IOFN(R0)	;STORE FUNCTION CODE IN DPB

     73	000010	010560 	000000G			MOV	R5,Q.IOPL(R0)	;STORE BUFFER ADDRESS IN DPB

     74	000014					DIR$	R0		;ISSUE DIRECTIVE

     75	000020	103004 				BCC	10$		;IF CC OK

     76	000022	016767 	000000G	000000G		MOV	$DSW,$IOST	;COPY DSW INTO STATUS BLOCK

     77	000030	000405 				BR	15$		;

     78	000032	105767 	000000G		10$:	TSTB	$IOST		;ERROR?

     79	000036	100016 				BPL	70$		;IF PL NO

     80	000040	105067 	000001G			CLRB	$IOST+1		;YES, CLEAR THE HIGH BYTE

     81	000044	012700 	000102'		15$:	MOV	#100$,R0	;SET POINTER TO ERROR TABLE

     82	000050	021067 	000000G		20$:	CMP	(R0),$IOST	;SCAN ERROR TABLE TO FIND ERROR TYPE

     83	000054	001403 				BEQ	30$		;IF EQ MATCH

     84	000056	022020 				CMP	(R0)+,(R0)+	;STEP TO NEXT ENTRY

     85	000060	005710 				TST	(R0)		;END OF TABLE?

     86	000062	001372 				BNE	20$		;IF NE NO

     87	000064	016000 	000002 		30$:	MOV	2(R0),R0	;GET ADRS OF ERROR MESSAGE

     88	000070	001002 				BNE	80$		;IF NE PRINT MESSAGE

     89	000072	000261 				SEC			;ELSE JUST SET CARRY AND EXIT

     90	000074				70$:	RETURN			;

     91

     92	000076	000167 	000000G		80$:	JMP	$MESAG

     93

     94

     95					;+

     96					; ERROR TABLE CONTAINS 2-WORD ENTRIES.

     97					; WORD 1 IS ERROR CODE (HIGH BYTE -1 IF DSW CODE,

     98					; 0 IF IO STATUS BLOCK CODE). WORD 2 IS ADDRESS OF

BADIO - I/O ROUTINES FOR ...BAD	MACRO M1110  22-AUG-78 02:07  PAGE 3-1





     99					; MESSAGE TO PRINT, OR 0 IF NO MESSAGE TO BE PRINTED,

    100					; IN WHICH CASE WE RETURN WITH CC-C SET.

    101					; END OF TABLE IS AN ENTRY WITH WORD 1 = 0.

    102					;-

    103

    104	000102	000000G	000000G		100$:	.WORD	IE.HWR,		$MSG13	; HANDLER NOT RESIDENT

    105	000106	000000C	000000G			.WORD	IE.DNR&377,	$MSG10	; DEVICE NOT READY

    106	000112	000000C	000000G			.WORD	IE.WLK&377,	$MSG9	; DEVICE WRITE LOCKED

    107	000116	000000C	000000G			.WORD	IE.DAA&377,	$MSG5	; DEVICE ALREADY ATTACHED

    108	000122	000000C	000000 			.WORD	IE.VER&377,	0	; PARITY ERROR

    109	000126	000000C	000000 			.WORD	IE.BBE&377,	0	; BAD BLOCK

    110	000132	000000C	000000G			.WORD	IE.FHE&377,	$MSG20	; FATAL HARDWARE ERROR

    111

    112

    113						.IF DF	R$$11M!R$$11S

    114

    115	000136	000000C	000000 			.WORD	IE.BLK&377,	0	; BLOCK NUMBER TOO HIGH

    116	000142	000000C	000000 			.WORD	IE.WCK&377,	0	; WRITE CHECK ERROR

    117

    118						.ENDC

    119

    120

    121	000146	000000 	000000G			.WORD	0,		$MSG8	; END OF TABLE

    122					;

    123

    124

    125					;+

    126					; **-$WRITE-ISSUE A WRITE FUNCTION

    127					;

    128					; SUBROUTINE TO ISSUE A WRITE QIO COMMAND.  IF ANY OF THE BLOCKS IN

    129					; THE TRANSFER REQUEST EXCEED THE SIZE OF THE VOLUME, AN IMMEDIATE

    130					; JUMP IS MADE VIA '$IEBLK'.  THE TOTAL NUMBER OF BLOCKS ON THE VOLUME

    131					; HAVE BEEN STORED IN '$MXLBN' (2 WORDS) BACK IN THE MAINLINE CODE.

    132					;

    133					;

    134					; INPUTS:

    135					;

    136					;	R5 -- BUFFER ADDRESS

    137					;

    138					; OUTPUTS:

    139					;

    140					;	BUFFER IS WRITTEN TO DISK BLOCK(S) SPECIFIED IN DISK DPB.

    141					;

    142					;-

    143

    144	000152	010046 			$WRITE::MOV	R0,-(SP)	;SAVE REGISTERS

    145	000154	010146 				MOV	R1,-(SP)	;

    146	000156	010346 				MOV	R3,-(SP)	;

    147	000160	016701 	000000G			MOV	$XFRSZ,R1	;CONVERT BYTE TRANSFER SIZE TO BLOCKS

    148	000164	000301 				SWAB	R1		;

    149	000166	006201 				ASR	R1		;

    150	000170	005301 				DEC	R1		;GET # OF BLOCKS -1

    151	000172	016700 	000000G			MOV	$LBNH,R0	;GET TRANSFER ADDRESS FROM DISK I/O DPB

    152	000176	016703 	000000G			MOV	$LBNL,R3

    153	000202	060103 				ADD	R1,R3		;ADD # OF BLOCKS -1 TO STARTING BLOCK #

    154	000204	005500 				ADC	R0

    155	000206	026700 	000000G			CMP	$MXLBN,R0	;WILL THE TRANSFER GO OFF THE END?

BADIO - I/O ROUTINES FOR ...BAD	MACRO M1110  22-AUG-78 02:07  PAGE 3-2





    156	000212	101011 				BHI	20$		;IF HI NO

    157	000214	103403 				BLO	10$		;IF LO YES

    158	000216	026703 	000002G			CMP	$MXLBN+2,R3	;MAYBE -- CHECK LOW BITS

    159	000222	101005 				BHI	20$		;IF HI NO

    160	000224	012603 			10$:	MOV	(SP)+,R3	;RESTORE REGISTERS

    161	000226	012601 				MOV	(SP)+,R1	;

    162	000230	012600 				MOV	(SP)+,R0	;

    163	000232	000177 	000000G			JMP	@$IEBLK		;EXIT TO ERROR ADDRESS

    164

    165	000236	012703 	000000C		20$:	MOV	#IO.WLB!IQ.X,R3	;GET WRITE WITHOUT RETRIES FUNCTION

    166

    167

    168						.IF NDF	R$$11M&R$$11S

    169

    170						TSTB	$LTDSK+1	;DOES DEVICE SUPPORT IQ.X?

    171						BNE	30$		;IF NE YES

    172						BIC	#IQ.X,R3	;CLEAR IQ.X BIT

    173

    174						.ENDC

    175

    176

    177	000242				30$:	CALL	$DSKIO		;WRITE THE BUFFER

    178	000246	012603 				MOV	(SP)+,R3	;RESTORE REGISTERS

    179	000250	012601 				MOV	(SP)+,R1	;

    180	000252	012600 				MOV	(SP)+,R0	;

    181	000254					RETURN			;EXIT WITH CARRY PRESERVED

    182

    183

    184					;+

    185					; **-$INIT-INITIALIZE I/O BUFFER

    186					;

    187					; SUBROUTINE TO SET UP TEST PATTERN IN DISK I/O BUFFER

    188					;

    189					;

    190					; INPUTS:

    191					;

    192					;	NONE

    193					;

    194					; OUTPUTS:

    195					;

    196					;	I/O BUFFER '$BUF' CONTAINS WORST CASE TEST PATTERN.

    197					;-

    198

    199	000256	010046 			$INIT::	MOV	R0,-(SP)	;SAVE REGISTERS

    200	000260	010246 				MOV	R2,-(SP)	;

    201	000262	010346 				MOV	R3,-(SP)	;

    202	000264	010546 				MOV	R5,-(SP)	;

    203	000266	012705 	000000G			MOV	#$BUF,R5	;SET UP TO INITIALIZE I/O BUFFER

    204	000272	016700 	000000G			MOV	$XFRSZ,R0	;GET TRANSFER SIZE FROM DISK I/O DPB

    205	000276	006200 				ASR	R0		; R0 CONTAINS # OF TIMES

    206	000300	006200 				ASR	R0		; PATTERN IS REPEATED

    207	000302	016702 	000000G			MOV	$TSTPT,R2

    208	000306	016703 	000002G			MOV	$TSTPT+2,R3

    209	000312	010225 			10$:	MOV	R2,(R5)+	;STORE FIRST WORD

    210	000314	010325 				MOV	R3,(R5)+	;STORE SECOND WORD

    211	000316	005300 				DEC	R0		;

    212	000320	001374 				BNE	10$		;

BADIO - I/O ROUTINES FOR ...BAD	MACRO M1110  22-AUG-78 02:07  PAGE 3-3





    213	000322	012605 				MOV	(SP)+,R5	;RESTORE REGISTERS

    214	000324	012603 				MOV	(SP)+,R3	;

    215	000326	012602 				MOV	(SP)+,R2	;

    216	000330	012600 				MOV	(SP)+,R0	;

    217	000332					RETURN			;EXIT

    218

    219

    220					;+

    221					; **-$PRINT-PRINT MESSAGE ON THE USERS TI:

    222					;

    223					; INPUTS:

    224					;

    225					;	R0 -- MESSAGE ADDRESS

    226					;	R1 -- CARRIAGE CONTROL

    227					;

    228					; OUTPUTS:

    229					;

    230					;	MESSAGE SENT TO TI:

    231					;-

    232

    233	000334	012705 	000000G		$PRINT::MOV	#$CODPB,R5	;GET OUTPUT DPB ADDRESS

    234	000340	012765 	000000G	000000G		MOV	#IO.WVB,Q.IOFN(R5)  ;SET FUNCTION CODE

    235	000346	010065 	000000G			MOV	R0,Q.IOPL(R5)	;STORE MESSAGE ADDRESS IN DPB

    236	000352	005065 	000002G			CLR	Q.IOPL+2(R5)	;CLEAR MESSAGE LENGTH COUNTER IN DPB

    237	000356	010165 	000004G			MOV	R1,Q.IOPL+4(R5)	;SET CARRIAGE CONTROL

    238	000362	105720 			1$:	TSTB	(R0)+		;END OF MESSAGE STRING?

    239	000364	001403 				BEQ	2$		;IF EQ YES

    240	000366	005265 	000002G			INC	Q.IOPL+2(R5)	;NO, BUMP COUNT

    241	000372	000773 				BR	1$		;GET NEXT CHARACTER

    242	000374				2$:	DIR$	R5		;PRINT THE MESSAGE

    243	000400	103004 				BCC	3$		;IF CC OK

    244	000402	022767 	000000G	000000G		CMP	#IE.UPN,$DSW	;POOL SPACE AVAILABLE?

    245	000410	001771 				BEQ	2$		;IF EQ NO, TRY AGAIN

    246	000412				3$:	RETURN			;

    247

    248

    249						.IF DF	S$$BAD

    250

    251					;+

    252					; **-$READ-READ A LINE FROM THE TERMINAL

    253					;

    254					; THIS SUBROUTINE WILL READ A LINE FROM THE CONSOLE

    255					; DEVICE.

    256					;

    257					; INPUTS:

    258					;

    259					;	NONE.

    260					;

    261					; OUTPUTS:

    262					;

    263					;	CARRY SET IF ANY ERROR AND

    264					;	R0=ERROR MESSAGE ADDRESS

    265					;

    266					;	CARRY CLEAR IF READ OK

    267					;-

    268

    269					$READ::	MOV	#$CODPB,R5	;GET INPUT DPB ADDRESS

BADIO - I/O ROUTINES FOR ...BAD	MACRO M1110  22-AUG-78 02:07  PAGE 3-4





    270						MOV	#IO.RVB,Q.IOFN(R5)  ;LOAD FUNCTION CODE

    271						MOV	#$MCRLN+2,Q.IOPL(R5)  ;LOAD BUFFER ADDRESS

    272						MOV	#80.,Q.IOPL+2(R5)  ;LOAD MAX NUMBER OF BYTES TO READ

    273						DIR$	R5		;READ IN THE LINE

    274						BCS	1$		;IF CS DIRECTIVE ERROR

    275						TSTB	$COST		;I/O ERROR?

    276						BLT	1$		;IF LT YES

    277						TSTB	$COST+1		;CHECK FOR A TERMINATED LINE

    278						BEQ	2$		;IF EQ BUFFER OVERFLOWED

    279						RETURN			;READ WAS OK

    280

    281					1$:	MOV	#$MSG28,R0	;COMMAND I/O ERROR

    282						BR	3$		;

    283					2$:	MOV	#$MSG29,R0	;COMMAND TOO LONG

    284					3$:	SEC			;SET ERROR RETURN

    285						RETURN

    286

    287						.ENDC

    288

    289

    290		000001 				.END

BADIO - I/O ROUTINES FOR ...BAD	MACRO M1110  22-AUG-78 02:07  PAGE 3-5

SYMBOL TABLE



A$$CHK= 000000   	IE.DAA= ****** GX	M$$CRB= 000124   	R$$KWC= 000000   	T$$SYN= 000000

A$$CPS= 000000   	IE.DNR= ****** GX	M$$CRX= 000000   	R$$K11= 000001   	T$$TRW= 000000

A$$NSI= 000000   	IE.FHE= ****** GX	M$$EXT= 000000   	R$$LKL= 000000   	T$$VBF= 000000

A$$PRI= 000000   	IE.HWR= ****** GX	M$$FCS= 000000   	R$$NDC= 000006   	U$$MHI= 000040

A$$TRP= 000000   	IE.UPN= ****** GX	M$$MGE= 000000   	R$$NDH= 000144   	U$$MLO= 120000

C$$CDA= 000001   	IE.VER= ****** GX	M$$MUP= 000000   	R$$NDL= 000001   	U$$MRN= 170324

C$$CKP= 000000   	IE.WCK= ****** GX	M$$NET= 000000   	R$$SND= 000000   	V$$CTR= 000400

C$$ORE= 002000   	IE.WLK= ****** GX	M$$OVR= 000000   	R$$VAX= 000000   	X$$DBT= 000000

C$$OVL= 000000   	IO.WLB= ****** GX	N$$CON= 000144   	R$$X11= 000001   	$BUF  = ****** GX

C$$RSH= 177564   	IO.WVB= ****** GX	N$$LDV= 000001   	R$$11M= 000000   	$CODPB= ****** GX

D$$BUG= 177514   	IQ.X  = ****** GX	N$$MOV= 000021   	S$$WPC= 000036   	$DSKIO  000000RG

D$$H11= 000002   	I$$RAR= 000000   	N$$MXM= 000400   	S$$WPR= 000005   	$DSKPB= ****** GX

D$$IAG= 000000   	I$$RDN= 000000   	N$$TMO= 000012   	S$$WRG= 000000   	$DSW  = ****** GX

D$$ISK= 000000   	K$$CNT= 177546   	P$$D70= 000000   	S$$YSZ= 030000   	$IEBLK= ****** GX

D$$L11= 000001   	K$$CSR= 177546   	P$$GMX= 000000   	T$$ACR= 000000   	$INIT   000256RG

D$$M11= 000001   	K$$LDC= 000000   	P$$LAS= 000000   	T$$BTW= 000000   	$IOST = ****** GX

D$$SHF= 000000   	K$$TPS= 000074   	P$$P11= 000001   	T$$BUF= 000000   	$LBNH = ****** GX

D$$YNC= 000000   	LD$DB = 000000   	P$$P45= 000000   	T$$CCA= 000000   	$LBNL = ****** GX

D$$YNM= 000000   	LD$DK = 000000   	P$$RFL= 000000   	T$$CCO= 000000   	$MESAG= ****** GX

E$$DVC= 000000   	LD$DS = 000000   	P$$RTY= 000000   	T$$CTR= 000000   	$MSG10= ****** GX

E$$NSI= 000000   	LD$DT = 000000   	P$$R11= 000001   	T$$C11= 000001   	$MSG13= ****** GX

E$$PER= 000000   	LD$DX = 000000   	P$$SRF= 000000   	T$$GMC= 000000   	$MSG20= ****** GX

E$$XPR= 000000   	LD$LP = 000000   	P$$TPT= 000000   	T$$GTS= 000000   	$MSG5 = ****** GX

F$$AST= 000000   	LD$MM = 000000   	Q$$OPT= 000014   	T$$J16= 000001   	$MSG8 = ****** GX

F$$LPP= 000000   	LD$PP = 000000   	Q.IOFN= ****** GX	T$$KMG= 000000   	$MSG9 = ****** GX

F$$LVL= 000001   	LD$PR = 000000   	Q.IOPL= ****** GX	T$$LWC= 000000   	$MXLBN= ****** GX

G$$TPP= 000000   	LD$TT = 000000   	R$$DER= 000000   	T$$MAN= 016703   	$PRINT  000334RG

G$$TSS= 000000   	L$$ASG= 000000   	R$$EXV= 000000   	T$$RNE= 000000   	$TSTPT= ****** GX

G$$TTK= 000000   	L$$DRV= 000000   	R$$JPO= 000000   	T$$RPR= 000000   	$WRITE  000152RG

IE.BBE= ****** GX	L$$P11= 000001   	R$$JP1= 000001   	T$$RST= 000000   	$XFRSZ= ****** GX

IE.BLK= ****** GX	L$$11R= 000000   	R$$JS1= 000001   	T$$RUB= 000000   	$$$R4 = 000000



. ABS.	000000	   000

      	000414	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  3915 WORDS  ( 16 PAGES)

DYNAMIC MEMORY:  4884 WORDS  ( 18 PAGES)

ELAPSED TIME:  00:00:09

OBJ$:BADIO,LIS$:BADIO/-SP=SRC$:RSXMC/PA:1,BADIO

