; Library: ZSLIB ; Version: 1.0 ; Module: ZSGSTPCP ; Version: 1.0 ; Author: Carson Wilson ; Date: 18 Feb 89 ; Changes: Changed name to indicate CP/M Plus with a P for clarity. ; Fixed stack pointer bug. ; Fixed IY pointer to store Modify stamp properly. ; Now preserves IX and IY. ; ; Module: ZSGSTPC3 ; Version: 0.1 ; Author: Carson Wilson ; Date: 29 Dec 88 ; ; Purpose: Get file datestamp from CP/M Plus. PUBLIC GSTPCP EXTRN DOSTYP,CPMVER,JUL2BIN,BINBCD BDOSPTR equ 5 GETFSTP equ 102 ; ; GSTPCP - Get file datestamp from CP/M Plus to 128-byte buffer. ; ; Entry: - points to file's FCB. ; - points to 128-byte datestamp buffer. ; Note: if file is not at default drive, FCB must be ; initialized with drive. File must be at default user. ; Exit: - Zero flag set (Z) and A=0 if buffer filled, ; Zero flag reset (NZ) if error. ; Uses: . ; Notes: File stamp is converted to DateStamper format. ; The CP/M Plus create/access stamp is copied to both the ; create and access fields of the caller's buffer. The calling ; program must examine the disk label to determine which field ; is valid. ; Only the first 15 bytes of the caller's buffer are valid. ; GSTPCP: push bc push de push hl push ix push iy ; 1. Test for CP/M Plus call DOSTYP ; Test if CP/M Plus jr nz,ERREX1 ; Abort if extended BDOS ld a,(CPMVER) cp 30h ; Plus? jr c,ERREX1 ; No ; 2. Copy user's FCB to temp. push hl ; Save buffer ptr. ex de,hl ld de,TMPFCB push de ; Save ld bc,14 ; d+name+ext+s1 ldir ; Copy to temp. ex de,hl ld (hl),b ; Module 0 dec hl dec hl ld (hl),b ; Extent 0 ; 3. Get file stamp to FCB pop de ; DE --> tmpfcb push de ld c,GETFSTP call BDOSPTR ; Get stamp and password mode to FCB inc a jr z,ERREXIT ; Stamps/modes not present ; Stamps now at FCB+24..FCB+31. Convert to DateStamper format. pop hl ; FCB+0 pop iy ; Buffer ptr. ld bc,24 add hl,bc ; Create/access stamp push hl ; Save FCB+24 call TRANSFR ; Transfer create/access stamp ; ..to create AND access fields of buffer ; (disk label determines stamps' meaning) pop hl ld bc,4 ; Update stamp add hl,bc inc bc ; Add 5 add iy,bc add iy,bc ; Add 10 for Modify field call TRANSFR xor a ; Say no error jr EXIT ; TRANSFER - transfer Julian stamp at HL to BCD buffers at IY and IY+5 TRANSFR: ld e,(hl) inc hl ld d,(hl) ; Julian date in DE push hl pop ix inc ix ; IX points to time ld a,(IX+0) ; Get BCD hour ld (IY+3),a ld (IY+8),a ld a,(IX+1) ; ..and minutes ld (IY+4),a ld (IY+9),a ex de,hl ; Julian date to HL call JUL2BIN ; b=month,c=year,a=l=day (binary), de preserved call BINBCD ; Make day BCD ld (IY+2),a ; Store day ld (IY+7),a ld a,c call BINBCD ; ..year ld (IY+0),a ld (IY+5),a ld a,b call BINBCD ld (IY+1),a ld (IY+6),a ; ..month ret ERREXIT: pop hl ; drop pop hl ; drop ERREX1: or 0FFh ; Return error EXIT: pop iy pop ix pop hl pop de pop bc ret ; ----------------- ; Data area DSEG TMPFCB: ds 36 ; Temp. FCB end ; End ZSGSTPC3.Z80