BADBLK - ROOT SEGMENT FOR BAD	MACRO M1110  22-AUG-78 02:07  PAGE 2





      1					.TITLE	BADBLK - ROOT SEGMENT 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					;	H. LEV 14-AUG-74

     32					;		CHANGES TO RUN UNDER RSX-11M.

     33					;

     34					;	H. LEV 06-FEB-75

     35					;		GET DEVICE BLOCK SIZE FROM GET LUN INFO.

     36					;

     37					;	R. NEWLAND 19-FEB-76

     38					;		001 -- IAS CONDITIONAL CODE.

     39					;

     40					;	P. WANNHEDEN 14-AUG-76

     41					;		PW001 -- USE QIOW$ DIRECTIVE. SUPPORT FOR RK06 LAST

     42					;			TRACK BAD BLOCK FILES.

     43					;

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

     45					;		PB010 -- CHANGE LAST TRACK BAD BLOCK FILE HANDLING

     46					;			TO SUPPORT ANY LAST TRACK DEVICE.  BREAK

     47					;			BAD INTO SEPERATE MODULES.  ADD /LI SWITCH.

     48					;

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

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

     51					;

     52					;	P. WANNHEDEN 07-NOV-77

     53					;		PW002 -- IMPLEMENT EXIT WITH STATUS.

BADBLK - ROOT SEGMENT FOR BAD	MACRO M1110  22-AUG-78 02:07  PAGE 3





     55					;+

     56					; **- ...BAD - FUNCTIONAL SPECIFICATION

     57					;

     58					; THE 'BAD' MCR FUNCTION PROVIDES A FACILITY OF VERIFYING DISKS --

     59					; I.E., DETERMINING THE NUMBER AND LOCATION OF ANY BAD BLOCKS ON A

     60					; FILES-11 DEVICE (NOT MAGTAPE!).  IT DOES THIS BY WRITING A "WORST CASE"

     61					; TEST PATTERN ONTO EACH BLOCK OF THE DISK, AND THEN PERFORMING A

     62					; READ VERIFY OF THE BLOCK.  BEFORE A BLOCK IS CONSIDERED TO BE BAD,

     63					; THE INITIAL WRITE OR READ VERIFY MUST FAIL, AS WELL AS A

     64					; SUBSEQUENT WRITE/READ-VERIFY OPERATION.

     65					;

     66					; AS 'BAD' LOCATES BAD BLOCKS, IT FORMATS THIS INFORMATION IN THE

     67					; BUFFER '$BADBK'.  WHEN ALL BLOCKS ON THE DISK HAVE BEEN PROCESSED,

     68					; '$BADBK' WILL BE WRITTEN INTO THE LAST GOOD BLOCK OF THE DISK.

     69					; NOTE -- THERE MUST BE AT LEAST ONE GOOD BLOCK WITHIN THE LAST 256

     70					; BLOCKS ON THE DISK.  IF BLOCK 0 IS BAD, '...BAD' WILL PRINT A MESSAGE

     71					; WARNING THE OPERATOR NOT TO USE THE DISK AS A SYSTEM DISK.

     72					;

     73					; THE FOLLOWING DIAGRAM ILLUSTRATES THE LAYOUT OF '$BADBK'.  THIS

     74					; IS THE FORMAT WHICH 'INITVOL' EXPECTS TO FIND, AND FROM WHICH THE

     75					; ACTUAL BAD BLOCK FILE IS CONSTRUCTED.

     76					;

     77					;

     78					;   $BADBK -->	-----------------------

     79					;		!  BB.AFS  !  BB.CFS  !   0

     80					;		!---------------------!

     81					;		!  BB.AVL  !  BB.USD  !   1

     82					;   BB.PTR -->  !---------------------!

     83					;		!  BB.CNT  !  BB.NHI  !   2

     84					;		!---------------------!

     85					;		!        BB.NLO       !   3

     86					;		!---------------------!

     87					;		!          .          !   .

     88					;		!---------------------!

     89					;		!          .          !   .

     90					;		!---------------------!

     91					;		!          .          !   .

     92					;   $PTRND -->  !---------------------!

     93					;		!      S P A R E      !  206.

     94					;		!---------------------!

     95					;		!          .          !   .

     96					;		!---------------------!

     97					;		!          .          !   .

     98					;		!---------------------!

     99					;		!          .          !   .

    100					;		!---------------------!

    101					;		!        BB.CKS       !  255.

    102					;		-----------------------

    103					;

    104					;

