Trailing-Edge
-
PDP-10 Archives
-
BB-H311B-RM
-
rsx20f-swskit/listings/bad.lis
There are no other files named bad.lis in the archive.
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12
TABLE OF CONTENTS
2- 53 FUNCTIONAL SPECIFICATION
4- 158 DATA SECTION
5- 222 LOCAL DATA
7- 318 BAD MAINLINE CODE
8- 426 SUBROUTINE 'BADCHK'
9- 544 ROUTINE 'MESAGE'
10- 592 SUBROUTINE 'DISKIO'
11- 669 SUBROUTINE 'WRITE'
12- 730 SUBROUTINE 'VERIFY'
13- 787 SUBROUTINE 'INIT'
14- 834 ROUTINE 'FINISH'
15- 915 SUBROUTINE 'MATCH'
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 1
1 .TITLE BAD BLOCK PROCESSOR
2 .IDENT "02"
3 .LIST MEB
4 ;
5 ;
6 ;
7 ;
8 ;
9 ; COPYRIGHT (C) 1974, 1978 BY
10 ; DIGITAL EQUIPMENT CORPORATION, MAYNARD MASS.
11 ;
12 ; THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
13 ; ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE INCLUSION
14 ; OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER COPIES THERE-
15 ; OF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON.
16 ; NO TITLE TO OR OWNERSHIP OF THE SOFTWARE IS HEREBY TRANSFERRED.
17 ;
18 ; THE INFORMATION CONTAINED IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT
19 ; NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
20 ; CORPORATION.
21 ;
22 ; DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS
23 ; SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPILED BY DIGITAL.
24 ;
25 ;
26 ;
27 ;
28 ;
29 ;
30 ;
31 ; MODULE: MCR FUNCTION 'BADBLOCKS'
32 ; VERSION: 02
33 ; AUTHOR: J. MASSE
34 ; DATE: 01 JUL 74
35 ;
36 ; MODIFIED: 14 AUG 74 BY: H. LEV
37 ; TO RUN UNDER RSX11M
38 ;
39 ; 6 FEB 75 BY: H. LEV
40 ; TO GET DEVICE BLOCK SIZE FROM GET LUN INFO
41 ;
42 ; 23-JUL-76 BY: J. MASSE
43 ; FOR KL FRONT END
44 ;
45 ;
46 ;
47 ;
48 ;
49 ; THIS MODULE CONTAINS:
50 ;
51 ; 1 -- CODE FOR THE MCR FUNCTION 'BADBLOCKS'
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 2
FUNCTIONAL SPECIFICATION
53 .SBTTL FUNCTIONAL SPECIFICATION
54 ;
55 ;
56 ;+
57 ; MCR FUNCTION -- BAD
58 ;
59 ; THE 'BAD' MCR FUNCTION PROVIDES A FACILITY OF VERIFYING DISKS --
60 ; I.E., DETERMINING THE NUMBER AND LOCATION OF ANY BAD BLOCKS ON A
61 ; FILES-11 DEVICE (NOT MAGTAPE!). IT DOES THIS BY WRITING A "WORST CASE"
62 ; TEST PATTERN ONTO EACH BLOCK OF THE DISK, AND THEN PERFORMING A
63 ; WRITE CHECK OF THE BLOCK. BEFORE A BLOCK IS CONSIDERED TO BE BAD,
64 ; THE INITIAL WRITE OR WRITE CHECK MUST FAIL, AS WELL AS A
65 ; SUBSEQUENT WRITE/WRITE-CHECK OPERATION.
66 ;
67 ; AS 'BAD' LOCATES BAD BLOCKS, IT FORMATS THIS INFORMATION IN THE
68 ; BUFFER 'BADBLK'. WHEN ALL BLOCKS ON THE DISK HAVE BEEN PROCESSED,
69 ; 'BADBLK' WILL BE WRITTEN INTO THE LAST GOOD BLOCK OF THE DISK.
70 ; NOTE -- THERE MUST BE AT LEAST ONE GOOD BLOCK WITHIN THE LAST 256
71 ; BLOCKS ON THE DISK. IF BLOCK 0 IS BAD, '...BAD' WILL PRINT A MESSAGE
72 ; WARNING THE OPERATOR NOT TO USE THE DISK AS A SYSTEM DISK.
73 ;
74 ; THE FOLLOWING DIAGRAM ILLUSTRATES THE LAYOUT OF 'BADBLK'. THIS
75 ; IS THE FORMAT WHICH 'INITVOL' EXPECTS TO FIND, AND FROM WHICH THE
76 ; ACTUAL BAD BLOCK FILE IS CONSTRUCTED.
77 ;
78 ;
79 ; BADBLK --> -----------------------
80 ; ! BB.AFS ! BB.CFS ! 0
81 ; !---------------------!
82 ; ! BB.AVL ! BB.USD ! 1
83 ; BB.PTR --> !---------------------!
84 ; ! BB.CNT ! BB.NHI ! 2
85 ; !---------------------!
86 ; ! BB.NLO ! 3
87 ; !---------------------!
88 ; ! . ! .
89 ; !---------------------!
90 ; ! . ! .
91 ; !---------------------!
92 ; ! . ! .
93 ; PTREND --> !---------------------!
94 ; ! S P A R E ! 206.
95 ; !---------------------!
96 ; ! . ! .
97 ; !---------------------!
98 ; ! . ! .
99 ; !---------------------!
100 ; ! . ! .
101 ; !---------------------!
102 ; ! BB.CKS ! 255.
103 ; -----------------------
104 ;
105 ;
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 3
FUNCTIONAL SPECIFICATION
107 ;
108 ;
109 ; SYMBOL DEFINITIONS:
110 ;
111 ; BADBLK -- POINTER TO BEGINNING OF 256 WORD BUFFER WHICH WILL
112 ; BE WRITTEN ONTO THE LAST GOOD BLOCK OF THE DISK.
113 ;
114 ; BB.AFS -- ALWAYS 3. FIELD SIZE IN BYTES OF BLOCK ADDRESS.
115 ;
116 ; BB.CFS -- ALWAYS 1. FIELD SIZE IN BYTES OF BLOCK COUNT.
117 ;
118 ; BB.AVL -- ALWAYS 204. NUMBER OF WORDS AVAILABLE FOR BAD BLOCK POINTERS.
119 ;
120 ; BB.USD -- POINTER TO BYTE CONTAINING COUNT OF WORDS USED FOR BAD
121 ; BLOCK POINTERS.
122 ;
123 ; BB.PTR -- POINTER TO BEGINNING OF BAD BLOCK POINTERS.
124 ;
125 ; BB.CNT -- OFFSET WITHIN A POINTER TO COUNT OF NUMBER OF BAD BLOCKS
126 ; IN THE GROUP DESCRIBED BY THE POINTER. HAS A BIAS OF
127 ; -1 -- I.E., ONE BAD BLOCK MEANS THIS BYTE WILL BE ZERO.
128 ;
129 ; BB.NHI -- OFFSET WITHIN A POINTER TO BYTE CONTAINING HIGH ADDRESS
130 ; BITS OF FIRST BLOCK OF GROUP.
131 ;
132 ; BB.NLO -- OFFSET WITHIN A POINTER TO WORD CONTAINING LOW ADDRESS
133 ; BITS OF FIRST BLOCK OF GROUP.
134 ;
135 ; PTREND -- POINTER TO WORD FOLLOWING LAST BAD BLOCK POINTER.
136 ;
137 ; BB.CKS -- POINTER TO CHECKSUM. THIS IS THE LAST WORD IN THE BUFFER.
138 ;
139 ;
140 ;
141 ; FOR 'BAD', THERE IS ONLY ONE LINE OF COMMAND INPUT, WHOSE SYNTAX IS:
142 ;
143 ; BAD::= "BAD"<BC><DEVICE>[<UNIT>][":"]<LT>;
144 ; <BC> ::=<SPACE>/<TAB>;
145 ; <DEVICE>::=ANY VALID FILES-11 DIRECTORY DEVICE;
146 ; <UNIT> ::=<0-77>;
147 ; <LT> ::=<CARRIAGE RETURN>/<ALT MODE>;
148 ;
149 ;
150 ; 'BAD' WILL PRINT THE NUMBER OF BAD BLOCKS FOUND WHEN THE END OF THE
151 ; DISK IS REACHED.
152 ;
153 ; 'BAD' REQUIRES ONE LUN (#2) FOR 'TI'
154 ; OUTPUT, AND ANOTHER LUN (#3) FOR DISK I/O, WHICH IS ASSIGNED VIA
155 ; THE 'ALUN$S' DIRECTIVE MACRO.
156 ;
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 4
DATA SECTION
158 .SBTTL DATA SECTION
159 ;
160 ;
161 ;
162 ; M A C R O L I B R A R Y C A L L S
163 ;
164 .MCALL CALL,DIR$,RETURN,QIOW$,ALUN$S,GLUN$S,EXIT$S
165 ;
166 ;
167 ;
168 ;
169 ;
170 ; L O C A L M A C R O S
171 ;
172 ;
173 ;
174 ; MACRO TO PUSH ARGUMENTS ONTO STACK
175 ;
176 .MACRO PUSH$ A,B,C,D,E,F
177 .NLIST
178 .NARG $$$ARG
179 .IIF GT $$$ARG-0, MOV A,-(SP)
180 .IIF GT $$$ARG-1, MOV B,-(SP)
181 .IIF GT $$$ARG-2, MOV C,-(SP)
182 .IIF GT $$$ARG-3, MOV D,-(SP)
183 .IIF GT $$$ARG-4, MOV E,-(SP)
184 .IIF GT $$$ARG-5, MOV F,-(SP)
185 .LIST
186 .ENDM PUSH$
187 ;
188 ;
189 ;
190 ;
191 ; MACRO TO POP ARGUMENTS OFF STACK
192 ;
193 .MACRO POP$ A,B,C,D,E,F
194 .NLIST
195 .NARG $$$ARG
196 .IIF GT $$$ARG-5, MOV (SP)+,F
197 .IIF GT $$$ARG-4, MOV (SP)+,E
198 .IIF GT $$$ARG-3, MOV (SP)+,D
199 .IIF GT $$$ARG-2, MOV (SP)+,C
200 .IIF GT $$$ARG-1, MOV (SP)+,B
201 .IIF GT $$$ARG-0, MOV (SP)+,A
202 .LIST
203 .ENDM POP$
204 ;
205 ;
206 ;
207 ;
208 ; L O C A L S Y M B O L S
209 ;
210 ;
211 000002 COLUN =2 ;LUN FOR OUTPUT TO TI
212 000003 DSKLUN =3 ;LUN FOR OUTPUT TO DISK
213 000033 AM =33 ;ALT MODE
214 000015 CR =15 ;CARRIAGE RETURN
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 4-1
DATA SECTION
215 000040 SPACE =40 ;SPACE
216 000011 TAB =11 ;TAB
217 000012 LF =12 ;LINE FEED
218 000001 NBLKS =1 ;NO. OF BLOCKS IN BUFFER
219 000400 BUFSIZ =NBLKS*256. ;NO. OF WORDS IN BUFFER
220
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 5
LOCAL DATA
222 .SBTTL LOCAL DATA
223
224
225 000000 000000 DEVICE: .WORD 0 ;DISK NAME (ASCII)
226 ;
227 000002 MCRLN: .BLKB 80. ;MCR LINE BUFFER
228 ;
229 000122 BUF: .BLKW BUFSIZ ;BUFFER FOR DISK I/O
230 ;
231 001122 GLUNPB: .BLKW 6 ;PARAMETER BLOCK FOR "GET LUN" DIRECTIVE
232 ;
233 001136 165555 133333 TSTPAT: .WORD 165555,133333 ;WORST CASE TEST PATTERN
234 ;
235 001142 BADBLK: ;BUFFER FOR BAD BLOCK INFO
236 000004 PTRSIZ =4 ;NO. OF BYTES IN A POINTER
237 000146 NPTRS =102. ;MAX. # OF POINTERS
238 001142 001 .BYTE 1 ;COUNT FIELD SIZE
239 001143 003 .BYTE 3 ;ADDRESS FIELD SIZE
240 001144 000 .BYTE 0 ;# WORDS USED FOR BAD BLOCK POINTERS
241 001145 314 .BYTE NPTRS*PTRSIZ/2 ;# WORDS AVAILABLE FOR BAD BLOCK POINTERS
242 .BLKW 254. ;REMAINING WORDS IN BLOCK
243 001144' BB.USD =BADBLK+2 ;POINTER TO # OF WORDS USED
244 001146' BB.PTR =BB.USD+2 ;START OF BAD BLOCK POINTERS
245 000000 BB.NHI =0 ;OFFSET TO HIGH BLOCK # BITS
246 000001 BB.CNT =1 ;OFFSET TO # OF BAD BLOCKS IN GROUP
247 000002 BB.NLO =2 ;OFFSET TO LOW BLOCK # BITS
248 001776' PTREND =NPTRS*PTRSIZ+BB.PTR ;WORD FOLLOWING LAST POINTER
249 002140' BB.CKS =255.*2+BADBLK ;POINTER TO CHECKSUM
250 ;
251 002142 000000 BBCNT: .WORD 0 ;CUMULATIVE SUM OF BAD BLOCKS
252 ;
253 002144 DSKQIO: ;QIO DPB FOR DISK I/O
254 002144 QIOW$ ,DSKLUN,1,,IOST,,<,,,,>
002144 003 013 .BYTE 3,$$$ARG
002146 000000 .WORD
002150 000003 .WORD DSKLUN
002152 001 000 .BYTE 1,
002154 002266' .WORD IOST
002156 000000 .WORD
002160 000000 .WORD
002162 000000 .WORD
002164 000000 .WORD
002166 000000 .WORD
002170 000000 .WORD
255 002162' XFERSZ =DSKQIO+Q.IOPL+2 ;POINTER TO TRANSFER SIZE (BYTES)
256 002166' LBNH =XFERSZ+4 ;POINTER TO HIGH BLOCK # BITS
257 002170' LBNL =LBNH+2 ;POINTER TO LOW BLOCK # BITS
258 ;
259 002172 COQIO: ;QIO DPB FOR OUTPUT TO CO
260 002172 QIOW$ IO.WVB,COLUN,2,,,,<,,40>
002172 003 011 .BYTE 3,$$$ARG
002174 000000G .WORD IO.WVB
002176 000002 .WORD COLUN
002200 002 000 .BYTE 2,
002202 000000 .WORD
002204 000000 .WORD
002206 000000 .WORD
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 5-1
LOCAL DATA
002210 000000 .WORD
002212 000040 .WORD 40
261 ;
262 002214 MCRDPB: ;QIO DPB TO READ INPUT LINE FROM TI
263 002214 QIOW$ IO.RLB,COLUN,2,,IOST,,<MCRLN,80.,40>
002214 003 011 .BYTE 3,$$$ARG
002216 000000G .WORD IO.RLB
002220 000002 .WORD COLUN
002222 002 000 .BYTE 2,
002224 002266' .WORD IOST
002226 000000 .WORD
002230 000002' .WORD MCRLN
002232 000120 .WORD 80.
002234 000040 .WORD 40
264 ;
265 002236 015 012 102 PROMPT: .ASCII <15><12>/BAD>/
002241 101 104 076
266 ;
267 000006 PRMPTZ =.-PROMPT
268 ;
269 .EVEN
270 ;
271 002244 PRMDPB: ;QIO DPB FOR PROMPT
272 002244 QIOW$ IO.WVB,COLUN,2,,,,<PROMPT,PRMPTZ,'$>
002244 003 011 .BYTE 3,$$$ARG
002246 000000G .WORD IO.WVB
002250 000002 .WORD COLUN
002252 002 000 .BYTE 2,
002254 000000 .WORD
002256 000000 .WORD
002260 002236' .WORD PROMPT
002262 000006 .WORD PRMPTZ
002264 000044 .WORD '$
273 ;
274 002266 IOST: .BLKW 2 ;I/O STATUS BLOCK FOR DISK I/O
275 ;
276 002272 000000 BLK0FG: .WORD 0 ;BLOCK 0 FLAG -- SET WHEN BLOCK 0 IS BAD
277 ;
278 002274 000000 IEBLK: .WORD 0 ;TRANSFER ADDRESS USED BY 'WRITE' WHEN
279 ;A WRITE OFF THE DISK IS ATTEMPTED
280 ;
281 002276 MAXLBN: .BLKW 2 ;TOTAL # OF BLOCKS ON THE VOLUME
282
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 6
LOCAL DATA
284 ;
285 ;
286 ; M E S S A G E S
287 ;
288 ;
289 002302 015 012 102 MSG2: .ASCIZ <15><12>/BAD -- SYNTAX ERROR/<15><12>
002305 101 104 040
002310 055 055 040
002313 123 131 116
002316 124 101 130
002321 040 105 122
002324 122 117 122
002327 015 012 000
290 ;
291 002332 015 012 102 MSG3: .ASCIZ <15><12>/BAD -- ILLEGAL DEVICE/<15><12>
002335 101 104 040
002340 055 055 040
002343 111 114 114
002346 105 107 101
002351 114 040 104
002354 105 126 111
002357 103 105 015
002362 012 000
292 ;
293 002364 015 012 102 MSG4: .ASCIZ <15><12>/BAD -- DEVICE NOT IN SYSTEM/<15><12>
002367 101 104 040
002372 055 055 040
002375 104 105 126
002400 111 103 105
002403 040 116 117
002406 124 040 111
002411 116 040 123
002414 131 123 124
002417 105 115 015
002422 012 000
294 ;
295 002424 015 012 102 MSG5: .ASCIZ <15><12>/BAD -- DISK ATTACH FAILED/<15><12>
002427 101 104 040
002432 055 055 040
002435 104 111 123
002440 113 040 101
002443 124 124 101
002446 103 110 040
002451 106 101 111
002454 114 105 104
002457 015 012 000
296 ;
297 002462 015 012 102 MSG6: .ASCII <15><12>/BAD -- BLOCK 0 BAD - DO NOT USE AS SYSTEM DISK/<15><12>
002465 101 104 040
002470 055 055 040
002473 102 114 117
002476 103 113 040
002501 060 040 102
002504 101 104 040
002507 055 040 104
002512 117 040 116
002515 117 124 040
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 6-1
LOCAL DATA
002520 125 123 105
002523 040 101 123
002526 040 123 131
002531 123 124 105
002534 115 040 104
002537 111 123 113
002542 015 012
298 000062 MSG6SZ =.-MSG6
299 ;
300 002544 015 012 102 MSG7: .ASCIZ <15><12>/BAD -- BAD BLOCK FILE OVERFLOW/<15><12>
002547 101 104 040
002552 055 055 040
002555 102 101 104
002560 040 102 114
002563 117 103 113
002566 040 106 111
002571 114 105 040
002574 117 126 105
002577 122 106 114
002602 117 127 015
002605 012 000
301 ;
302 002607 015 012 102 MSG8: .ASCIZ <15><12>/BAD -- DISK ERROR/<15><12>
002612 101 104 040
002615 055 055 040
002620 104 111 123
002623 113 040 105
002626 122 122 117
002631 122 015 012
002634 000
303 ;
304 002635 015 012 102 MSG9: .ASCIZ <15><12>/BAD -- DISK WRITE LOCKED/<15><12>
002640 101 104 040
002643 055 055 040
002646 104 111 123
002651 113 040 127
002654 122 111 124
002657 105 040 114
002662 117 103 113
002665 105 104 015
002670 012 000
305 ;
306 002672 015 012 102 MSG10: .ASCIZ <15><12>/BAD -- DISK NOT READY/<15><12>
002675 101 104 040
002700 055 055 040
002703 104 111 123
002706 113 040 116
002711 117 124 040
002714 122 105 101
002717 104 131 015
002722 012 000
307 ;
308 002724 015 012 102 MSG11: .ASCIZ <15><12>/BAD -- DISK MOUNTED/<15><12>
002727 101 104 040
002732 055 055 040
002735 104 111 123
002740 113 040 115
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 6-2
LOCAL DATA
002743 117 125 116
002746 124 105 104
002751 015 012 000
309 ;
310 002754 015 012 102 MSG12: .ASCII <15><12>/BAD -- TOTAL NO. OF BAD BLOCKS = 000000000/<15><12>
002757 101 104 040
002762 055 055 040
002765 124 117 124
002770 101 114 040
002773 116 117 056
002776 040 117 106
003001 040 102 101
003004 104 040 102
003007 114 117 103
003012 113 123 040
003015 075 040 060
003020 060 060 060
003023 060 060 060
003026 060 060 015
003031 012
311 003017' MSG12A =.-11.
312 ;
313 003032 015 012 102 MSG13: .ASCIZ <15><12>/BAD -- FAILED TO WRITE BAD BLOCK FILE/<15><12>
003035 101 104 040
003040 055 055 040
003043 106 101 111
003046 114 105 104
003051 040 124 117
003054 040 127 122
003057 111 124 105
003062 040 102 101
003065 104 040 102
003070 114 117 103
003073 113 040 106
003076 111 114 105
003101 015 012 000
314 ;
315 ;
316 .EVEN
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 7
BAD MAINLINE CODE
318 .SBTTL BAD MAINLINE CODE
319 ;
320 ;
321 ;
322 ;
323 003104 BAD: DIR$ #PRMDPB ; PRINT PROMPT
003104 012746 002244' MOV #PRMDPB,-(SP)
003110 104375 EMT 375
324 003112 DIR$ #MCRDPB ;TRY TO READ INPUT LINE
003112 012746 002214' MOV #MCRDPB,-(SP)
003116 104375 EMT 375
325 003120 103003 BCC 10$ ;READ FAILED IF CARRY SET
326 003122 EXIT$S ; JUST EXIT IF READ FAILS
003122 012746 MOV (PC)+,-(SP)
003124 063 001 .BYTE 51.,1
003126 104375 EMT 375
327
328 003130 012700 000002' 10$: MOV #MCRLN,R0 ;SET R0 AS LINE INDEX
329 003134 20$:
330 003134 005767 177130 TST IOST+2 ; ANYTHING READ?
331 003140 001410 BEQ 30$ ; NO IF EQ 0
332 003142 122767 000033 177117 CMPB #AM,IOST+1 ;IS TERMINATOR AN ALT MODE?
333 003150 001410 BEQ 40$ ;YES -- OK
334 003152 122767 000015 177107 CMPB #CR,IOST+1 ;NO -- IS IT A CARRIAGE RETURN?
335 003160 001404 BEQ 40$ ;YES -- OK
336 003162 30$:
337 003162 012700 002302' MOV #MSG2,R0 ;PUT MESSAGE ADDRESS IN R0
338 003166 000167 000654 JMP MESAGE ;PRINT "SYNTAX ERROR"
339
340 003172 112067 174602 40$: MOVB (R0)+,DEVICE ;GET DEVICE NAME (2 CHARACTERS)
341 003176 112067 174577 MOVB (R0)+,DEVICE+1
342 003202 CALL $COTB ; CONVERT UNIT NUMBER TO BINARY
003202 004767 000000G JSR PC,$COTB
343 003206 122702 000072 CMPB #':,R2 ; TERMINATOR COLON?
344 003212 001363 BNE 30$ ; NO, SYNTAX ERROR
345 003214 70$:
346 003214 166700 177050 SUB IOST+2,R0 ; CHECK FOR END OF LINE
347 003220 020027 000002' CMP R0,#MCRLN ; OK?
348 003224 001356 BNE 30$ ; NO IF NE TO BEGINNING OF BUFFER
349 003226 80$:
350 003226 ALUN$S #DSKLUN,DEVICE,R1 ;ASSIGN LUN TO DISK
003226 010146 MOV R1,-(SP)
003230 016746 174544 MOV DEVICE,-(SP)
003234 012746 000003 MOV #DSKLUN,-(SP)
003240 012746 MOV (PC)+,-(SP)
003242 007 004 .BYTE 7.,4
003244 104375 EMT 375
351 003246 103004 BCC 100$ ;ILLEGAL DEVICE IF ASSIGN FAILS
352 003250 90$:
353 003250 012700 002364' MOV #MSG4,R0 ;PUT MESSAGE ADDRESS IN R0
354 003254 000167 000566 JMP MESAGE ;PRINT "DEVICE NOT IN SYSTEM"
355 003260 100$: GLUN$S #DSKLUN,#GLUNPB ;GET LUN INFO FROM PUD
003260 012746 001122' MOV #GLUNPB,-(SP)
003264 012746 000003 MOV #DSKLUN,-(SP)
003270 012746 MOV (PC)+,-(SP)
003272 005 003 .BYTE 5,3
003274 104375 EMT 375
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 7-1
BAD MAINLINE CODE
356 003276 012703 000000G MOV #.PUDBA,R3 ; GET PUD STARTING ADDRESS
357 003302 110$:
358 003302 021367 175614 CMP @R3,GLUNPB ; IS THIS THE DEVICE?
359 003306 001004 BNE 120$ ; NO IF NE
360 003310 126367 000000G 175606 CMPB U.UN(R3),GLUNPB+2 ; YES -- UNIT MATCH?
361 003316 001406 BEQ 130$ ; YES IF EQ
362 003320 120$:
363 003320 062703 000000G ADD #U.SZ,R3 ; CHECK NEXT PUD
364 003324 020327 000000G CMP R3,#.PUDEA ; ANY MORE PUDS?
365 003330 103764 BLO 110$ ; YES IF LO
366 003332 000746 BR 90$ ; NO -- DEVICE NOT IN SYSTEM
367
368 003334 032763 000000G 000000G 130$: BIT #UC.F11,U.C1(R3) ; FILES-11 DEVICE?
369 003342 001004 BNE 150$ ; YES IF BIT SET
370 003344 140$:
371 003344 012700 002332' MOV #MSG3,R0 ; NO -- ERROR
372 003350 000167 000472 JMP MESAGE ; PRINT MESSAGE
373
374 003354 032763 000000G 000000G 150$: BIT #UC.DIR,U.C1(R3) ; DIRECTORY DEVICE?
375 003362 001770 BEQ 140$ ; NO -- ERROR
376 003364 032763 000000C 000000G BIT #UC.SDI!UC.SQD,U.C1(R3) ; CHECK IF MAGTAPE
377 003372 001364 BNE 140$ ; ERROR IF MAGTAPE
378 003374 132763 000000G 000000G BITB #CH.OFF,U.CH(R3) ; VOLUME MOUNTED?
379 003402 001004 BNE 160$ ; NO IF BIT SET
380 003404 012700 002724' MOV #MSG11,R0 ; YES --
381 003410 000167 000432 JMP MESAGE ; PRINT MESSAGE
382
383 003414 116367 000000G 176654 160$: MOVB U.LBH(R3),MAXLBN ; GET # OF BLOCKS ON THIS DISK
384 003422 105067 176651 CLRB MAXLBN+1
385 003426 016367 000000G 176644 MOV U.LBN(R3),MAXLBN+2
386 003434 012703 000000G MOV #IO.ATT,R3 ;PUT ATTACH CODE IN R3
387 003440 CALL DISKIO ;ATTACH TO DISK
003440 004767 000504 JSR PC,DISKIO
388 003444 012700 001146' MOV #BB.PTR,R0 ;SET R0 TO INDEX INTO BAD BLOCK BUFFER
389 003450 010004 MOV R0,R4 ;SET UP R4 TOO
390 003452 012701 000376 MOV #254.,R1 ;SET R1 AS COUNTER
391 003456 170$:
392 003456 005020 CLR (R0)+ ;CLEAR BAD BLOCK POINTERS
393 003460 005301 DEC R1 ;
394 003462 001375 BNE 170$ ;
395 003464 105067 175454 CLRB BB.USD ;INITIALIZE COUNTERS
396 003470 005067 176446 CLR BBCNT
397 003474 005067 176466 CLR LBNH
398 003500 005067 176464 CLR LBNL
399 003504 005067 176562 CLR BLK0FG ;RESET BLOCK 0 FLAG
400 003510 012705 000122' MOV #BUF,R5 ;PUT BUFFER ADDRESS INTO R5 FOR 'WRITE'
401 003514 012767 004576' 176552 MOV #FINISH,IEBLK ;SET UP TRANSFER ADDRESS FOR 'WRITE'
402 003522 180$:
403 003522 012767 001000 176432 MOV #BUFSIZ*2,XFERSZ ;SET TRANSFER SIZE FOR WHOLE BUFFER
404 003530 CALL INIT ;SET UP WORST CASE TEST PATTERN IN I/O BUFFER
003530 004767 000764 JSR PC,INIT
405 003534 CALL WRITE ;WRITE TEST PATTERN ONTO DISK
003534 004767 000544 JSR PC,WRITE
406 003540 103403 BCS 190$ ;PARITY ERROR DURING WRITE?
407 003542 CALL VERIFY ;NO -- READ BLOCK AND VERIFY IT
003542 004767 000650 JSR PC,VERIFY
408 003546 103003 BCC 200$ ;VERIFY OK IF CARRY CLEAR
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 7-2
BAD MAINLINE CODE
409 003550 190$:
410 003550 CALL BADCHK ;FIND THE BAD BLOCKS AND UPDATE THE BAD
003550 004767 000056 JSR PC,BADCHK
411 ;BLOCK POINTERS.
412 003554 000762 BR 180$ ;DO NEXT BLOCK
413 003556 062767 000001 176404 200$: ADD #NBLKS,LBNL ;SET FOR NEXT GROUP OF BLOCKS
414 003564 005567 176376 ADC LBNH
415 003570 105764 000001 TSTB BB.CNT(R4) ;ANY BAD BLOCKS IN THIS GROUP?
416 003574 001407 BEQ 210$ ;NO -- DON'T BUMP POINTER
417 003576 105364 000001 DECB BB.CNT(R4) ;YES -- ALLOW FOR BIAS OF -1
418 003602 062704 000004 ADD #PTRSIZ,R4 ;ADVANCE TO NEXT POINTER
419 003606 062767 000002 175330 ADD #PTRSIZ/2,BB.USD ;ADJUST WORD COUNT
420 003614 210$:
421 003614 116764 176346 000000 MOVB LBNH,BB.NHI(R4) ;SET NEW STARTING BLOCK #, SINCE THERE
422 ;WEREN'T ANY BAD BLOCKS IN THIS TRANSFER.
423 003622 016764 176342 000002 MOV LBNL,BB.NLO(R4)
424 003630 000734 BR 180$ ;DO NEXT TRANSFER
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 8
SUBROUTINE 'BADCHK'
426 .SBTTL SUBROUTINE 'BADCHK'
427 ;
428 ;
429 ;+
430 ; B A D C H K
431 ;
432 ;
433 ; SUBROUTINE TO CHECK INDIVIDUALLY ALL THE BLOCKS THAT WERE
434 ; TRANSFERRED IN THE LAST WHOLE BUFFER WRITE OR VERIFY OPERATION.
435 ; IF THE WRITE OR VERIFY FAILS FOR ANY BLOCK, THE BLOCK IS
436 ; CONSIDERED TO BE BAD AND IS ADDED TO THE BAD BLOCK POINTER
437 ; TABLE. THE FOLLOWING ALGORITHM IS USED IN THE CARE AND FEEDING
438 ; OF THE BAD BLOCK POINTERS:
439 ;
440 ; 1. IF THE BLOCK IS NOT BAD, THE LBN IN THE DISK I/O
441 ; DPB IS INCREMENTED BY ONE. THEN -- SINCE A GOOD BLOCK
442 ; HAS BEEN FOUND -- THE COUNT OF BAD BLOCKS IN THE CURRENT
443 ; POINTER IS CHECKED. IF THE COUNT IS NON-ZERO, IT MEANS
444 ; THAT THE POINTER POINTER MUST BE ADVANCED TO POINT TO
445 ; THE NEXT BAD BLOCK POINTER, BECAUSE THE POINTERS REPRESENT
446 ; CONTIGUOUS GROUPS OF BAD BLOCKS. REGARDLESS OF WHETHER
447 ; THE COUNT IS NON-ZERO, THE STARTING BLOCK NUMBER FOR
448 ; THIS POINTER IS RESET TO THE CURRENT VALUE OF THE LBN
449 ; (WHICH HAS ALREADY BEEN BUMPED) SINCE THIS IS NOW THE
450 ; NEXT POSSIBLE BAD BLOCK. THE COUNT BIAS OF -1 IS ALSO
451 ; TAKEN INTO ACCOUNT AT THIS POINT.
452 ;
453 ; 2. IF THE BLOCK IS BAD, THE LBN IS FIRST INCREMENTED BY ONE.
454 ; THEN A CHECK IS MADE FOR BLOCK ZERO -- IF BLOCK ZERO IS
455 ; BAD, A SPECIAL WARNING MESSAGE WILL BE PRINTED WHEN THE
456 ; PROGRAM FINISHES. NOTE THAT BLOCK ZERO WILL NOT BE INCLUDED
457 ; IN ANY BAD BLOCK POINTER IF IT IS BAD, SINCE 'INITVOL'
458 ; WOULD CONSIDER THIS TO BE AN ERROR. OTHER BLOCKS THAT
459 ; ARE FOUND TO BE BAD CAUSE THE TOTAL BAD BLOCK COUNT TO
460 ; BE INCREMENTED. IF THE POINTER POINTER IS POINTED PAST
461 ; THE LAST POINTER, AN ERROR MESSAGE IS IMMEDIATELY PRINTED,
462 ; AND THE PROGRAM TERMINATES FATALLY. OTHERWISE, THE BAD
463 ; BLOCK IS INCLUDED IN THE CURRENT POINTER, AND THE COUNT
464 ; IN THE POINTER IS INCREMENTED BY ONE. IF THERE IS ANY MORE
465 ; ROOM IN THE POINTER FOR MORE BAD BLOCKS, NOTHING MORE NEEDS
466 ; TO BE DONE. IF NOT, THE POINTER POINTER MUST BE ADVANCED TO
467 ; POINT TO THE NEXT BAD BLOCK POINTER, AND THE STARTING
468 ; BLOCK NUMBER OF THE NEW POINTER MUST BE INITIALIZED, IN CASE
469 ; ANY MORE BAD BLOCKS ARE FOUND.
470 ;
471 ;
472 ;
473 ; ENTRY CONDITIONS:
474 ;
475 ; R4 -- MUST POINT TO THE CURRENT BAD BLOCK POINTER
476 ;
477 ;
478 ; EXIT CONDITIONS:
479 ;
480 ; BAD BLOCK POINTER TABLE UPDATED WITH NEW BAD BLOCKS.
481 ;
482 ; REGISTERS ALTERED:
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 8-1
SUBROUTINE 'BADCHK'
483 ;
484 ; R4 (MAYBE)
485 ;
486 ;
487 ; CALLING SEQUENCE:
488 ;
489 ; CALL BADCHK
490 ;
491 ;
492 ;-
493 ;
494 003632 BADCHK: PUSH$ R1 ;SAVE R1
495 003634 012701 000001 MOV #NBLKS,R1 ;ERROR DURING WRITE OR READ OF WHOLE BUFFER --
496 ;NOW TRY THE BLOCKS ONE AT A TIME TO FIND THE
497 ;ONES THAT ARE BAD.
498 003640 012767 001000 176314 MOV #512.,XFERSZ ;SET TRANSFER SIZE FOR ONE BLOCK
499 003646 10$:
500 003646 CALL INIT ;SET UP WORST CASE TEST PATTERN IN I/O BUFFER
003646 004767 000646 JSR PC,INIT
501 003652 CALL WRITE ;WRITE TEST PATTERN
003652 004767 000426 JSR PC,WRITE
502 003656 103416 BCS 30$ ;BAD BLOCK IF ERROR
503 003660 CALL VERIFY ;TRY TO READ IT
003660 004767 000532 JSR PC,VERIFY
504 003664 103413 BCS 30$ ;BAD BLOCK IF ERROR
505 003666 20$:
506 003666 062767 000001 176274 ADD #1,LBNL ;BUMP LBN BY 1 -- DOUBLE PRECISION
507 003674 005567 176266 ADC LBNH
508 003700 105764 000001 TSTB BB.CNT(R4) ;ANY BAD BLOCKS IN THIS GROUP?
509 003704 001446 BEQ 70$ ;NO -- DON'T BUMP POINTER
510 003706 105364 000001 DECB BB.CNT(R4) ;YES -- ALLOW FOR BIAS OF -1
511 003712 000436 BR 60$ ;GO ADVANCE TO NEXT BAD BLOCK POINTER,
512 ;SINCE A GOOD BLOCK HAS BEEN FOUND.
513 003714 062767 000001 176246 30$: ADD #1,LBNL ;BUMP LBN BY 1 -- DOUBLE PRECISION
514 003722 005567 176240 ADC LBNH
515 003726 005767 176234 TST LBNH ;WAS THIS BLOCK 0?
516 003732 001007 BNE 40$ ;NO
517 003734 022767 000001 176226 CMP #1,LBNL ;MAYBE
518 003742 001003 BNE 40$ ;NO
519 003744 005267 176322 INC BLK0FG ;YES -- SET THE BLOCK 0 FLAG, SO THAT
520 ;A WARNING MESSAGE WILL BE PRINTED AT THE END
521 003750 000424 BR 70$ ;DO NEXT BLOCK, BUT DON'T INCLUDE BLOCK 0
522 ;IN THE BAD BLOCK FILE -- 'INITVOL' WON'T
523 ;APPRECIATE IT.
524 003752 005267 176164 40$: INC BBCNT ;BUMP CUMULATIVE BAD BLOCK COUNT
525 003756 022704 001776' CMP #PTREND,R4 ;ANY MORE POINTERS?
526 003762 001003 BNE 50$ ;YES
527 003764 012700 002544' MOV #MSG7,R0 ;NO -- PUT MESSAGE ADDRESS IN R0
528 003770 000426 BR MESAGE ;PRINT "BAD BLOCK FILE OVERFLOW"
529 003772 122764 000377 000001 50$: CMPB #255.,BB.CNT(R4) ;256 BAD BLOCKS IN THIS GROUP?
530 004000 001403 BEQ 60$ ;YES -- DON'T BUMP COUNT
531 004002 105264 000001 INCB BB.CNT(R4) ;NO -- BUMP BY 1
532 004006 000413 BR 80$ ;STILL ROOM IN THIS GROUP
533 004010 062704 000004 60$: ADD #PTRSIZ,R4 ;ADVANCE TO NEXT POINTER
534 004014 062767 000002 175122 ADD #PTRSIZ/2,BB.USD ;ADJUST WORD COUNT
535 004022 70$:
536 004022 116764 176140 000000 MOVB LBNH,BB.NHI(R4) ;SET STARTING BLOCK # FOR THIS GROUP
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 8-2
SUBROUTINE 'BADCHK'
537 004030 016764 176134 000002 MOV LBNL,BB.NLO(R4)
538 004036 80$:
539 004036 005301 DEC R1 ; HAVE ALL THE BLOCKS BEEN CHECKED INDIVIDUALLY?
540 004040 001302 BNE 10$ ; NO
541 004042 POP$ R1 ;YES -- RESTORE R1
542 004044 RETURN
004044 000207 RTS PC
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 9
ROUTINE 'MESAGE'
544 .SBTTL ROUTINE 'MESAGE'
545 ;
546 ;
547 ;+
548 ; M E S A G E
549 ;
550 ;
551 ; ROUTINE TO PRINT A MESSAGE AND EXIT FROM '...BAD'
552 ;
553 ;
554 ; ENTRY CONDITIONS:
555 ;
556 ; R0 -- ADDRESS OF "ASCIZ" MESSAGE STRING
557 ;
558 ;
559 ; EXIT CONDITIONS:
560 ;
561 ; THE MESSAGE IS SENT TO "CO" AND '...BAD' IS TERMINATED.
562 ;
563 ;
564 ; CALLING SEQUENCE:
565 ;
566 ; MESSAGE ADDRESS --> R0
567 ; JMP MESAGE
568 ;
569 ;
570 ;-
571 ;
572 004046 012705 002172' MESAGE: MOV #COQIO,R5 ;GET ADDRESS OF DPB IN R5
573 004052 005767 176214 TST BLK0FG ;WAS BLOCK 0 BAD?
574 004056 001410 BEQ 10$ ;NO
575 004060 012765 002462' 000014 MOV #MSG6,Q.IOPL(R5) ;YES -- PRINT WARNING MESSAGE
576 004066 012765 000062 000016 MOV #MSG6SZ,Q.IOPL+2(R5)
577 004074 DIR$ R5
004074 010546 MOV R5,-(SP)
004076 104375 EMT 375
578 004100 10$:
579 004100 010065 000014 MOV R0,Q.IOPL(R5) ;STORE MESSAGE ADDRESS IN DPB
580 004104 005001 CLR R1 ;CLEAR MESSAGE LENGTH COUNTER
581 004106 20$:
582 004106 105720 TSTB (R0)+ ;END OF MESSAGE STRING?
583 004110 001402 BEQ 30$ ;YES
584 004112 005201 INC R1 ;NO -- BUMP COUNT
585 004114 000774 BR 20$ ;GET NEXT CHARACTER
586 004116 010165 000016 30$: MOV R1,Q.IOPL+2(R5) ;STORE MESSAGE LENGTH IN DPB
587 004122 DIR$ R5 ;PRINT THE MESSAGE
004122 010546 MOV R5,-(SP)
004124 104375 EMT 375
588 004126 012767 000000G 176012 MOV #IO.DET,Q.IOFN+DSKQIO ;SET UP DISK DPB FOR DETACH
589 004134 DIR$ #DSKQIO ;DETACH DISK
004134 012746 002144' MOV #DSKQIO,-(SP)
004140 104375 EMT 375
590 004142 EXIT$S ;EXIT FROM '...BAD'
004142 012746 MOV (PC)+,-(SP)
004144 063 001 .BYTE 51.,1
004146 104375 EMT 375
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 10
SUBROUTINE 'DISKIO'
592 .SBTTL SUBROUTINE 'DISKIO'
593 ;
594 ;
595 ;+
596 ; D I S K I O
597 ;
598 ;
599 ; SUBROUTINE TO ISSUE DISK QIO DIRECTIVE
600 ;
601 ;
602 ; ENTRY CONDITIONS:
603 ;
604 ; R3 -- I/O FUNCTION CODE
605 ; R5 -- ADDRESS OF BUFFER (IF READ OR WRITE)
606 ;
607 ;
608 ; EXIT CONDITIONS:
609 ;
610 ; THE DISK QIO DIRECTIVE IS ISSUED. IF THERE WERE
611 ; NO ERRORS, THE CARRY BIT WILL BE CLEARED. IF THERE WAS
612 ; A PARITY ERROR (IE.VER), CARRY WILL BE SET. ALSO, SPECIFIC
613 ; ERROR MESSAGES WILL BE PRINTED WHEN THESE ERRORS ARE FOUND:
614 ;
615 ; 1. IE.DNR
616 ; 2. IE.WLK
617 ; 3. IE.DAA
618 ;
619 ; ANY OTHER ERROR CODE WILL BE REPORTED AS A "DISK ERROR".
620 ;
621 ;
622 ; REGISTERS ALTERED:
623 ;
624 ; R0
625 ;
626 ;
627 ; CALLING SEQUENCE:
628 ;
629 ; FUNCTION CODE --> R3
630 ; BUFFER ADDRESS --> R5
631 ; CALL DISKIO
632 ;
633 ;
634 ;-
635 ;
636 004150 012700 002144' DISKIO: MOV #DSKQIO,R0 ;PUT DISK DPB ADDRESS IN R0
637 004154 010360 000002 MOV R3,Q.IOFN(R0) ;STORE FUNCTION CODE IN DPB
638 004160 010560 000014 MOV R5,Q.IOPL(R0) ;STORE BUFFER ADDRESS IN DPB
639 004164 DIR$ R0 ;ISSUE DIRECTIVE
004164 010046 MOV R0,-(SP)
004166 104375 EMT 375
640 004170 116700 176072 10$: MOVB IOST,R0 ;GET ERROR CODE FROM STATUS BLOCK
641 004174 100042 BPL 70$ ;OK -- EXIT WITH CARRY CLEAR
642 004176 022700 000000G CMP #IE.DNR,R0 ;DISK NOT READY?
643 004202 001003 BNE 20$ ;NO
644 004204 012700 002672' MOV #MSG10,R0 ;YES -- PUT MESSAGE ADDRESS IN R0
645 004210 000716 BR MESAGE ;PRINT "DISK NOT READY"
646 004212 022700 000000G 20$: CMP #IE.WLK,R0 ;DISK WRITE LOCKED?
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 10-1
SUBROUTINE 'DISKIO'
647 004216 001003 BNE 30$ ;NO
648 004220 012700 002635' MOV #MSG9,R0 ;YES -- PUT MESSAGE ADDRESS IN R0
649 004224 000710 BR MESAGE ;PRINT "DISK WRITE LOCKED"
650 004226 022700 000000G 30$: CMP #IE.DAA,R0 ;ATTACH FAILED?
651 004232 001003 BNE 40$ ;NO
652 004234 012700 002424' MOV #MSG5,R0 ;YES -- PUT MESSAGE ADDRESS IN R0
653 004240 000702 BR MESAGE ;PRINT "ATTACH FAILED"
654 004242 022700 000000G 40$: CMP #IE.VER,R0 ;PARITY ERROR?
655 004246 001414 BEQ 60$ ;YES
656 004250 022700 000000G CMP #IE.PRI,R0 ; PRIVILEGED OPERATION?
657 004254 001406 BEQ 55$ ; YES, VOLUME IS MOUNTED
658 004256 022700 000000G CMP #IE.BLK,R0 ; NO, BAD BLOCK?
659 004262 001406 BEQ 60$ ; YES
660 004264 50$:
661 004264 012700 002607' MOV #MSG8,R0 ;NO -- PUT MESSAGE ADDRESS IN R0
662 004270 000666 BR MESAGE ;PRINT "DISK ERROR"
663 004272 012700 002724' 55$: MOV #MSG11,R0 ; DEVICE MOUNTED
664 004276 000663 BR MESAGE ;
665 004300 000261 60$: SEC ;SET CARRY FOR PARITY ERROR RETURN
666 004302 70$:
667 004302 RETURN ;EXIT
004302 000207 RTS PC
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 11
SUBROUTINE 'WRITE'
669 .SBTTL SUBROUTINE 'WRITE'
670 ;
671 ;
672 ;+
673 ; W R I T E
674 ;
675 ;
676 ; SUBROUTINE TO ISSUE A WRITE QIO COMMAND. IF ANY OF THE BLOCKS IN
677 ; THE TRANSFER REQUEST EXCEED THE SIZE OF THE VOLUME, AN IMMEDIATE
678 ; JUMP IS MADE VIA 'IEBLK'. THE TOTAL NUMBER OF BLOCKS ON THE VOLUME
679 ; HAVE BEEN STORED IN 'MAXLBN' (2 WORDS) BACK IN THE MAINLINE CODE.
680 ;
681 ;
682 ; ENTRY CONDITIONS:
683 ;
684 ; R5 -- BUFFER ADDRESS
685 ;
686 ;
687 ; EXIT CONDITIONS:
688 ;
689 ; BUFFER IS WRITTEN TO DISK BLOCK(S) SPECIFIED IN DISK DPB.
690 ;
691 ;
692 ; REGISTERS ALTERED:
693 ;
694 ; NONE
695 ;
696 ;
697 ; CALLING SEQUENCE:
698 ;
699 ; BUFFER ADDRESS --> R5
700 ; CALL WRITE
701 ;
702 ;
703 ;-
704 ;
705 004304 WRITE: PUSH$ R0,R1,R3 ;SAVE REGISTERS
706 004312 016701 175644 MOV XFERSZ,R1 ;CONVERT BYTE TRANSFER SIZE TO BLOCKS
707 004316 012700 000011 MOV #9.,R0 ; SET COUNT
708 004322 006201 5$: ASR R1 ; SHIFT
709 004324 005300 DEC R0 ;
710 004326 001375 BNE 5$ ; ALL BITS
711 004330 005301 DEC R1
712 004332 016700 175630 MOV LBNH,R0 ;GET TRANSFER ADDRESS FRON DISK I/O DPB
713 004336 016703 175626 MOV LBNL,R3
714 004342 060103 ADD R1,R3 ;ADD # OF BLOCKS - 1 TO STARTING BLOCK #
715 004344 005500 ADC R0
716 004346 026700 175724 CMP MAXLBN,R0 ;WILL THE TRANSFER GO OFF THE END?
717 004352 101011 BHI 20$ ;NO
718 004354 103403 BLO 10$ ;YES
719 004356 026703 175716 CMP MAXLBN+2,R3 ;MAYBE -- CHECK LOW BITS
720 004362 101005 BHI 20$ ;NO -- TRANSFER OK
721 004364 10$:
722 004364 POP$ R0,R1,R3 ;TRANSFER WILL GO OFF END -- TRANSFER CONTROL
723 ;TO 'FINISH' TO CHECK BLOCKS ONE AT A TIME
724 004372 000177 175676 JMP @IEBLK
725 004376 012703 000000G 20$: MOV #IO.WVB,R3 ;PUT WRITE FUNCTION CODE IN R3
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 11-1
SUBROUTINE 'WRITE'
726 004402 CALL DISKIO ;WRITE THE BUFFER
004402 004767 177542 JSR PC,DISKIO
727 004406 POP$ R0,R1,R3 ;RESTORE REGISTERS
728 004414 RETURN ;EXIT WITH CARRY PRESERVED
004414 000207 RTS PC
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 12
SUBROUTINE 'VERIFY'
730 .SBTTL SUBROUTINE 'VERIFY'
731 ;
732 ;
733 ;+
734 ; V E R I F Y
735 ;
736 ;
737 ; SUBROUTINE TO READ A BLOCK AND COMPARE IT WITH TEST PATTERN
738 ;
739 ;
740 ; ENTRY CONDITIONS:
741 ;
742 ; NONE.
743 ;
744 ;
745 ; EXIT CONDITIONS:
746 ;
747 ; CARRY -- CLEARED IF NO PARITY ERROR AND VERIFY OK
748 ; CARRY -- SET IF PARITY ERROR OR VERIFY ERROR
749 ;
750 ;
751 ; REGISTERS ALTERED:
752 ;
753 ; NONE
754 ;
755 ;
756 ; CALLING SEQUENCE:
757 ;
758 ; CALL VERIFY
759 ;
760 ;
761 ;-
762 ;
763 004416 VERIFY: PUSH$ R0,R2,R3,R5 ;SAVE REGISTERS
764 004426 012703 000000G MOV #IO.RLB,R3 ;PUT READ FUNCTION CODE IN R3
765 004432 012705 000122' MOV #BUF,R5 ;PUT BUFFER ADDRESS IN R5
766 004436 CALL DISKIO ;READ THE BLOCK SPECIFIED IN DPB
004436 004767 177506 JSR PC,DISKIO
767 004442 103421 BCS 30$ ;EXIT WITH CARRY SET IF PARITY ERROR
768 004444 016702 174466 MOV TSTPAT,R2 ;ELSE SET UP TO VERIFY THE READ
769 004450 016703 174464 MOV TSTPAT+2,R3
770 004454 016700 175502 MOV XFERSZ,R0 ;GET TRANSFER SIZE FROM DISK I/O DPB
771 004460 006200 ASR R0 ; R0 CONTAINS # OF TIMES PATTERN IS REPAETED
772 004462 006200 ASR R0 ;
773 004464 10$:
774 004464 020225 CMP R2,(R5)+ ;VERIFY OK?
775 004466 001006 BNE 20$ ;NO
776 004470 020325 CMP R3,(R5)+ ;MAYBE -- CHECK SECOND PATTERN
777 004472 001004 BNE 20$ ;NO
778 004474 005300 DEC R0 ; YES, CHECK NEXT WORD
779 004476 001372 BNE 10$ ;
780 004500 000241 CLC ;NO VERIFY ERRORS -- CLEAR CARRY
781 004502 000401 BR 30$ ;EXIT WITH CARRY CLEAR
782 004504 000261 20$: SEC ;SET CARRY FOR ERROR EXIT
783 004506 30$:
784 004506 POP$ R0,R2,R3,R5 ;RESTORE REGISTERS
785 004516 RETURN ;EXIT
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 12-1
SUBROUTINE 'VERIFY'
004516 000207 RTS PC
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 13
SUBROUTINE 'INIT'
787 .SBTTL SUBROUTINE 'INIT'
788 ;
789 ;
790 ;+
791 ; I N I T
792 ;
793 ;
794 ; SUBROUTINE TO SET UP TEST PATTERN IN DISK I/O BUFFER
795 ;
796 ;
797 ; ENTRY CONDITIONS:
798 ;
799 ; NONE
800 ;
801 ;
802 ; EXIT CONDITIONS:
803 ;
804 ; I/O BUFFER 'BUF' CONTAINS WORST CASE TEST PATTERN.
805 ;
806 ;
807 ; REGISTERS ALTERED:
808 ;
809 ; NONE
810 ;
811 ;
812 ; CALLING SEQUENCE:
813 ;
814 ; CALL INIT
815 ;
816 ;
817 ;-
818 ;
819 004520 INIT: PUSH$ R0,R2,R3,R5 ;SAVE REGISTERS
820 004530 012705 000122' MOV #BUF,R5 ;SET UP TO INITIALIZE I/O BUFFER
821 004534 016700 175422 MOV XFERSZ,R0 ;GET TRANSFER SIZE FROM DISK I/O DPB
822 004540 006200 ASR R0 ; R0 CONTAINS # OF TIMES
823 004542 006200 ASR R0 ; PATTERN IS REPEATED
824 004544 016702 174366 MOV TSTPAT,R2
825 004550 016703 174364 MOV TSTPAT+2,R3
826 004554 10$:
827 004554 010225 MOV R2,(R5)+ ;STORE FIRST WORD
828 004556 010325 MOV R3,(R5)+ ;STORE SECOND WORD
829 004560 005300 DEC R0 ;
830 004562 001374 BNE 10$ ;
831 004564 POP$ R0,R2,R3,R5 ;RESTORE REGISTERS
832 004574 RETURN ;EXIT
004574 000207 RTS PC
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 14
ROUTINE 'FINISH'
834 .SBTTL ROUTINE 'FINISH'
835 ;
836 ;
837 ;+
838 ; F I N I S H
839 ;
840 ;
841 ; ROUTINE TO WRITE OUT BAD BLOCK FILE AND GENERALLY CLEAN UP
842 ;
843 ;
844 ; ENTRY CONDITIONS:
845 ;
846 ; NONE.
847 ;
848 ;
849 ; EXIT CONDITIONS:
850 ;
851 ; 'BADBLK' IS WRITTEN TO THE DISK AND THE TOTAL NUMBER OF
852 ; BAD BLOCKS FOUND IS SENT TO "CO".
853 ;
854 ; NOTE -- 'FINISH' EXITS DIRECTLY TO 'MESAGE'
855 ;
856 ;
857 ; CALLING SEQUENCE:
858 ;
859 ; JMP FINISH
860 ;
861 ;
862 ;-
863 ;
864 004576 012767 004610' 175470 FINISH: MOV #10$,IEBLK ;SET TRANSFER ADDRESS FOR 'WRITE'
865 004604 CALL BADCHK ;SEE IF THERE WERE ANY BAD BLOCKS
004604 004767 177022 JSR PC,BADCHK
866 ;DURING THE LAST WHOLE BUFFER TRANSFER
867 004610 10$:
868 004610 105764 000001 TSTB BB.CNT(R4) ;ANY BAD BLOCKS IN THE LAST POINTER?
869 004614 001406 BEQ 20$ ;NO -- CLEAR LAST POINTER
870 004616 105364 000001 DECB BB.CNT(R4) ;YES -- ALLOW FOR BIAS OF -1
871 004622 062767 000002 174314 ADD #PTRSIZ/2,BB.USD ;ADD LAST POINTER TO "WORDS USED" COUNT
872 004630 000403 BR 30$
873 004632 005014 20$: CLR (R4) ;NOTHING IN LAST POINTER
874 004634 005064 000002 CLR 2(R4)
875 004640 30$:
876 004640 012700 000377 MOV #255.,R0 ;SET UP TO CALCULATE CHECKSUM
877 004644 012701 001142' MOV #BADBLK,R1
878 004650 005002 CLR R2
879 004652 40$:
880 004652 062102 ADD (R1)+,R2 ;CHECKSUM = SUM OF FIRST 255 WORDS
881 004654 005300 DEC R0 ;
882 004656 001375 BNE 40$ ;
883 004660 010211 MOV R2,@R1 ;STORE CHECKSUM IN BAD BLOCK BUFFER
884 004662 012700 000400 MOV #256.,R0 ;SET UP TO FIND LAST GOOD BLOCK --
885 ;'LBNH' AND 'LBNL' ARE NOW POINTING
886 ;TO LAST BLOCK + 1
887 004666 50$:
888 004666 162767 000001 175274 SUB #1,LBNL ;DECREMENT LBN BY 1 -- DOUBLE PRECISION
889 004674 005667 175266 SBC LBNH
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 14-1
ROUTINE 'FINISH'
890 004700 CALL MATCH ;SEARCH BAD BLOCK FILE FOR THIS LBN
004700 004767 000106 JSR PC,MATCH
891 004704 103403 BCS 60$ ;NOT IN FILE -- USE IT, IT'S GOOD
892 004706 005300 DEC R0 ; IT'S BAD, CHECK PREVIOUS LBN
893 004710 001366 BNE 50$ ;
894 004712 000413 BR 70$ ;ERROR -- LAST 256. BLOCKS WERE BAD
895 004714 012705 001142' 60$: MOV #BADBLK,R5 ;PUT BUFFER ADDRESS IN R5
896 004720 CALL WRITE ;WRITE OUT BAD BLOCK FILE TO LAST GOOD BLOCK
004720 004767 177360 JSR PC,WRITE
897 004724 103012 BCC 80$ ;OK IF CARRY CLEAR
898 004726 CALL WRITE ;ELSE TRY IT TWICE MORE
004726 004767 177352 JSR PC,WRITE
899 004732 103403 BCS 70$ ;IT MUST SUCCEED BOTH TIMES
900 004734 CALL WRITE
004734 004767 177344 JSR PC,WRITE
901 004740 103004 BCC 80$
902 004742 70$:
903 004742 012700 003032' MOV #MSG13,R0 ;ELSE PRINT ERROR MESSAGE
904 004746 000167 177074 JMP MESAGE
905 004752 012700 003017' 80$: MOV #MSG12A,R0 ;PUT MESSAGE ADDRESS IN R0 FOR 'CBTA'
906 004756 016701 175160 MOV BBCNT,R1 ;TOTAL # OF BAD BLOCKS FOUND --> R1
907 004762 005002 CLR R2 ;SET FOR LEADING ZERO SUPPRESS
908 004764 CALL $CBDMG ;CONVERT TO ASCII FOR OUTPUT
004764 004767 000000G JSR PC,$CBDMG
909 004770 112720 000015 MOVB #CR,(R0)+ ;STORE CR-LF AT END OF ASCII STRING
910 004774 112720 000012 MOVB #LF,(R0)+
911 005000 105010 CLRB @R0 ;ZERO LAST CHARACTER FOR 'MESAGE'
912 005002 012700 002754' MOV #MSG12,R0 ;PUT MESSAGE ADDRESS IN R0
913 005006 000167 177034 JMP MESAGE ;PRINT MESSAGE AND EXIT
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 15
SUBROUTINE 'MATCH'
915 .SBTTL SUBROUTINE 'MATCH'
916 ;
917 ;
918 ;+
919 ; M A T C H
920 ;
921 ;
922 ; SUBROUTINE TO SEARCH BAD BLOCK FILE FOR DISK BLOCK # IN 'LBNL' & 'LBNH'
923 ;
924 ;
925 ; ENTRY CONDITIONS:
926 ;
927 ; NONE
928 ;
929 ;
930 ; EXIT CONDITIONS:
931 ;
932 ; CARRY -- CLEARED IF MATCH FOUND
933 ; CARRY -- SET IF NO MATCH
934 ;
935 ;
936 ; REGISTERS ALTERED:
937 ;
938 ; R1,R2,R3,R4,R5
939 ;
940 ;
941 ; CALLING SEQUENCE:
942 ;
943 ; CALL MATCH
944 ;
945 ;-
946 ;
947 005012 116703 174126 MATCH: MOVB BB.USD,R3 ;ANY BAD BLOCKS FOUND?
948 005016 001434 BEQ 30$ ;NO -- INDICATE MATCH FAILED
949 005020 042703 177400 BIC #177400,R3 ;YES -- SET UP R3 FOR "SOB" LOOP
950 005024 006203 ASR R3 ;R3 = # BAD BLOCK SETS USED
951 005026 012704 001146' MOV #BB.PTR,R4 ;SET R4 FOR INDEXING INTO BAD BLOCK SETS
952 005032 10$:
953 005032 016701 175130 MOV LBNH,R1 ;GET LBN WE'RE TRYING TO MATCH
954 005036 016702 175126 MOV LBNL,R2
955 005042 116405 000000 MOVB BB.NHI(R4),R5 ;GET HIGH ORDER BITS FROM THIS SET
956 005046 042705 177400 BIC #177400,R5
957 005052 166402 000002 SUB BB.NLO(R4),R2 ;SUBTRACT LOW ORDER BITS --
958 ; LBN - BAD BLOCK # FROM SET
959 005056 005601 SBC R1 ;TAKE CARE OF BORROW
960 005060 160501 SUB R5,R1 ;AND SUBTRACT HIGH BITS
961 005062 001006 BNE 20$ ;NOT IN THIS SET IF HIGH BITS NOT ZERO,
962 ;SINCE EACH SET ONLY SPANS UP TO 256. BLOCKS
963 005064 116401 000001 MOVB BB.CNT(R4),R1 ;GET # OF BLOCKS IN SET
964 005070 042701 177400 BIC #177400,R1
965 005074 020102 CMP R1,R2 ;IS LBN WITHIN RANGE OF SET?
966 005076 103005 BHIS 40$ ;YES -- SUCCESSFUL MATCH -- EXIT WITH CARRY CLEAR
967 005100 20$:
968 005100 062704 000004 ADD #PTRSIZ,R4 ;NO -- ADVANCE INDEX TO NEXT SET
969 005104 005303 DEC R3 ; TRY NEXT SET
970 005106 001351 BNE 10$ ;
971 005110 30$:
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 15-1
SUBROUTINE 'MATCH'
972 005110 000261 SEC ;NO MATCH FOUND -- SET CARRY
973 005112 40$:
974 005112 RETURN
005112 000207 RTS PC
975 ;
976 ;
977 ;
978 ;
979 ;
980 ;
981 003104' .END BAD
BAD BLOCK PROCESSOR MACRO M1108 05-DEC-77 21:12 PAGE 15-2
SYMBOL TABLE
AM = 000033 DSKLUN= 000003 IO.WVB= ****** GX MSG7 002544R UC.DIR= ****** GX
BAD 003104R DSKQIO 002144R LBNH = 002166R MSG8 002607R UC.F11= ****** GX
BADBLK 001142R FINISH 004576R LBNL = 002170R MSG9 002635R UC.SDI= ****** GX
BADCHK 003632R GLUNPB 001122R LF = 000012 NBLKS = 000001 UC.SQD= ****** GX
BBCNT 002142R G.LUCW= 000004 MATCH 005012R NPTRS = 000146 U.CH = ****** GX
BB.CKS= 002140R G.LUFB= 000003 MAXLBN 002276R PRMDPB 002244R U.C1 = ****** GX
BB.CNT= 000001 G.LUNA= 000000 MCRDPB 002214R PRMPTZ= 000006 U.LBH = ****** GX
BB.NHI= 000000 G.LUNU= 000002 MCRLN 000002R PROMPT 002236R U.LBN = ****** GX
BB.NLO= 000002 IEBLK 002274R MESAGE 004046R PTREND= 001776R U.SZ = ****** GX
BB.PTR= 001146R IE.BLK= ****** GX MSG10 002672R PTRSIZ= 000004 U.UN = ****** GX
BB.USD= 001144R IE.DAA= ****** GX MSG11 002724R Q.IOAE= 000012 VERIFY 004416R
BLK0FG 002272R IE.DNR= ****** GX MSG12 002754R Q.IOEF= 000006 WRITE 004304R
BUF 000122R IE.PRI= ****** GX MSG12A= 003017R Q.IOFN= 000002 XFERSZ= 002162R
BUFSIZ= 000400 IE.VER= ****** GX MSG13 003032R Q.IOLU= 000004 $CBDMG= ****** GX
CH.OFF= ****** GX IE.WLK= ****** GX MSG2 002302R Q.IOPL= 000014 $COTB = ****** GX
COLUN = 000002 INIT 004520R MSG3 002332R Q.IOPR= 000007 $$ = 000067
COQIO 002172R IOST 002266R MSG4 002364R Q.IOSB= 000010 $$$ARG= 000004
CR = 000015 IO.ATT= ****** GX MSG5 002424R SPACE = 000040 $$$OST= 000014
DEVICE 000000R IO.DET= ****** GX MSG6 002462R TAB = 000011 .PUDBA= ****** GX
DISKIO 004150R IO.RLB= ****** GX MSG6SZ= 000062 TSTPAT 001136R .PUDEA= ****** GX
. ABS. 000000 000
005114 001
ERRORS DETECTED: 0
VIRTUAL MEMORY USED: 2805 WORDS ( 11 PAGES)
DYNAMIC MEMORY: 3104 WORDS ( 11 PAGES)
ELAPSED TIME: 00:00:48
[53,10]BAD,[53,20]BAD/-SP=[53,30]BAD