.MCALL .MODULE .MODULE PIPDK,VERSION=07,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. .ENABL GBL,LC .SBTTL PSECT definitions ;+ ; The PSECT's are defined here to give them the desired ordering. ; Consider the ordering critical. Several of the PSECT's contain ; stoppers for lists in the previous PSECT. ;- PSECT IMPURE ;Impure data PSECT PIPDK ;Main code psect PSECT PATCH ;Patch psect .BLKW 32. ;Root patch space .SBTTL NEXTDK - Get the next disk directory entry ;+ ; NEXTDK ; This routine returns the next entry in a directory. If there are no more ; it returns C-bit set. ; ; $NXTFL -> next entry in directory. Caller should set this to 0 ; to force the next segment to be read ; $NXTSG = segment number of the next directory segment. Caller ; should set this to 1 to force the directory to be read ; from the beginning ; $DIRCH = channel number to read the directory on ; $DIRBF -> buffer to read directory into. 512. words. ; ; CALL NEXTFL ; ; C-bit = 0 => no error ; R0 <> 0 => R0 -> directory entry ; $STBLK = starting block number for the entry ; ; R0 = 0 => no more entries in directory ; ; C-bit = 1 => error ; R0 = error code ; ; Errors: ; DIE ; ILD ;- ORIGIN PIPDK NEXTDK:: TST OVRLOD ;Are we being loaded? BNE 1$ ;Branch if not INC OVRLOD ;Bump flag to indicate real entry next time BR 10$ ;Go home 1$: JSR R5,$SAVRG ;Save registers 3-5 2$: MOV $NXTFL,R0 ;R0 -> next directory entry BNE 7$ ;Branch if we have one MOV $NXTSG,R5 ;R5 = next segment number. BEQ 9$ ;Branch if no more 3$: MOV $DIRBF,R4 ;R4 -> directory input buffer MOV R4,$NXTFL ;Copy it ADD #DH.SIZ,$NXTFL ;$NXTFL -> first entry ASL R5 ;Directory segments are 2 blocks long ADD #4,R5 ;And start at block 6 MOV R5,$DIRSG ;Save the block number for WRTDIR .READW #IOAREA,ICHAN,R4,#SEGSIZ,R5 ;Read the segment BCC 4$ ;Branch if no error ;+ ;ERROR MOV #DIE,R0 ;Set the error code BR 10$ ; ; ;- 4$: MOV DH.NXT(R4),$NXTSG ;Save the block number of the next segment MOV DH.STB(R4),$STBLK ;Save the start block for files in this seg. BEQ 6$ ;Branch if invalid CLR $LSTLN ;Clear the length of the last file CMP #6,R5 ;This the first segment? BNE 2$ ;Branch if not MOV DH.HI(R4),$HISEG ;Save the highest segment open MOV DH.AVL(R4),$AVAIL ;and the highest available BLE 6$ ;Branch if illegal CMP #MAXSEG,$AVAIL ;Is it good? BLO 6$ ;Branch if not 5$: MOV DH.EXB(R4),$EXTBY ;Save # of extra bytes CMP #MAXBYT,$EXTBY ;Valid? BLO 6$ ;Branch if not BIT #1,$EXTBY ;Is it odd? BEQ 2$ ;Branch if not ;+ ;ERROR 6$: MOV #ILD,R0 ;Return error code SEC ;Indicate error BR 10$ ; ; ;- 7$: BIT #DS.EOS,@R0 ;End-of-segment? BEQ 8$ ;Branch if not CLR $NXTFL ;Force next call to read next segment BR 9$ ;Done 8$: ADD #DE.SIZ,$NXTFL ;Point to next entry ADD $EXTBY,$NXTFL ;Don't forget extra bytes ADD $LSTLN,$STBLK ;Point to the start of this file MOV DE.LEN(R0),$LSTLN ;Save the size of this file 9$: CLC ;Indicate no errors 10$: RETURN .END