TITLE "DDIR - Syslib 4.0" ;================================================================= ; Copyright (C) 1989 by Harold F. Bower. Permission granted to ; Alpha Systems Corp. to distribute with The Libraries, Version 4 ;----------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from SDIR.Z80 Ver 1.5 by Richard Conn ; Date : 17 Aug 88 ; Version : 1.0 ; Module : DDIR ; Abstract: This module contains the General-purpose directory ; select routines DDIRF and DDIRFS. Both routines read ; the directory of a specified drive and return with all ; entries satisfying specified sort parameters, in sorted ; order as an array in memory. DDIRF returns records which ; do NOT contain enough information to derive file size, ; while DDIRFS contains sizing information accessable with ; the FSIZE routine. The difference in performance may be ; noticeable on larger directory sizes, with DDIRFS being ; slower because of increased processing overhead. ; Revision: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC DDIRF, DDIRFS ; External References EXT SELFLG EXT DBUFFER, DDIRLD, DDIRSLD, DDIRSEL EXT DDIRPAK, DDIRALFA .Z80 CSEG ;=============================================================== ; NAME - DDIRFS (WITH Sizing Data) ; Entry: HL - Points to Buffer starting address ; DE - Points to FCB for selection ; C - Flag for Time Stamp method (0=P2Dos, FF=DateStamper) ; A - Contains Select flag as: ; Bit 7 - Select Non-System Files ; Bit 6 - Select System Files ; Bit 5 - Select All Users ; Bits 4-0 - User Number ; Exit : HL - Points to First File in Buffer ; BC - Number of files in Buffer Array ; A <> 0, Zero Flag Reset (NZ) if Ok ; A = 0 and Zero Flag Set (Z) if TPA Overflow ; Uses AF,BC,HL ; Special Requirements: None ;=============================================================== DDIRFS: PUSH DE ; Save ptr to FCB LD (SELFLG),A ; Save Select Flag for DIRSEL CALL DBUFFER ; Get ptrs CALL DDIRSLD ; Load Dir with Sizing Information JR DDIRF0 ; ..continue with common code ;=============================================================== ; NAME - DDIRF (NO Sizing Data) ; Entry: HL - Points to Buffer starting address ; DE - Points to FCB for selection ; C - Flag for Time Stamp method (0=P2Dos, FF=DateStamper) ; A - Contains Select flag as: ; Bit 7 - Select Non-System Files ; Bit 6 - Select System Files ; Bit 5 - Select All Users ; Bits 4-0 - User Number ; Exit : HL - Points to Fiest File in Buffer ; BC - Number of files in Buffer Array ; A <> 0 Zero Flag Reset (NZ) if Ok ; A = 0 and Zero Flag Set (Z) if TPA Overflow ; Uses : AF,BC,HL ; Special Requirements: None ;=============================================================== DDIRF: PUSH DE ; Save ptr to FCB LD (SELFLG),A ; Save Select Flag for DDIRSEL CALL DBUFFER ; Get ptrs CALL DDIRLD ; Load Dir w/o sizing information (fast load) DDIRF0: POP DE ; Get ptr to FCB RET Z ; Abort if TPA Overflow PUSH AF ; Save flag to indicate no TPA overflow LD A,(SELFLG) ; Get select flag CALL DDIRSEL ; Select files CALL DDIRPAK ; Pack Directory XOR A ; Sort flag (FN and FT) CALL DDIRALFA ; Alphabetize POP AF ; Get PSW (TPA overflow flag) RET END