.MCALL .MODULE .MODULE DUPMRG,VERSION=02,COMMENT=,IDENT=NO ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion of the above copyright notice. This software, or ; any other copies thereof, may not be provided or otherwise ; made available to any other person except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. ;+ ; MERGE ; This routine places a new bad block table element in the list in ascending ; order by block number. If the block is already marked bad from the scan or ; from the manufactures bad sector file, a non-replaceable element takes ; precedence. ; ; R0 -> element to insert ; ; CALL MERGE ; ; R0 modified ;- MERGE: SAVE35 ;Save R3 - R5 MOV BADLHD,R5 ;R5 -> bad block list INC @R5 ;Bump the # of bad blocks MOV R5,R4 ;R4 -> bad block list MOV (R4)+,R3 ;R3 = # bad blocks ;R4 -> 1st list element DEC R3 ;Offset for 0 base ASL R3 ;*2 MOV R3,-(SP) ; ASL R3 ;*4 ADD (SP)+,R3 ;*6 ADD R4,R3 ;R3 -> 1st free element 1$: CMP R3,R4 ;Hit the end of the table? BEQ 5$ ;Branch if so. Insert new element at end CMP BT.BLK(R0),BT.BLK(R4) ;Starting block numbers match? BLO 2$ ;Branch if we insert here BEQ 4$ ;Branch if same block ADD #BT.SIZ,R4 ;R4 -> next list element BR 1$ ; 2$: CMP @R5,#MAXBAD ;Is the list already full? BHI 8$ ;Branch if so. Don't add new one MOV R4,R5 ;R5 -> current element MOV R3,R4 ;R4 -> past end of table ADD #BT.SIZ,R3 ;R3 -> past new entry 3$: CMP R4,R5 ;Done? BLOS 6$ ;Branch if so MOV -(R4),-(R3) ;Move the list down to make room BR 3$ ; 4$: DEC @R5 ;Fix count. Block already in table BIT #BAD.NR,@R0 ;Is new bad block non-replaceable? BNE 6$ ;Branch if so. Use it's data CMP (R0)+,(R4)+ ;Skip the type BR 7$ ;Go move in start block and length 5$: CMP @R5,#MAXBAD ;Is the list already full? BHI 8$ ;Branch if so. Don't add new one 6$: MOV (R0)+,(R4)+ ;Move in new element 7$: MOV (R0)+,(R4)+ ; MOV (R0)+,(R4)+ ; 8$: RETURN .END