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