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 / ARRAY4.ZZ0 / ARRAY4.Z80
Text File  |  2000-06-30  |  3KB  |  90 lines

  1. ;Library Name: ARRAYLIB
  2. ;Module Name: USEMDU
  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.     name usemdu
  26. ;This module contains the following routines:
  27.     public arrmaxdu
  28. ;..and uses the following external routines:
  29.     ext arrfr0$e,arxltbit,arvisiti,ardoblok,arrbcmsk
  30.  
  31. arrmaxdu:
  32. ;initialize an array whose assignment is to
  33. ;represent a disk/user bitmap. this routine
  34. ;sets all bits to '1' in the range from
  35. ; disk A, user 0 through the row designated by maxdsk and 
  36. ; the bit position in that row designated by maxusr. 
  37. ;on entry, the array must have been defined by
  38. ;a call to ARRDEFDU or ARRAYDEF. In addition, bc must
  39. ;contain maximum disk(1-16) and maximum user (0-31)
  40.  
  41.     push    bc        ;save input arguments
  42.     xor    a        ;initialization value
  43.     call    arrfr0$e    ;initialize to empty
  44. ;ARRFR0$E returns error code in A and CY set if array
  45. ;is undefined.
  46.     pop    bc
  47.     ret    c        ;ret if array is undefined
  48.     dec    b        ;convert drive(1..) to row(0..)
  49.     call    arxltbit    ;convert user into a column number and 
  50.                 ;a remainder (in acc and in reg e)
  51.     push    bc        ;save row, col
  52.     push    de        ;save bit position (e)
  53. ;set up function for ARDOBLOK to perform
  54.     ld    hl,wrtacc
  55.     ld    a,0ffh        ;value to write
  56.     ld    (wrtacc+1),a
  57.     call    arvisiti
  58. ;walk through the array up to max d/u
  59. ;marking all bits '1'
  60.     xor    a        ;make a zero
  61.     cp    c        ;only 1 column to do?
  62.     jr    z,lastcol    ;yes, if c=0
  63. ;more than one column, do all but the last one
  64.     dec    c        ;do last column separately
  65.     ld    d,b        ;last addr in block
  66.     ld    e,c        ;..in de
  67.     ld    bc,0        ;start at row 0, col 0
  68.     call    ardoblok
  69. ;now recover the remainder, and initialize the
  70. ;last column if the remainder is not 0.
  71. lastcol:
  72.     pop    de        ;max user, modulo 8
  73.     ld    a,e        ;..in a
  74.     call    arrbcmsk    ;generate mask in a
  75.     ld    (wrtacc+1),a
  76.     pop    de        ;last row, max user
  77.     ld    b,0        ;start at row 0
  78.     ld    c,e        ;..and max user
  79.     call    ardoblok    ;install the mask in the max user col
  80.     ret
  81.  
  82. ;function for ARRVISIT to perform - write a byte at hl
  83. ;the byte to write is determined by in-the-code modification
  84. wrtacc:    ld    (hl),0        ;0 is replaced before call from ARRVISIT:
  85.     ret
  86.  
  87. ;*************************************************
  88.  
  89.     end
  90.