home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / JSAGE / ZSUS / PROGPACK / V42-DOCS.LBR / DSLIB42.DZC / DSLIB42.DOC
Text File  |  1990-06-08  |  35KB  |  653 lines

  1. .hm1
  2. .fm1
  3. .sr0
  4. .he                                 ZCPR3: THE LIBRARIES 4.2 -- DSLIB
  5. .fo                                                            Page #
  6. .pn 161
  7.  
  8.            IV«  DSLI┬ -¡ Clocδ anΣ Filσ Stam≡ Support
  9.  
  10.      Introductioε « « « « « « « « « « « « « « « « « « « « « « 162
  11.           Systeφ Identit∙ « « « « « « « « « « « « « « « « « « 163
  12.                TIMINI¼ GETDOS¼ FINDCK¼ CKTDF¼ DOSTY╨ (global)¼
  13.                DOSVE╥ (global)¼ TIMTY╨ (global)
  14.           Clocδ Readinτ « « « « « « « « « « « « « « « « « « « 164
  15.                RCLOCK¼ RDCLK
  16.           Filσ Stam≡ Routine≤ « « « « « « « « « « « « « « « « 165
  17.                GSTAMP¼ PSTAMP¼ GETTD¼ SETTD
  18.           Director∙ Selectioε « « « « « « « « « « « « « « « « 167
  19.                DDIRQS¼ DDIRQ¼ DDIRNPAK¼ DDIRPAK¼ DDIRSEL
  20.           Timσ Conversion≤  « « « « « « « « « « « « « « « « « 169
  21.                U2PTIM¼ P2UTIM¼ U2MTIM¼ M2UTIM
  22.           Utilit∙ Routine≤  « « « « « « « « « « « « « « « « « 172
  23.                FSTNXT¼ BCD2BIN¼ BIN2BCD¼ DVERS
  24.           DateStampe≥ TIME&DA╘  « « « « « « « « « « « « « « « 173
  25.                OPENTD¼ CLOSTD¼ RWTD
  26.  
  27. .paè
  28.               DSLI┬ -¡ Clocδ anΣ Filσ Stam≡ Support
  29.  
  30.  
  31. INTRODUCTION:é  Thi≤ librar∙ contain≤ ß collectioε oµ routine≤ át∩ ì
  32. facilitatσ additioε oµ filσ timσ anΣ datσ stampinτ anΣ rea∞ átimσ ì
  33. clocδ áfeatures« á ┴ commoε datσ anΣ timσ forma⌠ i≤ useΣ át∩ áexì
  34. changσ datσ anΣ timσ datß witΦ use≥ programs«  I⌠ use≤ BC─ digit≤ ì
  35. as:
  36.  
  37.      Byte Offset:  00  01  02  03  04  05
  38.                    YY  MM  DD  hh  mm  ss
  39.  
  40. wherσ áYYÖ ╜ yea≥ (7╕-9╣ i≤ 197╕-1999¼ 0░-7╖ i≤ 200░-2077)¼ áMMÖ á╜ ì
  41. montΦ á(1..12)¼ DDÖ ╜ da∙ (1..28,30,31)¼ hhÖ ╜ hou≥ (0..23)¼ ámmÖ á╜ ì
  42. minutσ (00..59)¼ anΣ ssÖ ╜ seconΣ (00..59).
  43.  
  44. GeneralizeΣ ároutine≤ arσ includeΣ whicΦ uniforml∙ áreturε áclocδ ì
  45. time¼ áa≤ wel∞ a≤ filσ stam≡ datß froφ ZSDOS/ZDDOS¼ CP/═ 2.2¼ áo≥ ì
  46. ZRDO╙ á1.xÖ áwitΦ Plu*Perfec⌠ Systemsº áDateStamper¼ áanΣ áDigita∞ ì
  47. Research'≤ áCP/═ áPlu≤ (als∩ knowε a≤ CP/═ 3)«  Thσ ácommoε ádatß ì
  48. structure≤ arσ automaticall∙ converteΣ t∩ thσ appropriatσ áinte≥ì
  49. na∞ format≤ fo≥ thσ runninτ system.
  50.  
  51. A≤ áwitΦ áthσ clocδ structure¼ filσ stam≡ datß i≤ áhandleΣ áiε áß ì
  52. consisten⌠ DateStampe≥-ZSDO╙ forma⌠ oµ packeΣ BC─ digit≤ iε ß 1╡-ì
  53. bytσ field:
  54.  
  55.                    |-- Create --|  |¡ Las⌠ Acc -|  |-- Modify --|
  56.      Byte Offset:  00 01 02 03 04  05 06 07 08 09  10 11 12 13 14
  57.                    YY MM DD hh mm  YY MM DD hh mm  YY MM DD hh mm
  58.  
  59. wherσ áYYÖ ╜ yea≥ (7╕-9╣ i≤ 197╕-1999¼ 0░-7╖ i≤ 200░-2077)¼ áMMÖ á╜ ì
  60. montΦ á(1..12)¼ DDÖ ╜ da∙ (1..28,30,31)¼ hhÖ ╜ hou≥ (0..23)¼ ámmÖ á╜ ì
  61. minutσ (00..59).
  62.  
  63. Iε áadditioε t∩ thσ generalizeΣ interfacσ routines¼ entr∙ ápoint≤ ì
  64. exis⌠ fo≥ DateStampe≥ specifiπ routines«  Man∙ oµ thesσ áspecΘfiπ ì
  65. routine≤ áarσ automaticall∙ calleΣ froφ thσ generalizeΣ áro⌡tine≤ ì
  66. wheε DateStampe≥ i≤ detected.
  67.  
  68. Conversioε routine≤ als∩ exis⌠ t∩ managσ interface≤ betweeε datσ-ì
  69. timσ áfield≤ oµ DateStamper¼ thσ M╙-DO╙ compatiblσ áDosDisk¼ áanΣ ì
  70. thσ CP/═ Plu≤-compatiblσ P2DO╙ format.
  71. .paèSYSTEM IDENTITY:
  72.  
  73.      Routine║   TIMINI
  74.      Function║ See if there is a clock we can read.
  75.      Entry║    None
  76.      Exit:     A = time method¼ zero flag clear (NZ) if clock found
  77.                A = 0, zero flag set (Z) if no clock found
  78.      Affected║ AF
  79.      Usage:    Call≤ GETDO╙ settinτ DOSVE╥ anΣ DOSTYP¼ theε look≤ ì
  80. áááááááááááááááfo≥ ß clocδ t∩ read¼ implyinτ ß filσ stam≡ method«  ì
  81. áááááááááááááááType≤ are║ "Só ╜ ZSDOS/ZDDO╙ internal¼ "Dó ╜ Datσì
  82. áááááááááááááááStamper¼ á"3ó á╜ CP/═ Plu≤ (CP/═ 3¼ áP2DO╙ átype)«  ì
  83. áááááááááááááááThi≤ TIMTY╨ bytσ ma∙ bσ accesseΣ wheε desireΣ áanΣ ì
  84. ááááááááááááááái≤ áuseΣ b∙ GSTAM╨ anΣ PSTAM╨ t∩ ge⌠ anΣ se⌠ áfilσ ì
  85. ááááááááááááááástamp≤ respectively.
  86.  
  87.      Routine║   GETDOS
  88.      Function║ Determine DOS type and version, set global variables.
  89.      Entry║    None
  90.      Exit║     A = DOS type (character), zero clear (NZ) if identified
  91.                A = 0, zero flag set (Z) if not identified
  92.      Affected║ AF
  93.      Usage:    UseΣ t∩ identif∙ thσ runninτ DO╙ typσ anΣ version«  ì
  94. áááááááááááááááI⌠ i≤ calleΣ froφ TIMINI¼ bu⌠ ma∙ bσ calleΣ ásepaì
  95. ááááááááááááááárately« á Afte≥ ái⌠ i≤ called¼ DOSTY╨ áanΣ áDOSVE╥ ì
  96. áááááááááááááááglobal≤ ma∙ bσ directl∙ accessed.
  97.  
  98. .ix DOSTYP (g)
  99.      Global:   DOSTYP á¡¡ áBytσ characte≥ variablσ fo≥ áDO╙ átypσ ì
  100. ááááááááááááááá("S"=ZSDOS¼ "D"=ZDDOS¼ "1"=CP/═ 1.x¼ "2"=CP/═ 2.x¼ ì
  101. ááááááááááááááá"3"=CP/═ Plu≤ (3.x)¼ "R"=ZRDOS¼ 0=Unknown)
  102.  
  103. .ix DOSVER (g)
  104.      Global:   DOSVER á¡¡ áBytσ variablσ fo≥ DO╙ áversioε ánumbe≥ ì
  105. ááááááááááááááá(vendo≥ specific)
  106.  
  107. .ix TIMTYP (g)
  108.      Global:   TIMTYP ¡¡ Bytσ characte≥ variablσ fo≥ typσ oµ timσ ì
  109. áááááááááááááááanΣ datσ stampinτ anΣ clocδ iε usσ ("3"=CP/═ Plus¼ ì
  110. ááááááááááááááá"S"=Interna∞ ZSDO╙ o≥ ZDDOS¼ "D"=DateStamper).
  111.  
  112.      Routine║   FINDCK
  113.      Function║ Check for DateStamper clock and set read status
  114.      Entry:    None
  115.      Exit:     A <> 0, zero flag clear (NZ) if clock found
  116.                HL = pointer to clock starting address if found
  117.                A = 0, zero flag set (Z), HL = - if not found
  118.      Affected: AF¼ BC¼ DE¼ HL
  119.      Usage:    UseΣ áwitΦ DateStampe≥-specifiπ interfaces« á Cal∞ ì
  120. áááááááááááááááthi≤ ároutinσ nea≥ thσ beginninτ oµ ß áprograφ át∩ ì
  121. ááááááááááááááádeterminσ clocδ status«  Thi≤ routinσ i≤ no⌠ needì
  122. áááááááááááááááeΣ áiµ thσ recommendeΣ áTIMINI/RCLOC╦ ágeneralizeΣ ì
  123. ááááááááááááááároutine≤ arσ used.
  124. .paè     Routine║   CKTDF
  125.      Function║ Check for DateStamper TIME&DAT file on drive
  126.      Entry:    None¼ bu⌠ use≥ must log desired drive before calling
  127.      Exit:     A <> 0, zero flag reset (NZ) if TIME&DAT file i≤ located
  128.                A = 0, zero flag set (Z) if no TIME&DAT file present
  129.      Affected: AF¼ BC¼ DE¼ HL
  130.      Usage:    UseΣ witΦ DateStampe≥-specifiπ filσ stam≡ routine≤ ì
  131. áááááááááááááááonly¼ o≥ witΦ routine≤ wherσ individua∞ filσ stam≡ ì
  132. áááááááááááááááacces≤ ái≤ to∩ slow«  I⌠ shoulΣ bσ ácalleΣ ábeforσ ì
  133. áááááááááááááááan∙ attemp⌠ i≤ madσ t∩ acces≤ filσ stam≡ áinformaì
  134. ááááááááááááááátion« á ┴ ácommoε áusσ i≤ t∩ se⌠ áflag≤ áfo≥ ámodσ ì
  135. áááááááááááááááchanginτ betweeε stam≡ anΣ noε-stam≡ operations.
  136.  
  137. CLOCK READING:
  138.  
  139.      Routine║   RCLOCK
  140.      Function║ ReaΣ clocδ identifieΣ b∙ TIMIN╔ t∩ specifieΣ address
  141.      Entry:    HL = address of 6-byte area to receive time string
  142.      Exit:     A = 0, zero flag set (Z) if OK, time string filled
  143.                A <> 0, zero flag clear (NZ) if error
  144.      Affected: HL¼ DE¼ BC¼ AF
  145.      Usage:    Form≤ áß generalizeΣ clocδ reaΣ fo≥ áZSDOS¼ áDateì
  146. áááááááááááááááStamper¼ o≥ CP/═ Plu≤ clock≤ identifieΣ b∙ TIMINI«  ì
  147. áááááááááááááááI⌠ áread≤ clocδ datß t∩ thσ specifieΣ áaddres≤ áiε ì
  148. áááááááááááááááthσ ástandarΣ áformat«  Sincσ CP/═ Plu≤ ádoe≤ áno⌠ ì
  149. áááááááááááááááreturε áß ávaliΣ reaΣ flag¼ thσ statu≤ ái≤ áalway≤ ì
  150. áááááááááááááááassumeΣ át∩ ábσ truσ fo≥ ß gooΣ áread« á Yo⌡ ámus⌠ ì
  151. áááááááááááááááinsurσ tha⌠ ß valiΣ clocδ i≤ installeΣ anΣ workinτ ì
  152. ááááááááááááááábeforσ callinτ thi≤ routine.
  153.      Example║
  154.                          EXT  TIMINI,RCLOCK  ; always declare both routines
  155.                          ...                 ; ..preliminary code
  156.                          CALL TIMINI         ; initialize and identify clock
  157.                          ...                 ; ..other program code
  158.                          LD   HL,TIMSTR      ; place the time here
  159.                          CALL RCLOCK         ; ..and read the clock
  160.                          JR   NZ,BADCLK      ; jump if error reading clock
  161.                          ...                 ; ..else proceed to use it
  162.                TIMSTR:   DEFS 6              ; date/time: YY MM DD HH MM SS
  163.  
  164.      Routine║   RDCLK
  165.      Function║ Read DateStamper clock to specified buffer
  166.      Entry:    HL = pointer to 6-byte buffer location
  167.                FINDCK must have been previously called
  168.      Exit:     HL = pointer to last byte of date/time string iµ OK
  169.                A <> 0, zero flag clear (NZ) if OK
  170.                A = 0, zero set (Z), HL = 0 if bad clock read
  171.      Affected: AF¼ BC¼ DE¼ HL
  172.      Usage:    UseΣ át∩ reaΣ ß DateStampe≥-specifiπ clock« á Datσ ì
  173. áááááááááááááááanΣ timσ informatioε i≤ returneΣ iε thσ samσ áforì
  174. áááááááááááááááma⌠ a≤ othe≥ routine≤ iε thi≤ library.
  175.      Example:
  176.                          EXT  RDCLK,FINDCK   ; declare the routine
  177.                          ...                 ; ..initial program code
  178.                          CALL FINDCK         ; call this early in programè                         ...                 ; ..intervening program code
  179.                          LD   HL,TIMSTR      ; set addr for 6-byte buffer
  180.                          CALL RDCLK          ; read the clock
  181.                          JR   Z,NOGOOD       ; ..jump if bad read
  182.  
  183. FILE STAMP ROUTINES:
  184.  
  185.      Routine║   GSTAMP
  186.      Function║ Return file date stamp data for specified file
  187.      Entry:    DE = pointer to FCB for file of interest
  188.                HL = pointer to 15-byte buffer fo≥ stamp data
  189.                TIMIN╔ mus⌠ havσ beeε calleΣ t∩ se⌠ globa∞ ávarißì
  190. ááááááááááááááábles«  Drivσ anΣ use≥ areß fo≥ thσ specifieΣ áfilσ ì
  191. ááááááááááááááámus⌠ bσ se⌠ prio≥ t∩ callinτ thi≤ routine.
  192.      Exit:     A <> 0, zero flag clear (NZ) if operation successful
  193.                A = 0, zero flag set (Z) on error
  194.      Affected: AF¼ BC¼ HL
  195.                Curren⌠ DM┴ addres≤ i≤ altereΣ.
  196.      Usage:    RecommendeΣ fo≥ filσ stam≡ acces≤ iε CP/═-compatiì
  197. áááááááááááááááblσ systems«  Use≤ DOSTY╨ anΣ TIMTY╨ variable≤ át∩ ì
  198. ááááááááááááááádeterminσ ástam≡ methoΣ iε effect¼ anΣ áwil∞ áreaΣ ì
  199. áááááááááááááááfilσ stamp≤ unde≥ ZSDO╙ anΣ DateStampe≥ witΦ áCP/═ ì
  200. ááááááááááááááá2.▓ o≥ ZRDOS¼ anΣ wil∞ reaΣ stamp≤ froφ CP/═ áPlu≤ ì
  201. ááááááááááááááá(CP/═ 3).
  202.      Example║  Seσ PSTAM╨ below.
  203.  
  204.      Routine║   PSTAMP
  205.      Function║ Set file date stamp data for specified file
  206.      Entry:    DE = pointer to FCB for file of interest
  207.                HL = pointer to 15-byte buffer with stamp data
  208.                TIMIN╔ mus⌠ havσ beeε calleΣ t∩ se⌠ globa∞ ávariaì
  209. ááááááááááááááábles«  Drivσ anΣ use≥ areß fo≥ thσ specifieΣ áfilσ ì
  210. ááááááááááááááámus⌠ bσ se⌠ prio≥ t∩ callinτ thi≤ routine.
  211.      Exit:     A <> 0, zero flag clear (NZ) if operation successful
  212.                A = 0, zero flag set (Z) on error
  213.      Affected: AF¼ BC¼ HL
  214.                Curren⌠ DM┴ addres≤ i≤ altereΣ.
  215.      Usage:    RecommendeΣ fo≥ filσ stam≡ acces≤ iε CP/═-compatiì
  216. áááááááááááááááblσ systems«  Use≤ thσ DOSTY╨ anΣ TIMTY╨ variable≤ ì
  217. ááááááááááááááát∩ ádeterminσ ástam≡ methoΣ iε áeffect¼ áanΣ áwil∞ ì
  218. áááááááááááááááwritσ filσ stamp≤ unde≥ ZSDO╙ anΣ DateStampe≥ witΦ ì
  219. áááááááááááááááCP/═ á2.▓ o≥ ZRDOS¼ bu⌠ no⌠ unde≥ CP/═ Plu≤ á(CP/═ ì
  220. ááááááááááááááá3).
  221.      Example:
  222.                          EXT  GSTAMP,PSTAMP,TIMIN╔     ; declare routines
  223.                          ...                 ; ..preceding code
  224.                          CALL TIMINI         ; set the time sybsystem early
  225.                          ...                 ; ..other program code
  226.                          CALL SETFCB         ; set an FCB to a desired file
  227.                          LD   DE,FCB         ; ..point to it
  228.                          LD   HL,TBUFF       ; ..and to buffer for stamps
  229.                          CALL GSTAMP         ; get stamp for this file
  230.                          JR   Z,NOSTAMP      ; ..go to error handler if bad
  231.                          ...                 ; use the data
  232.                          CALL SETDAT         ; set stamp data in bufferè                         LD   DE,FCB         ; ..point to FCB for file
  233.                          LD   ╚L,TBUFF       ; ..and to buffer with stamps
  234.                          CALL PSTAMP         ; stamp file with TBUFF values
  235.                          JR   Z,NOSTAMP      ; ..jump error if bad return
  236.                          ...                 ; else carry on
  237.  
  238.                FCB:      DEFS 36             ; FCB for file of interest
  239.                TBUFF:    DEFS 15             ; buffer for stamp data
  240.  
  241.      Routine║   GETTD
  242.      Function║ Get DateStamper file stamp for specified file
  243.      Entry:    A = TIME&DAT sector index (0..7) (from FSTNXT)
  244.                DE = randoφ record number (from FSTNXT)
  245.                HL = pointer to 15-byte buffer for date-time info
  246.                User must log onto drive containing file and stamp
  247.      Exit:     A <> 0, zero flag clear (NZ) if OK
  248.                A = 0, zero flaτ set (Z) if no file or read error
  249.      Affected: AF¼ BC¼ DE¼ HL
  250.                DMA is altered by this routine.
  251.      Usage:    DateStampe≥-specifiπ routinσ returninτ filσ ástam≡ ì
  252. ááááááááááááááádatß fo≥ ß filσ usinτ FSTNX╘ cal∞ parameters.
  253.      Example:
  254.                          EXT  GETTD          ; declare the routine
  255.                          ...                 ; ..check DateStamper
  256.                          ...                 ; ..log drive, call FSTNXT
  257.                          LD   HL,USRDAT      ; put 15-byte stamp data here
  258.                          CALL GETTD          ; fill in destination string
  259.                          JR   Z,NODATA       ; ..jump if bad/no stamp
  260.                          ...                 ; else process the stamp
  261.  
  262.      Routine║   SETTD
  263.      Function║ Set DateStamper file stamp for specified file.
  264.      Entry:    A = TIME&DAT sector index (0..7) (from FSTNXT)
  265.                DE = random record number (from FSTNXT)
  266.                HL = pointer to stamp data in 15-byte buffer
  267.                Use≥ must log onto drive containing file and stamp
  268.      Exit:     A <> 0, zero flag clear (NZ) if OK
  269.                A = 0, zero set (Z) if no file or read error
  270.      Affected: AF¼ BC¼ DE¼ HL
  271.                DMA is altered by this routine.
  272.      Usage:    DateStampe≥-specifiπ routinσ set≤ filσ stam≡ ádatß ì
  273. áááááááááááááááfo≥ ß specifieΣ filσ t∩ use≥-supplieΣ values.
  274.      Example:
  275.                          EXT  SETTD          ; declare the routine
  276.                          ...                 ; ..validate DateStamper
  277.                          ...                 ; ..log drive, call FSTNXT
  278.                          LD   HL,USRDAT      ; point to 15-byte stamp field
  279.                          CALL SETTD          ; set DateStamper file stamp
  280.                          JR   Z,BADSET       ; ..jump if if error
  281.                          ...                 ; else carry on!
  282. .paèDIRECTORY SELECTION:
  283.  
  284.      Routine║   DDIRQS
  285.      Function║ Return sorted directory with file stamps and sizing
  286.      Entry:    HL = address of TPA buffer start
  287.                DE = points to FCB entry to match directory entries
  288.                A = modσ selec⌠ character:
  289.                     b7 -- 1 = select system files
  290.                     b6 -- 1 = select non-system files
  291.                     b5 -- 1 = select all users
  292.                C = secondary modσ selec⌠:
  293.                     b7 -- ▒ ╜ sort type then name, ░ ╜ name then type
  294.                     b0 -- 1 = searcΦ ááDateStampe≥ áfirst¼ áátheε ì
  295. ááááááááááááááááááááááááááááááDosDisk¼ átheε áP2DO╙ stamps╗ á░ á╜ ì
  296. ááááááááááááááááááááááááááááááski≡ DateStamper
  297.      Exit:     A <> 0, zero flag clear (NZ) if OK
  298.                A = 0, zero set (Z) if TPA overflow
  299.                BC = number of files in sorted directory array
  300.                HL = address of first file in buffer
  301.      Affected: HL¼ BC¼ AF
  302.                DMA Address is set to 80h
  303.      Usage:    ┴ replacemen⌠ fo≥ thσ SYSLI┬ routinσ DIRQS« á Filσ ì
  304. ááááááááááááááástamp≤ áarσ áautomaticall∙ appendeΣ át∩ ádirector∙ ì
  305. ááááááááááááááádatß áfroφ áDateStamper¼ P2DO╙ á(CP/═ áPlus)¼ áanΣ ì
  306. áááááááááááááááDosDisk« á Thσ álas⌠ áacces≤ fielΣ ái≤ ánulleΣ áiε ì
  307. áááááááááááááááP2DOS¼ anΣ thσ singlσ DosDisδ stam≡ i≤ returneΣ iε ì
  308. áááááááááááááááthσ las⌠ modifieΣ field«  EacΦ entr∙ i≤ 3▒ characì
  309. áááááááááááááááter≤ lonτ (1╢ fo≥ filσ entry¼ 1╡ fo≥ stamp).
  310.      Example║  Seσ DDIR╤ below.
  311.  
  312.      Routine║   DDIRQ
  313.      Function║ Return sorted directory with file stamps
  314.      Entry:    HL = address of TPA buffer start
  315.                DE = points to FCB entry to match directory entries
  316.                A = modσ select character:
  317.                     b7 -- 1 = select system files
  318.                     b6 -- 1 = select non-system files
  319.                     b5 -- 1 = select all users
  320.                C = secondary modσ select:
  321.                     b7 -- 1 = sor⌠ typσ theε name¼ ░ ╜ namσ átheε ì
  322. áááááááááááááááááááááááááááááátype
  323.                     b0 -- 1 = searcΦ ááDateStampe≥ áfirst¼ áátheε ì
  324. ááááááááááááááááááááááááááááááDosDisk¼ átheε áP2DO╙ stamps╗ á░ á╜ ì
  325. ááááááááááááááááááááááááááááááski≡ DateStamper
  326.      Exit:     A <> 0, zero flag clear (NZ) if OK
  327.                A = 0, zero set (Z) if TPA overflow
  328.                BC = number of files in sorted directory array
  329.                HL = address of first file in buffer
  330.      Affected: HL¼ BC¼ AF
  331.                DMA Address is set to 80h
  332.      Usage:    ┴ replacemen⌠ fo≥ thσ SYSLI┬ routine≤ DIRQ« á Filσ ì
  333. ááááááááááááááástamp≤ áarσ áautomaticall∙ appendeΣ át∩ ádirector∙ ì
  334. ááááááááááááááádatß áfroφ áDateStamper¼ P2DO╙ á(CP/═ áPlus)¼ áanΣ ì
  335. áááááááááááááááDosDisk« á Thσ álas⌠ áacces≤ fielΣ ái≤ ánulleΣ áiε ì
  336. áááááááááááááááP2DOS¼ anΣ thσ singlσ DosDisδ stam≡ i≤ returneΣ iε ìèáááááááááááááááthσ las⌠ modifieΣ field«  EacΦ entr∙ i≤ 3▒ characì
  337. áááááááááááááááter≤ lonτ (1╢ fo≥ filσ entry¼ 1╡ fo≥ stamp).
  338.      Example:
  339.                          EXT  DDIR╤          ; ..or DDIRQS, don't use both
  340.                          ...
  341.                          CALL CODEND         ; get lower TPA value in HL
  342.                          LD   DE,MYFCB       ; match this file spec
  343.                          LD   C,01H          ; sort name/type, DS first
  344.                          LD   A,0E0H         ; SYS & non-SYS, all user areas
  345.                          CALL DDIRQ          ; do the call (or to DDIRQS)
  346.                          JP   Z,ERROR        ; ..error if not enough space
  347.                          LD   A,B            ; do we have any files?
  348.                          OR   C              ; ..BC has number of files
  349.                          JP   Z,NOFILS       ; jump if no files in array
  350.                          ...                 ; ..use the files in the array
  351.  
  352.                MYFCB:    DEFB 0,'???????????',0,0,0,0  ; FCB to match
  353.                          DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  354.  
  355.      Routine║   DDIRNPAK
  356.      Function║ Negate selection markings in directory buffer
  357.      Entry:    HL = points to directory buffer from DDIRQ/DDIRQS
  358.                BC = number of entries in the buffer
  359.      Exit:     BC = number of entries in buffer after select/packing
  360.      Affected: BC
  361.      Usage:    UseΣ át∩ deletσ filσ entrie≤ froφ DDIRQ╙ o≥ áDDIR╤ ì
  362. ááááááááááááááádirector∙ routines«  Upoε completion¼ onl∙ entrie≤ ì
  363. ááááááááááááááápreviousl∙ unmarkeΣ remain¼ anΣ thσ tablσ i≤ ácoφì
  364. ááááááááááááááápresseΣ t∩ onl∙ thesσ entries«  Thi≤ i≤ simila≥ t∩ ì
  365. áááááááááááááááthσ SYSLI┬ routinσ DIRNPAK¼ bu⌠ tailoreΣ t∩ átimσ-ì
  366. ááááááááááááááádatσ stampeΣ director∙ lists.
  367.      Example:
  368.                          EXT  DDIRNPAK       ; declare the routine
  369.                          ...                 ; build dir table (DDIRQ(S))
  370.                          ...                 ; ..and select entries
  371.                          LD   HL,(BUFF)      ; buffer start (DDIRQ/DDIRQS)
  372.                          LD   BC,(COUNT)     ; ..# of entries (DDIRQ/DDIRQS)
  373.                          CALL DDIRNPAK       ; Keep unselected & pack buffer
  374.                          ...                 ; ..continue w/ new file count
  375.  
  376.      Routine║   DDIRPAK
  377.      Function║ Pack directory buffer from DDIRQ/DDIRQS
  378.      Entry:    HL = points to directory buffer from DDIRQ/DDIRQS
  379.                BC = number of entries in the buffer
  380.      Exit:     BC = new number of buffer entries after select/pack
  381.      Affected: BC
  382.      Usage:    Compres≤ filσ I─ arra∙ froφ director∙ sor⌠ routinσ ì
  383. áááááááááááááááretaininτ onl∙ markeΣ filσ entries«  Thi≤ ároutinσ ì
  384. ááááááááááááááái≤ simila≥ t∩ thσ SYSLI┬ routinσ DIRPAK¼ bu⌠ funcì
  385. ááááááááááááááátion≤ witΦ timσ-datσ stampeΣ director∙ lists.
  386.      Example:
  387.                          EXT  DDIRPAK        ; declare the routine
  388.                          ...                 ; build dir table (DDIRQ/DDIRQS)
  389.                          ...                 ; ..and select entries
  390.                          LD   HL,(BUFF)      ; buffer start (DDIRQ/DDIRQS)è                         LD   BC,(COUNT)     ; ..# of entries (DDIRQ/DDIRQS)
  391.                          CALL DDIRPAK        ; keep selected entries & pack
  392.                          ...                 ; ..continue w/new file count
  393.  
  394.      Routine║   DDIRSEL
  395.      Function║ Select entries from DDIRQ/DDIRQS directory buffer
  396.      Entry:    HL = points to directory buffer from DDIRQ/DDIRQS
  397.                DE = FCB entry to select against
  398.                BC = number of entries in the buffer
  399.                A = modσ select flag:
  400.                     b7 -- select non-system files
  401.                     b6 -¡ select system files
  402.                     b5 -- select all users
  403.                     b4..b0 -- user number
  404.      Exit:     Selected files are marked
  405.      Affected: None
  406.      Usage:    Selec⌠ áfilσ áentrie≤ b∙ settinτ thσ áMS┬ áoµ áthσ ì
  407. áááááááááááááááfirs⌠ bytσ (use≥ #⌐ baseΣ oε filσ namσ anΣ typσ iε ì
  408. áááááááááááááááFCB¼ anΣ selectioε flags«  Thi≤ routinσ i≤ simila≥ ì
  409. ááááááááááááááát∩ áthσ áSYSLI┬ routinσ áDIRSEL¼ ábu⌠ áaccomodate≤ ì
  410. ááááááááááááááátimσ-datσ stampeΣ director∙ lists.
  411.      Example:
  412.                          EXT  DDIRSEL        ; declare the routine
  413.                          ...                 ; build dir (DDIRQ/DDIRQS)
  414.                          LD   HL,(BUFF)      ; buffer start (DDIRQ/DDIRQS)
  415.                          LD   DE,MYFCB       ; ..FCB criteria for selection
  416.                          LD   BC,(COUNT)     ; ..and # entries (from DDIRQ)
  417.                          LD   A,01100000B    ; SYS files in all user areas
  418.                          CALL DDIRSEL        ; mark matching entries
  419.                          ...                 ; ..continue on
  420.  
  421. TIME CONVERSIONS:
  422.  
  423.      Routine║   U2PTIM
  424.      Function║ Convert ZSDOS-DateStamper time to P2DOS (CP/M Plus)
  425.      Entry:    DE = points to Universal time string (source)
  426.                HL = points to P2DOS time string (destination)
  427.      Exit:     ┴ á╜ 0¼ zer∩ se⌠ (Z⌐ iµ OK¼ destinatioε átimσ áse⌠ ì
  428. ááááááááááááááá(les≤ seconds)
  429.                A <> 0, zero clear (NZ) if error, destination zeroed
  430.                D┼ ╜ pointe≥ t∩ second≤ bytσ iε sourcσ strinτ (no⌠ ì
  431. ááááááááááááááámoved)
  432.                H╠ ╜ pointe≥ t∩ second≤ bytσ iε destinatioε strinτ ì
  433. ááááááááááááááá(no⌠ filled)
  434.      Affected: HL¼ DE¼ BC¼ AF
  435.      Usage:    Conversioε oµ timσ froφ ZSDO╙-DateStampe≥ t∩ áCP/═ ì
  436. áááááááááááááááPlu≤ type«  Onl∙ thσ date¼ hour¼ anΣ minutσ field≤ ì
  437. áááááááááááááááarσ áconverted¼ ábu⌠ register≤ arσ áreturneΣ ásucΦ ì
  438. ááááááááááááááátha⌠ ß singlσ LD╔ movσ instructioε afte≥ thσ árouì
  439. ááááááááááááááátinσ wil∞ movσ an∙ second≤ information«  Year≤ 7╕-ì
  440. ááááááááááááááá9╣ arσ assumeΣ t∩ bσ 197╕-1999¼ ░-7╖ a≤ 200░-2077«  ì
  441. áááááááááááááááThi≤ ároutinσ woulΣ commonl∙ bσ useΣ áiε áprogram≤ ì
  442. ááááááááááááááásucΦ áa≤ librar∙ utilitie≤ whicΦ internall∙ usσ áß ì
  443. áááááááááááááááCP/═ Plu≤ typσ oµ stamp.
  444. .paè     Example:
  445.                          EXT  U2PTIM         ; declare the variable
  446.                          ...                 ; read a clock or stamp
  447.                          LD   DE,UTIM        ; set source time spec address
  448.                          LD   HL,PTIM        ; ..and dest time spec addr
  449.                          CALL U2PTIM         ; do the conversion
  450.                          JR   NZ,ERROR       ; ..jump if conversion error
  451.                          ...                 ; else use the P2DOS string
  452.  
  453.      Routine║   P2UTIM
  454.      Function║ Convert P2DOS (CP/M Plus) time spec to standard
  455.      Entry:    HL = points to P2DOS (CP/M Plus) time string (source)
  456.                DE = points to universal time string (destination)
  457.      Exit:     ┴ á╜ á0¼ zer∩ se⌠ (Z)¼ destinatioε ástrinτ áfilleΣ ì
  458. ááááááááááááááá(les≤ seconds)
  459.                Errors only due to bad entry (check YY=MM=0).
  460.                H╠ ╜ point≤ t∩ second≤ bytσ iε sourcσ strinτ á(no⌠ ì
  461. ááááááááááááááámoved)
  462.                D┼ ╜ point≤ t∩ second≤ bytσ iε destinatioε ástrinτ ì
  463. ááááááááááááááá(no⌠ filled)
  464.      Affected: HL¼ DE¼ BC¼ AF
  465.      Usage:    Commonl∙ useΣ t∩ providσ interfacσ froφ CP/═ áPlu≤ ì
  466. ááááááááááááááásystem≤ át∩ CP/═ 2.2¼ o≥ iε librar∙ áutilit∙ árouì
  467. ááááááááááááááátine≤ t∩ providσ timσ interface«  Sourcσ stam≡ ái≤ ì
  468. áááááááááááááááP2DO╙ á(CP/═ áPlu≤ ácompatible)¼ ádestinatioε áái≤ ì
  469. áááááááááááááááZSDO╙-DateStampe≥ ástandard« á ┴ singlσ áLD╔ ámovσ ì
  470. áááááááááááááááinstructioε afte≥ conversioε wil∞ movσ thσ second≤ ì
  471. ááááááááááááááábyte« á Onl∙ date≤ froφ ▒ Jaε 197╕ througΦ 3▒ áDeπ ì
  472. ááááááááááááááá207╖ wil∞ bσ properl∙ converted«  Othe≥ date≤ wil∞ ì
  473. áááááááááááááááse⌠ áyea≥ áanΣ montΦ byte≤ t∩ ázero« á Checδ áthi≤ ì
  474. ááááááááááááááástatσ fo≥ erro≥ condition.
  475.      Example:
  476.                          EXT  P2UTIM         ; declare the variable
  477.                          ...                 ; read a clock or stamp
  478.                          LD   DE,UTIM        ; point to the dest string
  479.                          LD   HL,PTIM        ; ..and the source string
  480.                          CALL P2UTIM         ; do the conversion
  481.                          LDI                 ; move the seconds (if desired)
  482.                          LD   HL,UTIM        ; check for errors
  483.                          LD   A,(HL)         ; get years byte
  484.                          INC  HL             ; ..advance to months
  485.                          OR   L              ; ..and check for errors
  486.                          JR   Z,ERROR        ; jump if error
  487.                          ...                 ; ..continue on
  488. .paè     Routine║   U2MTIM
  489.      Function║ Convert universal time specification to MS-DOS/DosDisk
  490.      Entry:    DE = points to universal time string (source)
  491.                HL = points to MS-DOS format time string (destination)
  492.      Exit:     ┴ á╜ 0¼ zer∩ se⌠ (Z⌐ iµ OK¼ destinatioε átimσ áse⌠ ì
  493. ááááááááááááááá(les≤ seconds)
  494.                ┴ á<╛ á0¼ zer∩ clea≥ (NZ⌐ áiµ áerror¼ ádestinatioε ì
  495. ááááááááááááááástrinτ zeroed
  496.                DE = pointer to seconds byte in source string (not moved)
  497.                H╠ á╜ ápointe≥ t∩ higΦ-orde≥ timσ bytσ áiε áM╙-DO╙ ì
  498. áááááááááááááááfielΣ (lo≈-orde≥ bytσ ha≤ second≤ fielΣ nulled)
  499.      Affected: HL¼ DE¼ BC¼ AF
  500.      Usage:    Commonl∙ useΣ t∩ conver⌠ froφ interna∞ timσ forma⌠ ì
  501. ááááááááááááááát∩ áexterna∞ forφ fo≥ writinτ t∩ M╙-DO╙ disδ áforì
  502. ááááááááááááááámats« á Conversioε oµ second≤ datß t∩ áthσ áforma⌠ ì
  503. áááááááááááááááuseΣ áiε thσ M╙-DO╙ timσ specificatioε i≤ áß áuse≥ ì
  504. áááááááááááááááprograφ responsibility«  Date≤ froφ ▒ Januar∙ 198░ ì
  505. ááááááááááááááát∩ 3▒ Decembe≥ 207╖ wil∞ bσ properl∙ converted.
  506.      Example:
  507.                          EX╘  U2MTIM         ; declare the variable
  508.                          ...                 ; read a clock or stamp
  509.                          LD   DE,UTIM        ; source time spec string addr
  510.                          LD   HL,MTIM        ; ..dest time spec string addr
  511.                          CALL U2MTIM         ; do the conversion
  512.                          JR   NZ,ERROR       ; ..jump if conversion error
  513.                          ...                 ; else use P2DOS string
  514.  
  515.      Routine║   M2UTIM
  516.      Function║ Convert MS-DOS/DosDisk time to universal
  517.      Entry:    HL = points to MS-DOS time string (source)
  518.                DE = points to universal time string (destination)
  519.      Exit:     ┴ á╜ á0¼ zer∩ se⌠ (Z)¼ destinatioε ástrinτ áfilleΣ ì
  520. ááááááááááááááá(les≤ seconds)
  521.                A <> 0, zero clear (NZ) if error, destination nulled
  522.                HL = points to second (hi-order) byte in MS-DOS string
  523.                D┼ ╜ point≤ t∩ second≤ bytσ iε destinatioε ástrinτ ì
  524. ááááááááááááááá(no⌠ filled)
  525.      Affected: HL¼ DE¼ BC¼ AF
  526.      Usage:    Commonl∙ áuseΣ t∩ conver⌠ M╙-DO╙ timσ t∩ áinterna∞ ì
  527. áááááááááááááááforma⌠ fo≥ interna∞ prograφ manipulation«  Converì
  528. ááááááááááááááásioε áoµ ásecond≤ i≤ you≥ áresponsibility« á Date≤ ì
  529. áááááááááááááááfroφ á▒ Jaε 198░ througΦ 3▒ Deπ 207╖ wil∞ bσ áproì
  530. áááááááááááááááperl∙ converted«  Other≤ producσ ß nul∞ date.
  531.      Example:
  532.                          EXT  M2UTIM         ; declare the variable
  533.                          ...                 ; read a clock or stamp
  534.                          LD   DE,UTIM        ; point to the dest string
  535.                          LD   HL,MTIM        ; ..and the source string
  536.                          CALL M2UTIM         ; do the conversion
  537.                          JR   NZ,ERROR       ; ..handle error if bad
  538.                          ...                 ; else convert secs & continue
  539. .paèUTILITY ROUTINES:
  540.  
  541.      Routine║   FSTNXT
  542.      Function║ File search returning DateStamper indices
  543.      Entry:    C = 1╖ (search first) or 1╕ (search next) DOS command
  544.                DE = points to FCB containing the target filename
  545.                User must log drive and user before calling
  546.      Exit:     ┴ ╜ director∙ inde° (0..3)¼ carr∙ flaτ clea≥ á(NC⌐ ì
  547. áááááááááááááááiµ found
  548.                A ╜ indeterminate, carry flag set (C) if not found
  549.                DE = random sector number in !!!TIME&.DAT
  550.                B = index into TIME&DAT sector (0..7)
  551.      Affected: AF¼ BC¼ DE¼ HL
  552.      Usage:    UseΣ áiε DateStampe≥-specifiπ system≤ át∩ áperforφ ì
  553. áááááááááááááááfilσ searche≤ anΣ returε indice≤ int∩ thσ TIME&DA╘ ì
  554. áááááááááááááááfile«  Usσ thi≤ cal∞ fo≥ functioε 1╖ anΣ 1╕ searcΦ ì
  555. ááááááááááááááácall≤ iε lie⌡ oµ ß direc⌠ cal∞ t∩ thσ BDO╙ ávecto≥ ì
  556. áááááááááááááááa⌠ locatioε 5.
  557.      Example:
  558.                          EXT  FSTNXT         ; declare the routine
  559.                          ...                 ; log drive/user & set FCB
  560.                          LD   C,17           ; set for search first command
  561.                          LD   DE,FCB         ; ..addr FCB for desired name
  562.                          CALL FSTNXT         ; search for the desired file
  563.                          JR   NC,FOUND       ; ..jump if file found
  564.                          ...                 ; else do not found things
  565.  
  566.      Routine║   BCD2BIN
  567.      Function║ Convert binary coded decimal (BCD) byte to binary
  568.      Entry:    A = BCD digit to convert (0-99 value)
  569.      Exit:     A = binary byte representation of digit(s) (00-63h)
  570.      Affected: AF
  571.      Usage:    Primaril∙ áuseΣ áiε conversion≤ oµ date≤ áuseΣ áb∙ ì
  572. áááááááááááááááDSLI┬ ároutines¼ bu⌠ i≤ availablσ fo≥ othe≥ áuses«  ì
  573. áááááááááááááááI⌠ convert≤ ß packeΣ BC─ bytσ iε thσ rangσ oµ ░ t∩ ì
  574. ááááááááááááááá9╣ t∩ ß binar∙ bytσ oµ 0..63h.
  575.  
  576.      Routine║   BIN2BCD
  577.      Function║ Convert binary byte to packed BCD
  578.      Entry:    A = binary digit to convert (00-63h, 0-99 decimal)
  579.      Exit:     A = packed BCD byte (1 or 2 digits)
  580.      Affected: AF
  581.      Usage:    Commonl∙ useΣ t∩ conver⌠ byte≤ iε thσ rangσ oµ á░-ì
  582. ááááááááááááááá9╣ (0░-63h⌐ t∩ ß packeΣ BC─ byte«  I⌠ i≤ primaril∙ ì
  583. áááááááááááááááuseΣ iε datσ conversioε routine≤ iε DSLIB¼ bu⌠ ái≤ ì
  584. áááááááááááááááavailablσ fo≥ othe≥ uses.
  585.  
  586.      Routine║   DVERS
  587.      Function║ Return the DSLIB version number
  588.      Entry:    None
  589.      Exit:     HL = the version number (╚ ╜ major, ╠ ╜ minor)
  590.      Affected: HL
  591.      Usage:    Mos⌠ ofteε useΣ fo≥ contro∞ o≥ debugginτ ápurpose≤ ì
  592. ááááááááááááááát∩ embeΣ thσ linkeΣ librar∙ version.
  593. .paèDATESTAMPER TIME&DAT:
  594.  
  595.      Routine║   OPENTD
  596.      Function║ Open DateStamper TIME&DAT file for reaΣ o≥ write
  597.      Entry:    A = 0 for read, A = 0FFh for write
  598.                You must select the drive before calling
  599.      Exit:     A <> 0, zero flag clear (NZ) if OK
  600.                A = 0, zero flag set (Z) if open error
  601.      Affected: AF¼ BC¼ DE¼ HL
  602.      Usage:    DateStampe≥-specifiπ ároutinσ ái≤ useΣ át∩ áacces≤ ì
  603. ááááááááááááááálargσ ánumber≤ áoµ stamps¼ áo≥ áwherσ áperformancσ ì
  604. ááááááááááááááápenaltie≤ iε pe≥-filσ stam≡ accesse≤ arσ undesireì
  605. áááááááááááááááable« á Thi≤ ároutinσ open≤ thσ TIME&DA╘ áfilσ áiε ì
  606. áááááááááááááááuse≥ ░ oε thσ curren⌠ drive«  Iµ openeΣ fo≥ áwritì
  607. áááááááááááááááing¼ thσ R/╧ attributσ i≤ cleared«  Thσ use≥ ánumì
  608. ááááááááááááááábe≥ i≤ restoreΣ oε exit.
  609.  
  610.      Routine║   CLOSTD
  611.      Function║ Close DateStamper TIME&DAT file
  612.      Entry:    None
  613.      Exit:     A <> 0, zero flag clear (NZ) if OK
  614.                A = 0, zero flag set (Z) if error
  615.      Affected: AF¼ BC¼ DE¼ HL
  616.      Usage:    DateStampe≥-specifiπ ároutinσ close≤ thσ áTIME&DA╘ ì
  617. áááááááááááááááfilσ iε use≥ ░ oµ curren⌠ drive¼ anΣ set≤ thσ áR/╧ ì
  618. ááááááááááááááábit«  I⌠ i≤ useΣ iε conjunctioε witΦ OPENT─ above.
  619.  
  620.      Routine║   RWTD
  621.      Function║ Read or write to TIME&DAT file on current drive
  622.      Entry:    A = 0 to read, A = 0FFh to write
  623.                DE = random record to read or write
  624.      Exit:     H╠ ╜ addresse≤ thσ star⌠ oµ TIME&DA╘ secto≥ t∩ ábσ ì
  625. áááááááááááááááreaΣ o≥ written
  626.                A <> 0, zero flag clear (NZ) if OK
  627.                A = 0, zero flag set (Z) if error
  628.      Affected: AF¼ BC¼ DE¼ HL, and BDOS DMA address
  629.      Usage:    DateStampe≥-specifiπ ároutinσ normall∙ áuseΣ áonl∙ ì
  630. áááááááááááááááfo≥ director∙ lis⌠ anΣ cataloτ o≥ archivσ program≤ ì
  631. áááááááááááááááwherσ acces≤ t∩ block≤ oµ datσ stamp≤ i≤ ádesired«  ì
  632. áááááááááááááááYo⌡ mus⌠ rese⌠ DM┴ addres≤ afte≥ cal∞ iµ needed.
  633.      Example:
  634.                          EXT  RWTD           ; declare the routine
  635.                          ...                 ; log drive, set DMA addr
  636.                          LD   DE,(RECNUM)    ; get T&D rec # from FSTNXT or
  637.                                              ; ..specified random rec number
  638.                          LD   A,MODE         ; A=0 for read, A=FF for write
  639.                          CALL RWTD           ; perform the action
  640.                          JR   NZ,RWOK        ; ..jump if OK
  641.                          ...                 ; else perform error activity
  642.                RWOK:     ...                 ; sector has been read/written
  643. .paè
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.                Thi≤ pagσ intentionall∙ lef⌠ blank.
  653. .paè