;
                                  ZSLIB.COM                                   

             Size (recs) CRC   Version    Author/Latest Issue      Disk
ZSLIB10S.REL   3k (22)   27C4  1.0        Carson Wilson 2/89       Z3LIB2
ZSLIB10M.REL   3k (24)   A01D  1.0        Carson Wilson 2/89       Z3LIB2

  1- Introduction  2- Notes                                                   

   ZSLIB is  a package of assembly language routines to  assist programmers in 
handling datestamp maintenance under ZSDOS, Z3PLUS, and CP/M Plus.  

   The  following briefly  describes  the  functions performed by the separate 
ZSLIB  modules.     

 A- BCD2JUL  E- SPHL5DC+  I- ZSGSTIME  M- ZSPAHC    Q- ZSPTIMC1  U- ZSPTIMM2
 B- JBCD2BN  F- ZSBINCBD  J- ZSGSTIMP  N- ZSPRDAT1  R- ZSPTIMC2  V- ZSPTIMM3
 C- JUL2BIN  G- ZSDOSTYP  K- ZSGSTPCP  O- ZSPRDAT2  S- ZSPTIMC3
 D- SB2H     H- ZSGSSTP   L- ZSPAFHC   P- ZSPRDAT3  T- ZSPTIMM1
:1
Introduction:

     One of the most attractive features of ZSDOS from  a programming point of
view is  built-in file datestamping.   For the first time,  a  standard set of 
functions has  been implemented  which make  file datestamp  maintenance fast, 
transparent,  and secure.   ZSLIB provides assembly language programs with the 
low-level tools to  handle most routine datestamp tasks under ZSDOS.   Several 
parallel  routines for CP/M Plus have  also  been  added  in  the  interest of 
maintaining  program compatibility with  that system.   For a demonstration of 
the ZSLIB routines under ZSDOS or CP/M Plus, run the ZSLIBDEM program included
in ZSLIB10.LBR by typing "ZSLIBDEM" or "ZSLIBDEM <filename>".

     ZSLIB  is  distributed in  two  library formats:  the standard  Microsoft
library format and  the  newer and  faster  SLR format.   ZSLIB10S is  the SLR 
format and ZSLIB10M is the  Microsoft  format  version.   ZSLIB is designed to 
work  along  with SYSLIB  to provide standard assembly language interfaces and 
maximize efficiency by removing redundant code.  Therefore, several of ZSLIB's
routines,  like those of Z3LIB and VLIB,  reference SYSLIB routines, requiring 
that SYSLIB be linked to the program after ZSLIB.
:2


ZSLIB Notes:

   a. Calling any of the routines  in  a module  as  an external automatically 
      adds all other routines in the module to the program's code.
:a

Module:
BCD2JUL Prog Size 0058  Data Size 0000

Public Symbols Defined:
BCD2JUL          BIN2JUL

External Symbols Referenced:
DPERMO           JBCD2BN

Authors: Bridger Mitchell & Howard Goldstein.

BCD2JUL  - BCD to Julian date routine.

         Entry:	<HL> points to date expressed as yy mm dd in BCD.
	 Exit:	<HL> contains Julian date in binary (1/1/1978 = 1).
         Uses:  <HL>.
	 Notes:	If the year is less than 1978 this routine wraps 
                to the next century.  This routine covers dates 
                from 1/1/1978 through 12/31/2077.


BIN2JUL  - Binary to Julian Date routine.

	 Entry:	<HL> points to date expressed as yy mm dd in 
                     binary.
	 Exit:	<HL> contains Julian date in binary (1/1/78 = 1).
	 Uses:	<HL>.
:b

Module:
JBCD2BN Prog Size 0012  Data Size 0000

Public Symbols Defined:
JBCD2BN

External Symbols Referenced:
None

Authors: Bridger Mitchell & Howard Goldstein.

JBCD2BN  - BCD to Binary digit routine.

	 Entry:	<A> in BCD.
	 Exit:	<A> in binary.
	 Uses:	<DE>, <A>.
:c

Module:
JUL2BIN Prog Size 0037  Data Size 0000

Public Symbols Defined:
JUL2BIN

External Symbols Referenced:
DPERMO

Authors: Bridger Mitchell & Howard Goldstein.

