;Library Name: ARRAYLIB ;Module Name: USEMDU ;Author: Al Hawley ;Date: 31 Mar 1987 ;Version number: 1.0c ;Version History: ;Program Function: ARRAYLIB is a collection of subroutines which ; implement the management of byte arrays in programs written ; for Z80 or HD64180 based computers. This module is one of the ; set, and may require the presence of others. ;*************************************************** ; COPYRIGHT NOTICE ;ARRAYLIB is copyright by A. E. Hawley on March 4, 1987. ;It may be freely distributed, but it must not be sold ;either separately or as part of a package without the ;written consent of the author. The author may be reached ;via electronic mail at the Ladera Z-Node in Los Angeles, ;213-670-9465, or by Voice Phone at: 213-649-3575 ; ;*************************************************** name usemdu ;This module contains the following routines: public arrmaxdu ;..and uses the following external routines: ext arrfr0$e,arxltbit,arvisiti,ardoblok,arrbcmsk arrmaxdu: ;initialize an array whose assignment is to ;represent a disk/user bitmap. this routine ;sets all bits to '1' in the range from ; disk A, user 0 through the row designated by maxdsk and ; the bit position in that row designated by maxusr. ;on entry, the array must have been defined by ;a call to ARRDEFDU or ARRAYDEF. In addition, bc must ;contain maximum disk(1-16) and maximum user (0-31) push bc ;save input arguments xor a ;initialization value call arrfr0$e ;initialize to empty ;ARRFR0$E returns error code in A and CY set if array ;is undefined. pop bc ret c ;ret if array is undefined dec b ;convert drive(1..) to row(0..) call arxltbit ;convert user into a column number and ;a remainder (in acc and in reg e) push bc ;save row, col push de ;save bit position (e) ;set up function for ARDOBLOK to perform ld hl,wrtacc ld a,0ffh ;value to write ld (wrtacc+1),a call arvisiti ;walk through the array up to max d/u ;marking all bits '1' xor a ;make a zero cp c ;only 1 column to do? jr z,lastcol ;yes, if c=0 ;more than one column, do all but the last one dec c ;do last column separately ld d,b ;last addr in block ld e,c ;..in de ld bc,0 ;start at row 0, col 0 call ardoblok ;now recover the remainder, and initialize the ;last column if the remainder is not 0. lastcol: pop de ;max user, modulo 8 ld a,e ;..in a call arrbcmsk ;generate mask in a ld (wrtacc+1),a pop de ;last row, max user ld b,0 ;start at row 0 ld c,e ;..and max user call ardoblok ;install the mask in the max user col ret ;function for ARRVISIT to perform - write a byte at hl ;the byte to write is determined by in-the-code modification wrtacc: ld (hl),0 ;0 is replaced before call from ARRVISIT: ret ;************************************************* end