BADBLK - ROOT SEGMENT FOR BAD	MACRO M1110  22-AUG-78 02:07  PAGE 4





    106					; SYMBOL DEFINITIONS:

    107					;

    108					;	$BADBK -- POINTER TO BEGINNING OF 256 WORD BUFFER WHICH WILL

    109					;		  BE WRITTEN ONTO THE LAST GOOD BLOCK OF THE DISK.

    110					;

    111					;	BB.AFS -- ALWAYS 3.  FIELD SIZE IN BYTES OF BLOCK ADDRESS.

    112					;

    113					;	BB.CFS -- ALWAYS 1.  FIELD SIZE IN BYTES OF BLOCK COUNT.

    114					;

    115					;	BB.AVL -- ALWAYS 204.  NUMBER OF WORDS AVAILABLE FOR BAD BLOCK POINTERS.

    116					;

    117					;	BB.USD -- POINTER TO BYTE CONTAINING COUNT OF WORDS USED FOR BAD

    118					;		  BLOCK POINTERS.

    119					;

    120					;	BB.PTR -- POINTER TO BEGINNING OF BAD BLOCK POINTERS.

    121					;

    122					;	BB.CNT -- OFFSET WITHIN A POINTER TO COUNT OF NUMBER OF BAD BLOCKS

    123					;		  IN THE GROUP DESCRIBED BY THE POINTER.  HAS A BIAS OF

    124					;		  -1 -- I.E., ONE BAD BLOCK MEANS THIS BYTE WILL BE ZERO.

    125					;

    126					;	BB.NHI -- OFFSET WITHIN A POINTER TO BYTE CONTAINING HIGH ADDRESS

    127					;		  BITS OF FIRST BLOCK OF GROUP.

    128					;

    129					;	BB.NLO -- OFFSET WITHIN A POINTER TO WORD CONTAINING LOW ADDRESS

    130					;		  BITS OF FIRST BLOCK OF GROUP.

    131					;

    132					;	$PTRND -- POINTER TO WORD FOLLOWING LAST BAD BLOCK POINTER.

    133					;

    134					;	BB.CKS -- POINTER TO CHECKSUM.  THIS IS THE LAST WORD IN THE BUFFER.

    135					;

    136					;

    137					; FOR 'BAD', THERE IS ONLY ONE LINE OF COMMAND INPUT, WHOSE SYNTAX IS:

    138					;

    139					;	BAD<SP><DEVICE>[<UNIT>][:][<SWITCH>]<LT>

    140					;

    141					;	WHERE:

    142					;		<SP>	- <SPACE> OR <TAB>

    143					;		<DEVICE>- ANY VALID FILES-11 DIRECTORY DEVICE

    144					;		<UNIT>	- <0-7>

    145					;		<SWITCH>- ANY COMBINATION OF THE FOLLOWING SWITCHES:

    146					;		   /OVR	- OVERRIDE USE OF MANUFACTURES BAD SECTOR FILE

    147					;		   /LI	- LIST ALL BAD BLOCKS

    148					;		   /CSR=XXXXXX - CHANGE CSR ADDRESS (STANDALONE ONLY)

    149					;		   /VEC=XXX - CHANGE VECTOR ADDRESS (STANDALONE ONLY)

    150					;		   /WCHK - SET WRITE CHECK (STANDALONE ONLY)

    151					;		   /NOWCHK - CLEAR WRITE CHECK (STANDALONE ONLY)

    152					;		<LT>	- <CARRIAGE RETURN> OR <ALT MODE>

    153					;

    154					;

    155					; 'BAD' WILL PRINT THE NUMBER OF BAD BLOCKS FOUND (IN DECIMAL)

    156					; WHEN THE END OF THE DISK IS REACHED.

    157					;-

BADBLK - ROOT SEGMENT FOR BAD	MACRO M1110  22-AUG-78 02:07  PAGE 5





    159

    160					.MCALL	DIR$, ALUN$S, GLUN$S, GCML$

    161

    162	000000				$BADEP::			;ENTRY POINT

    163	000000	105067 	000000G			CLRB	$SWOVR		;RESET OVERRIDE SWITCH

    164	000004	105067 	000000G			CLRB	$SWLST		;RESET LISTING SWITCH

    165	000010	012767 	000000G	000000G		MOV	#EX$SUC,$STATS	;INITIALIZE EXIT STATUS TO "SUCCESS"

    166

    167

    168						.IF DF	IAS

    169

    170						GCML$	#$GCMD		;GET COMMAND LINE

    171						BCS	5$

    172						CMPB	#GE.EOF,$GCMD+G.ERR

    173						BNE	10$

    174					5$:	JMP	$BADXT		;GET OUT OF HERE

    175					10$:	TST	G.CMLD+$GCMD	;ANY CHARACTERS?

    176						BEQ	$BADEP

    177						CALL	.CKPRV		;SEE IF INVOKING TERMINAL IS PRIVILEGED

    178						BCC	35$		;YES

    179						MOV	#$MSG15,R0	;NO

    180					20$:	JMP	$MESAG

    181					30$:	MOV	#$MSG2,R0	;SYNTAX ERROR

    182						BR	20$

    183					35$:	MOV	G.CMLD+2+$GCMD,R2

    184					40$:	MOVB	(R2)+,$DVICE	;GET DEVICE NAME (2 CHARACTERS)

    185						MOVB	(R2)+,$DVICE+1

    186						MOVB	(R2)+,R1	;GET UNIT NUMBER

    187						SUB	#3,G.CMLD+$GCMD ; REDUCE THE CHARACTER COUNT

    188						MOV	R1,R3		;SAVE IT FOR LATER

    189						SUB	#'0,R1		;SUBTRACT ASCII BIAS

    190						BMI	50$		;NOT A NUMERIC

    191						CMP	#7,R1		;CHECK HIGH LIMIT

    192						BLO	50$		;OCTAL DIGIT IF .LE. 7

    193						MOVB	(R2)+,R3	;GET NEXT CHARACTER

    194						DEC	G.CMLD+$GCMD

    195						BR	60$		;CHECK IF COLON

    196					45$:	JMP	INVSW		;INVALID SWITCH

    197					50$:	CLR	R1		;DEFAULT TO 0 IF NO UNIT SPECIFIED

    198					60$:	CMP	#':,R3		;CHECK FOR LEGAL TERMINATOR

    199						BNE	30$		;NOT A COLON

    200						TST	G.CMLD+$GCMD

    201						BEQ	80$		;ALL DONE

    202					61$:	CMPB	#'/,(R2)+	;START OF SWITCH?

    203						BNE	30$		;IF NE NO

    204						CMPB	#'O,(R2)+	;TEST FOR /OVR

    205						BEQ	62$		;IF EQ YES

    206						CMPB	#'L,-1(R2)	;TEST FOR /LI

    207						BNE	45$		;IF NE NO

    208						CMPB	#'I,(R2)+	;

    209						BNE	45$

    210						SUB	#3,G.CMLD+$GCMD	;REDUCE CHARACTER COUNT

    211						INCB	$SWLST		;SET /LI SWITCH SEEN

    212						BR	63$		;TRY FOR MORE

    213					62$:	CMPB	#'V,(R2)+

    214						BNE	45$

    215						CMPB	#'R,(R2)+

