; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ; * * ; * D A T E F N * ; * * ; * Dated Filename Label File Utility * ; * * ; * by * ; * Terry Hazen * ; * 21460 Bear Creek Road * ; * Los Gatos, CA 95030 * ; * * ; * Voice.......... (408) 354-7188 * ; * Zee-Machine.... (408) 245-1420 * ; * Ladera Znode... (213) 670-9465 * ; * * ; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ; ; ; Revision History ; ---------------- ; ; 01/22/91 Initial release. ; v1.0 - Terry Hazen ; ;======================================================================= ; ; Overview ; -------- ; ; Reads ZSDOS clock and creates a 0-length label file with the current ; date as the filename. The date format may be configured as one of ; of two formats, ?ddMMMyy.typ or mm/dd/yy.typ. ; ;======================================================================= vers equ 10 off equ 00h no equ off on equ 0ffh yes equ on bdos equ 5 fcb equ 5ch fcb2 equ 6ch cmdbuf equ 80h tab equ 9 cr equ 13 lf equ 10 bell equ 7 .request nztim ext mont .request dslib ext timini,rclock .request z3lib ext z3init,zsyschk,getefcb,z3log .request syslib ext eprint,cout,ma2hc,pafdc,capstr,pfn2 ext retud,f$exist,f$make,f$delete ; Start of program entry: jp start db 'Z3ENV' ; ZCPR3 indentifier db 3 ; Type 3 utility z3eadr: dw 0 ; Z3ENV addr dw entry ; Type 3 address for fill ; Default ZCNFG configuration overlay filename (8 characters total) db 'DATEFN' db vers/10+'0',vers mod 10+'0' ; Default date filename format ; Set to OFF for mm/dd/yy format ; Set to ON for !ddMMMyy format format: db ON ; Default is !ddMMMyy ; Date filename default prefix character for ddMMMyy format only ; Set to ' ' for no prefix character ; Set to desired prefix character (eg:'-' for -ddMMMyy) prefix: db ' ' ; Date file prefix ; Date filename default filetype ftype: db ' ' ; Date file filetype pname equ $+3 ; Default program name banner: call eprint defnam: db 'DATEFN vers ' db vers/10+'0','.',vers mod 10+'0' db ' - Dated Filename Label File Utility' db cr,lf,lf,0 ret ; help: call eprint db 'Create or delete an empty date label file ' db 'with the current date as' db cr,lf db 'the filename. The date format may be configured ' db 'by ZCNFG as' db cr,lf db '?ddMMMyy.typ (default) or mm/dd/yy.typ.' db cr,lf,lf db 'Syntax:',0 call name db ' [dir:] Create date label file',0 call name db ' [dir:] /A Create archived date label file',0 call name db ' [dir:] /D Delete date label file',cr,lf,0 ret ; name: push hl ; Save message pointer call eprint db cr,lf,' ',0 ; Set up for name display ; ld hl,(fname) ; Get name pointer ld b,8 ; name1: ld a,(hl) inc hl or a ; End? jr z,name2 ; Yes cp ' ' ; End? jr z,name2 call cout djnz name1 name2: call eprint db ' ',0 ; Display common trailing message pop hl ; Restore message pointer and fall thru jp eprint ; To display the next message ; Start of main code start: ld (stack),sp ; Save system stack pointer ld sp,stack ; Our stack ld hl,exit ; Save exit address on stack push hl ; xor a ld hl,data ; Initialize data area ld de,data+1 ld (hl),a ld bc,datalen ldir ; ld hl,(z3eadr) ; Check for z3 system call zsyschk ret nz ; Not present, quit ; call banner ; Tell'em who we are call z3init ; Do zcpr3 initialization call getefcb jr nz,efcb ; call eprint db 'No EFCB!',bell,0 ret ; efcb: inc hl ; Point to filename ld (fname),hl ; Save filename pointer ; ld hl,fcb2+1 ld a,'/' ; Check for option cp (hl) jr nz,hlpchk1 ; No ; inc hl ld a,'D' ; Delete file? cp (hl) jr z,setflg ; Yes ; ld a,'A' ; Archive file? cp (hl) jr z,setflg ; Yes ; hlpchk1:ld hl,fcb+1 ; Point to fcb ld a,'/' ; Option or help cp (hl) ; Option flag? jr nz,strt2 ; No, must be dir: ; inc hl ; Yes, skip flag cp (hl) ; Help? jp z,help ; Yes, display help screen ; strt1: ld a,'D' ; Delete file? cp (hl) jr z,setflg ; Yes ; ld a,'A' ; Archive file? cp (hl) jp nz,help ; No, must be help request ; setflg: ld (oflag),a ; Set option flag ; strt2: ld de,fcb call z3log ; Log into any specified dir: call timini ; Check for clock jr nz,clk ; Clock present ; call eprint db 'No clock present!',bell,0 ret ; clk: ld hl,today call rclock ; Store time if clock ok jr z,clkok ; call eprint db 'Can''t read clock!',bell,0 ret ; clkok: ld de,fcb+1 ld a,(format) ; Get default filename format or a ; Check format jr z,chktyp ; Skip prefix ; ld a,(prefix) cp ' ' ; Prefix character? jr z,chktyp ; No ; ld (de),a ; Move prefix to fcb inc de ; chktyp: exx ; Save pointers ld hl,ftype ; Point to default filetype ld de,fcb+9 ; Point to fcb filetype ld bc,3 ldir ; Move it exx ; Restore pointers ; curdat: push de ; Save fcb pointer ld hl,today ; Move current date to fcb call rclock pop de ; Restore fcb pointer ; ld a,(format) ; Check format or a jr z,slash ; ld a,(today+2) ; Move day call ma2hc push de ; Save fcb pointer ld de,today ; Move month call mont ; Point to pop de ; Restore fcb pointer call capstr ; Capitalize month ld bc,3 ldir ; Move first 3 letters jr movyr ; slash: ld a,(today+1) call ma2hc ld a,'/' ld (de),a inc de ld a,(today+2) call ma2hc ld a,'/' ld (de),a inc de ; movyr: ld a,(today) ; Move year call ma2hc ; ld de,fcb ld a,(oflag) ; Delete file? cp 'D' jr nz,xist ; No ; call f$delete ; Delete it call eprint db 'Deleting date label file ',0 jr fnout ; xist: call f$exist jr z,create ; call eprint db 'Existing file ',0 jr fnout ; create: call eprint db 'Creating ',0 call f$make ld a,(oflag) ; Check for archive option cp 'A' jr nz,creat0 ; No ; ld hl,fcb+11 set 7,(hl) ; Set archive bit ld c,30 ; Set file attributes call bdos call eprint db 'archived ',0 ; creat0: call eprint db 'empty date label file ',0 ; fnout: call retud ; Get current du in bc ld a,b ; Display du add 'A' call cout ld a,c call pafdc ld a,':' call cout ld de,fcb+1 ; Display filename call pfn2 ; exit: call eprint ; Add final blank line db lf,0 ; ld sp,(stack) ret dseg data: fname: ds 2 ; EFCB filename pointer today: ds 6 ; Date (bcd) oflag: db 0 ; 'A'-archive file, 'D'-delete file datalen equ $-data ; ds 48 stack: ds 2 end