JUL2BIN  - Julian to binary date routine.

	 Entry:	<HL> = Days since 12/31/1977 (Julian date).
	 Exit:	<B>  = Binary month (1=Jan...).
		<C>  = Binary year (78...).
		<L>  = Binary day (1...31).
		<A>  = <L>.
	 Uses:	<AF>,<BC>,<HL>.
:d

Module:
SB2H    Prog Size 000D  Data Size 0000

Public Symbols Defined:
@B2HH            @B2HL

External Symbols Referenced:
None

@B2HH    - Convert the high nybble of a byte to a hexidecimal 
           digit in ASCII.

         Entry:  <A> - contains byte in high nybble.
         Exit:   <A> - contains hexidecimal equivalent in ASCII.
         Uses:	<AF>.
         Examples: if A contains 2B hex on entry, A will contain 
                   the ASCII character '2' on exit.


@B2HL    - Convert the low nybble of a byte to a hexidecimal digit 
           in ASCII.

         Entry:  <A> - contains byte in low nybble.
         Exit:   <A> - contains hexidecimal equivalent in ASCII.
         Uses:	<AF>.
         Examples: if A contains 2B hex on entry, A will contain 
                   the ASCII character 'B' on exit.
:e

Module:
SPHL5DC+        Prog Size 005D  Data Size 0000

Public Symbols Defined:
PHL2DC           PHL4DC           PHL5DC           PHLDC

External Symbols Referenced:
COUT

This is my enhancement of Richard Conn's SPHL5DC module which adds 
routines to print the value in HL as 2 and 4 decimal characters.  
Useful when displaying user areas and relative date stamps.


PHL2DC   - Print number as 2 decimal characters with leading 
           zeroes.

         Entry: <HL> - contains number to print
         Exit:  Number printed.
         Uses:	None.
         Examples: "00"  "01"  "10"

PHL4DC   - Print number as 4 decimal characters with leading 
           zeroes.

         Entry: <HL> - contains number to print
         Exit:  Number printed.
         Uses:	None.
         Examples: "0000"  "0001"  "0010"


PHL5DC   - Print number as 5 decimal characters with leading 
           zeroes.

         Entry: <HL> - contains number to print
         Exit:  Number printed.
         Uses:	None.
         Examples: "00000"  "00001"  "00010"

PHLDC    - Print number as up to five decimal characters with 
           leading spaces in 5-char field.

         Entry: <HL> - contains number to print
         Exit:  Number printed with leading spaces.
         Uses:	None.
         Examples: "    0"  "    1"  "   10"

:f

Module:
ZSBINBCD        Prog Size 0013  Data Size 0000

Public Symbols Defined:
BINBCD

External Symbols Referenced:
None

BINBCD   - Convert binary number to BCD.

         Entry:	<A> - contains binary number.
         Exit:	<A> - contains BCD number.
         Uses:	<AF>.
         Notes: Adapted from BYE510.ASM.
:g

Module:
ZSDOSTYP        Prog Size 001F  Data Size 0002

Public Symbols Defined:
CPMVER           DOSTYP           DOSVER

External Symbols Referenced:
None


DOSTYP   - Determine BDOS type.

         Entry: None.
         Exit:	 <F> - Zero flag reset (NZ) if extended BDOS 
		        present.
		 <A> - Contains extended BDOS identifier, or 0FFh 
		        if none.
		(CPMVER)
		     - Contains the CP/M version (22h = CP/M 2.2).
         Uses:	<AF>.
         Notes:	For convenience, (DOSVER) = A on exit.  The only 
		extended BDOS identifiers currently in use are:

			 0	- ZRDOS
			'S'	- ZSDOS
			'D'	- ZDDOS
:h

Module:
ZSGSSTP Prog Size 0053  Data Size 0027

Public Symbols Defined:
GETSTP           SETSTP

External Symbols Referenced:
DOSTYP


GETSTP   - Get ZSDOS file datestamp to 128-byte buffer.

         Entry:	<DE> - points to file's FCB.
		<HL> - points to 128-byte datestamp buffer.
         Exit:	 <F> - Zero flag set (Z) and A=0 if buffer filled,
		     - Zero flag reset (NZ) if error.
         Uses:	<AF>.

         Notes: Buffer is filled with 15-byte datestamp as 
                yy,mm,dd,hh,min of file creation, last access, 
                and last modification, respectively.  If file is 
                not at default drive, FCB must be initialized with 
                drive.  If file is not at default user, FCB must 
                be initialized with user number and ZSDOS error 
                mode set to non-zero.


