; CONDATE.INC -- Include file for CONCAT.Z80 ; ; This module contains file stamping and date formatting routines. ; ; ChkStp -- Check for filename match with output file. If names match, ; get date stamp. ; ChkStp: ld de,InFcb+1 ; point to source filename ld hl,OutNam+1 ; point to output filename ld b,11 ; checking 11 characters call @fncmp ret nz ; (no match) ; ; GetStp -- Get create stamp from original file, if available, and ; transfer it to new file. ; GetStp: ld de,InFcb ; point to input filename ld hl,StpBuf ; point to date stamp buffer call gstamp ; get file stamp ret z ; (error) ld a,(StpBuf+1) ; check for create date or a ld hl,StpBuf ; point to create date jr nz,GetSt1 ; (we've got a create date) ld a,(StpBuf+11) ; none, so check for modify date or a ret z ; (no date stamp) ld hl,StpBuf+10 ; point to modify date GetSt1: ld de,StpTmp ; move date to storage ld bc,5 ldir ret ; ; PutStp -- Takes create date if it exists in StpTmp buffer and makes ; it the create date of the new file. ; PutStp: ld de,OutFcb call initfcb ld hl,StpBuf ; point to date stamp buffer call gstamp ; get file stamp ret z ; (error) ld a,(StpTmp+1) ; do we have a stamp? or a ret z ; (no) ld hl,StpTmp ; move old stamp to create date string ld de,StpBuf ld bc,5 ldir ld de,OutFcb ; setup for file stamping ld hl,StpBuf jp pstamp ; set file stamp and return to caller ; ; DATES3 -- Stores long form of date in American ("March 2, 1988"), ; European ("2 March 1988"), or Japanese (1993 March 2") format to a ; variable-length memory buffer. Based on the MDATS1 module of ZSLIB. ; ; On Entry: HL = address of date as BCD yy mm dd, DE = address of memory ; buffer (18 bytes maximum). On exit DE = address of byte after output. ; HL is preserved. ; ; Date format is set by DatFmt configuration byte: 1=American, ; 2=European, 4=Japanese). ; Dates3: push hl ld c,(hl) ; save year inc hl ld b,(hl) ; save month inc hl ld a,(hl) push af ; save day ld a,(DatFmt) ; format? dec a jr z,DoUSA ; (1=American) dec a jr z,DoEuro ; (2=European) ; Do Japanese format call DoYear call Space call DoMnth pop af ; get day call MAFHC jr DDone ; Do American format DoUSA: call DoMnth pop af ; get day call MAFHC ld a,',' call MOUT call Space call DoYear jr DDone ; Do European format DoEuro: pop af call MAFHC call Space call DoMnth call DoYear jr DDone ; Store month DoMnth: xor a ; clear carry for DAA ld hl,DSTRMO ; point to months table ld a,b ; get month push de ; save memory NxtMth: ld e,(hl) inc hl ld d,(hl) inc hl dec a daa ; decimal adjust jr nz,NxtMth ex de,hl ; HL --> month pop de ; restore memory call MSTR ; month to memory jr Space ; .. and return to caller ; Store year DoYear: ld a,c ; get year cp 78h ld a,19h jr nc,Cent20 ; 20th century ld a,20h Cent20: call MAFHC ; century ld a,c jp MA2HC ; year .. and return to caller ; DDone: pop hl ret ; exit this module ; Space: ld a,' ' jp MOUT ;