TITLE "DTIMINI - Initialize Time/Stamp modes" ;================================================================= ; Copyright (C) 1989 by Harold F. Bower. Permission granted to ; Alpha Systems Corp. to distribute with The Libraries, Version 4 ;----------------------------------------------------------------- ; Author : Harold F. Bower ; Date : 30 Dec 88 ; Version : 1.0 ; Module : DTIMINI ; Abstract: This module contains the routine TIMINI which initializes ; a global variable which controls the remainder of Time/Stamp ; modules with respect to how to access a Clock and File Stamps. ; It also calls the Dos Type identification routine, and can ; be used as a single reference to specifically identify the DOS ; type and stamp methodology being used. ; The module also contains a single clock read routine which ; may be used across stamp methods to return standardized time ; and date information. ; Revisions: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points: PUBLIC TIMINI, TIMTYP, RCLOCK ; External references: EXT DOSTYP, FINDCK, RDCLK, P2UTIM, GETDOS ; Definitions: BDOSE EQU 5 ; Dos Entry vector FGTIME EQU 98 ; Read ZS/ZDDOS clock w/Dos call FGTIM3 EQU 105 ; Read CP/M Plus clock w/Dos call .Z80 CSEG ;========================================================== ; TIMINI - Initialize Time and Stamp method flag ; Enter: None ; Exit : A = Time Type, Zero Flag Clear (NZ) if Clock found ; A = 0, Zero Flag Set (Z) if No clock detected ; Regs Affected: AF ;========================================================== TIMINI: PUSH HL ; Save regs PUSH DE PUSH BC CALL GETDOS ; Determint Dos type and set variable CP '3' ; Is this CP/M Plus? JR Z,HAVTIM ; ..jump if so CP 'S' ; Is this ZSDOS? JR Z,CKZS ; ..jump if so and test for ZS Clock CP 'D' ; Is this ZDDOS? JR NZ,CKDSTP ; ..jump if not and test for DateStamper CKZS: LD HL,TIMSTR ; Try to read clock with ZSDOS call CALL RCLKZS LD A,'S' ; ..(prepare for Ok response) JR Z,HAVTIM ; ..jump here if Time read OK ;..else fall thru to check DateStamper CKDSTP: CALL FINDCK ; Test for The DateStamper JR Z,HAVTIM ; ..jump to set invalid if can't find DS LD A,'D' ; Else show is as DateStamper HAVTIM: LD (TIMTYP),A ; Store the Time type char OR A ; Set flags for return POP BC ; Restore regs POP DE POP HL RET ;================================================================== ; RCLOCK - Read clock to specified addr in whatever mode is active ; Enter: HL --> 6 byte string to read time into, in Universal form ; Exit : A = 0, Zero Flag Set (Z) if Ok ; A <> 0, Zero Flag Clear (NZ) if Error ; Uses : HL, DE, BC, AF ;================================================================== RCLOCK: LD A,(TIMTYP) ; Is ZSDOS active? CP 'S' JR Z,RCLKZS ; ..jump to ZSDOS read if so CP '3' ; Do we have CP/M Plus time? JR Z,RCLK3 ; ..jump to read it if so CALL RDCLK ; Read DateStamper directly if there JR Z,RCLKNO ; ..Jump error if No DS or bad read XOR A ; Else set Ok read conditions RET RCLK3: PUSH HL ; Save destination on stack LD DE,TIMSTR ; Read CP/M Plus time here for conversion LD C,FGTIM3 ; Use Function 105 CALL BDOSE ; Do the read LD (TIMSTR+4),A ; ..and save seconds byte POP DE ; Restore destination address LD HL,TIMSTR ; ..and source CALL P2UTIM ; Convert to universal PUSH AF LDI ; Move the seconds byte POP AF ; ..and restore status RET RCLKZS: EX DE,HL ; Put destination in DE LD C,FGTIME ; Use Function 98 to read clock CALL BDOSE ; ..via the BDOS DEC A ; Check Ok read (1 --> 0) RET Z ; ..with 0 if Ok RCLKNO: OR 0FFH ; Else set proper error code RET ; ..and exit ; Data Area in DSEG DSEG TIMSTR: DEFS 6 ; Temp string for trial clock read TIMTYP: DEFS 1 ; 0=None, 'S'=ZS/ZDDOS, 'D'=DateStamper, ; '3'=CP/M Plus END