BADBLK - ROOT SEGMENT FOR BAD	MACRO M1110  22-AUG-78 02:07  PAGE 5-1





    216						BNE	45$

    217						SUB	#4,G.CMLD+$GCMD	;REDUCE CHARACTER COUNT

    218						INCB	$SWOVR		;SET /OVR SWITCH SEEN

    219					63$:	TST	G.CMLD+$GCMD	;CHARACTER COUNT EXHAUSTED?

    220						BNE	61$		;IF NE NO

    221

    222						.IFF

    223

    224

    225						.IF DF	S$$BAD

    226

    227						MOV	#$BADEP,SP	;RESET STACK POINTER

    228						CLR	$WCHK		;RESET WRITE CHECK FLAG

    229						CMP	$SYSIZ,#40*16.	;IS THERE AT LEAST 16K?

    230						BHIS	10$		;IF HIS YES

    231						CRASH			;NO, CRASH THE SYSTEM!!!

    232					10$:	CALL	$PARSE		;PROMPT AND PARSE COMMAND LINE

    233

    234						.IFF

    235

    236	000016					DIR$	#$MCRLN		;TRY TO READ MCR LINE

    237	000024	103003 				BCC	10$		;IF CC OK

    238	000026	012700 	000000G			MOV	#$MSG1,R0	;MCR READ ERROR

    239	000032	000421 				BR	35$		;PRINT MESSAGE

    240	000034				10$:				;REF LABEL

    241

    242

    243						.IF NDF R$$11M

    244

    245						CALL	.CKPRV		;SEE IF INVOKING TERMINAL IS PRIVILEGED

    246						BCC	15$		;YES

    247						MOV	#$MSG15,R0	;NO

    248						BR	35$

    249

    250						.ENDC

    251

    252

    253	000034	012702 	000005G		15$:	MOV	#$MCRLN+5,R2	;SET R2 AS LINE INDEX

    254	000040	112201 			20$:	MOVB	(R2)+,R1	;GET CHARACTER

    255	000042	122701 	000040 			CMPB	#40,R1		;IS IT A SPACE?

    256	000046	001415 				BEQ	40$		;YES -- LOOK FOR DEVICE NAME

    257	000050	122701 	000011 			CMPB	#11,R1		;NO -- IS IT A TAB?

    258	000054	001412 				BEQ	40$		;YES

    259	000056	122701 	000033 			CMPB	#33,R1		;NO -- IS IT AN ALT MODE?

    260	000062	001403 				BEQ	30$		;YES -- SYNTAX ERROR

    261	000064	122701 	000015 			CMPB	#15,R1		;NO -- IS IT A CARRIAGE RETURN?

    262	000070	001363 				BNE	20$		;NO -- CONTINUE SCAN FOR BREAK CHARACTER

    263	000072	012700 	000000G		30$:	MOV	#$MSG2,R0	;SYNTAX ERROR

    264	000076	000167 	000000G		35$:	JMP	$MESAG

    265	000102	112267 	000000G		40$:	MOVB	(R2)+,$DVICE	;GET DEVICE NAME (2 CHARACTERS)

    266	000106	112267 	000001G			MOVB	(R2)+,$DVICE+1

    267

    268

    269						.IF DF	R$$11M

    270

    271	000112	010200 				MOV	R2,R0		; COPY BUFFER POINTER

    272	000114					CALL	$COTB		; CONVERT UNIT NUMBER TO BINARY

