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
/
CPM
/
BDOS
/
Z80DOS10.LBR
/
DATEDEMO.ZZ0
/
DATEDEMO.Z8°
Wrap
Text File
|
2000-06-30
|
5KB
|
252 lines
;
; Program: DATEDEMO
; Author: Carson Wilson
; Date: September 19, 1987
; Version: 1.0
; Assembly: Z80ASM, PDLN, SYSLIB.REL, DATEHL.REL
;
; Purpose: Example program using Z80DOS and DATEHL module.
;
; Comments: Produces a non-alphabetized listing of matching filenames
; and their Z80DOS time stamps on console.
;
; Usage:
; DATEDEMO / display help (both versions)
;
; DATEDEMO [d:][afn] non-ZCPR version
; DATEDEMO [du: or dir:][afn] ZCPR version
no equ 0
yes equ not no
Z80ASM equ no ; Assemble with Z80ASM
tab equ 09h
cr equ 0dh
lf equ 0ah
fcb1 equ 05ch
dskbuf equ 80h
bdos equ 5
sfirst equ 17
snext equ 18
zuser equ 069h ; ZCPR location
getstp equ 54 ; Z80DOS call
vers equ 10
.request syslib,datehl ; Linker request for PDLN.COM
external datehl ; DATEHL module
external pa2hc,print,crlf,cout ; SYSLIB routines
external pfn1,sua,cin,condin ; SYSLIB routines
if Z80ASM ; Z80ASM pseudo-op
.accept 'Assemble for ZCPR ("yes" or "no"): ',ZCPR
else
ZCPR equ no ; Assemble for ZCPR
endif
;
; Begin
;
if ZCPR
ld a,(zuser) ; Log to ZCPR user #
call sua
endif
;
; Test for help command
;
ld a,(dskbuf) ; # chars on command line
cp 1 ; One character?
jr nz,nohelp ; No
ld a,(fcb1+1) ; Yes
cp '/' ; Help command?
jr nz,nohelp ; No
call print ; Display help and exit
db 'DATEDEMO Version '
db vers / 10 + '0','.', vers mod 10 + '0'
db ' for Z80DOS',cr,lf
db ' Syntax:',cr,lf
if ZCPR
db tab,'DATEDEMO [du: or dir:][afn]',cr,lf,0
else
db tab,'DATEDEMO [d:][afn]',cr,lf,0
endif ; ZCPR
ret ; Return to user
;
; Begin output
;
nohelp:
ld a,(fcb1+1)
cp ' ' ; Filespec given?
jr nz,test
ld hl,fcb1+1 ; No, match all files
ld a,'?'
ld b,11
fill: ; Fill with '?'
ld (hl),a
inc hl
djnz fill
;
; Search for match
;
test:
ld de,fcb1
ld c,sfirst
call bdos
cp 0ffh ; No matches
jp nz,found
call print
db 'DATEDEMO: no matching files.',cr,lf,0
ret
;
; Matches found - print header:
;
found:
call print
db tab,tab,'----Access---- ----Update---- -Create-'
db cr,lf,0
call process ; Display name and stamp of first match
;
; Search for next match
;
next:
call condin ; Test pause
call nz,cin ; Get input to restart
ld de,fcb1
ld c,snext
call bdos
cp 0ffh ; No more matches
ret z
call process ; Display name and stamp of next match
jr next
;
; Process - Get date/time stamp, display filename and stamp
;
process:
push af ; save dir. return code from search
;
; Store time stamp
;
ld c,getstp ; Z80DOS call
call bdos ; HL --> stamp
ld b,10 ; copy 10 byte stamp
ld de,cdate
ldir ; to cdate, udate, utime, adate, atime
;
; Print file name and stamp
;
pop af ; Get return code
add a,a
add a,a
add a,a
add a,a
add a,a
add 81h ; Point to matching filename in DMA
ld e,a
ld d,0
call pfn1 ; SYSLIB print file name pointed to by DE
call ptab
call printstp ; Display stamp
call crlf
ret
;
; PrintStp - Display file's time stamp from buffers
;
PrintStp:
ld hl,(adate) ; Print last access date
call datedisp
call space
ld hl,(atime) ; ..and time
call timedisp
call space
call space
call space
ld hl,(udate) ; Print update date
call datedisp
call space
ld hl,(utime) ; ..and time
call timedisp
call space
call space
call space
ld hl,(cdate) ; Print create date
call datedisp
ret
;
; DateDisp - Display mm-dd-yy on console
;
; Inputs: HL = Days since Dec. 31, 1977 in hex.
;
DateDisp:
call datehl ; --> H = BCD year, L = BCD month,
; ..A = BCD day
ld b,a ; Save day
ld a,l ; Get month
call pa2hc ; Print 2 digit month
call dash
ld a,b ; Get day
call pa2hc ; Print 2 digit day
call dash
ld a,h ; Get year
call pa2hc ; Print 2 digit year
ret ; Done with date
;
; TimeDisp - Display hh:mm on console
;
; Inputs: H = minutes in BCD, L = hours in BCD
;
TimeDisp:
ld a,l
call pa2hc ; Print 2 digit hour
ld a,':' ; Print ':'
call cout
ld a,h
call pa2hc ; Print 2 digit minute
ret ; Done with time
;
ptab: ; Print a tab on console
ld a,tab
call cout
ret
;
space: ; Print a space on console
ld a,' '
call cout
ret
;
dash: ; Print a dash on console
ld a,'-'
call cout
ret
; -----------------------
; Data Area
; -----------------------
dseg ; Or else we collide with code segment
cdate:
ds 2 ; Create date
udate:
ds 2 ; Update date
utime:
ds 2 ; Update time
adate:
ds 2 ; Last access date
atime:
ds 2 ; Last access time
;
end
; END of DATEDEMO.Z80