home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / z3util / array10b.lbr / ARRAY6.ZZ0 / ARRAY6.Z80
Encoding:
Text File  |  1993-06-07  |  3.5 KB  |  117 lines

  1. ;Library Name: ARRAYLIB
  2. ;Module Name: NDR$MXU
  3. ;Author: Al Hawley
  4. ;Date: 06 Mar 1987
  5. ;Version number: 1.0a
  6. ;Previous version: 1.0 dated 4 March 1987
  7.  
  8. ;Version History:
  9.     
  10. ;Program Function: ARRAYLIB is a collection of subroutines which
  11. ;    implement the management of byte arrays in programs written
  12. ;    for Z80 or HD64180 based computers. This module is one of the
  13. ;    set, and may require the presence of others.
  14.  
  15. ;***************************************************
  16. ;        COPYRIGHT NOTICE
  17. ;ARRAYLIB is copyright by A. E. Hawley on March 4, 1987.
  18. ;It may be freely distributed, but it must not be sold 
  19. ;either separately or as part of a package without the 
  20. ;written consent of the author.  The author may be reached 
  21. ;via electronic mail at the Ladera Z-Node in Los Angeles,
  22. ;213-670-9465, or by U.S. Mail at:
  23. ;
  24. ;    6032 Chariton Ave.
  25. ;    Los Angeles, CA. 90056
  26. ;    Voice Phone: 213-649-3575
  27. ;
  28. ;        RELEASE NOTICE
  29. ;ARRAYLIB is released for beta test through the Z-system 
  30. ;users group Z-SIG.  It may be reached through the 
  31. ;Lillipute Z-Node in Chicago, 312-649-1730.
  32.  
  33. ;***************************************************
  34.  
  35.     name ndr$mxu
  36. ;This module contains the following routines:
  37.     public ardndmxu
  38. ;..and uses the following external routines:
  39.     ext arrfr0$e,arxltbit,arrxltrc,arrbcmsk,armemora
  40.     ext getmus,getndre,gtnxtdu
  41.  
  42. ;**********************************************
  43.  
  44. ardndmxu:
  45. ;Initialize a D/U array 64 bytes long, with bits set
  46. ;through maxdu value from system env for each drive
  47. ;which has an entry in the system NDR.
  48.  
  49.     xor    a        ;make null for...
  50.     call    arrfr0$e    ;init array to nulls
  51.     ret    c        ;ret if error, code in A
  52.     call    getndre        ;return pointer to NDR in HL
  53.     ret    c        ;ret if error, code in A
  54.     ld    (curloc),hl    ;pass it to NDR access routine
  55.     call    getmus        ;max user from sys env
  56.     ld    hl,maxdu    ;point to local d/U storage
  57.     ld    (hl),a        ;store in local variable
  58.     inc    hl
  59.     ld    (hl),0        ;say no drive initially
  60.  
  61. drvlp:    call    gtnxtdu        ;get potential DU entry from NDR
  62.     ret    z        ;return if no more entries
  63.     ld    a,(maxdu+1)    ;get last drive referenced
  64.     cp    a,b        ;same?
  65.     jr    z,drvlp        ;jump if yes, and get next entry
  66.  
  67.     ld    a,b
  68.     ld    (maxdu+1),a    ;store the new drive number
  69.     dec    b        ;convert drive to row
  70.     ld    a,(maxdu)    ;get maximum user
  71.     ld    c,a        ;..in c
  72.     call    fillrow        ;fill its row with 1's to maxusr
  73.     jr    drvlp        ;repeat until no more entries
  74.  
  75. ;**********************************************
  76.  
  77. fillrow:
  78. ;set bits in row (B) up to the user value in C
  79. ;NOTE: this ignores possible entries higher than
  80. ;column C, which may in fact contain set bits
  81.  
  82.     push    bc
  83.     push    de
  84.     call    arxltbit    ;make row,column,bit pos in bc,e
  85.     call    arrxltrc    ;addr of row,column in hl
  86.     ld    a,e        ;bit position in a from e
  87.     call    arrbcmsk    ;make mask from E in A
  88.     call    armemora    ;set bits 0 to (e) in column C
  89.     ld    a,0ffh        ;mask for columns 0 to (c)
  90.     ld    b,c        ;column number in B
  91.     inc    b        ;number of columns to mask
  92.     jr    lp2tst        ;jmp to test first in case only 1 to do
  93. loop2:    dec    hl        ;back up to previous entry
  94.     call    armemora    ;fill it with 1's
  95. lp2tst:    djnz    loop2        ;continue through col 0
  96.     pop    de
  97.     pop    bc
  98.     ret
  99.  
  100. ;**********************************************
  101.     COMMON /ARDAT/
  102.  
  103. ;COMMON data area - contains default values for a 64
  104. ;byte array useful for disk/user bitmapping.
  105. bitmap:    dw    0    ;..filled in by ARRAYDEF
  106. hicol:    dw    3    ;4 columns: 0,1,2,3
  107. hirow:    dw    15    ;16 rows (0....15)
  108. dumaplen:
  109.     dw    64    ;(3+1)*(15+1)
  110.  
  111. maxdu:    dw    0    ;transient d/u data
  112. curloc:    dw    0    ;NDR entry pointer
  113.  
  114. ;**********************************************
  115.  
  116.     end
  117.