BADBLK - ROOT SEGMENT FOR BAD	MACRO M1110  22-AUG-78 02:07  PAGE 5-2





    273	000120	010203 				MOV	R2,R3		; GET TERMINATOR

    274	000122	010002 				MOV	R0,R2		; RESTORE BUFFER POINTER

    275	000124	122703 	000072 			CMPB	#':,R3		; TERMINATOR  COLON?

    276	000130	001360 				BNE	30$		; NO, SYNTAX ERROR

    277	000132	112203 			70$:	MOVB	(R2)+,R3	;GET NEXT CHARACTER

    278

    279						.IFF

    280

    281						MOVB	(R2)+,R3	;GET NEXT CHARACTER

    282						MOV	R3,R1		;ASSUME ITS NUMERIC

    283						SUB	#'0,R1		;SUBTRACT ASCII BIAS

    284						BMI	50$		;IF MI ITS NOT NUMERIC

    285						CMP	#7,R1		;CHECK HIGH LIMIT

    286						BLO	50$		;IF LO ITS NOT NUMERIC

    287						MOVB	(R2)+,R3	;GET NEXT CHARACTER

    288						BR	60$		;CHECK IF COLON

    289					50$:	CLR	R1		;DEFAULT TO 0 IF NO UNIT SPECIFIED

    290					60$:	CMP	#':,R3		;CHECK FOR LEGAL TERMINATOR

    291						BNE	70$		;NOT A COLON

    292						MOVB	(R2)+,R3	;GET NEXT CHARACTER

    293					70$:				;REF LABEL

    294

    295						.ENDC

    296

    297

    298	000134	122703 	000057 		71$:	CMPB	#'/,R3		;START OF SWITCH?

    299	000140	001031 				BNE	75$		;IF NE NO

    300	000142	122722 	000117 			CMPB	#'O,(R2)+	;TEST FOR /OVR

    301	000146	001412 				BEQ	72$		;IF EQ YES

    302	000150	122762 	000114 	177777 		CMPB	#'L,-1(R2)	;TEST FOR /LI

    303	000156	001020 				BNE	74$		;IF NE NO

    304	000160	122722 	000111 			CMPB	#'I,(R2)+

    305	000164	001015 				BNE	74$

    306	000166	105267 	000000G			INCB	$SWLST		;SET /LI SWITCH SEEN

    307	000172	000410 				BR	73$

    308	000174	122722 	000126 		72$:	CMPB	#'V,(R2)+

    309	000200	001007 				BNE	74$

    310	000202	122722 	000122 			CMPB	#'R,(R2)+

    311	000206	001004 				BNE	74$

    312	000210	105267 	000000G			INCB	$SWOVR		;SET /OVR SWITCH SEEN

    313	000214	112203 			73$:	MOVB	(R2)+,R3	;GET NEXT CHARACTER

    314	000216	000746 				BR	71$

    315	000220	000167 	000440 		74$:	JMP	INVSW		;INVALID SWITCH

    316	000224	022703 	000033 		75$:	CMP	#33,R3		;CHECK LINE TERMINATOR

    317	000230	001403 				BEQ	80$		;OK IF ALT MODE OR CARRIAGE RETURN

    318	000232	022703 	000015 			CMP	#15,R3

    319	000236	001315 				BNE	30$		;ERROR IF NEITHER

    320

    321						.ENDC

    322

    323

    324						.ENDC

    325

    326

