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 / ARRAYS10.LBR / ARRAYG.ZZ0 / ARRAYG.Z80
Text File  |  2000-06-30  |  4KB  |  128 lines

  1. ;Library Name: ARRAYLIB
  2. ;Module Name: PUTDEF
  3. ;Author: Al Hawley
  4. ;Date: 31 Mar 1987
  5. ;Version number: 1.0c
  6.  
  7. ;Version History:
  8.     
  9. ;Program Function: ARRAYLIB is a collection of subroutines which
  10. ;    implement the management of byte arrays in programs written
  11. ;    for Z80 or HD64180 based computers. This module is one of the
  12. ;    set, and may require the presence of others.
  13.  
  14. ;***************************************************
  15. ;        COPYRIGHT NOTICE
  16. ;ARRAYLIB is copyright by A. E. Hawley on March 4, 1987.
  17. ;It may be freely distributed, but it must not be sold 
  18. ;either separately or as part of a package without the 
  19. ;written consent of the author.  The author may be reached 
  20. ;via electronic mail at the Ladera Z-Node in Los Angeles,
  21. ;213-670-9465, or by Voice Phone at: 213-649-3575
  22. ;
  23. ;***************************************************
  24.  
  25.     MACLIB    ARRHDR
  26.  
  27.     name putdef
  28. ;This module contains the following routines:
  29.     public arrdefdu,arraydef
  30. ;..and uses the following external routines:
  31.     ext mulhd    ;from SYSLIB or HD180
  32.  
  33. arrdefdu:
  34. ;defines a standard d/u map in a 64 byte buffer.
  35. ;(16 drives(1-16) and 32 users (0-31) per drive)
  36. ;on entry,
  37. ;    hl    = address of the buffer
  38.  
  39.     xor    a
  40.     ld    bc,101fh    ;16,31 are max Drive,User
  41. ;..fall through to ARRAYDEF
  42.  
  43. ;***************************************************
  44.  
  45. arraydef:
  46. ;stores array start, number of rows, and
  47. ;number of columns in local variables. subsequent
  48. ;calls to routines in the package don't have to
  49. ;pass that information.
  50. ;on entry, 
  51. ;    hl    = address of buffer large enough for array
  52. ;    a    = 0 or 1 or >1
  53. ;to specify the array in terms of d/u:
  54. ;    a    = 0
  55. ;    b    = highest drive
  56. ;    c    = highest user number
  57. ;to specify the array in terms of row/column:
  58. ;    a    = 1
  59. ;    b    = highest row number
  60. ;    c    = highest column number
  61. ;alternatively, to specify the row length in bits:
  62. ;    a    > 1
  63. ;    b    = highest row number
  64. ;    de    = highest bit number in row
  65.  
  66. ;on exit, all registers are destroyed
  67.  
  68.     ld    (bitmap),hl
  69.     or    a        ;is BC a drive/user number?
  70.     jr    nz,bcisrc    ;jump if not
  71.     dec    b        ;convert to row number
  72.     ld    e,c        ;move highest bit # to de
  73.     ld    d,a        ;zero in d to make de=c
  74.     jr    calchcol    ;calculate hi col, store r/c
  75.  
  76. bcisrc:    dec    a        ;is BC a Row/Col? (i.e, is A=1?)
  77.     jr    z,saverc    ;jump over column calc if yes (z)
  78.  
  79. ;here if A > 1, meaning B = Max Row number, DE = Max BIT
  80. ;or if the Drive/User input has been converted to this form
  81. calchcol:
  82.     srl    d        ;maximum bit is in de,
  83.     rr    e        ;..which must be divided by 8
  84.     srl    d        ;..to get maximum column
  85.     rr    e
  86.     srl    d
  87.     rr    e        ;B = max row, E = max col
  88. saverc:    ld    hl,hicol    ;save in array data table
  89.     ld    (hl),e
  90.     ld    hl,hirow
  91.     ld    (hl),b
  92. ;note that hicol and hirow are 16 bit locations. The high byte
  93. ;is always zero. This permits either byte or word access by
  94. ;other routines.
  95.  
  96. calclen:
  97. ;calculate the total length of the array, in bytes
  98.     ld    hl,(hirow)
  99.     inc    hl        ;number of rows
  100.     ld    de,(hicol)
  101.     inc    de        ;number of columns
  102.     call    mulhd        ;8 bit multiply from syslib/hd180
  103.     ld    (dumaplen),hl    ;store in array data table
  104.     ret
  105.  
  106. ;**********************************************
  107.  
  108.     IF    ZAS
  109.     COMMON            ;common block for ZAS
  110.     ELSE
  111.     COMMON    /ADATA/        ;common block for M80, SLR
  112.     ENDIF
  113.  
  114. ;COMMON data area - contains default values for a 64
  115. ;byte array useful for disk/user bitmapping.
  116. bitmap:    ds    2    ;..filled in by ARRAYDEF
  117. hicol:    ds    2    ;default is 4 columns: 0,1,2,3
  118. hirow:    ds    2    ;default is 16 rows (0....15)
  119. dumaplen:
  120.     ds    2    ;default is (3+1)*(15+1)
  121.  
  122. maxdu:    ds    2    ;transient d/u data
  123. curloc:    ds    2    ;NDR entry pointer
  124.  
  125. ;**********************************************
  126.  
  127.     end
  128.