; ; Program: ZSLIBDEM ; Author: Carson Wilson ; Version: 2.0 ; Date: 21 Jan 90 ; Changes: Added tests for ZSLIB memory routines. ; Added test for ZSLIB datespec parse routine. VERS equ 20 ; ; Version: 1.0 ; Date: 19 Feb 89 ; Changes: Added CP/M Plus compatibility. ; Version: 0.1 ; Date: 22 Aug 88 ; Purpose: Demonstrate use of ZSLIB version 0.1 ; ; Assembly: Z80ASM, SLRNK, SYSLIB, ZSLIB ; ; Usage: "ZSLIBDEM" or "ZSLIBDEM ufn" or "ZSLIBDEM =date" or "ZSLIBDEM //" ; Equates: TAB equ 9 CR equ 13 LF equ 10 FCB1 equ 05Ch FCB2 equ 06Ch DEFDMA equ 80h ; Externals: EXTRN CRLF,COUT,PRINT,PFN1 ; SYSLIB EXTRN PRDAT1,PRDAT2,PRDAT3 ; ZSLIB EXTRN PTIMM1,PTIMM2,PTIMM3 EXTRN PTIMC1,PTIMC2,PTIMC3 EXTRN GETSTP,GETTIM EXTRN GSTPCP,GTIMEP EXTRN PARSDS EXTRN MDAT1,MDAT2,MDAT3 ; ZSLIB memory routines EXTRN MTIMM1,MTIMM2,MTIMM3 EXTRN MTIMC1,MTIMC2,MTIMC3 EXTRN ISBCDD ; Program begins call PRINT db CR,LF,'ZSLIBDEM - ZSLIB Demonstration version ' db VERS / 10 + '0','.',VERS MOD 10 + '0','. ' db ' Type "ZSLIBDEM //" for help.',CR,LF,LF,0 ld a,(FCB1+1) cp '/' jp nz,RUN ld a,(FCB1+2) cp '/' jp nz,RUN call PRINT db ' Usage:',CR,LF db ' "ZSLIBDEM ufn" - show file datestamp',CR,LF db ' "ZSLIBDEM" - show current date',CR,LF db ' "ZSLIBDEM =date" - show current and parsed date',CR,LF db ' date:',CR,LF db ' dd[.mm[.yy[ time]]]',CR,LF db ' time:',CR,LF db ' hh[:mm] - real',CR,LF db ' +nnnn - relative',CR,LF,0 ret ; Get current date and time RUN: ld a,(FCB1+1) ; Stamp? cp ' ' jp nz,SHOWSTP ld hl,TIMEBUF ; Point to buffer call GETTIM ; ZSDOS/Datestamper time? jr z,GOTTIM ; Yes call GTIMEP ; No, try for CP/M Plus jr z,GOTTIM call PRINT ; No db 'Clock not available.',CR,LF,0 ret ; Display current date and time in various formats GOTTIM: call ISBCDD jp nz,BADCLK push hl ; Save time buffer pointer call PRINT db 'Current Date',CR,LF,'------------',CR,LF,0 pop hl ; Restore pointer call PRINTD push hl call PRINT db 'Current Time',CR,LF,'------------',CR,LF,0 pop hl call PRINTT ld a,(DEFDMA) or a ; Datespec? jp z,FILLMEM ; No exx ; Save pointer ld hl,DEFDMA+1 ld c,a ld b,0 ld a,'=' cpir jr z,SHOWSPEC exx jp FILLMEM ; No ; Show datespec SHOWSPEC: ; HL points to spec from above ld de,TIMEBUF call PARSDS jp nz,BADPARS ex de,hl ; HL points to parsed date (BCD) push hl call PRINT db 'Parsed Date',CR,LF,'-----------',CR,LF,0 pop hl ; Restore pointer call PRINTD push hl call PRINT db 'Parsed Time',CR,LF,'-----------',CR,LF,0 pop hl call PRINTT jp FILLMEM ; Get stamp of specified file SHOWSTP: call PRINT ; Yes, show file name db 'File: ',0 ld de,FCB1+1 call PFN1 ; Get file's stamp to STPBUF dec de ; Point DE to file's FCB ld hl,STPBUF ; Point HL to filestamp buffer call GETSTP ; Got stamp? jr z,GOTSTP ; Yes call GSTPCP ; No, try for CP/M Plus jr z,GOTSTP call PRINT ; No db ' - Stamp not found',0 ret ; Quit GOTSTP: call ISBCDD jp nz,BADSTP push hl ; Save stamp buffer pointer call PRINT db CR,LF,LF,'Create Date',CR,LF,'-----------',CR,LF,0 pop hl ; Restore pointer call PRINTD push hl call PRINT db 'Create Time',CR,LF,'-----------',CR,LF,0 pop hl call PRINTT ; Test memory routines FILLMEM: ld de,2000h ; Output location call MDAT1 call MDAT2 call MDAT3 call MTIMM1 call MTIMM2 call MTIMM3 call MTIMC1 call MTIMC2 call MTIMC3 ld hl,INITSTR ; Set following memory for clarity ld bc,INITLEN ldir call PRINT db 'Memory at 2000 hex initialized to last displayed date/time.' db CR,LF,0 ret ; Quit ; Time and/or date invalid error BADCLK: call PRINT db ' Clock',0 jr BADTD BADSTP: call PRINT db ' Stamp',0 jr BADTD BADPARS: call PRINT db ' Parsed',0 BADTD: call PRINT db ' Time and/or date invalid - abort.',CR,LF,0 ret ; Quit ; -------------------------------------------------------------- ; Subroutines ; ----------------- ; ; QUOTE - Print a quote mark ; QUOTE: ld a,'"' jp COUT ; ; PRINTD - Print date at HL in three formats ; PRINTD: call QUOTE ; Leading quote call PRDAT1 ; Print date format 1 call PRINT db '"(prdat1) "',0 call PRDAT2 ; Print format 2 call PRINT db '"(prdat2) "',0 call PRDAT3 ; Print format 3 call PRINT db '"(prdat3)',CR,LF,LF,0 ret ; ; TIMESEP - Print '" "' ; TIMESEP: call PRINT db '" "',0 ret ; ; PRINTT - Print time at HL+4 in 6 formats ; PRINTT: call QUOTE ; Leading quote call PTIMM1 ; Print time military format 1 call TIMESEP call PTIMM2 ; Military format 2 call TIMESEP call PTIMM3 ; Military format 3 call TIMESEP call PTIMC1 ; Print time civilian format 1 call TIMESEP call PTIMC2 ; Civilian format 2 call TIMESEP call PTIMC3 ; Civilian format 3 call QUOTE ; Trailing quote call PRINT db CR,LF,'(ptimm1) (ptimm2) (ptimm3) ' db '(ptimc1) (ptimc2) (ptimc3)',CR,LF,LF,0 ret ; ---------------------------------------------------------------- ; Data area ; --------------- INITSTR: db '<<============ End of ZSLIB Initialized Memory ==============' INITLEN equ $-INITSTR DSEG STPBUF: ds 128 TIMEBUF: ds 6 end ; End ZSLIBDEM.Z80