.MCALL .MODULE .MODULE DIRDK,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. ; ; DIR (Directory Program) ; .NLIST .LIST .PSECT DISK ;+ ; Module DIRDK ; This module contains routines to get directory entries for disks. ;- .SBTTL NEXTDK- Get a disk directory entry ;+ ; NEXTDK ; This routine points R5 at the next directory entry of a disk directory. ; R5 cannot be modified once NEXTDK has been called. ; OUTPUTS: ; R5 -> next directory entry, if one exists ; C-bit = 1 if no more directory entries ;- XTERNL GBLDAT GBLDAT GBLDAT GBLDAT NEXTDK::TST EOSFLG ;Have we got a segment? BNE 7$ ;Branch if yes 1$: MOV NXTDSG,RBLK ;Get the next directory segment BNE 2$ ;If NE then we're not at end SEC ;Flag no more entries BR 9$ ; and return to caller 2$: MOV SP,EOSFLG ;Fix the end-of-segment flag ASL RBLK ;Each directory segment is 2 blocks ADD #4,RBLK ;Offset to block 6 for 1st one MOV #IBUF,R5 ;Point R5 at the input buffer MOV R5,NXTFIL ;Set the pointer to the next file ADD #DH.SIZ,NXTFIL ;Skip the header words .READW #IOAREA,#ICHAN,R5,#INBFSZ/2,RBLK ;Read a directory segment BCC 3$ ;Branch if no error JMP INERR ;Else issue the error 3$: MOV DH.EXB(R5),XTRABY ;Set the number of extra bytes BIT #1,XTRABY ;Odd number of extra bytes? BNE 4$ ;Branch if so. Illegal directory. MOV DH.NXT(R5),NXTDSG ;Set the next directory segment MOV DH.STB(R5),SBLOCK ;Get starting block number for segment BNE 5$ ;If EQ, then illegal directory 4$: JMP ILDIR ;Give "Illegal directory" error 5$: TST HISEG ;Is this the first segment? BNE 6$ ;Branch if not MOV DH.HI(R5),HISEG ;Else get the highest segment open MOV DH.AVL(R5),AVAIL ; and the highest available BLE 4$ ;If <= 0, illegal directory CMP #37,AVAIL ;Too many directory segments? BLO 4$ ;Branch if so 6$: TST EOSFLG ;Was the last entry end of a segment? BEQ 1$ ;Branch if so 7$: MOV NXTFIL,R5 ;Point R5 at the next entry BIT #DS.EOS,@R5 ;Are we pointing to end of the segment? BEQ 8$ ;Branch if not CLR EOSFLG ;Set the flag 8$: ADD #DE.SIZ,NXTFIL ;Point to next file entry for next loop ADD XTRABY,NXTFIL ;Don't forget extra bytes CLC ;Clear the carry bit 9$: RETURN .END