; TITLE "Z3PRS3C - Z3lib 4.0" NAME ('DIRSCAN') ;================================================================ ; The Libraries, Version 4, (C) 1989 by Alpha Systems Corp. ;---------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from Z3PRS3.Z80 Ver 1.1 by Richard Conn ; Date : 29 Jul 89 ; Version : 1.3 ; Module : Z3PRS3C ; Abstract: This module contains the routine DIRSCAN which scans ; a token for a Disk Name in DIR form. ; Revision: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC DIRSCAN ; From Z3LIB Get.. EXT GETNDR ; From SYSLIB Get.. EXT RETUD .Z80 CSEG ;=============================================================== ; NAME - DIRSCAN ; Entry: HL - Points to Disk Name (8 chars max) ; Exit : BC - B = Disk, C = User if Valid ; A <> 0, Zero Flag Reset (NZ) if Valid, else ; A = 0, Zero Flag Set (Z) if NOT Valid ; Uses : AF,BC ; Special Requirements: None ;=============================================================== DIRSCAN: PUSH HL ; Save regs PUSH DE EX DE,HL ; DE pts to name CALL GETNDR ; Pt to named DIR JR Z,ERROR ; ..Abort if none EX DE,HL ; Ptr in HL to name, DE to DIR buffers DIRS1: CALL RETUD ; Get Current DU in BC LD A,(DE) ; Get next char OR A ; Zero if end of DIR JR Z,ERROR ; ..jump error exit if end ;; CP '$' ; Is it default drive? ;; JR Z,DIRS1A ; ..jump if so DEC A ; Else have real drive..compensate (A=0) LD B,A ; .and put in exit reg ;;DIRS1A: INC DE ; Advance to User # LD A,(DE) ; .and retrieve ;; CP '$' ; Is it current User? ;; JR Z,DIRS1B ; ..jump if so LD C,A ; Else put in exit reg ;;DIRS1B: INC DE PUSH BC ; Save DU PUSH HL ; Save ptr to file name PUSH DE ; Save ptr to DIR entry LD B,8 ; Match? DIRS2: LD A,(DE) ; Get byte CP (HL) ; Compare JR NZ,DIRS3 INC HL ; Pt to next INC DE DJNZ DIRS2 ; Count down DIRS3: POP DE ; Restore regs POP HL POP BC ; Restore DU JR Z,OKEXIT ; ..and exit if Ok EX DE,HL ; Else advance to next entry LD BC,16 ; 8 Bytes for name + 8 Bytes for password ADD HL,BC EX DE,HL JR DIRS1 ; ..and loop to match next entry OKEXIT: DEFB 0F6H ; Else set OK status w/"OR A,0AFH" ERROR: XOR A ; Error status if entered here POP DE POP HL RET END