SETSTP   - Set file datestamp from 128-byte buffer

         Entry:	<DE> - points to file's FCB.
		<HL> - points to 128-byte datestamp buffer.
         Exit:	 <F> - Zero flag set (Z) and A=0 if file stamped,
		     - Zero flag reset (NZ) if error.
         Uses:	<AF>.
         Notes: See GETSTP, above.
:i

Module:
ZSGSTIME        Prog Size 0020  Data Size 0000

Public Symbols Defined:
GETTIM           SETTIM

External Symbols Referenced:
DOSTYP

GETTIM   - Get current ZSDOS time to 6-byte BCD buffer.

         Entry:	<HL> - points to 6-byte time buffer.
         Exit:	 <F> - Zero flag set (Z) and A=0 if buffer filled,
		     - Zero flag reset (NZ) if error.
         Uses:	<AF>.
         Notes: Time expressed as yy,mm,dd,hh,min,ss.


SETTIM   - Set current ZSDOS time from 6-byte BCD buffer.

	 Entry:	<HL> - points to 6-byte time buffer.
	 Exit:	 <F> - Zero flag set (Z) and A=0 if clock set,
		     - Zero flag reset (NZ) if error.
	 Uses:	<AF>.
         Notes: See GETTIM, above.
:j

Module:
ZSGSTIMP        Prog Size 0060  Data Size 0000

Public Symbols Defined:
GTIMEP           STIMEP

External Symbols Referenced:
BCD2JUL          BINBCD           CPMVER           DOSTYP
JUL2BIN

GTIMEP   - Get current CP/M Plus time to 6-byte BCD buffer.

         Entry:	<HL> - points to 6-byte time buffer.
         Exit:	 <F> - Zero flag set (Z) and A=0 if buffer filled,
		     - Zero flag reset (NZ) if error.
         Uses:	<AF>.
         Notes: Time expressed as yy,mm,dd,hh,min,ss.


STIMEP   - Set current CP/M Plus time from 6-byte BCD buffer.

         Entry:	<HL> - points to 6-byte time buffer.
	 Exit:	 <F> - Zero flag set (Z) and A=0 if clock set,
		     - Zero flag reset (NZ) if error.
	 Uses:	<AF>.
         Notes: See GTIMEP, above.
:k

Module:
ZSGSTPCP        Prog Size 0090  Data Size 0024

Public Symbols Defined:
GSTPCP

External Symbols Referenced:
BINBCD           CPMVER           DOSTYP           JUL2BIN


GSTPCP   - Get file datestamp from CP/M Plus to 128-byte buffer.

	 Entry:	<DE> - points to file's FCB.
		<HL> - points to 128-byte datestamp buffer.
	 Exit:	 <F> - Zero flag set (Z) and A=0 if buffer filled,
		     - Zero flag reset (NZ) if error.
	 Uses:	<AF>.
	 Notes: If file is not at default drive, FCB must be 
                initialized with drive.  File must be at default 
                user.  File stamp is converted to DateStamper 
                format (yy,mm,dd,hh,min of file creation, last 
                access, and last modification, respectively, in 
                BCD).  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(s) are 
                valid.  On exit, only the first 15 bytes of data 
                in the caller's buffer are valid.
:l

Module:
ZSPAFHC Prog Size 0013  Data Size 0000

Public Symbols Defined:
PAFHC

External Symbols Referenced:
@B2HH            @B2HL            COUT

PAFHC    - Print number as up to 2 hex characters.

	 Entry:	 <A> - Contains number to be printed.
	 Exit:	Number printed to screen as 1 or 2 hex chars.
	 Uses:	None.
:m

Module:
ZSPAHC  Prog Size 0017  Data Size 0000

Public Symbols Defined:
PAHC

External Symbols Referenced:
@B2HH            @B2HL            COUT

PAHC     - Print number as up to 2 hex characters with leading 
           spaces.  

         Entry:   <A> - Contains number to be printed.
         Exit:   Number printed.
         Uses:   None.
:n

Module:
ZSPRDAT1        Prog Size 00BC  Data Size 0000

Public Symbols Defined:
PRDAT1

External Symbols Referenced:
COUT             PA2HC            PAFHC            PSTR

