home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / zsus / z3help / y.lbr / DSLIB.HLP < prev    next >
Encoding:
Text File  |  1991-01-13  |  25.4 KB  |  579 lines

  1.  Introduction                                     (Rev 5 Jan 91)
  2.  System Identity      - TIMINI, GETDOS, FINDCK, CKTDF
  3.  Clock Reading        - RCLOCK, RDCLK
  4.  File Stamp Routines  - GSTAMP, PSTAMP, GETTD, SETTD
  5.  Directory Selection  - DDIRQS, DDIRQ, DDIRNPAK, DDIRPAK, DDIRSEL
  6.  Time Conversions     - U2PTIM, P2UTIM, U2MTIM, M2UTIM
  7.  Utility Routines     - FSTNXT, BCD2BIN, BIN2BCD, DVERS
  8.  DateStamper(tm) T&D  - OPENTD, CLOSTD, RWTD
  9. :                    Introduction to DSLIB 
  10.  
  11. This library contains a collection of routines to facilitate
  12. addition of File Time and Date Stamping and Real Time Clock
  13. features.  A common Date and Time format is used to exchange
  14. date and time data with user programs.  It uses BCD digits as:
  15.  
  16.     Byte Offset   00  01  02  03  04  05
  17.                   --  --  --  --  --  --
  18.                   YY  MM  DD  hh  mm  ss
  19.  
  20.    Where YY = Year (78-99 is 1978-1999, 00-77 is 2000-2077),
  21. MM = Month (1..12), DD = Day (1..28,30,31), hh = Hour (0..23),
  22. mm = Minute (00..59), ss = Second (00..59).
  23.  
  24. Generalized routines are included which uniformly return Clock
  25. time, as well as File Stamp data from ZSDOS/ZDDOS, CP/M 2.2 or
  26. ZRDOS 1.x with Plu*Perfect Systems' DateStamper(tm), and
  27. Digital Research's CP/M Plus (also known as CP/M 3).  The
  28. common data structures are automatically converted to the
  29. appropriate internal formats for the running system.
  30.    As with the Clock structure, File Stamp data is handled in
  31. a consistent DateStamper(tm)/ZSDOS format of packed BCD digits
  32. in a 15-byte field as:
  33.  
  34.               |-- Create --|  |- L.Access -|  |-- Modify --|
  35.  Byte Offset  00 01 02 03 04  05 06 07 08 09  10 11 12 13 14
  36.               -- -- -- -- --  -- -- -- -- --  -- -- -- -- --
  37.               YY MM DD hh mm  YY MM DD hh mm  YY MM DD hh mm
  38.  
  39. Where YY = Year (78-99 is 1978-1999, 00-77 is 2000-2077), MM =
  40. Month (1..12), DD = Day (1..28,30,31), hh = Hour (0..23), mm =
  41. Minute (00..59).
  42.  
  43. In addition to the generalized interface routines, entry points
  44. exist for DateStamper(tm) specific routines.  Many of these
  45. specific routines are automatically called from the generalized
  46. routines when DateStamper is detected.
  47.  
  48. Conversion routines also exist to manage interfaces between
  49. Date/Time fields of DateStamper(tm), the MS-DOS compatible
  50. DosDisk(tm), and the CP/M Plus-compatible P2DOS format.
  51. :                     System Identity 
  52.  
  53. TIMINI - See if there is a Clock we can read.
  54.  
  55.    TIMTYP - Byte variable for Type of Time/Date Stamping and
  56.                 clock in use ("3"=CP/M Plus, "S"=Internal ZSDOS
  57.                 or ZDDOS, "D"=DateStamper).
  58.  
  59.   ENTER: None
  60.   EXIT : A = Time method, Zero Flag Clear (NZ) if Clock found
  61.            A = 0, Zero Flag Set (Z) if no clock found
  62.   USES : AF
  63.  
  64.  Usage: This routine calls GETDOS setting DOSVER and DOSTYP,
  65.   then looks for a clock to read, implying a File Stamp method.
  66.   Types are: "S"=ZSDOS/ZDDOS Internal, "D"=DateStamper,
  67.   "3"=CP/M Plus (CP/M 3.x, also termed P2DOS type).  This byte
  68.   may be accessed when desired, and is used by GSTAMP and
  69.   PSTAMP to Get and Set File Stamps respectively.
  70.  
  71. GETDOS - Determine DOS type & Version, set global variables.
  72.  
  73.    DOSTYP - Byte variable for DOS type ("S"=ZSDOS, "D"=ZDDOS,
  74.                 "1"=CP/M 1.x, "2"=CP/M 2.x, "3"=CP/M Plus (3.x),
  75.                 "R"=ZRDOS, 0=Unknown)
  76.    DOSVER - Byte variable for DOS version # (vendor specific)
  77.  
  78.   ENTER: None
  79.   EXIT : A = DOS Type Character, Zero Clear (NZ) if identified
  80.            A = 0, Zero Flag Set (Z) if Not identified
  81.   USES : AF
  82.  
  83.  Usage: This routine is used to identify the running DOS type
  84.   and version.  It is called from TIMINI, but may be called
  85.   separately.  After it is called, DOSTYP and DOSVER globals
  86.   may be directly accessed.
  87.  
  88. FINDCK - Check for DateStamper(tm) clock and set read status
  89.  
  90.   ENTER: None
  91.   EXIT :  A <> 0, Zero Flag Clear (NZ) if Clock Found
  92.          HL = pointer to Clock starting address if Found
  93.             A = 0, Zero Flag Set (Z), HL = - if Not Found
  94.   USES : AF,BC,DE,HL
  95.  
  96.  Usage: Used with DateStamper(tm)-specific interfaces.  Call
  97.   this routine near the beginning of a program to determine
  98.   clock status.  This routine is not needed if the recommended
  99.   TIMINI/RCLOCK generalized routines are used.
  100.  
  101. CKTDF - Check for DateStamper(tm) Time&Date File on drive
  102.  
  103.   ENTER: None
  104.   EXIT : A <> 0, Zero Flag Reset (NZ) if T&D file located Ok
  105.            A = 0, Zero Flag Set (Z) if NO T&D file present
  106.   USES : AF,BC,DE,HL
  107.   REQUIREMENTS: User must log desired drive before calling
  108.  
  109.  Usage: This routine is used with DateStamper(tm)-specific File
  110.   Stamp routines only, or with routines where individual file
  111.   stamp access is too slow.  It should be called before any
  112.   attempt is made to access File Stamp information.  A common
  113.   use is to set flags for mode changing between Stamp and Non-
  114.   Stamp operations.
  115.  
  116. :RCLOCK - Read clock identified by TIMINI to specified addr
  117.  
  118.   ENTER: HL = Address of 6-byte area to receive time string
  119.   EXIT :  A = 0, Zero Flag Set (Z) if Ok, Time String filled
  120.             A <> 0, Zero Flag Clear (NZ) if Error
  121.   USES : HL,DE,BC,AF
  122.  
  123.  Usage: This routine forms a generalized Clock Read for ZSDOS,
  124.   DateStamper or CP/M Plus clocks identified by TIMINI.  It
  125.   reads clock data to the specified address in the standard
  126.   format.  Since CP/M Plus does not return a valid read flag,
  127.   the status is always assumed to be True, for a good read.
  128.   Note: You must insure that a valid clock is installed and
  129.   working before calling this routine.
  130.  
  131. Example:
  132.       EXT    TIMINI,RCLOCK   ; Always declare both routines
  133.       ...                    ; ..preliminary code
  134.       CALL   TIMINI          ; Initialize and identify clock
  135.       ...                    ; ..other program code
  136.       LD     HL,TIMSTR       ; Place the time here
  137.       CALL   RCLOCK          ; ..and read the clock
  138.       JR     NZ,BADCLK       ; Jump if error reading clock
  139.       ...                    ; ..else proceed to use it
  140.  TIMSTR: DEFS   6            ; Date/Time: YY MM DD HH MM SS
  141.  
  142. RDCLK - Read DateStamper(tm) clock to specified buffer
  143.  
  144.   ENTER: HL = Pointer to 6-byte buffer location
  145.   EXIT : HL = Pointer to last byte of Date/Time string if Ok
  146.           A <> 0, Zero Flag Clear (NZ) if Ok
  147.             A = 0, Zero Set (Z), HL = 0 if Bad Clock Read
  148.   USES : AF,BC,DE,HL
  149.   REQUIREMENTS:  FINDCK must have been previously called.
  150.  
  151.  Usage: This routine is used to read a DateStamper(tm)-specific
  152.   clock.  Date and Time information is returned in the same
  153.   format as other routines in this library.
  154.  
  155. Example:
  156.       EXT    RDCLK,FINDCK    ; Declare the routine
  157.       ...                    ; ..initial program code
  158.       CALL   FINDCK          ; Call this early in program
  159.       ...                    ; ..intervening program code
  160.       LD     HL,TIMSTR       ; Set addr for 6-byte buffer
  161.       CALL   RDCLK           ; Read the clock.
  162.       JR     Z,NOGOOD        ; ..jump if bad read
  163. :                   File Stamp Routines 
  164.  
  165. GSTAMP - Return File Date Stamp data for specified file
  166. PSTAMP - Set File Date Stamp data for specified file
  167.  
  168.   ENTER: DE = Pointer to FCB for file of interest
  169.          HL = Pointer to 15-byte buffer for/with Stamp data
  170.   EXIT :  A <> 0 Zero Flag Clear (NZ) if Operation Successful
  171.             A = 0, Zero Flag Set (Z) on Error
  172.   USES : AF,BC,HL
  173.   SIDE EFFECTS: Current DMA address is altered by this routine.
  174.   REQUIREMENTS: TIMINI must have been called to set global
  175.         variables.  Drive and User area for the specified file
  176.         must be set prior to calling either of these routines.
  177.  
  178.  Usage: These routines are recommended for File Stamp access in
  179.   CP/M-compatible systems.  They use the DOSTYP and TIMTYP
  180.   variables to determine stamp method in effect, and will read
  181.   and write File Stamps under ZSDOS and DateStamper with CP/M
  182.   2.2 or ZRDOS, and will read stamps from CP/M Plus (CP/M 3.x).
  183. Example:
  184.       EXT    GSTAMP,PSTAMP,TIMINI     ; Declare routines
  185.       ...                    ; ..preceding code
  186.       CALL   TIMINI          ; Set the Time sybsystem early
  187.       ...                    ; ..other program code
  188.       CALL   SETFCB          ; Set an FCB to a desired file
  189.       LD     DE,FCB          ; .point to it
  190.       LD     HL,TBUFF        ; ..and to buffer for Stamps
  191.       CALL   GSTAMP          ; Get stamp for this file
  192.       JR     Z,NOSTAMP       ; ..go to error handler if bad
  193.       ...                    ; Use the data
  194.       CALL   SETDAT          ; Set stamp data in buffer
  195.       LD     DE,FCB          ; .point to FCB for file
  196.       LD     HL,TBUFF        ; ..and to buffer with Stamps
  197.       CALL   PSTAMP          ; Stamp file with TBUFF values
  198.       JR     Z,NOSTAMP       ; ..jump Error if bad return
  199.       ...                    ; Else carry on.
  200.  
  201.  FCB:   DEFS   36            ; FCB for file of interest
  202.  TBUFF: DEFS   15            ; Buffer for Stamp data
  203. GETTD - Get DateStamper(tm) File Stamp for specified file
  204.  
  205.   ENTER:  A - Contains T&D Sector Index (0..7) (from FSTNXT)
  206.          DE - Contains Random Record Number    (from FSTNXT)
  207.          HL = Pointer to 15-byte buffer for Date/Time info
  208.   EXIT :  A <> 0, Zero Flag Clear (NZ) if OK
  209.             A = 0, Zero Set (Z) if No File or Read Error
  210.   USES : AF,BC,DE,HL
  211.   REQUIREMENTS: User must log onto drive containg File & Stamp
  212.   SIDE EFFECTS: DMA is altered by this routine
  213.  
  214.  Usage: This is a DateStamper(tm)-specific routine returning
  215.   file stamp data for a file using FSTNXT call parameters.
  216.  
  217. Example:
  218.       EXT    GETTD           ; Declare the routine
  219.       ...                    ; .check DateStamper
  220.       ...                    ; ..Log drive, Call FSTNXT
  221.       LD     HL,USRDAT       ; Put 15-byte Stamp data here
  222.       CALL   GETTD           ; Fill in destination string
  223.       JR     Z,NODATA        ; ..jump if bad/no stamp
  224.       ...                    ; Else process the stamp
  225. SETTD - Set DateStamper File Stamp into for specified file.
  226.  
  227.   ENTER:  A - Contains T&D Sector Index (0..7) (from FSTNXT)
  228.          DE - Contains Random Record Number    (from FSTNXT)
  229.          HL = Pointer to Stamp data in 15-byte buffer
  230.   EXIT :  A <> 0, Zero Flag Clear (NZ) if OK
  231.             A = 0, Zero Set (Z) if No File or Read Error
  232.   USES : AF,BC,DE,HL
  233.   REQUIREMENTS: You must log onto drive containing file & Stamp
  234.   SIDE EFFECTS: DMA is altered by this routine
  235.  
  236.  Usage: This DateStamper(tm)-specific routine sets File Stamp
  237.   data for a specified file to user-supplied values.
  238.  
  239. Example:
  240.       EXT    SETTD           ; Declare the routine
  241.       ...                    ; .Validate DateStamper
  242.       ...                    ; ..log drive, call FSTNXT
  243.       LD     HL,USRDAT       ; Point to 15-byte Stamp field
  244.       CALL   SETTD           ; Set DateStamper File Stamp
  245.       JR     Z,BADSET        ; ..jump if if Error
  246.       ...                    ; Else carry on!
  247. :DDIRQS - Return sorted directory with file stamps and sizing
  248.  DDIRQ  - Return sorted directory with file stamps
  249.  
  250.   ENTER: HL = Address of TPA buffer start
  251.          DE = Points to FCB entry to match directory entries
  252.           A = Select character
  253.              B7 - 1 = Select SYStem files
  254.              B6 - 1 = Select Non-SYStem files
  255.              B5 - 1 = Select All users
  256.           C = Secondary select
  257.              B7 - 1=Sort Type then Name, 0=Name then Type
  258.              B6 - 1=Don't reorder recs after sort, 0=Reorder    |
  259.              B0 - 1=Search DateStamper first, then DosDisk
  260.                     then P2DOS stamps; 0=Skip DateStamper
  261.   EXIT :  A <> 0, Zero Flag Clear (NZ) if Ok,
  262.             A = 0, Zero Set (Z) if TPA Overflow
  263.          BC = Number of files in Sorted Directory Array
  264.          DE = Address of Pointer (Order) Table                  |
  265.          HL = Address of first file in buffer
  266.   USES : HL,DE,BC,AF
  267.   SIDE EFFECT: Dos DMA Address is set to 80H
  268.  
  269.  Usage: These routines provide a replacement for the SYSLIB
  270.   routines DIRQS and DIRQ.  File Stamps are automatically
  271.   appended to Directory data from DateStamper(tm), P2DOS (CP/M
  272.   Plus), and Plu*Perfect Systems' DosDisk.  The Last Access
  273.   field is nulled in P2DOS, and the single DosDisk stamp is
  274.   returned in the Last Modified field.  Each entry is 31 char-
  275.   acters long (16 for file entry, 15 for stamp).
  276.  
  277. Example:
  278.       EXT    DDIRQS       ; ..or DDIRQ.  DON'T use both
  279.       ...
  280.       CALL   CODEND       ; Get lower TPA value in HL
  281.       LD     DE,MYFCB     ; Match this file spec
  282.       LD     C,01H        ; Sort Name/Type, DS first, reorder   |
  283.       LD     A,0E0H       ; SYS & Non-SYS, all user areas
  284.       CALL   DDIRQS       ; Do the call (or to DDIRQ)
  285.       JP     Z,ERROR      ; ..error if not enough space
  286.       LD     A,B          ; Do we have any files?
  287.       OR     C            ; ..BC has number of files
  288.       JP     Z,NOFILS     ; Jump if no files in array
  289.       ...                 ; ..use the files in the array
  290.  
  291.  MYFCB: DEFB    0,'???????????',0,0,0,0         ; FCB to match
  292.         DEFB    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  293.  
  294. DDIRNPAK - Negate selection markings in Directory Buffer
  295.  
  296.   ENTER: HL = Points to Directory Buffer from DDIRQ/DDIRQS
  297.          BC = Number of entries in the Buffer
  298.   EXIT : BC = Number of entries in Buffer after select/packing
  299.   USES : BC
  300.  
  301.  Usage: This routine is used to delete file entries from DDIRQS
  302.   or DDIRQ directory routines.  Upon completion, only entries
  303.   previously unmarked remain, and the table is compressed to
  304.   only these entries. This is similar to the SYSLIB routine
  305.   DIRNPAK, but tailored to Time/Date Stamped Directory lists.
  306.  
  307. Example:
  308.       EXT     DDIRNPA        ; Declare the routine
  309.       ...                    ; Build dir table (DDIRQ(S))
  310.       ...                    ; ..and select entries
  311.       LD      HL,(BUFF)      ; Buffer start (DDIRQ/DDIRQS)
  312.       LD      BC,(COUNT)     ; ..# of entries (DDIRQ/DDIRQS)
  313.       CALL    DDIRNPAK       ; Keep unselected & pack Buffer
  314.       ...                    ; ..continue w/ new file count
  315.  
  316. DDIRPAK - Pack Directory Buffer from DDIRQ/DDIRQS
  317.  
  318.   ENTER: HL = Points to Directory Buffer from DDIRQ/DDIRQS
  319.          BC = Number of entries in the Buffer
  320.   EXIT : BC = New Number of Buffer entries after select/pack
  321.   USES : BC
  322.  
  323.  Usage: Compress File ID array from Directory Sort routine
  324.   retaining only marked file entries.  This routine is similar
  325.   to the SYSLIB routine DIRPAK, but functions with Time/Date
  326.   Stamped Directory lists.
  327.  
  328. Example:
  329.       EXT    DDIRPAK        ; Declare the routine
  330.       ...                   ; build dir tbl (DDIRQ/DDIRQS)
  331.       ...                   ; ..and select entries
  332.       LD     HL,(BUFF)      ; Buffer start (DDIRQ/DDIRQS)
  333.       LD     BC,(COUNT)     ; ..# of entries (DDIRQ/DDIRQS)
  334.       CALL   DDIRPAK        ; Keep selected entries & pack
  335.       ...                   ; ..continue w/new file count
  336.  
  337. DDIRSEL - Select entries from DDIRQ/DDIRQS Directory Buffer
  338.  
  339.   ENTER: HL = Points to Directory Buffer from DDIRQ/DDIRQS
  340.          DE = FCB entry to select against
  341.          BC = Number of entries in the Buffer
  342.           A = Select flag: Bit 7 - Select Non-SYStem files
  343.                            Bit 6 - Select SYStem files
  344.                            Bit 5 - Select All Users
  345.                            Bits 4..0 - User Number
  346.   EXIT : None.  Selected files are marked
  347.   USES : None
  348.  
  349.  Usage: Select file entries by setting the MSB of the first
  350.   byte (User #) based on file name and type in FCB, and
  351.   selection flags.  This routine is similar to the SYSLIB
  352.   routine DIRSEL, but accomodates Time/Date Stamped Directory
  353.   lists.
  354.  
  355. Example:
  356.       EXT    DDIRSEL         ; Declare the routine
  357.       ...                    ; Build Dir (DDIRQ/DDIRQS)
  358.       LD     HL,(BUFF)       ; Buffer start (DDIRQ/DDIRQS)
  359.       LD     DE,MYFCB        ; .FCB criteria for selection
  360.       LD     BC,(COUNT)      ; ..and # entries (from DDIRQ)
  361.       LD     A,01100000B     ; SYS files in All User Areas
  362.       CALL   DDIRSEL         ; Mark matching entries
  363.       ...                    ; ..continue on
  364. :U2PTIM - Convert ZSDOS/DateStamper Time to P2DOS (CP/M Plus)
  365.  
  366.   ENTER: DE = Points to Universal Time string (Source)
  367.          HL = Points to P2DOS Time string (Destination)
  368.   EXIT :  A = 0, Zero Set (Z) if Ok, Dest time set (less secs)
  369.             A <> 0, Zero Clear (NZ) if error, Dest zeroed
  370.          DE = Pointer to Secs byte in Source string (not moved)
  371.          HL = Pointer to Secs byte in Dest string (not filled)
  372.   USES : HL,DE,BC,AF
  373.  
  374.  Usage: Utility conversion of Time from ZSDOS/DateStamper(tm)
  375.   to CP/M Plus type.  Only the Date, Hour and Minute fields are
  376.   converted, but registers are returned such that a single LDI
  377.   move instruction after the routine will move any seconds
  378.   information.  Years 78-99 are assumed to be 1978-1999, 0-77
  379.   as 2000-2077.  This routine would commonly be used in
  380.   programs such as Library Utilities which internally use a
  381.   CP/M Plus type of stamp.
  382.  
  383. Example:
  384.       EXT    U2PTIM         ; Declare the variable
  385.       ...                   ; Read a clock or stamp
  386.       LD     DE,UTIM        ; Set source time spec address
  387.       LD     HL,PTIM        ; ..and dest time spec addr
  388.       CALL   U2PTIM         ; Do the conversion
  389.       JR     NZ,ERROR       ; ..jump if conversion error
  390.       ...                   ; Else use the P2DOS string
  391.  
  392. P2UTIM - Convert P2DOS (CP/M Plus) Time spec to Standard
  393.  
  394.   ENTER: HL = Points to P2DOS (CP/M Plus) Time string (Source)
  395.          DE = Points to Universal Time string (Destination)
  396.   EXIT :  A = 0, Zero Set (Z), Dest string filled (less secs)
  397.               Errors only due to bad entry.  (Check YY=MM=0)
  398.          HL = Points to Secs byte in Source string (Not moved)
  399.          DE = Points to Secs byte in Dest string (not filled)
  400.   USES : HL,DE,BC,AF
  401.  
  402.  Usage: Commonly used to provide interface from CP/M Plus
  403.   systems to CP/M 2.2, or in Library Utility routines to
  404.   provide time interface.  Source stamp is P2DOS (CP/M Plus
  405.   compatible), destination is ZSDOS/DateStamper(tm) standard.
  406.   A single LDI move instruction after conversion will move the
  407.   seconds byte.  Only dates from 1 Jan 1978 thru 31 Dec 2077
  408.   will be properly converted.  Other dates will set Year and
  409.   Month bytes to zero.  Check this state for error condition.
  410.  
  411. Example:
  412.       EXT    P2UTIM        ; Declare the variable
  413.       ...                  ; Read a clock or Stamp
  414.       LD     DE,UTIM       ; Point to the Dest string
  415.       LD     HL,PTIM       ; ..and the Source string
  416.       CALL   P2UTIM        ; Do the conversion
  417.       LDI                  ; Move the seconds (if desired)
  418.       LD     HL,UTIM       ; Check for errors
  419.       LD     A,(HL)        ; Get years byte
  420.       INC    HL            ; ..advance to Months
  421.       OR     L             ; ...and check for errors
  422.       JR     Z,ERROR       ; Jump if error
  423.       ...                  ; ..continue on
  424. U2MTIM - Convert Universal Time Spec to MS-DOS/DosDisk(tm)
  425.  
  426.   ENTER: DE = Points to Universal Time string (Source)
  427.          HL = Points to MS-DOS format Time string (Destination)
  428.   EXIT :  A = 0, Zero Set (Z) if Ok, Dest time set (less secs)
  429.             A <> 0, Zero Clear (NZ) if error, Dest str zeroed
  430.          DE = Pointer to Secs byte in Source string (not moved)
  431.          HL = Pointer to High-order time byte in MS-DOS field
  432.                 (low-order byte has secs field nulled)
  433.   USES : HL,DE,BC,AF
  434.  
  435.  Usage: Commonly used to convert from internal time format to
  436.   External form for writing to MS-DOS disk formats.  Conversion
  437.   of seconds data to the format used in the MS-DOS Time spec is
  438.   a user program responsibility.  Dates from 1 January 1980 to
  439.   31 December 2077 will be properly converted.
  440.  
  441. Example:
  442.       EXT    U2MTIM        ; Declare the variable
  443.       ...                  ; Read a clock or stamp
  444.       LD     DE,UTIM       ; Source time spec string addr
  445.       LD     HL,MTIM       ; ..dest time spec string addr
  446.       CALL   U2MTIM        ; Do the conversion
  447.       JR     NZ,ERROR      ; ..jump if conversion error
  448.       ...                  ; Else use P2DOS string
  449. M2UTIM - Convert MS-DOS/DosDisk(tm) Time to Universal
  450.  
  451.   ENTER: HL = Points to MS-DOS Time string (Source)
  452.          DE = Points to Universal Time string (Destination)
  453.   EXIT :  A = 0, Zero Set (Z), Dest string filled (less secs)
  454.             A <> 0, Zero Clear (NZ) if Error, Dest Nulled
  455.          HL = Points to Second (hi-order) byte in MS-DOS string
  456.          DE = Points to Secs byte in Dest string (not filled)
  457.   USES : HL,DE,BC,AF
  458.  
  459.  Usage: Commonly used to convert MS-DOS time to internal format
  460.   for internal program manipulation.  Conversion of seconds is
  461.   your responsibility.  Dates from 1 Jan 1980 thru 31 Dec 2077
  462.   will be properly converted.  Others produce null date.
  463.  
  464. Example:
  465.       EXT    M2UTIM        ; Declare the variable
  466.       ...                  ; Read a clock or stamp
  467.       LD     DE,UTIM       ; Point to the Dest string
  468.       LD     HL,MTIM       ; ..and the Source string
  469.       CALL   M2UTIM        ; Do the conversion
  470.       JR     NZ,ERROR      ; ..handle error if bad
  471.       ...                  ; Else convert secs & continue
  472.  
  473. :FSTNXT - File search returning DateStamper(tm) Indices
  474.  
  475.   ENTER:  C - Search First (17) or Search Next (18) DOS command
  476.          DE - Points to FCB containg the target Filename.type
  477.   EXIT :  A = Dir Index (0..3), Carry Flag Clear (NC) If Found
  478.             A indeterminate, Carry Flag Set (C) If NOT Found
  479.          DE - Contains random Sector number in !!!TIME&.DAT
  480.           B - Index into T&D sector (0..7)
  481.   USES : AF,BC,DE,HL
  482.   REQUIREMENTS: User must log Drive and User before calling
  483.  
  484.  Usage: This routine is used in DateStamper-specific systems to
  485.   perform File searches and return indices into the Time & Date
  486.   file.  Use this call for Function 17 and 18 Search calls in
  487.   lieu of a direct call to the BDOS vector at location 5.
  488.  
  489. Example:
  490.       EXT    FSTNXT        ; Declare the routine
  491.       ...                  ; Log Drive/User & Set FCB
  492.       LD     C,17          ; Set for Search First command
  493.       LD     DE,FCB        ; ..addr FCB for desired name
  494.       CALL   FSTNXT        ; Search for the desired file
  495.       JR     NC,FOUND      ; ..jump if file found
  496.       ...                  ; Else do not found things
  497.  
  498. BCD2BIN - Convert Binary Coded Decimal (BCD) byte to binary
  499.  
  500.   ENTER: A = BCD digit to convert (0-99 value)
  501.   EXIT : A = binary byte representation of digit(s) (00-63H)
  502.   USES : AF
  503.  
  504.  Usage: This routine is primarily used in conversions of dates
  505.   used by DSLIB routines but is available for other uses.  It
  506.   converts a packed BCD byte in the range of 0 to 99 to a
  507.   binary byte of 0..63H.
  508.  
  509. BIN2BCD - Convert binary byte to packed BCD.
  510.  
  511.   ENTER: A = Binary digit to convert (00-63H, 0-99 decimal)
  512.   EXIT : A = Packed BCD byte (1 or 2 digits)
  513.   USES : AF
  514.  
  515.  Usage: This routine is commonly used to convert bytes in the
  516.   range of 0-99 (00-63H) to a packed BCD byte.  It is primarily
  517.   used in date conversion routines in DSLIB but is available
  518.   for other uses.
  519.  
  520. DVERS - Return the DSLIB version number
  521.  
  522.   ENTER: None
  523.   EXIT : HL - Contains the Version Number (H=major, L=minor)
  524.   USES : HL.  Other registers unaffected
  525.  
  526.  Usage: This routine is most often used for control or
  527.   debugging purposes to embed the linked library version.
  528.  
  529. :OPENTD - Open DateStamper(tm) Time & Date file for Read/Write
  530.  
  531.   ENTER: A = 0 for Read, A = 0FFH for Write
  532.   EXIT : A <> 0, Zero Flag Clear (NZ) if OK
  533.            A = 0, Zero Flag Set (Z) if Open Error
  534.   USES : AF,BC,DE,HL
  535.   REQUIREMENTS: You must select the drive before calling
  536.  
  537.  Usage: This DateStamper-specific routine is used to access
  538.   large numbers of stamps, or where performance penalties in
  539.   per-file stamp accesses are undesireable.  This routine Opens
  540.   the TIME&DAT file in User 0 on the current drive.  If opened
  541.   for writing, the R/O attribute is cleared.  The User Number
  542.   is restored on exit.
  543.  
  544. CLOSTD - Close DateStamper(tm) Time & Date file
  545.  
  546.   ENTER: None
  547.   EXIT : A <> 0, Zero Flag Clear (NZ) if OK
  548.            A = 0, Zero flag Set (Z) if Error
  549.   USES : AF,BC,DE,HL
  550.  
  551.  Usage: This DateStamper-specific routine closes the TIME&DAT
  552.   file in user 0 of current drive, and sets the R/O bit.  It is
  553.   used in conjunction with OPENTD above.
  554.  
  555. RWTD - Read or write to Time & Date file on current drive.
  556.  
  557.   ENTER:  A = 0 to Read, A = 0FFH to Write
  558.          DE - Contains Random Record to Read or Write
  559.   EXIT : HL - Addresses the start of T&D sector Read/Written
  560.           A <> 0, Zero Flag Clear (NZ) if OK
  561.             A = 0, Zero Flag Set (Z) if Error
  562.   USES : AF,BC,DE,HL and BDOS DMA Address
  563.  
  564.  Usage: DateStamper(tm)-specific routine normally used only for
  565.   Directory list, Catalog or Archive programs where access to
  566.   blocks of Date Stamps is desired.
  567.   NOTE: You must reset DMA address after call if needed.
  568.  
  569. Example:
  570.         EXT    RWTD          ; Declare the routine
  571.         ...                  ; Log drive, Set DMA addr
  572.         LD     DE,(RECNUM)   ; Get T&D Rec # from FSTNXT or
  573.                              ; ..specified Random rec number
  574.         LD     A,MODE        ; A=0 for read, A=FF for write
  575.         CALL   RWTD          ; Perform the action
  576.         JR     NZ,RWOK       ; ..jump if OK
  577.         ...                  ; Else perform error activity
  578.  RWOK:  ...                  ; Sector has been read/written
  579.