BADBLK - ROOT SEGMENT FOR BAD	MACRO M1110  22-AUG-78 02:07  PAGE 6





    328	000240				80$:	ALUN$S	#DSKLUN,$DVICE,R1  ;ASSIGN LUN TO DISK

    329	000260	103004 				BCC	100$		;IF CC DEVICE LEGAL

    330	000262	012700 	000000G		90$:	MOV	#$MSG4,R0	;DEVICE NOT IN SYSTEM

    331	000266	000167 	000000G		95$:	JMP	$MESAG

    332	000272	005067 	000000G		100$:	CLR	$LTDSK		;ASSUME NOT LAST TRACK DEVICE

    333	000276					GLUN$S	#DSKLUN,#$GLDPB	;GET LUN INFO FOR DEVICE

    334					;

    335					; REARRANGE THE GEOMETRY INFO IN $GLDPB FROM STARLET CME FORMAT TO

    336					; RSX-11M FORMAT. ALSO, SET UP $CYL, $TRAK AND $SECT.

    337					;

    338	000314	016700 	000006G			MOV 	$GLDPB+G.LUCW+2,R0	; # OF TRACKS & # OF SECTORS TO R0.

    339	000320	010001 				MOV	R0,R1			; SAVE TRACKS INFORMATION..

    340	000322	042700 	177400 			BIC	#^C377,R0		; ISOLATE THE SECTORS INFO.

    341	000326	105001 				CLRB	R1			; ISOLATE THE TRACKS INFO.

    342	000330	000301 				SWAB	R1			; MOV TRACK INFO TO LOW ORDER.

    343	000332					CALL	$MUL			; COMPUTE SECTORS PER CYLINDER.

    344	000336	010100 				MOV	R1,R0			; SECTORS PER CYLINDER TO R0.

    345	000340	005002 				CLR	R2			; ALWAYS LT 65K CYLINDERS.

    346	000342	016703 	000010G			MOV	$GLDPB+G.LUCW+4,R3	; NUMBER OF CYLINDERS TO R3.

    347	000346					CALL	$DMUL			; COMPUTE BLOCKS PER VOLUME.

    348	000352	010067 	000000G			MOV	R0,$MXLBN		; SAVE NUMBER OF BLOCKS ON

    349	000356	010167 	000002G			MOV	R1,$MXLBN+2		; VOLUME FOR LATER USE.

    350

    351

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

    353

    354	000362	012703 	000000G			MOV	#$GLDPB,R3	; GET LUN PARAM BLOCK ADDRESS

    355	000366	032763 	000000G	000004 		BIT	#FD.DIR,G.LUCW(R3) ; IS THIS A DIRECTORY DEVICE?

    356	000374	001003 				BNE	120$		; YES

    357	000376	012700 	000000G			MOV	#$MSG3,R0	; NO, ILLEGAL DEVICE

    358	000402	000731 				BR	95$		; PRINT ERROR

    359	000404				120$:

    360	000404				130$:

    361	000404	022767 	043104 	000000G		CMP	#"DF,$DEVNM	;IS THIS AN RF11 DISK?

    362	000412	001023 				BNE	161$		; NO

    363	000414	016746 	000002G			MOV	$MXLBN+2,-(SP)	; YES, GET LBNS ON A SINGLE PLATTER

    364	000420	005067 	000000G			CLR	$LBNL		; ZERO STARTING LBN

    365	000424	005067 	000000G			CLR	$LBNH		;

    366	000430	061667 	000000G		150$:	ADD	(SP),$LBNL	; INCREMENT IT TO NEXT PLATTER

    367	000434	005567 	000000G			ADC	$LBNH		;

    368	000440					CALL	$DSKIO		; READ IT

    369	000444	103405 				BCS	160$		; IF CS IE.BLK FROM DFDRV

    370	000446	061667 	000002G			ADD	(SP),$MXLBN+2	; UPDATE TOTAL BLOCKS

    371	000452	005567 	000000G			ADC	$MXLBN		;

    372	000456	000764 				BR	150$		; READ UNTIL END OF VOLUME

    373	000460	005726 			160$:	TST	(SP)+		; CLEAN STACK

    374

    375						.IFF

    376

    377						MOV	.PUDBA,R3	;PUD STARTING ADDRESS

    378					110$:	CMP	(R3),$DEVNM	; DEVICE MATCH?

    379						BNE	120$		;NO

    380						CMPB	U.UN(R3),$GLDPB+2  ;YES, UNIT MATCH?

    381						BEQ	130$		;YES

    382					120$:	ADD	#U.SZ,R3	;CHECK NEXT PUD

    383						CMP	R3,.PUDEA	;ANY MORE PUD?

    384						BLO	110$		;YES

