home *** CD-ROM | disk | FTP | other *** search
- page
-
- ; RCP-PROT.Z80
-
- ;Section 5F
- ;Command: PROT
- ;Function: To set the attributes of a file (R/O and SYS)
- ;
- ;Form:
- ; PROT afn RSI
- ;If either R or S are omitted, the file is made R/W or DIR, resp;
- ;R and S may be in any order. If I is present, Inspection is enabled.
-
- att:
- call retsave
- xor a ; Set no inspect
- ld (inspect),a
- ld hl,0 ; Set r/o and sys attributes off
- ld de,fcb2+1 ; Pt to attributes
- ld b,3 ; 3 chars max
- att1:
- ld a,(de) ; Get char
- inc de ; Pt to next
- cp 'I' ; Inspect?
- jr z,atti
- cp 'R' ; Set r/o?
- jr z,attr
- cp 'S' ; Set sys?
- jr z,atts
- att2:
- djnz att1
- jr att3
- atti:
- ld (inspect),a ; Set flag
- jr att2
- attr:
- ld h,80h ; Set r/o bit
- jr att2
- atts:
- ld l,80h ; Set sys bit
- jr att2
- att3:
- ld (fatt),hl ; Save file attributes
- ld a,1 ; Select dir and sys files
- call getdir ; Load directory
- jp z,prfnf ; No file error
- jr att5
- att4:
- ld hl,(nxtfile) ; Pt to next file
- ld a,(hl) ; End of list?
- or a
- jp z,exit
- call crlf ; New line
- att5:
- call break ; Check for possible abort
- push hl ; Save ptr to current file
- call prfn ; Print its name
- ld (nxtfile),hl ; Save ptr to next file
- call print
- db ' Set to R','/'+80h
- ld hl,(fatt) ; Get attributes
- ld c,'W' ; Assume r/w
- ld a,h ; Get r/o bit
- or a
- jr z,att6
- ld c,'O' ; Set r/o
- att6:
- ld a,c ; Get char
- call conout
- ld a,l ; Get sys flag
- or a ; Set flag
- jr z,att7
- call print
- db ' and SY','S'+80h
- att7:
- inspect equ $+1 ; Ptr for in-the-code modification
- ld a,0 ; Get inspect flag
- or a ; Z=no
- pop hl ; Get ptr to current file
- jr z,att8
- call eraq1 ; Ask for y/n
- jr nz,att4 ; Advance to next file if not y
- att8:
- ld de,fcb1+1 ; Copy into fcb1
- ld b,11 ; 11 bytes
- call blkmov
- fatt equ $+1 ; Ptr for in-the-code modification
- ld hl,0 ; Get attributes
- dec de ; Pt to sys byte
- dec de
- ld a,l ; Get sys flag
- call attset ; Set attribute correctly
- dec de ; Pt to r/o byte
- ld a,h ; Get r/o flag
- call attset
- ld de,fcb1 ; Pt to fcb
- ld c,30 ; Set attributes
- call bdos
- jr att4
- attset:
- or a ; 0=clear attribute
- jr z,attst1
- ld a,(de) ; Get byte
- or 80h ; Set attribute
- ld (de),a
- ret
- attst1:
- ld a,(de) ; Get byte
- and 7fh ; Clear attribute
- ld (de),a
- ret
- ;
- ; End RCP-PROT.Z80
-
-