home *** CD-ROM | disk | FTP | other *** search
- ;
- ; Z3LIB Module Name: Z3ROOT
- ; Author: Richard Conn
- ; Z3LIB Version Number: 1.3
- ; Module Version Number: 1.1
- ;
- public root
-
- ext envptr,retud
-
- ;
- ; ROOT returns the DU of the root directory in BC. No other registers
- ; are affected.
- ;
- 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
- jp z,rootx
- rootl:
- ld a,(hl) ;get next path element
- or a ;end of path?
- jp z,rootx ;done if so
- call retud ;get current DU
- cp '$' ;current disk?
- jp 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?
- jp z,rootl ;advance
- ld c,a ;set user
- jp rootl ;continue
- rootx:
- pop hl ;restore HL
- pop de ;restore DE
- ret
-
- end