TITLE "Z3ROOT - Z3lib 4.0" ;================================================================ ; The Libraries, Version 4, (C) 1989 by Alpha Systems Corp. ;---------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from Z3ROOT.Z80 Ver 1.1 by Richard Conn ; Date : 8 Mar 87 ; Version : 1.2 ; Module : Z3ROOT ; Abstract: This module contains the routine ROOT which returns ; the Drive and User of the ROOT directory from the Named ; Directory Buffer ; Revision: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC ROOT ; External References EXT ENVPTR, RETUD .Z80 CSEG ;=============================================================== ; NAME - ROOT ; Entry: - None ; Exit : BC = DU: of root dir (B = Drive, C = User) ; The current DU is returned if there is no NDR ; Uses : AF,BC ; Special Requirements: None ;=============================================================== ROOT: PUSH DE ;save DE PUSH HL ;save HL LD HL,(ENVPTR) ;pt to environment LD DE,9 ;pt to path entry ADD HL,DE LD E,(HL) ;get path address in DE INC HL LD D,(HL) EX DE,HL ;HL pts to path CALL RETUD ;get current DU LD A,H ;no path? OR L JR Z,ROOTX ROOTL: LD A,(HL) ;get next path element OR A ;end of path? JR Z,ROOTX ;done if so CALL RETUD ;get current DU CP '$' ;current disk? JR Z,ROOT1 LD B,A ;get disk in B DEC B ;adjust for A=0 ROOT1: INC HL ;pt to user LD A,(HL) ;get user INC HL ;pt to next path element CP '$' ;current user? JR Z,ROOTL ;advance LD C,A ;set user JR ROOTL ;continue ROOTX: POP HL ;restore HL POP DE ;restore DE RET END