home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / z3util / array10b.lbr / BITMAP.DZC / BITMAP.DOC
Encoding:
Text File  |  1993-06-07  |  5.9 KB  |  129 lines

  1.      ARRAYS is a set of routines which started out as a means of
  2. providing a Disk/User bit-map for controlling directory access by
  3. programs like FINDF and SDIR. The routines utilize a bit map of all
  4. possible drives/user areas and permit arbitrary designation of which
  5. of the D/U combinations are allowed access by transient programs. The
  6. concept (and routines) is easily extensible to BIOS functions, and to
  7. the manipulation of byte arrays of arbitrary data.
  8.  
  9.      Many programs use a Maximum Drive and Maximum User number above
  10. which program access is forbidden. Satisfactory as that scheme has been,
  11. it has one major drawback: if a device like Ramdisk is assigned a drive
  12. designation which is not contiguous, then you must choose between ignoring
  13. that drive or having programs attempt to access non-existant drives!
  14. On one system, I have four floppies (A: - D:) and a Ramdisk which is
  15. assigned as drive M:. These assignments are a BIOS function; to change
  16. them is no small task. A bit-map approach (in each program!) is
  17. obviously a solution, but could still be a great deal of trouble to
  18. maintain as assignments change. SDIR uses this approach for the
  19. Drives that are accessible (but not the User Areas), and must be
  20. manually maintained and reassembled if the logical drive assignments
  21. change.
  22.  
  23.      ARRAYS provides a set of routines which can be included in a
  24. program to provide for semi-automatic maintenance of the bit-map.
  25. The map can be manually prepared in an intuitive manner if desired.
  26. The Map can also be configured from Max DU in the program or from the
  27. ZCPR3 Environment Descriptor, from the ZCPR3 Named Directories segment,
  28. or from combinations of them. Since a bitmap is really an array of bytes
  29. the routines are arranged in such a way that they can be used to
  30. manipulate an array of bytes with equal ease. In fact, the routines are
  31. useful for byte arrays whose rows and columns are up to 255 bytes in
  32. extent. (That would fill a 64K memory bank!)
  33.  
  34.      The ARRAYS routines are fully documented in the accompanying
  35. HELP files. They are intended to be used in the same way as SYSLIB,
  36. VLIB, Z3LIB, and similar relocatable object sources. They provide a set
  37. of general purpose basic tools that can be used with any program
  38. written for ZCPR3.
  39.  
  40.      The following notes on DU maps may help provide an overview to
  41. help in understanding the rationale behind ARRAYS routines..
  42.  
  43. Structure of the DU map
  44.  
  45. dumap:
  46. row0:    ds    (maxdu+1)/8    ;for drive 1 (A:)
  47. row1:    ..    .....        ;for drive 2 (B:)
  48. ...    ..    .....        ;  etc.
  49. ...    ..    .....        ;  etc.
  50. row15:    ds    (maxdu+1)/8    ;for drive 16 (P:)
  51.  
  52. for maxdu=31 (typical) and maxdrv = 4, the following array
  53. is defined: (4 physical drives, and system limit is 32 users)
  54. The 1's mark user numbers that are allowed. Each row represents
  55. a drive; if the row contains all 0's then the corresponding
  56. drive is considered not available for access.
  57.  
  58. dumap:    db    11111111b,11111111b,11111111b,11111111b
  59.     db    11111111b,11111111b,11111111b,11111111b
  60.     db    11111111b,11111111b,11111111b,11111111b
  61.     db    11111111b,11111111b,11111111b,11111111b
  62.     db    00000000b,00000000b,00000000b,00000000b
  63.     ..    ......... ......... ......... .........
  64.     ..    ......... ......... ......... .........
  65. row15:    db    00000000b,00000000b,00000000b,00000000b
  66.  
  67. If now the system access were restricted to the
  68. following LOGICAL assignments:
  69.     drive A: Users >15 not available
  70.     drive B: Users >10 not available
  71.     drive C: not available for access
  72.     drive D: Users >10 not available
  73.     drive D: Users 2 and 8 not available
  74. here is what the DU map looks like
  75.  
  76. ;user numbers->    7......0  15.....8  23....16  31....24
  77. dumap:
  78.     db    11111111b,11111111b,00000000b,00000000b
  79.     db    11111111b,00000111b,00000000b,00000000b
  80.     db    00000000b,00000000b,00000000b,00000000b
  81.     db    11111011b,00000110b,00000000b,00000000b
  82.     db    00000000b,00000000b,00000000b,00000000b
  83.     ..    ......... ......... ......... .........
  84.     ..    ......... ......... ......... .........
  85.     db    00000000b,00000000b,00000000b,00000000b
  86.  
  87. Notes on the DU array:
  88. 1.  The maximum array size (Z-System or ZCPR3/CPM operating systems)
  89.     is 64 bytes. The 64 bytes provide one bit position for each possible
  90.     drive/user combination in a maximum size configuration.
  91.  
  92. 2.  Note that the assignment of bits to user numbers appears to be
  93.     "backwards". This order is a result of the difference in the way
  94.     assemblers describe bit positions and the way that humans conventionally
  95.     write a list of numbers. This is an awkward situation if you want to
  96.     generate a D/U map manually. If the map is generated by a subroutine
  97.     (from maximum disk/user input, for example) then there is no difficulty
  98.     except for the usual translation from hex to binary notation (in the
  99.     'backward' form!)
  100.  
  101. 3)  One of the routines in ARRAYS is designed to make life a little
  102.     easier for manual bitmap generation. It simply walks through the
  103.     array reversing the order of the bits in each byte. You can write
  104.     the source code with bit assignments as shown below. Then, before
  105.     your program attempts to read or write data in the bitmap, the
  106.     ARINVERT routine is called. Voila! You AND the program can be happy!
  107.  
  108. user numbers->    0......7  8.....15  16....23  24....31
  109. dumap:    db    00000000b,00000000b,00000000b,00000000b
  110.  
  111. Using this strategy, the bitmap from the example above could be
  112. manually entered as follows:
  113.  
  114. dumap:    db    11111111b,11111111b,00000000b,00000000b
  115.     db    11111111b,11100000b,00000000b,00000000b
  116.     db    00000000b,00000000b,00000000b,00000000b
  117.     db    11011111b,01100000b,00000000b,00000000b
  118.     db    00000000b,00000000b,00000000b,00000000b
  119.  
  120.  
  121.  
  122. Standard Register usage for DU oriented array:
  123.  
  124. B    = Drive number. Range 1-16
  125. C    = User Number. Range 0-31
  126. CY flag is used (when set) to indicate an error condition, and when
  127.     an error condition exists, register A returns containing a
  128.     value which identifies the type of error.
  129.