home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol089 / syslib1.hlp < prev    next >
Text File  |  1985-02-09  |  14KB  |  277 lines

  1. Directory Manipulation Routines
  2. Generalized Routines -- DIRF and DIRFS
  3. Buffer Allocation Routine -- DBUFFER
  4. Disk Parameter Information Extraction Routine -- DPARAMS
  5. Free Space Computation Routine -- DFREE
  6. File Size Computation Routine -- FSIZE
  7. Directory Load Routines -- DIRLOAD and DIRSLOAD
  8. Directory Alphabetization Routine -- DIRALPHA
  9. Directory Entry Selection Routine -- DIRSEL
  10. Directory Pack Routine -- DIRPACK
  11. :Directory Manipulation Routines
  12.      Thi≤ se⌠ oµ SYSLI┬ routine≤ concern≤ itselµ witΦ thσ loadinτ ì
  13. oµ anΣ acces≤ oµ ß disδ director∙ fo≥ thσ genera∞ purpose≤ oµ thσ ì
  14. user.  Included in this set of routines are the functions of:
  15.           1.  Preallocation of buffer space for the routines
  16.           2.  Two routines which load all undeleted directory
  17.                entries into a buffer, constantly checking for
  18.                memory overflow as they go
  19.                     DIRLOAD loads the first entry for each file
  20.                          (this is the faster of the two)
  21.                     DIRSLOAD loads the last entry for each file
  22.                          (this routine is required if the
  23.                               user wishes to compute file sizes)
  24.           3.  A routine to determine the amount of free space on
  25.                the disk
  26.           4.  A routine to compute the size of a file in K
  27.           5.  A routine to sort a loaded directory by file name
  28.                and type or by file type and name
  29.           6.  A routine to select (by marking) a set of directory
  30.                entries which match a given ambiguous file spec
  31.           7.  A routine to pack the loaded directory, leaving in
  32.                it only those entries marked by the select routine
  33. :Generalized Routines -- DIRF and DIRFS
  34.      Routine Name: DIRF and DIRFS
  35.      Function║
  36.           Thi≤ routinσ initialize≤ thσ buffe≥ area¼á load≤ ß disδ ì
  37. directory¼á select≤á ßá se⌠á oµ file≤ froφ thσá loadeΣá director∙ ì
  38. specifieΣá b∙á thσ user'≤ ambiguou≤ filσ namσ anΣ ßá passeΣá flaτ ì
  39. (whicΦ indicate≤ iµ Systeφ file≤ arσ selected¼á Non-systeφá file≤ ì
  40. arσá selected¼á al∞á use≥á area≤á arσ t∩á bσá covered¼á anΣá wha⌠ ì
  41. particula≥á use≥ areß i≤ t∩ bσ covereΣ iµ al∞ use≥ area≤ arσá no⌠ ì
  42. selected)¼ pack≤ thσ directory¼ anΣ alphabetize≤ thσ director∙ b∙ ì
  43. filσ namσ anΣ filσ type.
  44.      Iµá DIR╞ i≤ used¼á thσ processinτ proceed≤ faste≥ sincσ onl∙ ì
  45. thσá firs⌠ entr∙ oµ eacΦ filσ i≤ loadeΣ int∩ thσá memor∙á buffer«  ì
  46. Filσ sizinτ informatioε i≤ no⌠ includeΣ iε thi≤ load¼ however.
  47.      Iµ DIRF╙ i≤ used¼ thσ processinτ i≤ somewha⌠ slower¼ bu⌠ thσ ì
  48. las⌠á entr∙ fo≥ eacΦ filσ i≤ loadeΣ rathe≥ thaε thσ first«á  Filσ ì
  49. sizinτá informatioεá i≤á containeΣá iεá thi≤á entry¼áá anΣáá thi≤ ì
  50. informatioε caε bσ useΣ b∙ thσ FSIZ┼ routine.
  51.      Inputs:  HL points to a dynamic buffer which extends from
  52.                after the user's code and buffer areas to the
  53.                end of the TPA
  54.               DE points to the first byte of the FCB used to
  55.                specify the ambiguous file name; only the chars
  56.                in the FN and FT fields are significant, so this
  57.                need not be a true FCB and may be as short as 12
  58.                bytes
  59.               A is the selection flag, structured as follows:
  60.                Bit 7 - If Set, Select Non-System Files
  61.                Bit 6 - If Set, Select System Files
  62.                Bit 5 - If Set, Select All User Areas
  63.                Bits 4-0 - If Bit 5 is Cleared, contains number
  64.                     of User Area to Select
  65.      Outputs:  HL points to the first file entry in the buffer;
  66.                 each file entry is 16 bytes long
  67.                BC contains the number of files selected
  68. ááááá          A contains an error flag; A=0 and Zero Flag Set
  69. ááááá           (Z) indicates TPA overflow error during load of
  70. ááááá           directory entries; A<>0 and NZ indicates load OK
  71.  
  72.      Registers Affected:  HL, BC, PSW
  73.      SYSLIB Routines Called:  DBUFFER, DIRLOAD, DIRSEL, DIRPACK,
  74.                               DIRALPHA
  75.      Special Error Conditions:  As outline for the A register
  76. ááááá     above.
  77.  
  78.  
  79. :Buffer Allocation Routine -- DBUFFER
  80.      Routine Name: DBUFFER
  81.      Function:
  82.           Thi≤á routinσ allocate≤ thσ buffe≥ spacσ necessar∙á fo≥ ì
  83. thσá se⌠ oµ director∙ function≤ iε general«á  Iεá particular¼á i⌠ ì
  84. allocate≤ thσ necessar∙ spacσ fo≥ thσ alphabetizatioε functioε a≤ ì
  85. wel∞ a≤ thσ loadeΣ director∙ itself«á  Thi≤ routinσ mus⌠ bσá useΣ ì
  86. iµá thσá DIRALPH┴á routinσá i≤á t∩ bσá late≥á useΣá t∩á sor⌠á thσ ì
  87. directory╗á thi≤á routinσá allocate≤ al∞ thσ spacσá necessar∙á b∙ ì
  88. DIRALPH┴ t∩ sor⌠ thσ routinσ (pointe≥ space)«  Iµ thi≤ routinσ i≤ ì
  89. called¼ i⌠ i≤ no⌠ necessar∙ t∩ cal∞ thσ DPARAM╙ routine.
  90.      Inputs:  HL points to the beginning address of a dynamic
  91. ááááá          buffer area which extends to under the CCP
  92.      Outputs:  HL points to the first byte at which the directory
  93. ááááá           entries are to be loaded
  94. ááááá          A=0 and Zero Flag is Set (Z) if the CCP is
  95. ááááá           already overrun; else, A<>0 and NZ
  96.      Registers Affected:  HL, PSW
  97.      SYSLIB Routines Called:  DPARAMS
  98.      Special Error Conditions:  As indicated by A reg and Z flag
  99. :Disk Parameter Information Extraction Routine -- DPARAMS
  100.      Routine Name:  DPARAMS
  101.      Function:
  102.      Thi≤á routinσá extract≤ necessar∙ informatioε froφ thσá Disδ ì
  103. Paramete≥á Blocδ (DPB⌐ anΣ store≤ i⌠ awa∙ iε somσ globa∞á buffer≤ ì
  104. useΣ b∙ othe≥ Disδ Director∙ Routines«  Thσ informatioε extracteΣ ì
  105. i≤ no⌠ oµ genera∞ concerε b∙ thσ programmer«á  AL╠ TH┼ PROGRAMME╥ ì
  106. NEED╙á T╧ KNO╫ I╙ THA╘ THI╙ ROUTIN┼ MUS╘ B┼ CALLE─ A╘ LEAS╘á ONC┼ ì
  107. BEFOR┼ TH┼ DIRLOA─ O╥ DIRSLOA─ ROUTIN┼ I╙ CALLED«  Iµ thσ DBUFFE╥ ì
  108. routinσá i≤á called¼á theε i⌠ i≤ no⌠ necessar∙á t∩á cal∞á DPARAM╙ ì
  109. again.
  110.      Fo≥ thσ informatioε oµ thσ reader¼ thσ followinτ informatioε ì
  111. i≤ extracted:
  112. ááááá          BLKSHF <-- Block Shift Factor (1 Byte)
  113. ááááá          BLKMSK <-- Block Mask (1 Byte)
  114. ááááá          EXTENT <-- Extent Mask (1 Byte)
  115. ááááá          BLKMAX <-- Max Number of Blocks on Disk (2 Bytes)
  116. ááááá          DIRMA╪ <-- Ma° Numbe≥ oµ Di≥ Entrie≤ (▓ Bytes)
  117.      Thi≤á routinσ automaticall∙ adjust≤ fo≥ version≤ 1.┤ anΣ 2.▓ ì
  118. oµ CP/═ anΣ i≤ compatablσ witΦ botΦ version≤ oµ CP/M.
  119.  
  120.      Inputs:  None
  121.      Outputs:  None (Information Extracted into Buffers)
  122.      Registers Affected:  None
  123.      SYSLIB Routines Called:  None
  124.      Special Error Conditions:  None
  125. :Free Space Computation Routine -- DFREE
  126.      Routine Name: DFREE
  127.      Function:
  128.           Thi≤á routinσá compute≤ thσ amoun⌠ oµ freσ spacσ (iεá ╦ ì
  129. bytes⌐ lef⌠ oε disk.
  130.      Thσá routinσá DPARAM╙á (o≥á DBUFFER¼á sincσá i⌠á als∩á call≤ ì
  131. DPARAMS⌐á mus⌠ bσ calleΣ beforσ thi≤ routinσ i≤ useΣ s∩ tha⌠á thσ ì
  132. correct disk parameter information is loaded for it.
  133.      Inputs:  None
  134.      Outputs:  DE = Amount of Free Disk Space in K Bytes
  135.      Registers Affected:  DE
  136.      SYSLIB Routines Called:  None
  137.      Special Error Conditions:  None
  138. :File Size Computation Routine -- FSIZE
  139.      Routine Name: FSIZE
  140.      Function:
  141.           Thi≤á routinσá compute≤ thσ sizσ oµ ß filσ whosσá entr∙ ì
  142. (whicΦá MUS╘ bσ loadeΣ b∙ DIRSLOAD⌐ i≤ pointeΣ t∩á b∙á HL«á  Thi≤ ì
  143. routinσ wil∞ work¼ bu⌠ generall∙ returε incorrec⌠ results¼ iµ thσ ì
  144. entr∙ pointeΣ t∩ wa≤ loadeΣ b∙ DIRLOA─ instead.
  145.      Thσá routinσá DPARAM╙á (o≥á DBUFFER¼á sincσá i⌠á als∩á call≤ ì
  146. DPARAMS⌐á mus⌠ bσ calleΣ beforσ thi≤ routinσ i≤ useΣ s∩ tha⌠á thσ ì
  147. correct disk parameter information is loaded for it.
  148.      Inputs:  HL points to first byte of file entry
  149.      Outputs:  DE contains the file size in K Bytes
  150.      Registers Affected:  DE
  151.      SYSLIB Routines Called:  None
  152.      Special Error Conditions:  None
  153. :Directory Load Routines -- DIRLOAD and DIRSLOAD
  154.      Routine Name: DIRLOAD and DIRSLOAD
  155.      Function:
  156.           DIRLOA─á anΣá DIRSLOA─ loaΣ entrie≤ fo≥á al∞á undeleteΣ ì
  157. file≤á oεá thσá currentl∙ loggeΣ iε disδ int∩ thσá memor∙á buffe≥ ì
  158. pointeΣ t∩ b∙ HL«  Al∞ entrie≤ arσ 1╢ byte≤ long.
  159.      DIRLOA─á i≤ faste≥ thaε DIRSLOAD«á  I⌠ load≤ jus⌠ thσá firs⌠ ì
  160. entr∙ oµ eacΦ filσ oε disk«á  DIRLOAD¼á however¼á shoulΣ bσá useΣ ì
  161. onl∙áá iµá filσá sizinτá informatioεá i≤á no⌠á requireΣá b∙áá thσ ì
  162. application≤ program.
  163.      DIRSLOA─á load≤á jus⌠ thσ LAS╘ entr∙ oµ eacΦ filσá oεá disk«  ì
  164. Thi≤á entr∙ contain≤ thσ necessar∙ filσ sizinτ informatioεá whicΦ ì
  165. ma∙ bσ useΣ b∙ FSIZ┼ t∩ computσ thσ sizσ oµ thσ loadeΣ file.
  166.      Iµá thσá TP┴ i≤ filleΣ durinτ DIRLOA─ o≥ DIRSLOA─ anΣá therσ ì
  167. arσ stil∞ morσ filσ entrie≤ t∩ load¼á thσ loaΣ wil∞ bσ halteΣ anΣ ì
  168. aε erro≥ returε wil∞ bσ madσ t∩ thσ caller«á  Oε return¼á iµá A=░ ì
  169. anΣá thσá Zer∩á Flaτá i≤ Se⌠ (Z)¼á theε ßá loaΣá erro≥á occurred╗ ì
  170. otherwise¼ thσ loaΣ wa≤ OK.
  171.  
  172.  
  173.      Inputs:  HL points to the first byte of the directory buffer
  174. ááááá          area; this area extends from after the last buffer
  175. ááááá          used by the applications program to the page
  176. ááááá          before the CCP.  If alphabetization is to be done,
  177. ááááá          the value returned in HL by DBUFFER is a correct
  178. ááááá          input for DIRLOAD or DIRSLOAD
  179. ááááá         A=0 and Zero Flag is Set (Z) if TPA Overflow;
  180. ááááá          A<>0 and NZ if load OK
  181.      Outputs:  BC is the number of files loaded into the buffer
  182.      Registers Affected:  BC
  183.      SYSLIB Routines Called:  None
  184.      Special Error Conditions:  If TPA is filled and load is
  185. ááááá     incomplete, A=0 and Zero Flag is Set (Z) as error indic
  186. :Directory Alphabetization Routine -- DIRALPHA
  187.      Routine Name: DIRALPHA
  188.      Function:
  189.           T∩ alphabetizσ thσ file≤ iε thσ director∙ pointeΣ t∩ b∙ ì
  190. H╠á b∙ eithe≥ filσ namσ anΣ typσ (STEST.AS═ goe≤ beforσ TEST.AAA⌐ ì
  191. o≥ b∙ filσ typσ anΣ namσ (TEST.AA┴ goe≤ beforσ STEST.ASM).
  192.      Inputs:  HL points to first directory entry
  193. ááááá         BC contains the number of files to sort
  194. ááááá         ┴ i≤ thσ sor⌠ flag╗ A=░ mean≤ sor⌠ b∙ filσ namσ anΣ ì
  195. ááááá     áááááthen file type, A<>0 means by file type and name
  196.      Outputs:  None (directory list is sorted)
  197.      Registers Affected:  PSW
  198.      SYSLIB Routines Called:  PRINT
  199.      Special Error Conditions:
  200. ááááá     I⌠á i≤ possible¼á alth∩ highl∙ unlikel∙ froφ al∞á test≤ ì
  201. ááááágiveεá s∩á far¼á tha⌠á DIRALPH┴ ma∙ experiencσá aεá interna∞ ì
  202. áááááerror.  If this happens, the message:
  203. ááááá          DIRALPHA -- Pointer Error
  204. áááááwil∞ bσ printeΣ anΣ thσ routinσ wil∞ abor⌠ t∩ CP/M«  Iµ thi≤ ì
  205. áááááhappens¼á pleasσá repor⌠á thi≤ probleφ anΣá bσá prepareΣá t∩ ì
  206. áááááduplicatσ thσ exac⌠ situatioε whicΦ causeΣ thi≤ erro≥ t∩ thσ ì
  207. áááááauthor, Richard Conn.
  208. :Directory Entry Selection Routine -- DIRSEL
  209.      Routine Name: DIRSEL
  210.      Function:
  211.           DIRSE╠á select≤á al∞á entrie≤ iε thσá director∙á buffe≥ ì
  212. whicΦá matcΦ thσ ambiguou≤ filσ namσ specifieΣ iε thσ F╬á anΣá F╘ ì
  213. field≤á oµá thσá FC┬ pointeΣ t∩ b∙ D┼ upoε entr∙á t∩á DIRSEL«á  ┴ ì
  214. selectioεá flaτ i≤ als∩ passeΣ t∩ DIRSE╠ iε thσ ┴á register¼á anΣ ì
  215. thi≤ flaτ tell≤ DIRSE╠ whethe≥ o≥ no⌠ t∩ includσ Non-Systeφ file≤ ì
  216. anΣ Systeφ file≤ iε thσ selectioε anΣ whethe≥ t∩ selec⌠ file≤á iε ì
  217. al∞ use≥ area≤ o≥ iε ß particula≥ use≥ area.
  218.      DIRSE╠á identifie≤ thσ selecteΣ filσ entrie≤ b∙ settinτá thσ ì
  219. Mos⌠á Significan⌠ Bi⌠ oµ thσ firs⌠ bytσ oµ eacΦ oµ thesσá entrie≤ ì
  220. t∩ ▒ iµ thσ entr∙ i≤ selected«á  DIRSE╠ make≤ n∩ othe≥ change≤ t∩ ì
  221. thσ filσ entrie≤ iε thσ director∙ buffer.
  222.  
  223.      Inputs:  HL points to the directory buffer
  224. ááááá         D┼á point≤ t∩ thσ FC┬ containinτ thσá ambiguou≤á F╬ ì
  225. ááááá          and FT fields; only the first 12 bytes are needed
  226. ááááá         BC contains the number of files in the directory
  227. ááááá         A contains a selection flag, organized as follows:
  228. ááááá          Bit 7 - Select Non-System Files
  229. ááááá          Bit 6 - Select System Files
  230. ááááá          Bit 5 - Select Files in All User Areas
  231. ááááá          Bits 4-0 - If Bit 5 is 0, indicates number of
  232. ááááá               User Area to select files from
  233.      Outputs:  None (MSBs of selected entries are set)
  234.      Registers Affected:  None
  235.      SYSLIB Routines Called:  None
  236.      Special Error Conditions:  None
  237. :Directory Pack Routine -- DIRPACK and DIRNPACK
  238.      Routine Name:  DIRPACK
  239.      Function:
  240.           DIRPAC╦á restructure≤ thσ director∙ buffe≥á t∩á contaiε ì
  241. onl∙ thosσ entrie≤ markeΣ b∙ DIRSEL«á  Iε thi≤ way¼ thosσ entrie≤ ì
  242. NO╘á markeΣá b∙ DIRSE╠ arσ discardeΣ froφ thσá buffe≥á (actually¼ ì
  243. jus⌠á takeε ou⌠ oµ consideration¼á bu⌠ thσ content≤ oµ thσ buffe≥ ì
  244. afte≥á thσá las⌠á selecteΣ entr∙ i≤á no⌠á guaranteeΣá t∩á contaiε ì
  245. anythinτ significant).
  246.      Thσá Mos⌠á Significan⌠ Bi⌠ oµ thσ firs⌠ bytσ oµ al∞á entrie≤ ì
  247. remaininτ iε thσ director∙ buffe≥ i≤ rese⌠ t∩ ░ a≤ ß sidσá effec⌠ ì
  248. oµ DIRPACK.
  249.      Inputs:  HL points to the directory buffer
  250. ááááá         BC contains the number of files in the buffer
  251.      Outputs:  BC contains the number of files (those selected by
  252. ááááá           DIRSEL) remaining in the directory buffer
  253.      Registers Affected:  BC
  254.      SYSLIB Routines Called:  None
  255.      Special Error Conditions:  None
  256.      Routine Name:  DIRNPACK
  257.      Function:
  258.           DIRNPAC╦á restructure≤ thσ director∙ buffe≥ t∩á contaiε ì
  259. onl∙á thosσá entrie≤ NO╘ markeΣ b∙ DIRSEL«á  Iε thi≤á way¼á thosσ ì
  260. entrie≤ markeΣ b∙ DIRSE╠ arσ discardeΣ froφ thσ buffe≥ (actually¼ ì
  261. jus⌠ takeε ou⌠ oµ consideration¼á bu⌠ thσ content≤ oµ thσá buffe≥ ì
  262. afte≥á thσá las⌠á selecteΣá entr∙ i≤ no⌠á guaranteeΣá t∩á contaiε ì
  263. anythinτ significant).
  264.      Thσá Mos⌠ Significan⌠ Bi⌠ oµ thσ firs⌠ bytσ oµá al∞á entrie≤ ì
  265. remaininτá iε thσ director∙ buffe≥ i≤ rese⌠ t∩ ░ a≤ ß sidσ effec⌠ ì
  266. oµ DIRNPACK.
  267.      Thσá routinσá DIRSE╠ MUS╘ bσ calleΣ beforσ DIRNPAC╦ i≤á useΣ ì
  268. sincσá DIRNPAC╦ use≤ aε interna∞ flaτ se⌠ b∙ DIRSE╠á (fo≥á SYSTE═ ì
  269. and R/O information).
  270.      Inputs:  HL points to the directory buffer
  271. ááááá         BC contains the number of files in the buffer
  272.      Outputs:  BC contains the number of files (those NOT selected
  273. ááááá           by DIRSEL) remaining in the directory buffer
  274.      Registers Affected:  BC
  275.      SYSLIB Routines Called:  DIRPACK
  276.      Special Error Conditions:  None
  277.