BADBLK - ROOT SEGMENT FOR BAD	MACRO M1110  22-AUG-78 02:07  PAGE 6-1





    385						BR	90$		;NO -- DEVICE NOT IN SYSTEM

    386					130$:	BIT	#UC.F11,U.C1(R3)  ;FILES-11 DEVICE?

    387						BNE	150$		;YES

    388					140$:	MOV	#$MSG3,R0	;NO -- ILLEGAL DEVICE

    389						BR	95$

    390					150$:	BIT	#UC.DIR,U.C1(R3)  ;DIRECTORY DEVICE?

    391						BEQ	140$		;NO -- ERROR

    392						BIT	#UC.SDI!UC.SQD,U.C1(R3)  ;CHECK FOR MAGTAPE

    393						BNE	140$		;ERROR IF MAGTAPE

    394						BITB	#CH.OFF,U.CH(R3)  ;VOLUME MOUNTED?

    395						BNE	160$		;NO

    396						MOV	#$MSG11,R0	;YES -- ERROR

    397						BR	95$		; PRINT ERROR

    398					160$:	MOVB	U.LBH(R3),$MXLBN  ; GET # OF BLOCKS ON THIS DISK

    399						CLRB	$MXLBN+1

    400						MOV	U.LBN(R3),$MXLBN+2

    401						BITB	#U2.BAD,U.C2(R3) ;DOES DISK HAVE A MDBSF?

    402						BEQ	166$		;IF EQ NO

    403

    404						.IFTF

    405

    406	000462	012703 	000000G		161$:	MOV	#$LTDEV,R3	;POINT TO LAST TRACK DEVICE TABLE

    407	000466	005713 			162$:	TST	(R3)		;ARE WE FINISHED?

    408	000470	001432 				BEQ	165$		;IF EQ YES

    409	000472	026723 	000000G			CMP	$DEVNM,(R3)+	;COMPARE WITH DEVICE NAME

    410	000476	001403 				BEQ	164$		;IF EQ THIS IS IT

    411	000500	062703 	000000G		163$:	ADD	#$LTSIZ,R3	;POINT TO NEXT ENTRY

    412	000504	000770 				BR	162$		;LOOP

    413	000506	026713 	000000G		164$:	CMP	$MXLBN,(R3)	;DO THE BLOCK #'S MATCH?

    414	000512	001372 				BNE	163$		;IF NE NO

    415	000514	026763 	000002G	000002 		CMP	$MXLBN+2,2(R3)	;

    416	000522	001366 				BNE	163$		;IF NE NO

    417	000524	022323 				CMP	(R3)+,(R3)+	;POINT PAST LBN

    418	000526	012700 	000000G			MOV	#$LTTRK,R0	;POINT TO DATA TABLE

    419	000532	012320 				MOV	(R3)+,(R0)+	;TRANSFER TRACK

    420	000534	012320 				MOV	(R3)+,(R0)+	;TRANSFER SECTORS/TRACK

    421	000536	012320 				MOV	(R3)+,(R0)+	;TRANSFER SECTORS/BLOCK

    422	000540	012320 				MOV	(R3)+,(R0)+	;TRANSFER BLOCKS/TRACK

    423	000542	012320 				MOV	(R3)+,(R0)+	;TRANSFER BLOCKS/CYLINDER

    424	000544	012320 				MOV	(R3)+,(R0)+	;TRANSFER MANUFACTURES BAD SECTORS

    425	000546	012320 				MOV	(R3)+,(R0)+	;TRANSFER SOFTWARE BAD SECTORS

    426	000550	005167 	000000G			COM	$LTDSK		;FLAG LAST TRACK DEVICE

    427	000554	000400 				BR	166$		;

    428	000556				165$:				;REF LABEL

    429

    430						.IFF

    431

    432						MOV	#$MSG17,R0	;UNRECOGNIZED DISK TYPE

    433						BR	168$		;PRINT MESSAGE

    434

BADBLK - ROOT SEGMENT FOR BAD	MACRO M1110  22-AUG-78 02:07  PAGE 7





    436						.IFTF

    437	000556	012703 	000000G		166$:	MOV	#IO.ATT,R3	; ATTACH DISK

    438	000562					CALL	$DSKIO		;

    439

    440					;

    441					; ISSUE A PACK ACK QIO TO SET VOLUME VALID FOR RK06/07 DEVICES.

    442					;

    443	000566	012767 	000000G	000000C		MOV	#IO.STC,$DSKPB+Q.IOFN	; SET CHARACTERISTICS = PACK ACK.

    444	000574					DIR$	#$DSKPB			; EXECUTE A QIOW$ DIRECTIVE.

    445					;

    446					; WE ASSUME THE ABOVE CAN'T FAIL FOR RK06 TYPE DEVICES, AND WILL FAIL

    447					; ON ALL OTHER DEVICES, SO NO ERROR TEST IS NEEDED.

    448					;

    449					;

    450					; TRY TO ACCESS THE MFD, IF WE SUCCEED, COMPLAIN THAT THE TARGET

    451					; VOLUME IS MOUNTED AS A FILES-11 VOLUME.

    452					;

    453	000602	010601 				MOV	SP,R1			; SAVE STACK RESET VALUE.

    454	000604	005046 				CLR	-(SP)			; BUILD A 3 WORD FILE ID ON

    455	000606	012746 	000004 			MOV	#4,-(SP)		; ON THE STACK.

    456	000612	011646 				MOV	(SP),-(SP)		; 4,4 IS THE MFD.

    457	000614	010605 				MOV	SP,R5			; FIRST PARAMETER IS PTR TO FILE ID.

    458	000616	052767 	100000 	000000C		BIS	#100000,$DSKPB+Q.IOPL+8. ; ENABLE ACCESS CONTROL.

    459	000624	012703 	000000G			MOV	#IO.ACR,R3		; USE ACCESS FOR READ FUNCT CODE.

    460	000630					CALL	$DSKIO			; GO DO QIOW$

    461	000634	010106 				MOV	R1,SP			; CLEAN THE STACK.

    462	000636	103404 				BCS	LTDCHK			; BR IF VOLUME NOT MOUNTED FILES-11 (ACCESS FAILED).

    463	000640	012700 	000000G			MOV	#$MSG16,R0		; "BAD -- VOLUME IS MOUNTED AS FILES-11"

    464	000644	000167 	000000G			JMP	$MESAG			; GO TYPE THE MESSAGE AND EXIT.

    465					 	.ENDC

    466

    467

    468	000650	105767 	000000G		LTDCHK:	TSTB	$LTDSK		; "LAST-TRACK" DISK?

    469	000654	001007 				BNE	X169$		;IF NE YES

    470	000656	105767 	000000G			TSTB	$SWOVR		;OVERRIDE IN EFFECT?

    471	000662	001417 				BEQ	X170$		;IF EQ NO

    472	000664	012700 	000000G		INVSW:	MOV	#$MSG22,R0	;INVALID SWITCH

    473	000670	000167 	000000G		X168$:	JMP	$MESAG

    474	000674	166767 	000000G	000002G	X169$:	SUB	$LTBPT,$MXLBN+2	;DON'T WRITE LAST TRACK

    475	000702	005667 	000000G			SBC	$MXLBN		;

    476	000706	105767 	000000G			TSTB	$SWOVR		;OVERRIDE IN EFFECT?

    477	000712	001003 				BNE	X170$		;IF NE YES

    478	000714					CALL	$RMBBF		;CHECK MDBSF

    479	000720	103763 				BCS	X168$		;IF CS ERROR

    480	000722	012700 	000000G		X170$:	MOV	#BB.PTR,R0	;SET R0 TO INDEX INTO BAD BLOCK BUFFER

    481	000726	010004 				MOV	R0,R4		;SET UP R4 TOO

    482	000730	012701 	000376 			MOV	#254.,R1	;SET R1 AS COUNTER

    483	000734	005020 			175$:	CLR	(R0)+		;CLEAR BAD BLOCK POINTERS

    484	000736	005301 				DEC	R1

    485	000740	001375 				BNE	175$

    486	000742	105067 	000000G			CLRB	BB.USD		;INITIALIZE COUNTERS

    487	000746	005067 	000000G			CLR	$BBCNT

    488	000752	005067 	000000G			CLR	$LBNH

    489	000756	005067 	000000G			CLR	$LBNL

    490	000762	005067 	000000G			CLR	$BK0FG		;RESET BLOCK 0 FLAG

    491	000766	012705 	000000G			MOV	#$BUF,R5	;PUT BUFFER ADDRESS INTO R5 FOR 'WRITE'

    492	000772	012767 	000000G	000000G		MOV	#$FINI,$IEBLK	;SETUP TRANSFER ADDRESS FOR 'WRITE'

