PV1 EQU 0F003H
os equ pv1
;Programm XDIR mit UNIX-Matching
;als Testprogramm zu CAOS NT
DEFW 7F7FH
DEFM 'XDIR'
DEFB 1
or a ;Null Args?
jr nz,nodef
ld a,3
ld (0b782h),a
nodef
call os
db 23h,'Mask :',0
call os
db 17h
ret c
ld hl,6
add hl,de
ld de,buf1
ld bc,12
ldir
xor a
ld (de),a
ld hl,(0b782h)
ld h,l
DIR LD A,0DH ;Directory open
WDI CALL STEUER
jr NZ,ERR1 ;Fehler
BIT 2,A ;Ende
JR NZ,STAT
LD D,3 ;3 Namen
LD B,82H
NA3 push hl
push de
push bc
call cpbuf2 ;bc->buf2
ld hl,buf2
ld de,buf1
call glob
pop bc
pop de
pop hl
jr c,nolst
push bc
LD E,9 ;Name
CALL ANZ
PUSH AF
LD E,2 ;Typ
CALL ANZ
POP AF
BIT 7,A
LD A,' ' ;WR
JR Z,WR
LD A,'*' ;RO
WR CALL PV1
DEFB 24h
CALL PV1
DEFB 2bh ;ospac
INC B
pop bc
ld a,b
add 13
ld b,a
dec h
jr nz,nle
ld h,l
call os
db 2ch ;crlf
nle DEC D
JR NZ,NA3
LD A,5 ;Dir weiter
JR WDI
ERR1 LD BC,81F3H
IN A,(C)
CALL PV1
DEFB 1ch
ERR2 CALL PV1
DEFB 19h
RET
STAT LD A,15H ;Status
CALL STEUER
jr NZ,ERR1 ;Fehler
LD E,20
LD B,82H
ANZ IN A,(C)
PUSH AF
AND 7FH
INC B
CALL PV1
DEFB 24h
POP AF
DEC E
JR NZ,ANZ
RET
STEUER LD BC,80F3H
OUT (C),A
STEU PUSH BC
LD A,1
CALL PV1
DEFB 14h
POP BC
IN A,(C)
BIT 0,A
JR NZ,STEU ;fertig ?
BIT 7,A ;Fehler ?
RET
cpbuf2: ;copy cb to buffer 2
;zu einem vernuenftigen String
;Fasst Spaces zusammen
ld hl,buffer2
ld e,8
call cpl1
in a,(c)
cp 21h
ret z
ld m,'.'
inc hl
ld e,3
cpl1 in a,(c)
inc b
cp 21h
jr c,cpl2
and 7fh
ld m,a
inc hl
cpl2 dec e
jr nz,cpl1
ld m,0 ;Null!
ret
mat0 inc hl
mat0e inc de
glob: ld a,(de)
or m ;Beide Ende
ret z
ld a,(de)
cp '*'
jr z,mat0s
cp 1
ret c ;M Ende
ld a,m
cp 1
ret c ;N Ende
ld a,(de)
cp '?'
jr z,mat0
bit 5,m
call z,UpCase
cp m
jr z,mat0
scf
ret
mat0s push hl
push de
call mat0e
pop de
pop hl
ret nc
ld a,m
inc hl
or a
jr nz,mat0s
scf
ret
UpCase: ;A upcasen
cp 'a'
ret c
cp 'z'+1
ret nc
and 0dfh
ret
buffer1
org $+13
buffer2
endÿÿÿ7‡8‡9‡:‡;‡<‡=‡>‡?‡@‡
Detected encoding: ANSI (CP1252) | 4
|
|