home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ZSYS
/
SIMTEL20
/
ZCPR3
/
VFILR4-2.LBR
/
VFCMDS2.ZZ0
/
VFCMDS2.Z80
Wrap
Text File
|
2000-06-30
|
5KB
|
221 lines
;===========================================================================
;
; VFCMDS2.Z80 - Tagging, Untagging, Retagging Commands (T, U, W, Y)
;
;===========================================================================
; * * *COMMAND: T
tag:
ld b,tagch ; Tag char
jr ut ; Do tag
; * * COMMAND: U
untag:
ld b,' ' ; Reset tag byte to space
; Common Entry Point for Untag/Tag: Reg B = Untag/Tag Char
ut:
ld hl,(ringpos) ; Move back one..
ld a,' '
cp b
jr nz,ut0 ; Tagging, carry on..
push hl ; Save ringpos
ld de,9
add hl,de ; Point to R/O attribute
ld a,128
cp (hl)
pop hl ; Restore ringpos
jr nc,ut0 ; File is R/W
ld b,'r' ; Flag as R/O
ut0:
push hl
ld de,eltsiz-1 ; Character position..
add hl,de ; And check tagging status.
ld (hl),b ; If file previously tagged, remove.
pop hl
call reffn ; Refresh file name
jp forward
; SOFTAG - Untag but remember it was tagged
stag:
ld hl,(ringpos) ; Current file
ld de,eltsiz-1
add hl,de ; Point to tag
ld a,tagch
cp (hl)
ret nz ; Not tagged, forget it
ld (hl),stagch ; Soft tag it
; REFFN - Refresh file name with new tag
reffn:
if bihelp
ld a,(helpdisp) ; Currently displaying help?
or a ; Nop if so.
ret nz
endif
call clrcur ; Clear cursor
ld hl,(ringpos) ; Reprint file name
; Enter with HL pointing to file in ring
reffnt:
push hl
ld de,eltsiz-1 ; Character position..
add hl,de ; Point to tag
ld a,(hl) ; Get tag character
cp tagch ; Hard tag?
if revvideo
call z,stndout ; Reverse if tagged
else
call nz,stndout ; Dim if not tagged
endif
pop hl ; Restore ringpos
inc hl ; Point to name
call prfn
ld a,(hl)
call cout ; Print tag
jp stndend ; Bright
; ; * COMMAND: W
wtag:
call cprmpt
db 'Tag/Untag (T/U)? ',0
call keyin ; Get response.
cp 'T' ; Wild tag?
ld b,tagch ; Get tag character
jr z,wtag1 ; Br if wild tag.
cp 'U' ; Wild untag?
jp nz,loop ; Return to position if not.
ld b,' ' ; Get untag byte
wtag1:
push bc ; Save tag.
call cprmpt
db 'Match (filename.ext)? ',0
ld de,d$fcb ; -> match pattern.
call filename ; Get match file id.
wtagen:
ld hl,(ringpos) ; Save current ring position.
ld (sringpos),hl
ld hl,(ring) ; -> start of ring.
ld (ringpos),hl
pop bc ; Restore tag
wtag2:
ld hl,(ringend) ; At end of ring?
ex de,hl
ld hl,(ringpos)
call cmpdehl ; Same if so
jr z,wtag3 ; Exit if done.
ex de,hl ; De-> current file id.
ld hl,eltsiz ; -> next file in ring.
add hl,de
ld (ringpos),hl ; Save pointer to next file.
ld hl,d$fcb ; -> match pattern.
call fmatch ; Check for file match.
jr nz,wtag2 ; Br if not a match.
ld hl,(ringpos) ; -> current tag char
dec hl
ld (hl),b ; Set tag/untag
jr wtag2 ; Next file.
; Redisplay files with updated tag indicators
wtag3:
ld hl,(sringpos) ; Restore current ring position.
ld (ringpos),hl
jp runsh4 ; Redisplay files, return for next command.
; FMATCH - Check two file ID's for a match
;
; Input: HL -> Match File ID (possibly ambiguous); ; DE -> Current File ID
; Output: Z Match
; NZ Not a match
fmatch:
push bc ; Save regs.
push de
push hl
inc de ; Bypass drive
inc hl
ld b,11 ; Length of file name and file type.
fmat1:
ld a,(hl) ; Get match character.
cp '?' ; Wild char?
jr z,fmat2 ; Yes - automatic match.
ld a,(de) ; Get current file id char
and 7fh ; Ignore attributes
cp (hl) ; Match?
jr nz,fmat3 ; Exit on first difference. (nz)
fmat2:
inc de ; Next char
inc hl
djnz fmat1 ; Loop until all chars checked.
fmat3:
pop hl ; Restore regs
pop de
pop bc
ret ; Exit
;
; COMMAND: 'Y' Retag soft tags
yank:
ld hl,(ringpos) ; Old ring position
ld (sringpos),hl ; Save ring position
ld hl,(curat)
ld (scurat),hl ; Save cursor position
ld hl,(ring) ; Beginning of ring
ld de,-eltsiz
add hl,de ; Back up
ld (ringpos),hl ; New ring position (-1)
yank1:
ld hl,(ringpos) ; Last position
ld de,eltsiz ; One element size
add hl,de
ld (ringpos),hl ; New position
ex de,hl ; To DE
ld hl,(ringend) ; Check end of ring
call cmpdehl
jr z,yankex ; Finished
; Check for soft tag. Hard tag if found
ld hl,(ringpos) ; Current position
ld de,eltsiz-1
add hl,de ; Point to tag
ld a,(hl) ; Get it
cp stagch ; Soft?
jr nz,yank1 ; Try again..
ld (hl),tagch ; Tag it
jr yank1 ; Try again..
yankex:
ld hl,(sringpos)
ld (ringpos),hl ; Restore ring location
ld hl,(scurat)
ld (curat),hl ; Restore cursor location
jp runsh5 ; Continue..