BADBLK - ROOT SEGMENT FOR BAD	MACRO M1110  22-AUG-78 02:07  PAGE 7-1





    493	001000	012767 	000000C	000000G	180$:	MOV	#$BUFSZ*2,$XFRSZ  ;SET TRANSFER SIZE FOR WHOLE BUFFER

    494	001006					CALL	$INIT		;SET UP WORST CASE TEST PATTERN IN I/O BUFFER

    495	001012					CALL	$WRITE		;WRITE TEST PATTERN ONTO DISK

    496	001016	103403 				BCS	190$		;IF CS ERROR DURING WRITE

    497	001020					CALL	$VERFY		;READ BLOCK AND VERIFY IT

    498	001024	103003 				BCC	200$		;IF CC VERIFICATION OK

    499	001026				190$:	CALL	$BADCK		;FIND BAD BLOCKS AND UPDATE POINTERS

    500	001032	000762 				BR	180$		;DO NEXT BLOCK

    501	001034	062767 	000000G	000000G	200$:	ADD	#$NBLKS,$LBNL	;SET FOR NEXT GROUP OF BLOCKS

    502	001042	005567 	000000G			ADC	$LBNH

    503	001046	105764 	000000G			TSTB	BB.CNT(R4)	;ANY BAD BLOCKS IN THIS GROUP?

    504	001052	001407 				BEQ	210$		;IF EQ NO, DON'T BUMP PONTER

    505	001054	105364 	000000G			DECB	BB.CNT(R4)	;ALLOW FOR BIAS OF -1

    506	001060	062704 	000000G			ADD	#$PTRSZ,R4	;ADVANCE TO NEXT POINTER

    507	001064	062767 	000000C	000000G		ADD	#$PTRSZ/2,BB.USD  ;ADJUST WORD COUNT

    508	001072	116764 	000000G	000000G	210$:	MOVB	$LBNH,BB.NHI(R4)  ;SET NEW STARTING BLOCK #, SINCE THERE

    509									;WEREN'T ANY BAD BLOCKS IN THIS TRANSFER.

    510	001100	016764 	000000G	000000G		MOV	$LBNL,BB.NLO(R4)

    511	001106	000734 				BR	180$		;DO NEXT TRANSFER

    512

    513		000000'				.END	$BADEP

BADBLK - ROOT SEGMENT FOR BAD	MACRO M1110  22-AUG-78 02:07  PAGE 7-2

SYMBOL TABLE



A$$CHK= 000000   	G.LUCW= 000004   	N$$CON= 000144   	T$$ACR= 000000   	$DMUL = ****** GX

A$$CPS= 000000   	G.LUFB= 000003   	N$$LDV= 000001   	T$$BTW= 000000   	$DSKIO= ****** GX

A$$NSI= 000000   	G.LUNA= 000000   	N$$MOV= 000021   	T$$BUF= 000000   	$DSKPB= ****** GX

A$$PRI= 000000   	G.LUNU= 000002   	N$$MXM= 000400   	T$$CCA= 000000   	$DVICE= ****** GX

A$$TRP= 000000   	INVSW   000664R  	N$$TMO= 000012   	T$$CCO= 000000   	$FINI = ****** GX