PRDAT1   - Print long form of date, e.g., "March 2, 1988".

	 Entry:	<HL> - points to date as BCD yy mm dd.
	 Exit:	 <F> - Zero flag set (Z) and A=0 if date printed,
                     - Zero flag reset (NZ) and A=0FFh if day was 
                       out of range 1..31h.
	 Uses:	<AF>.
:o

Module:
ZSPRDAT2        Prog Size 0063  Data Size 0000

Public Symbols Defined:
PRDAT2

External Symbols Referenced:
COUT             PA2HC            PAHC

PRDAT2   - Print intermediate form of date, e.g., " 2 Mar 88".

	 Entry:	<HL> - points to date as BCD yy mm dd.
	 Exit:	 <F> - Zero flag set (Z) and A=0 if date printed,
                     - Zero flag reset (NZ) and A=0FFh if day was 
                       out of range 1..31h.
	 Uses:	<AF>.
:p

Module:
ZSPRDAT3        Prog Size 002E  Data Size 0000

Public Symbols Defined:
PRDAT3

External Symbols Referenced:
COUT             PA2HC
            
PRDAT3   - Print short form of date, e.g., "03/02/88".

	 Entry:	<HL> - points to date as BCD yy mm dd.
	 Exit:	 <F> - Zero flag set (Z) and A=0 if date printed,
                     - Zero flag reset (NZ) and A=0FFh if day was 
                       out of range 1..31h.
	 Uses:	<AF>.
:q

Module:
ZSPTIMC1        Prog Size 0048  Data Size 0000

Public Symbols Defined:
PTIMC1

External Symbols Referenced:
COUT             PA2HC            PHL4DC

PTIMC1   - Print civilian (12-hour) time as "hh:mm ", or "hh:mmp" 
           if p.m., or print relative time as "+nnnn ".

	 Entry:	<HL> - points to date as BCD yy mm dd hh min.
	 Exit:	Time printed.
	 Uses:	None.
:r

Module:
ZSPTIMC2        Prog Size 0048  Data Size 0000

Public Symbols Defined:
PTIMC2

External Symbols Referenced:
COUT             PA2HC            PAHC             PHL4DC

PTIMC2   - Print civilian time with padded hours as "hh:mm " or 
           " h:mm " if a.m., "hh:mmp" or " h:mmp" if p.m.  Print 
           relative time as "+nnnn ".

	 Entry:	<HL> - points to date as BCD yy mm dd hh min.
	 Exit:	Time printed.
	 Uses:	None.
:s

Module:
ZSPTIMC3        Prog Size 0048  Data Size 0000

Public Symbols Defined:
PTIMC3

External Symbols Referenced:
COUT             PA2HC            PAFHC            PHL4DC

PTIMC3   - Print civilian time with formatted hours as "hh:mm " or 
           "h:mm " if a.m., "hh:mmp" or "h:mmp" if p.m.  Print 
           relative time as "+nnnn ".

	 Entry:	<HL> - points to date as BCD yy mm dd hh min.
	 Exit:	Time printed.
	 Uses:	None.
:t

Module:
ZSPTIMM1        Prog Size 002E  Data Size 0000

Public Symbols Defined:
PTIMM1

External Symbols Referenced:
COUT             PA2HC            PHL4DC

PTIMM1   - Print military (24-hour) time as "hh:mm".  Print 
           relative time as "+nnnn".

	 Entry:	<HL> - points to date as BCD yy mm dd hh min.
	 Exit:	Time printed.
	 Uses:	None.
:u

Module:
ZSPTIMM2        Prog Size 002C  Data Size 0000

Public Symbols Defined:
PTIMM2

External Symbols Referenced:
COUT             PA2HC            PAHC             PHL4DC

PTIMM2   - Print military time with padded hours as "hh:mm" or
           " h:mm".  Print relative time as "+nnnn".

	 Entry:	<HL> - points to date as BCD yy mm dd hh min.
	 Exit:	Time printed.
	 Uses:	None.
:v

Module:
ZSPTIMM3        Prog Size 002C  Data Size 0000

Public Symbols Defined:
PTIMM3

External Symbols Referenced:
COUT             PA2HC            PAFHC            PHL4DC

PTIMM3   - Print military time with formatted hours as "hh:mm" or 
           "h:mm".  Print relative time as "+nnnn".

	 Entry:	<HL> - points to date as BCD yy mm dd hh min.
	 Exit:	Time printed.
	 Uses:	None.