BB.CNT= ****** GX	IO.ACR= ****** GX	P$$D70= 000000   	T$$CTR= 000000   	$GLDPB= ****** GX

BB.NHI= ****** GX	IO.ATT= ****** GX	P$$GMX= 000000   	T$$C11= 000001   	$IEBLK= ****** GX

BB.NLO= ****** GX	IO.STC= ****** GX	P$$LAS= 000000   	T$$GMC= 000000   	$INIT = ****** GX

BB.PTR= ****** GX	I$$RAR= 000000   	P$$P11= 000001   	T$$GTS= 000000   	$LBNH = ****** GX

BB.USD= ****** GX	I$$RDN= 000000   	P$$P45= 000000   	T$$J16= 000001   	$LBNL = ****** GX

C$$CDA= 000001   	K$$CNT= 177546   	P$$RFL= 000000   	T$$KMG= 000000   	$LTBPT= ****** GX

C$$CKP= 000000   	K$$CSR= 177546   	P$$RTY= 000000   	T$$LWC= 000000   	$LTDEV= ****** GX

C$$ORE= 002000   	K$$LDC= 000000   	P$$R11= 000001   	T$$MAN= 016703   	$LTDSK= ****** GX

C$$OVL= 000000   	K$$TPS= 000074   	P$$SRF= 000000   	T$$RNE= 000000   	$LTSIZ= ****** GX

C$$RSH= 177564   	LD$DB = 000000   	P$$TPT= 000000   	T$$RPR= 000000   	$LTTRK= ****** GX

DSKLUN= ****** GX	LD$DK = 000000   	Q$$OPT= 000014   	T$$RST= 000000   	$MCRLN= ****** GX

D$$BUG= 177514   	LD$DS = 000000   	Q.IOFN= ****** GX	T$$RUB= 000000   	$MESAG= ****** GX

D$$H11= 000002   	LD$DT = 000000   	Q.IOPL= ****** GX	T$$SYN= 000000   	$MSG1 = ****** GX

D$$IAG= 000000   	LD$DX = 000000   	R$$DER= 000000   	T$$TRW= 000000   	$MSG16= ****** GX

D$$ISK= 000000   	LD$LP = 000000   	R$$EXV= 000000   	T$$VBF= 000000   	$MSG2 = ****** GX

D$$L11= 000001   	LD$MM = 000000   	R$$JPO= 000000   	U$$MHI= 000040   	$MSG22= ****** GX

D$$M11= 000001   	LD$PP = 000000   	R$$JP1= 000001   	U$$MLO= 120000   	$MSG3 = ****** GX

D$$SHF= 000000   	LD$PR = 000000   	R$$JS1= 000001   	U$$MRN= 170324   	$MSG4 = ****** GX

D$$YNC= 000000   	LD$TT = 000000   	R$$KWC= 000000   	V$$CTR= 000400   	$MUL  = ****** GX

D$$YNM= 000000   	LTDCHK  000650R  	R$$K11= 000001   	X$$DBT= 000000   	$MXLBN= ****** GX

EX$SUC= ****** GX	L$$ASG= 000000   	R$$LKL= 000000   	X168$   000670R  	$NBLKS= ****** GX

E$$DVC= 000000   	L$$DRV= 000000   	R$$NDC= 000006   	X169$   000674R  	$PTRSZ= ****** GX

E$$NSI= 000000   	L$$P11= 000001   	R$$NDH= 000144   	X170$   000722R  	$RMBBF= ****** GX

E$$PER= 000000   	L$$11R= 000000   	R$$NDL= 000001   	$BADCK= ****** GX	$STATS= ****** GX

E$$XPR= 000000   	M$$CRB= 000124   	R$$SND= 000000   	$BADEP  000000RG 	$SWLST= ****** GX

FD.DIR= ****** GX	M$$CRX= 000000   	R$$VAX= 000000   	$BBCNT= ****** GX	$SWOVR= ****** GX

F$$AST= 000000   	M$$EXT= 000000   	R$$X11= 000001   	$BK0FG= ****** GX	$VERFY= ****** GX

F$$LPP= 000000   	M$$FCS= 000000   	R$$11M= 000000   	$BUF  = ****** GX	$WRITE= ****** GX

F$$LVL= 000001   	M$$MGE= 000000   	S$$WPC= 000036   	$BUFSZ= ****** GX	$XFRSZ= ****** GX

G$$TPP= 000000   	M$$MUP= 000000   	S$$WPR= 000005   	$COTB = ****** GX	$$$OST= 000014

G$$TSS= 000000   	M$$NET= 000000   	S$$WRG= 000000   	$DEVNM= ****** GX	$$$R4 = 000000

G$$TTK= 000000   	M$$OVR= 000000   	S$$YSZ= 030000



. ABS.	000000	   000

      	001110	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  4688 WORDS  ( 19 PAGES)

DYNAMIC MEMORY:  5940 WORDS  ( 22 PAGES)

ELAPSED TIME:  00:00:13

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

